/* The admin site's pages (login, dashboard, users): jyotishivani.com's "Sandstone Saffron" palette and type, light like
   the website and the chat app. Chart colours: mobile, web and team take categorical slots 1-3 (validated together on
   the white panel; teal is under 3:1, so every chart has a legend and a table view). */
:root {
  color-scheme: light;
  --bg: #faf4ea; --panel: #ffffff; --panel-2: #fbf3e6; --panel-3: #f4eadb; --ink: #2b1f1a; --muted: #6a5c52; --faint: #a08c76;
  --line: #eee2d0; --line-2: #e6d6be; --accent: #8f4708; --accent-2: #a2530c; --accent-soft: #fce6c8; --accent-ink: #fff6ea;
  --saffron: #f08a24; --cream: #fff6ea; --night: #1f2350;
  --ok: #2a6e5e; --ok-soft: #eaf4f0; --warn: #7a5306; --warn-soft: #fbebc4; --err: #a23e22; --err-soft: #fbeae4;
  --grid: #f1e8da; --axis: #e2d3bc;
  --mobile: #2a78d6; --web: #eb6834; --team: #1baf7a; --single: #8f4708;
  --shadow-sm: 0 1px 2px rgba(74, 44, 16, .06); --shadow: 0 1px 2px rgba(74, 44, 16, .06), 0 14px 32px -20px rgba(74, 44, 16, .35);
  --font-display: "Marcellus", Georgia, "Times New Roman", serif;
  --font-body: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 18px; --radius-sm: 12px; --side-w: 248px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font-body); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--saffron); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------------------------------------------------------- brand mark */
