/* Technosport sales dashboard */
:root {
  color-scheme: light;
  --page: #f9f9f9;
  --surface-1: #ffffff;
  --surface-2: #f3f3f3;
  --text-primary: #191919;
  --text-secondary: #666666;
  --grid: #e7e7e7;
  --axis: #c2c2c2;
  --border: rgba(11, 11, 11, 0.10);
  --hover: rgba(11, 11, 11, 0.05);
  --accent: #257de0;
  --good-text: #006c10;
  --bad-text: #b42324;
  --warning: #fbb315;
  --critical: #dc3c3d;
  --serious: #f18a59;
  --good: #0aac23;
  --series-1: #257de0; /* Website */
  --series-2: #f47230; /* Myntra */
  --series-3: #00b894; /* Flipkart */
  --series-4: #f2a600; /* Amazon */
  --series-5: #ee7fac; /* Ajio */
  --series-6: #008a17; /* Flipkart SOR */
  --series-7: #6a4ce2; /* Blinkit */
  --series-other: #a3a3a3;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0b0b0b;
    --surface-1: #191919;
    --surface-2: #222222;
    --text-primary: #efefef;
    --text-secondary: #9c9c9c;
    --grid: #303030;
    --axis: #474747;
    --border: rgba(255, 255, 255, 0.10);
    --hover: rgba(255, 255, 255, 0.06);
    --accent: #338ced;
    --good-text: #53c556;
    --bad-text: #eb6263;
    --series-1: #338ced;
    --series-2: #e76624;
    --series-3: #00a888;
    --series-4: #d28e05;
    --series-5: #e24d8b;
    --series-6: #0aac23;
    --series-7: #9887ef;
    --series-other: #6b6b6b;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--page);
  color: var(--text-primary);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}
.wrap { max-width: 1280px; margin: 0 auto; padding: 20px 24px 48px; }

header.top {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-bottom: 16px;
}
header.top h1 { font-size: 20px; font-weight: 600; margin: 0; }
.muted { color: var(--text-secondary); }
.small { font-size: 12px; }

nav.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--grid); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
nav.tabs button { flex: none; white-space: nowrap; }
nav.tabs button {
  appearance: none; background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--text-secondary); font: inherit; font-weight: 500; padding: 10px 14px; cursor: pointer;
}
nav.tabs button:hover { color: var(--text-primary); }
nav.tabs button[aria-selected="true"] { color: var(--text-primary); border-bottom-color: var(--accent); }

.view[hidden] { display: none; }

.filters { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-bottom: 16px; }
.filters label.lbl { font-size: 12px; color: var(--text-secondary); margin-right: 4px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button {
  appearance: none; border: 0; background: var(--surface-1); color: var(--text-secondary);
  font: inherit; font-size: 13px; padding: 6px 12px; cursor: pointer;
}
.seg button + button { border-left: 1px solid var(--border); }
.seg button[aria-pressed="true"] { color: var(--text-primary); background: var(--surface-2); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-1); color: var(--text-primary);
  font: inherit; font-size: 12px; cursor: pointer;
}
.chip[aria-pressed="false"] { color: var(--text-secondary); opacity: 0.55; }
.sw { flex: none; display: inline-block; vertical-align: middle; }

input[type="search"], select {
  font: inherit; font-size: 13px; padding: 6px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-1); color: var(--text-primary);
}
input[type="search"] { min-width: 240px; }

.card {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px;
}
.card h2 { font-size: 15px; font-weight: 600; margin: 0 0 2px; }
.card .sub { font-size: 12px; color: var(--text-secondary); margin: 0 0 12px; }
.stack > * + * { margin-top: 16px; }

.tiles { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 900px) { .tiles { grid-template-columns: 1fr 1fr; } }
.tile .label { font-size: 12px; color: var(--text-secondary); }
.tile .value { font-size: 28px; font-weight: 600; margin-top: 4px; }
.tile.hero .value { font-size: 48px; line-height: 1.1; }
.tile .value.sm { font-size: 20px; }
.tile .delta { font-size: 12px; margin-top: 4px; color: var(--text-secondary); }
.delta .up { color: var(--good-text); font-weight: 600; }
.delta .down { color: var(--bad-text); font-weight: 600; }

.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--text-secondary); margin: 4px 0 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.line { height: 2px; width: 14px; border-radius: 1px; }
.legend i.dash { height: 0; width: 14px; border-top: 2px dashed currentColor; border-radius: 0; }

.chart { position: relative; width: 100%; }
.chart > svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--text-secondary); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .grid { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .base { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .gap { stroke: var(--surface-1); stroke-width: 2; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .hit:hover, .chart .hit.on { fill: var(--hover); }
.chart .hitline { fill: transparent; cursor: crosshair; }
.chart .xhair { stroke: var(--axis); stroke-width: 1; }
.chart .today { stroke: var(--text-secondary); stroke-width: 1; stroke-dasharray: 2 3; }
.chart .endlbl { fill: var(--text-primary); font-size: 12px; font-weight: 600; }

.tip {
  position: absolute; pointer-events: none; z-index: 5; min-width: 160px;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12); padding: 8px 10px; font-size: 12px;
}
.tip .t { font-weight: 600; margin-bottom: 4px; color: var(--text-primary); }
.tip .r { display: flex; align-items: center; gap: 6px; justify-content: space-between; color: var(--text-secondary); }
.tip .r b { color: var(--text-primary); font-weight: 600; font-variant-numeric: tabular-nums; margin-left: 12px; }
.tip .r span { display: inline-flex; align-items: center; gap: 6px; }
.tip .tot { border-top: 1px solid var(--grid); margin-top: 4px; padding-top: 4px; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 12px; }

.tablewrap { overflow: auto; max-height: 560px; border: 1px solid var(--grid); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--grid); white-space: nowrap; }
th { position: sticky; top: 0; background: var(--surface-2); font-weight: 600; font-size: 12px; color: var(--text-secondary); z-index: 1; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text-primary); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: var(--hover); }
tbody tr.clickable { cursor: pointer; }
tbody tr.sel { background: var(--surface-2); }
tfoot td { font-weight: 600; background: var(--surface-2); position: sticky; bottom: 0; }

