/* Control Room · Pastel Bento (LOCKED, CONTROL-ROOM.md "LOCKED style"). Tokens first; every screen uses these. */
:root {
  --bg: #F7F7FB;
  --surface: #FFFFFF;
  --line: #E9E9F1;
  --text: #17162A;
  --text2: #5A5872;
  --text3: #7E7C95;
  --accent: #5B4BDB;
  --accent-soft: #C9C2F7;
  --pos: #1E8E5A;
  --neg: #C2410C;
  --warn: #A15C00;
  --mint: #E8F6EE;
  --peach: #FFF1E3;
  --lilac: #EEEAFE;
  --sky: #E6F3FB;
  --pink: #FDEBF1;
  --butter: #FFF8DB;
  --live: #FF3B30;
  --r-tile: 24px;
  --r-ctl: 10px;
  --font: 'Plus Jakarta Sans', 'Hind Siliguri', system-ui, sans-serif;
  --bn: 'Hind Siliguri', 'Plus Jakarta Sans', system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; }
body { min-width: 760px; }
button, input, select, textarea { font-family: inherit; }
a { color: inherit; }
.boot { padding: 80px; text-align: center; color: var(--text3); }

/* ---------- the top bar ---------- */
.top { position: sticky; top: 0; z-index: 20; height: 68px; padding: 0 28px; display: flex; align-items: center; gap: 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; flex: none; text-decoration: none; }
.brand .mark { width: 32px; height: 32px; border-radius: 10px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-family: var(--bn); }
.brand .name { font-size: 15px; font-weight: 700; }
.nav { display: flex; gap: 2px; padding: 4px; border-radius: 22px; background: var(--bg); min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav a, .nav button { height: 36px; padding: 0 13px; border-radius: 18px; background: transparent; color: var(--text2); display: inline-flex; align-items: center; font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; border: 0; cursor: pointer; }
.nav a:hover, .nav button:hover { color: var(--text); }
.nav a.on, .nav button.on { background: var(--text); color: #fff; }
.nav a.off { opacity: .4; pointer-events: none; }
.nav .bn { font-family: var(--bn); }
.spacer { flex: 1; }
.search-btn { height: 36px; padding: 0 12px; border-radius: 18px; background: var(--bg); display: inline-flex; align-items: center; gap: 8px; color: var(--text3); font-size: 12.5px; border: 0; cursor: pointer; flex: none; }
.avatar { width: 34px; height: 34px; border-radius: 17px; background: var(--lilac); display: grid; place-items: center; font-weight: 700; font-size: 13px; border: 0; cursor: pointer; flex: none; }
.menu { position: absolute; z-index: 30; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 6px; min-width: 200px; box-shadow: 0 8px 24px rgba(23, 22, 42, .08); }
.menu a, .menu button { display: flex; width: 100%; padding: 9px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; text-decoration: none; background: none; border: 0; text-align: left; cursor: pointer; color: var(--text); }
.menu a:hover, .menu button:hover { background: var(--bg); }
.menu .note { padding: 8px 12px; font-size: 12px; color: var(--text3); }

/* ---------- page ---------- */
main.page { max-width: 1280px; margin: 0 auto; padding: 24px 32px 48px; display: flex; flex-direction: column; gap: 14px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.head h1 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.head .sub { margin-top: 4px; font-size: 13.5px; color: var(--text3); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 12px; }
.g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.flex { display: flex; gap: 12px; min-width: 0; }
.flex > * { min-width: 0; }
@media (max-width: 1180px) { .g6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .flex.wrap-md { flex-wrap: wrap; } .flex.wrap-md > * { flex: 1 1 340px !important; } }
@media (max-width: 1180px) { .nav a, .nav button { padding: 0 9px; font-size: 12.5px; } .brand .name { display: none; } .search-btn .k { display: none; } }
@media (max-width: 900px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .top { padding: 0 16px; } main.page { padding: 20px 16px 40px; } .brand .name { display: none; } }

/* ---------- tiles (no borders) ---------- */
.tile { border-radius: var(--r-tile); padding: 16px; min-width: 0; overflow: hidden; background: var(--surface); }
.tile.p20 { padding: 20px; }
.tile.p24 { padding: 24px; }
.tile.card { border: 1px solid var(--line); padding: 14px; }
.mint { background: var(--mint); } .peach { background: var(--peach); } .lilac { background: var(--lilac); } .sky { background: var(--sky); } .pink { background: var(--pink); } .butter { background: var(--butter); } .white { background: var(--surface); }
.label { font-size: 13px; font-weight: 600; color: var(--text2); }
.label .bn, .bn { font-family: var(--bn); }
.small { font-size: 12px; color: var(--text3); }
.big { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.05; margin-top: 8px; }
.huge { font-size: 64px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.05; }
.delta { margin-top: 4px; font-size: 12.5px; font-weight: 600; }
.delta .vs { color: var(--text3); font-weight: 500; }
.up { color: var(--pos); } .down { color: var(--neg); } .flat { color: var(--text3); }
.muted { color: var(--text3); }
.none { font-size: 12.5px; color: var(--text3); line-height: 1.45; }
.tile-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }

/* ---------- controls ---------- */
.btn { height: 36px; padding: 0 14px; border-radius: var(--r-ctl); background: var(--surface); color: var(--text); border: 1px solid var(--line); font-size: 13px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--accent-soft); }
.btn.primary { background: var(--accent); color: #fff; border: 0; }
.btn.danger { background: var(--neg); color: #fff; border: 0; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.chip { height: 34px; padding: 0 14px; border-radius: 17px; border: 0; background: var(--surface); color: var(--text); font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--text); color: #fff; }
.chip .n { opacity: .75; margin-left: 4px; font-weight: 500; }
.pill { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; font-weight: 600; }
.live-dot { width: 8px; height: 8px; border-radius: 4px; background: var(--live); box-shadow: 0 0 0 3px rgba(255, 59, 48, .18); animation: crpulse 1.6s ease-in-out infinite; }
@keyframes crpulse { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
.tag { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 12px; font-size: 12px; font-weight: 600; white-space: nowrap; background: rgba(91, 75, 219, .1); color: var(--accent); }
.tag.pos { background: rgba(30, 142, 90, .1); color: var(--pos); }
.tag.neg { background: rgba(194, 65, 12, .1); color: var(--neg); }
.tag.warn { background: rgba(161, 92, 0, .1); color: var(--warn); }
.tag.grey { background: rgba(126, 124, 149, .12); color: var(--text2); }
div.in { display: flex; align-items: center; }
input.in, select.in, textarea.in, div.in { height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; color: var(--text); width: 100%; outline: none; }
textarea.in { height: 80px; padding: 10px 14px; resize: vertical; }
input.in:focus, select.in:focus, textarea.in:focus { border-color: var(--accent); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--text2); }
.switch { position: relative; width: 40px; height: 24px; border-radius: 12px; border: 0; background: #DCDCE6; cursor: pointer; flex: none; padding: 0; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 9px; background: #fff; transition: transform .15s; }
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(16px); }
.switch:disabled { cursor: default; opacity: .6; }
.prog { height: 8px; border-radius: 4px; background: #ECEBF5; overflow: hidden; }
.prog > i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
input[type=range].rng { accent-color: var(--accent); width: 100%; }

/* ---------- tables (rows as flex, like the boards) ---------- */
.tbl .tr { display: flex; align-items: center; min-height: 42px; border-bottom: 1px solid var(--line); }
.tbl .tr:last-child { border-bottom: 0; }
.tbl .tr.h > div { font-size: 12px; font-weight: 600; color: var(--text3); }
.tbl .tr > div { min-width: 0; padding: 0 10px; font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbl .tr.click { cursor: pointer; }
.tbl .tr.click:hover, .tbl .tr.sel { background: var(--bg); }
.ini { width: 30px; height: 30px; flex: none; border-radius: 15px; display: grid; place-items: center; font-weight: 700; font-size: 12px; font-family: var(--bn); }
.who { display: inline-flex; align-items: center; gap: 10px; }

/* ---------- charts ---------- */
.bars { display: block; width: 100%; }
.heat { display: flex; gap: 3px; }
.heat > div { flex: 1; height: 46px; border-radius: 6px; background: var(--accent); }
.axis { display: flex; gap: 3px; margin-top: 6px; font-size: 11px; color: var(--text3); }
.axis > span { flex: 1; text-align: center; white-space: nowrap; overflow: visible; min-width: 0; }
.rank { position: relative; height: 34px; margin-bottom: 6px; border-radius: 8px; overflow: hidden; }
.rank > i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent-soft); opacity: .9; border-radius: 8px; }
.rank > div { position: relative; height: 34px; padding: 0 10px; display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.rank > div > span:first-child { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank > div > span:last-child { font-weight: 600; }
.ring { position: relative; width: 120px; height: 120px; flex: none; }
.ring > div { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.15; }

/* ---------- "What this means" ---------- */
.means .t { display: flex; gap: 10px; align-items: center; }
.means .ic { width: 28px; height: 28px; border-radius: 10px; background: var(--surface); display: grid; place-items: center; }
.means .k { font-size: 12px; font-weight: 700; color: var(--accent); letter-spacing: .04em; text-transform: uppercase; }
.means h3 { margin: 10px 0 0; font-size: 14.5px; font-weight: 700; line-height: 1.4; }
.means p { margin: 6px 0 0; font-size: 13px; color: var(--text2); line-height: 1.5; }
.means .out { margin-top: 10px; padding: 10px 12px; border-radius: 14px; background: rgba(255, 255, 255, .7); font-size: 12.5px; line-height: 1.5; }
.means .acts { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.att { display: flex; gap: 10px; align-items: flex-start; text-decoration: none; }
.att .d { margin-top: 5px; width: 8px; height: 8px; border-radius: 4px; flex: none; }
.att .x { display: flex; flex-direction: column; line-height: 1.35; }
.att .x b { font-size: 13px; font-weight: 600; }
.att .x span { font-size: 12px; color: var(--text3); }

/* ---------- dialogs, palette, toast ---------- */
.scrim { position: fixed; inset: 0; z-index: 50; background: rgba(23, 22, 42, .45); display: grid; place-items: center; padding: 24px; }
.dialog { width: min(520px, 100%); max-height: calc(100vh - 48px); overflow: auto; background: var(--surface); border-radius: var(--r-tile); padding: 24px; box-shadow: 0 24px 60px rgba(23, 22, 42, .18); }
.dialog h2 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.dialog .sub { margin-top: 4px; font-size: 13px; color: var(--text3); }
.dialog .body { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.dialog .foot { margin-top: 18px; display: flex; justify-content: flex-end; gap: 8px; }
.opt { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 14px; cursor: pointer; }
.opt b { display: block; font-size: 13.5px; }
.opt span { display: block; font-size: 12px; color: var(--text2); margin-top: 2px; }
.happens { padding: 12px 14px; border-radius: 14px; background: var(--lilac); font-size: 12.5px; line-height: 1.5; }
.palette { width: min(560px, 100%); background: var(--surface); border-radius: 18px; padding: 10px; box-shadow: 0 24px 60px rgba(23, 22, 42, .18); align-self: start; margin-top: 10vh; }
.palette input { border: 0; height: 48px; font-size: 16px; }
.palette .res a { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 10px; text-decoration: none; font-size: 13.5px; }
.palette .res a.on, .palette .res a:hover { background: var(--bg); }
.toast { position: fixed; z-index: 60; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: #fff; padding: 12px 18px; border-radius: 14px; font-size: 13.5px; font-weight: 600; max-width: 90vw; }
.toast.err { background: var(--neg); }
.skel { background: linear-gradient(90deg, #EFEFF6, #F7F7FB, #EFEFF6); border-radius: 12px; min-height: 16px; }

/* ---------- sign-in ---------- */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.signin .box { width: min(420px, 100%); background: var(--surface); border-radius: var(--r-tile); padding: 32px; text-align: center; }
.signin h1 { margin: 16px 0 6px; font-size: 24px; }
.signin p { color: var(--text2); font-size: 13.5px; line-height: 1.5; }

/* timeline */
.tl { display: flex; flex-direction: column; }
.tl .it { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid rgba(23, 22, 42, .06); align-items: flex-start; }
.tl .it:last-child { border-bottom: 0; }
.tl .tm { width: 44px; flex: none; font-size: 12px; color: var(--text3); padding-top: 6px; }
.tl .ico { width: 26px; height: 26px; flex: none; border-radius: 13px; background: rgba(255, 255, 255, .8); display: grid; place-items: center; }
.tl .tx b { font-size: 13px; font-weight: 600; display: block; }
.tl .tx span { font-size: 12px; color: var(--text3); }
.kv { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; padding: 5px 0; }
.kv > span:first-child { color: var(--text3); }
.kv > span:last-child { font-weight: 600; text-align: right; }
.scroll { overflow: auto; }