.logo { width: 34px; height: 34px; flex: none; }
.logo .disk { fill: #fbe3c3; } .logo .ring { fill: none; stroke: var(--accent); } .logo .crescent { fill: var(--saffron); }
.brand { display: flex; align-items: center; gap: 10px; }
.brand b { font-family: var(--font-display); font-weight: 400; font-size: 19px; letter-spacing: .01em; }
.brand b span { color: var(--accent); }
.brand small { display: block; color: var(--faint); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; margin-top: -2px; }

/* ---------------------------------------------------------------- buttons and inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 16px;
  border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel); font-weight: 600; text-decoration: none; color: var(--ink); }
.btn:hover { background: var(--panel-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-2); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--panel-3); }
.btn.sm { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn:disabled { opacity: .6; cursor: default; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: 13px; }
.input { width: 100%; min-height: 44px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--panel); }
.input:focus { outline: none; border-color: var(--saffron); box-shadow: 0 0 0 3px var(--accent-soft); }
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; background: var(--panel-3); }
.segmented button { border: 0; background: transparent; padding: 6px 13px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--muted); }
.segmented button:hover { color: var(--ink); }
.segmented button[aria-pressed="true"] { background: var(--panel); color: var(--ink); box-shadow: var(--shadow-sm); }
.error { color: var(--err); background: var(--err-soft); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 13.5px; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12.5px; }

/* ---------------------------------------------------------------- sign-in page */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.login-art { position: relative; overflow: hidden; background: radial-gradient(120% 90% at 20% 10%, #2c3170 0%, var(--night) 55%, #141737 100%);
  color: var(--cream); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.login-art .brand b { color: var(--cream); } .login-art .brand b span { color: var(--saffron); }
.login-art .brand small { color: #c9bfae; }
.login-art h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(30px, 3.6vw, 46px); line-height: 1.12; margin: 0 0 14px; max-width: 13em; }
.login-art p { color: #d9cfbf; max-width: 30em; margin: 0; font-size: 15px; }
.login-art .orbit { position: absolute; right: -140px; bottom: -160px; width: 520px; height: 520px; opacity: .55; pointer-events: none; }
.login-art .orbit circle { fill: none; stroke: rgba(245, 165, 74, .35); }
.login-art ul { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 10px; }
.login-art li { display: flex; gap: 10px; align-items: center; color: #e8dfd0; }
.login-art li svg { color: var(--saffron); }
.login-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.login-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 18px; }
.login-card h2 { font-family: var(--font-display); font-weight: 400; font-size: 30px; margin: 0; }
.login-card .btn.primary { min-height: 46px; width: 100%; font-size: 15px; }
.password { position: relative; }
.password .input { padding-right: 48px; }
.password button { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }

/* ---------------------------------------------------------------- app shell */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 22px; padding: 22px 16px;
  background: var(--panel); border-right: 1px solid var(--line); }
.side .brand { padding: 0 8px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { color: var(--faint); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; padding: 0 12px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 12px; color: var(--muted); font-weight: 600; text-decoration: none; }
.nav a:hover { background: var(--panel-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.nav a .ext { margin-left: auto; width: 14px; height: 14px; opacity: .6; }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding: 14px 8px 0; display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--accent-soft);
  color: var(--accent); font-weight: 700; font-size: 13px; }
.side-foot .who { min-width: 0; flex: 1; line-height: 1.25; }
.side-foot .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main { min-width: 0; padding: 28px clamp(16px, 3vw, 40px) 56px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.page-head h1 { font-family: var(--font-display); font-weight: 400; font-size: 32px; line-height: 1.15; margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 22px; }
.toolbar .spacer { flex: 1; }
.updated { color: var(--faint); font-size: 12.5px; }
.loading .card, .loading .kpis { opacity: .55; transition: opacity .15s; }

/* ---------------------------------------------------------------- cards, KPIs */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 20px 22px; min-width: 0; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2 { font-size: 15.5px; font-weight: 700; margin: 0; }
.card-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.section-title { font-family: var(--font-display); font-weight: 400; font-size: 22px; margin: 34px 0 14px; display: flex; align-items: baseline; gap: 12px; }
.section-title small { font-family: var(--font-body); font-size: 13px; color: var(--muted); }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.kpi .label { color: var(--muted); font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.kpi .label svg { width: 15px; height: 15px; color: var(--accent); }
.kpi .value { font-size: 28px; font-weight: 700; letter-spacing: -.01em; margin-top: 6px; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi .sub { color: var(--faint); font-size: 12.5px; margin-top: 4px; }
.kpi.hero { background: linear-gradient(160deg, #fff7ec, var(--panel)); border-color: var(--line-2); }
.kpi.hero .value { color: var(--accent); }

/* ---------------------------------------------------------------- platform cards */
.platform { position: relative; overflow: hidden; }
.platform::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--c); }
.platform .card-head h2 { display: flex; align-items: center; gap: 9px; font-size: 16px; }
.platform .tag { font-size: 11.5px; color: var(--muted); font-weight: 600; background: var(--panel-2); border-radius: 999px; padding: 2px 9px; }
.platform .big { display: flex; gap: 22px; margin-bottom: 14px; }
.platform .big div b { display: block; font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.platform .big div span { color: var(--muted); font-size: 12.5px; }
.facts { display: grid; grid-template-columns: 1fr auto; gap: 7px 12px; margin: 0; font-size: 13.5px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.share { display: flex; height: 10px; border-radius: 999px; overflow: hidden; gap: 2px; background: var(--panel); margin: 6px 0 8px; }
.share span { background: var(--c); min-width: 2px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; display: inline-block; }

/* ---------------------------------------------------------------- charts */
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.chart { position: relative; }
.chart svg { display: block; width: 100%; max-width: 100%; height: auto; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--faint); font-size: 11px; font-family: var(--font-body); }
.chart .col:hover rect.seg, .chart .col:focus rect.seg { filter: brightness(1.08); }
.chart .col:focus { outline: none; }
.chart .col:focus .hit { stroke: var(--saffron); stroke-width: 1.5; }
.chart .hit { fill: transparent; }
.chart .col:hover .hit { fill: rgba(143, 71, 8, .05); }
.tooltip { position: absolute; z-index: 5; pointer-events: none; background: var(--ink); color: var(--cream); border-radius: 10px;
  padding: 9px 12px; font-size: 12.5px; box-shadow: var(--shadow); min-width: 150px; transform: translate(-50%, calc(-100% - 10px)); }
.tooltip .t { color: #c9bfae; margin-bottom: 4px; }
.tooltip .r { display: flex; align-items: center; gap: 8px; }
.tooltip .r i { width: 12px; height: 2px; border-radius: 2px; background: var(--c); }
.tooltip .r b { margin-left: auto; padding-left: 14px; font-variant-numeric: tabular-nums; }
.tooltip .total { border-top: 1px solid rgba(255, 246, 234, .2); margin-top: 5px; padding-top: 5px; }
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 160px) minmax(0, 1fr) auto; gap: 12px; align-items: center; font-size: 13px; }
.bar-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.bar-row .track { height: 12px; background: var(--panel-2); border-radius: 0 4px 4px 0; }
.bar-row .fill { height: 100%; background: var(--single); border-radius: 0 4px 4px 0; min-width: 2px; }
.bar-row .val { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.bar-row .val small { color: var(--faint); font-weight: 500; margin-left: 6px; }
.view-toggle { margin-top: 12px; }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { border-collapse: collapse; width: 100%; font-size: 13.5px; }
table.data th, table.data td { padding: 10px 12px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
table.data th { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .02em; background: var(--panel-2); position: sticky; top: 0; }
table.data th:first-child { border-top-left-radius: 10px; } table.data th:last-child { border-top-right-radius: 10px; }
table.data tbody tr:hover { background: #fffaf3; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data th button { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
table.data th button:focus-visible { outline: 2px solid var(--saffron); }
table.data th[aria-sort] { color: var(--accent); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--panel-2); color: var(--muted); }
.pill.ok { background: var(--ok-soft); color: var(--ok); } .pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.err { background: var(--err-soft); color: var(--err); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; color: var(--muted); font-size: 13px; }
.empty { color: var(--muted); text-align: center; padding: 28px 12px; }
.notice { display: flex; gap: 10px; align-items: flex-start; background: var(--warn-soft); color: var(--warn); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 13px; margin-top: 14px; }
.search { position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); width: 16px; height: 16px; }
.search .input { min-height: 38px; padding-left: 36px; border-radius: 999px; width: 260px; }

/* ---------------------------------------------------------------- small screens */
.menu-btn { display: none; }
@media (max-width: 1100px) { .grid.three { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) {
  .grid.two { grid-template-columns: minmax(0, 1fr); }
  .login { grid-template-columns: minmax(0, 1fr); }
  .login-art { padding: 28px 24px; min-height: 0; }
  .login-art .orbit, .login-art ul { display: none; }
  .login-art h1 { font-size: 26px; margin-top: 18px; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .segmented { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .segmented button { flex: none; }
  .section-title { flex-wrap: wrap; gap: 4px 12px; }
  .page-head p { font-size: 13px; }
  .side { position: fixed; z-index: 20; inset: 0 auto 0 0; width: 270px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .shell.open .side { transform: none; }
  .menu-btn { display: inline-flex; }
  .main { padding-top: 16px; }
  .page-head h1 { font-size: 26px; }
  .search .input { width: 100%; }
  .search { flex: 1 1 100%; }
  .kpi .value { font-size: 24px; }
}
