/* EY Tender Radar — design system */
:root {
  --ey-yellow: #ffe600; --ey-dark: #2e2e38;
  --bg: #14141a; --bg2: #1c1c24; --bg3: #23232e; --line: #33333f;
  --tx: #e9e9ee; --tx2: #a0a0b0; --tx3: #6f6f80;
  --accent: #ffe600; --accent-tx: #2e2e38;
  --good: #35c46b; --warn: #ffb020; --bad: #ff4d4f; --info: #4aa8ff;
  --radius: 12px; --shadow: 0 8px 30px rgba(0,0,0,.35);
  --sb: 232px;
}
:root[data-theme="light"] {
  --bg: #f4f5f8; --bg2: #ffffff; --bg3: #eef0f4; --line: #e0e2e9;
  --tx: #1d1d26; --tx2: #55586a; --tx3: #8a8d9c; --shadow: 0 8px 30px rgba(20,20,40,.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif; background: var(--bg); color: var(--tx); font-size: 14px; -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Login */
.login { position: fixed; inset: 0; display: grid; place-items: center; background: radial-gradient(1200px 600px at 70% -10%, #2a2a3a, var(--bg)); }
.login-card { background: var(--bg2); border: 1px solid var(--line); border-radius: 16px; padding: 34px 30px; width: min(360px, 90vw); box-shadow: var(--shadow); text-align: center; }
.login-logo { font-size: 22px; font-weight: 800; }
.login-sub { color: var(--tx2); font-size: 12.5px; margin: 6px 0 20px; }
.login-card input { width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg3); color: var(--tx); font-size: 15px; }
.login-card button { width: 100%; margin-top: 12px; padding: 12px; border: 0; border-radius: 10px; background: var(--accent); color: var(--accent-tx); font-weight: 700; font-size: 15px; }
.login-err { color: var(--bad); font-size: 13px; min-height: 18px; margin-top: 10px; }

/* App shell */
.app { display: grid; grid-template-columns: var(--sb) 1fr; height: 100vh; }
.sidebar { background: var(--bg2); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 16px 12px; gap: 4px; }
.brand { font-weight: 800; font-size: 16px; padding: 6px 10px 14px; display: flex; gap: 8px; align-items: center; }
.brand span { background: linear-gradient(90deg, var(--ey-yellow), #ffd21a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav .group { color: var(--tx3); font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; padding: 14px 12px 4px; }
.nav button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 9px 12px; border: 0; border-radius: 9px; background: transparent; color: var(--tx2); font-size: 13.5px; }
.nav button:hover { background: var(--bg3); color: var(--tx); }
.nav button.active { background: var(--bg3); color: var(--tx); font-weight: 600; }
.nav button .badge { margin-left: auto; background: var(--accent); color: var(--accent-tx); font-size: 11px; font-weight: 700; border-radius: 20px; padding: 1px 8px; }
.nav button.active::before { content: ""; position: absolute; left: 0; width: 3px; height: 22px; background: var(--accent); border-radius: 3px; }
.nav button { position: relative; }
.side-foot { display: flex; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.ghost { background: transparent; border: 1px solid var(--line); color: var(--tx2); border-radius: 8px; padding: 7px 10px; font-size: 14px; }
.ghost:hover { color: var(--tx); border-color: var(--tx3); }

/* Main */
.main { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 24px; border-bottom: 1px solid var(--line); background: var(--bg); }
.topbar h1 { margin: 0; font-size: 19px; }
.poll-info { color: var(--tx3); font-size: 11.5px; margin-top: 3px; }
.search { width: min(340px, 40vw); padding: 9px 13px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); color: var(--tx); }
.content { padding: 20px 24px; overflow-y: auto; flex: 1; }

/* Stat cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.card { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.card .k { color: var(--tx2); font-size: 12px; }
.card .v { font-size: 26px; font-weight: 800; margin-top: 4px; }
.card.accent .v { color: var(--accent); }
.card.warn .v { color: var(--warn); }

/* Filters */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; align-items: center; }
.chip { border: 1px solid var(--line); background: var(--bg2); color: var(--tx2); border-radius: 20px; padding: 6px 13px; font-size: 12.5px; }
.chip.active { background: var(--accent); color: var(--accent-tx); border-color: var(--accent); font-weight: 600; }
.chip:hover { color: var(--tx); }

/* Table */
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; background: var(--bg2); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 13px; white-space: nowrap; }
th { color: var(--tx3); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; position: sticky; top: 0; background: var(--bg2); cursor: pointer; user-select: none; }
th:hover { color: var(--tx); }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--bg3); }
td.title-cell { white-space: normal; max-width: 420px; }
td.title-cell b { font-weight: 600; }
td.title-cell .cust { color: var(--tx3); font-size: 11.5px; display: block; margin-top: 2px; }
.flag { font-size: 15px; }
.score { display: inline-block; min-width: 34px; text-align: center; border-radius: 6px; padding: 2px 6px; font-weight: 700; font-size: 12px; }
.score.hi { background: rgba(53,196,107,.18); color: var(--good); }
.score.mid { background: rgba(255,176,32,.18); color: var(--warn); }
.dl { font-variant-numeric: tabular-nums; }
.dl.soon { color: var(--bad); font-weight: 700; }
.dl.near { color: var(--warn); }
.muted { color: var(--tx3); }

