/* TSA Clean Bids Hub — light operations-dashboard look (white cards on a cool grey
   ground, big tabular numbers, one red for "act now"). Public Sans is the typeface the
   U.S. Web Design System uses for government sites — fitting for a bids desk. */
:root {
  --bg: #F2F4F7; --card: #FFFFFF; --ink: #17202B; --muted: #5D6A79; --line: #E1E6EC; --soft: #F7F9FB;
  --navy: #1F3A6B; --red: #C8102E; --red-soft: #FDECEE; --ok: #1E8A5A; --ok-soft: #E7F5EE;
  --amber: #B7791F; --amber-soft: #FFF5DC; --federal: #1F3A6B; --state: #1A9E8F; --local: #E8A33D;
  --radius: 10px; --shadow: 0 1px 2px rgba(20,32,50,.06), 0 1px 8px rgba(20,32,50,.04);
  font-family: "Public Sans", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  color: var(--ink); font-size: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
h1, h2, h3 { text-wrap: balance; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--navy); }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* ---------- login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { background: var(--card); padding: 30px 32px; border-radius: 14px; box-shadow: var(--shadow); width: min(380px, 100%); display: grid; gap: 12px; }
.login-logo { height: 54px; justify-self: start; }
.login-card h1 { font-size: 24px; font-weight: 800; }
label { display: grid; gap: 5px; font-weight: 600; font-size: 13px; }
input, select, textarea { border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; background: #fff; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--navy); outline-offset: 1px; }
.err { color: var(--red); min-height: 1em; margin: 0; }

/* ---------- shell */
.shell { display: grid; grid-template-columns: 228px 1fr; min-height: 100vh; }
.side { background: #16243F; color: #D7DEEA; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 14px; text-decoration: none; color: #fff; font-weight: 800; font-size: 17px; }
.brand img { height: 34px; background: #fff; border-radius: 6px; padding: 3px 5px; }
.side nav { display: grid; gap: 2px; padding: 6px 10px; overflow-y: auto; }
.side nav a { display: flex; align-items: center; justify-content: space-between; padding: 9px 12px; border-radius: 8px; color: #D7DEEA; text-decoration: none; font-weight: 500; }
.side nav a:hover { background: rgba(255,255,255,.07); }
.side nav a.on { background: #fff; color: var(--ink); font-weight: 700; }
.badge { background: var(--red); color: #fff; border-radius: 99px; padding: 1px 8px; font-size: 12px; font-weight: 700; }
.badge:empty { display: none; }
.badge.soft { background: #5B6D8C; } .badge.ok { background: var(--ok); }
.side-foot { margin-top: auto; padding: 14px 16px; font-size: 12px; display: flex; justify-content: space-between; gap: 8px; border-top: 1px solid rgba(255,255,255,.08); }
.link { background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; padding: 0; }
.main { min-width: 0; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 26px 6px; flex-wrap: wrap; }
.top h1 { font-size: 26px; font-weight: 800; letter-spacing: -.01em; }
.top-right { display: flex; gap: 12px; align-items: center; }
.top-right input { width: 300px; max-width: 60vw; }
.scan { font-size: 12px; color: var(--muted); }
.view { padding: 12px 26px 40px; display: grid; gap: 16px; }

/* ---------- cards + grid */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; min-width: 0; }
.card h2 { font-size: 15px; font-weight: 700; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card h2 small { font-weight: 500; color: var(--muted); font-size: 12px; }
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1250px) { .kpis { grid-template-columns: repeat(3, 1fr); } .g-2-1, .g-3 { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .shell { grid-template-columns: 1fr; } .side { position: static; height: auto; } .kpis, .g-2 { grid-template-columns: 1fr 1fr; } .view, .top { padding-left: 14px; padding-right: 14px; } }

.kpi { display: grid; gap: 4px; cursor: pointer; border: 2px solid transparent; }
.kpi:hover { border-color: var(--line); }
.kpi .label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.kpi .value { font-size: 32px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .foot { font-size: 12px; color: var(--muted); }
.kpi.alert .value { color: var(--red); } .kpi.alert { background: var(--red-soft); }
.kpi.good .value { color: var(--ok); }
.pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.pill.red { background: var(--red); color: #fff; } .pill.amber { background: var(--amber-soft); color: var(--amber); }
.pill.ok { background: var(--ok-soft); color: var(--ok); } .pill.grey { background: #EDF0F4; color: var(--muted); }
.pill.fed { background: var(--federal); color: #fff; } .pill.sta { background: var(--state); color: #fff; } .pill.loc { background: var(--local); color: #2B1D00; }

/* ---------- lists */
.rows { display: grid; }
.row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 10px 2px; border-bottom: 1px solid var(--line); cursor: pointer; }
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--soft); }
.row .t { font-weight: 600; }
.row .s { color: var(--muted); font-size: 12.5px; grid-column: 1 / -1; }
.row .n { color: var(--ink); font-size: 13px; grid-column: 1 / -1; }
.empty { color: var(--muted); padding: 18px 0; text-align: center; }
#alist { max-height: 560px; overflow-y: auto; }
.recs { background: var(--amber-soft); }
.recs ul { margin: 0; padding-left: 18px; display: grid; gap: 8px; }

/* ---------- map */
.map-wrap { position: relative; }
.map-wrap svg { width: 100%; height: auto; display: block; }
.map-wrap .st { stroke: #fff; stroke-width: .8; cursor: pointer; transition: opacity .15s; }
.map-wrap .st:hover { opacity: .8; }
.map-wrap .st.sel { stroke: var(--ink); stroke-width: 2; }
.dot { stroke: #fff; stroke-width: .8; pointer-events: none; }
.legend { display: flex; flex-wrap: wrap; gap: 10px 16px; font-size: 12.5px; align-items: center; margin-top: 8px; }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.legend .sq { border-radius: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 5px 11px; font-size: 12.5px; cursor: pointer; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; padding: 8px 10px; border-radius: 8px; font-size: 12px; line-height: 1.45; max-width: 260px; }

/* ---------- calendar */
.cal-head { display: flex; align-items: center; gap: 10px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.cal .dow { background: var(--soft); font-size: 12px; font-weight: 700; color: var(--muted); padding: 6px 8px; }
.cal .day { background: #fff; min-height: 104px; padding: 5px 6px; display: flex; flex-direction: column; gap: 3px; }
.cal .day.out { background: #FAFBFC; color: #A9B2BD; }
.cal .day.today { box-shadow: inset 0 0 0 2px var(--navy); }
.cal .d { font-size: 12px; font-weight: 700; }
.evt { font-size: 11.5px; padding: 2px 6px; border-radius: 5px; color: #fff; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.evt.act { box-shadow: 0 0 0 2px var(--red); }

/* ---------- pipeline */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.col { background: #E9EDF2; border-radius: 10px; padding: 10px; display: grid; gap: 8px; align-content: start; }
.col h3 { font-size: 13px; display: flex; justify-content: space-between; }
.mini { background: #fff; border-radius: 8px; padding: 9px 10px; box-shadow: var(--shadow); cursor: pointer; display: grid; gap: 4px; border-left: 4px solid var(--line); }
.mini .t { font-weight: 600; font-size: 13px; }
.mini .s { font-size: 12px; color: var(--muted); }

/* ---------- bid page */
.bid-head { display: grid; gap: 6px; }
.bid-head .sol { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .03em; }
.bid-head h2 { font-size: 22px; font-weight: 800; }
.due { display: inline-flex; gap: 8px; align-items: center; font-weight: 700; }
.steps { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.steps span { flex: 1 1 90px; font-size: 11.5px; font-weight: 600; padding: 7px 8px; background: #EDF0F4; color: var(--muted); border-radius: 6px; text-align: center; }
.steps span.done { background: #D9E4F5; color: var(--navy); } .steps span.now { background: var(--navy); color: #fff; }
.next { border-left: 5px solid var(--red); background: var(--red-soft); }
.next.calm { border-left-color: var(--ok); background: var(--ok-soft); }
.next p { margin: 0; font-size: 16px; font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 8px 14px; font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn.primary:hover { background: #172d54; }
.btn.danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn.good { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn[disabled] { opacity: .5; cursor: default; }
.best { border: 2px solid var(--ok); }
.best .price { font-size: 30px; font-weight: 800; color: var(--ok); font-variant-numeric: tabular-nums; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 7px 8px; border-bottom: 2px solid var(--line); }
table.t td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t td.r, table.t th.r { text-align: right; font-variant-numeric: tabular-nums; }
table.t tr.hl td { background: var(--ok-soft); font-weight: 600; }
.scroll { overflow-x: auto; }
textarea { width: 100%; min-height: 220px; line-height: 1.5; }
.frame { width: 100%; height: 760px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.tl { display: grid; gap: 0; max-height: 420px; overflow-y: auto; }
.tl div { padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.tl b { font-weight: 600; } .tl small { color: var(--muted); }
.chat { display: grid; gap: 8px; max-height: 420px; overflow-y: auto; margin-bottom: 8px; }
.msg { padding: 9px 12px; border-radius: 10px; white-space: pre-wrap; line-height: 1.45; }
.msg.user { background: #E7EEF9; justify-self: end; max-width: 85%; }
.msg.assistant { background: var(--soft); border: 1px solid var(--line); max-width: 92%; }
.chatbar { display: flex; gap: 8px; } .chatbar input { flex: 1; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 5px 14px; font-size: 13px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.bars { display: grid; gap: 6px; }
.bar { display: grid; grid-template-columns: 150px 1fr 70px; gap: 8px; align-items: center; font-size: 12.5px; }
.bar i { height: 12px; background: var(--navy); border-radius: 3px; display: block; }
.warn { background: var(--amber-soft); border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.2); z-index: 20; max-width: 90vw; }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--navy); border-radius: 50%; animation: sp 1s linear infinite; vertical-align: -2px; }
@keyframes sp { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }
.chartbox { position: relative; height: 240px; }