.toggle { appearance: none; border: 0; background: none; color: var(--accent); font: inherit; font-size: 12px; cursor: pointer; padding: 0; }
.note { font-size: 12px; color: var(--text-secondary); margin-top: 8px; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-secondary); }
.badge svg { flex: none; }

.msg { padding: 40px; text-align: center; color: var(--text-secondary); }
.msg.err { color: var(--bad-text); }
ul.warn { margin: 0; padding-left: 18px; }
ul.warn li { margin: 4px 0; }
.split { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 12px; }
@media (max-width: 1000px) { .split { grid-template-columns: 1fr; } }

.tiles.three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .tiles.three { grid-template-columns: 1fr; } }
.tile .value.big { font-size: 40px; line-height: 1.15; }
.tile .value .unit { font-size: 14px; font-weight: 500; color: var(--text-secondary); }
.tile .rev { font-size: 18px; font-weight: 600; margin-top: 2px; }
.pill { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-secondary); }
input[type="date"] { font: inherit; font-size: 13px; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-1); color: var(--text-primary); }
.filters + .filters { margin-top: -6px; }
.tile .est { font-size: 12px; color: var(--text-secondary); margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--grid); }
.est-cell { color: var(--text-secondary); font-style: italic; }
.est-cell small { font-style: normal; font-size: 10px; text-transform: uppercase; letter-spacing: .03em; }
.estline { font-size: 11px; color: var(--text-secondary); font-style: italic; }
.demo-banner { background: var(--surface-2); border: 1px dashed var(--axis); border-radius: 8px; padding: 8px 12px; font-size: 12px; color: var(--text-secondary); margin-bottom: 14px; }
.tablewrap.free { max-height: none; overflow-x: auto; overflow-y: visible; }
.tablewrap.free tfoot td { position: static; }

.status { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.sicon { flex: none; vertical-align: -2px; }
.alert { border: 1px solid var(--border); border-left: 4px solid var(--critical); background: var(--surface-1); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; }
.alert-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.alert-head .toggle { margin-left: auto; }
.alert-list { font-size: 12px; margin-top: 4px; color: var(--text-primary); }
.statgrid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 1000px) { .statgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 600px) { .statgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { display: flex; flex-direction: column; gap: 2px; text-align: left; font: inherit; color: inherit; cursor: pointer; padding: 12px 14px; }
.stat .label { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); }
.stat .value { font-size: 26px; font-weight: 600; }
.stat:hover { background: var(--hover); }
.stat.on { outline: 2px solid var(--accent); outline-offset: -2px; }
.hbars { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 10px; }
.hbar { display: grid; grid-template-columns: 22px minmax(120px, 170px) minmax(0, 1fr) 72px 16px; align-items: center; gap: 8px; font-size: 13px; }
.hbar .rk { color: var(--text-secondary); text-align: right; font-variant-numeric: tabular-nums; }
.hbar .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar .bar { display: block; width: 100%; }
.hbar .v { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
#tp-q { margin-bottom: 10px; }

button.hbar { appearance: none; border: 0; background: none; font: inherit; color: inherit; text-align: left; padding: 3px 4px; border-radius: 6px; cursor: pointer; width: 100%; }
button.hbar:hover { background: var(--hover); }
.hbars.wide .hbar { grid-template-columns: 22px minmax(150px, 210px) minmax(0, 1fr) 72px 16px; }
.gtiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.gtiles .label { display: inline-flex; align-items: center; gap: 6px; }
.clip { display: inline-block; max-width: 280px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
#sy-q { margin-bottom: 10px; }
.split + .card { margin-top: 12px; }

/* ---------- sign in ---------- */
.top-right { display: flex; gap: 12px; align-items: baseline; }
.signout { color: var(--accent); text-decoration: none; }
.signout:hover { text-decoration: underline; }
main.login { max-width: 340px; margin: 12vh auto 0; padding: 28px 26px; background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; }
main.login h1 { font-size: 20px; font-weight: 600; margin: 0 0 4px; }
main.login form { display: grid; gap: 6px; margin-top: 16px; }
main.login label { font-size: 12px; color: var(--text-secondary); margin-top: 6px; }
main.login input { font: inherit; font-size: 14px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-1); color: var(--text-primary); }
main.login button { margin-top: 14px; font: inherit; font-weight: 600; padding: 9px; border: 0; border-radius: 8px; background: var(--accent); color: #fff; cursor: pointer; }
.login-error { border-left: 4px solid var(--critical); background: var(--surface-2); padding: 8px 10px; border-radius: 6px; font-size: 13px; margin: 12px 0 0; }