/* Status select */
.status-sel { border: 1px solid var(--line); background: var(--bg3); color: var(--tx); border-radius: 7px; padding: 4px 8px; font-size: 12px; }
.st-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.st-new{background:var(--info)} .st-reviewing{background:var(--warn)} .st-preparing{background:#a06bff}
.st-submitted{background:#4aa8ff} .st-won{background:var(--good)} .st-lost{background:var(--bad)} .st-skip{background:var(--tx3)}

/* Drawer */
.drawer { position: fixed; inset: 0; z-index: 50; }
.drawer-scrim { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.drawer-panel { position: absolute; right: 0; top: 0; height: 100%; width: min(560px, 94vw); background: var(--bg2); border-left: 1px solid var(--line); box-shadow: var(--shadow); overflow-y: auto; padding: 22px 24px; animation: slidein .18s ease; }
@keyframes slidein { from { transform: translateX(30px); opacity: .6; } to { transform: none; opacity: 1; } }
.drawer-panel h2 { margin: 0 0 4px; font-size: 18px; line-height: 1.35; }
.dw-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.pill { background: var(--bg3); border: 1px solid var(--line); border-radius: 20px; padding: 4px 11px; font-size: 12px; color: var(--tx2); }
.dw-section { margin-top: 18px; }
.dw-section .lbl { color: var(--tx3); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.dw-section p { margin: 0; line-height: 1.55; color: var(--tx); }
.notes { width: 100%; min-height: 90px; border: 1px solid var(--line); background: var(--bg3); color: var(--tx); border-radius: 10px; padding: 10px 12px; font: inherit; resize: vertical; }
.save-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.btn { background: var(--accent); color: var(--accent-tx); border: 0; border-radius: 9px; padding: 9px 16px; font-weight: 700; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 10px; padding: 6px 0; color: var(--tx2); font-size: 12.5px; border-left: 2px solid var(--line); padding-left: 12px; }
.close-x { position: absolute; top: 16px; right: 18px; font-size: 22px; color: var(--tx3); background: none; border: 0; }

/* Charts + health */
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.panel { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.panel h3 { margin: 0 0 12px; font-size: 14px; }
.health-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.hsrc { display: flex; align-items: center; gap: 10px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg2); }
.hsrc .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.hsrc .dot.ok { background: var(--good); } .hsrc .dot.bad { background: var(--bad); }
.hsrc .nm { font-size: 12.5px; } .hsrc .ct { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.hsrc .grp { color: var(--tx3); font-size: 10.5px; }
.empty { color: var(--tx3); text-align: center; padding: 50px; }

@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; left: 0; top: 0; bottom: 0; width: 220px; transform: translateX(-100%); transition: .2s; }
  .sidebar.open { transform: none; }
  .search { width: 40vw; }
}
