/* Concierge Admin — an operations console, so information design before decoration.
   Palette: warm neutrals with a faint plum bias; one accent (deep beetroot) for navigation and
   identity; status colour is a separate family (green / amber / red / slate) so "the accent" and
   "something is wrong" never look like the same thing. Every status also carries a shape, because
   colour alone is not a signal. Type: IBM Plex Sans for the interface, IBM Plex Mono for anything
   that lines up in a column (times, latencies, ids), Noto Sans Devanagari for spoken text — Hindi is
   what the callers speak, and it deserves a real face rather than a fallback. */

:root {
  color-scheme: light;
  --bg: #f5f2f3;
  --surface: #ffffff;
  --raised: #ede6e9;
  --line: #ded4d9;
  --line-strong: #c6b7bf;
  --text: #1e171b;
  --muted: #6b5e64;
  --accent: #6e2749;
  --accent-ink: #ffffff;
  --accent-wash: #f3e4eb;
  --ok: #17663f;
  --ok-wash: #e0efe7;
  --warn: #8a5300;
  --warn-wash: #f6e9d6;
  --bad: #a32521;
  --bad-wash: #f7e2e0;
  --info: #2c5674;
  --info-wash: #e1ebf2;
  --focus: #0b63c5;
  --shadow: 0 1px 2px rgb(30 23 27 / 6%);

  --sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", "Cascadia Mono", Menlo, monospace;
  --deva: "Noto Sans Devanagari", "Nirmala UI", "Kohinoor Devanagari", "Mangal", var(--sans);

  --rail: 214px;
  --gap: 16px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  color-scheme: dark;
  --bg: #171315;
  --surface: #1f1a1d;
  --raised: #292227;
  --line: #372d33;
  --line-strong: #4b3d45;
  --text: #f0e9ec;
  --muted: #a4949b;
  --accent: #e894b7;
  --accent-ink: #23131a;
  --accent-wash: #3a2130;
  --ok: #5cc28f;
  --ok-wash: #173427;
  --warn: #e0a552;
  --warn-wash: #3a2a15;
  --bad: #f0857c;
  --bad-wash: #3d1f1e;
  --info: #8cb9db;
  --info-wash: #1b2c39;
  --focus: #7fb2ef;
  --shadow: 0 1px 2px rgb(0 0 0 / 34%);
  }
}

/* the same dark values again, for an explicit choice rather than the OS setting */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #171315;
  --surface: #1f1a1d;
  --raised: #292227;
  --line: #372d33;
  --line-strong: #4b3d45;
  --text: #f0e9ec;
  --muted: #a4949b;
  --accent: #e894b7;
  --accent-ink: #23131a;
  --accent-wash: #3a2130;
  --ok: #5cc28f;
  --ok-wash: #173427;
  --warn: #e0a552;
  --warn-wash: #3a2a15;
  --bad: #f0857c;
  --bad-wash: #3d1f1e;
  --info: #8cb9db;
  --info-wash: #1b2c39;
  --focus: #7fb2ef;
  --shadow: 0 1px 2px rgb(0 0 0 / 34%);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }

h1, h2, h3 { margin: 0; font-weight: 600; text-wrap: balance; letter-spacing: -0.01em; }
h1 { font-size: 21px; }
h2 { font-size: 16px; }
h3 { font-size: 13px; }
p { margin: 0; }

.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.deva { font-family: var(--deva); line-height: 1.7; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

/* ---------------------------------------------------------------- shell ---- */

.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }

.rail {
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand { display: flex; flex-direction: column; gap: 2px; }
.brand b { font-size: 15px; letter-spacing: -0.015em; }
.brand span { font-size: 11px; color: var(--muted); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: block;
  padding: 6px 9px;
  border-radius: 5px;
  color: var(--text);
  text-decoration: none;
  font-size: 13.5px;
}
.nav a:hover { background: var(--raised); }
.nav a[aria-current="page"] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }

.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; font-size: 11.5px; color: var(--muted); }
.rail-foot dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; margin: 0; }
.rail-foot dt { color: var(--muted); }
.rail-foot dd { margin: 0; font-family: var(--mono); font-size: 11px; color: var(--text); overflow-wrap: anywhere; }

.linkbutton {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 5px;
  cursor: pointer;
}
.linkbutton:hover { background: var(--raised); }

.main { padding: 24px 28px 64px; max-width: 1360px; display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.pagehead { display: flex; flex-direction: column; gap: 4px; }
.pagehead .lede { color: var(--muted); max-width: 68ch; }

/* ---------------------------------------------------------------- pieces ---- */

.notice {
  border: 1px solid var(--line);
  border-left: 3px solid var(--info);
  background: var(--surface);
  padding: 9px 13px;
  border-radius: 4px;
  color: var(--muted);
}
.notice.warn { border-left-color: var(--warn); }
.notice.bad { border-left-color: var(--bad); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.panel > header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.panel > .body { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }

.scroll { overflow-x: auto; }

table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th {
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
  border-bottom-color: var(--line-strong);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--raised); }
td.num, th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
td.id { font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }

/* status: colour plus a shape, so it survives a monochrome screen or colour-blind eyes */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 8px 1px 6px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}
.pill::before { font-size: 9px; line-height: 1; }
.pill.ok { background: var(--ok-wash); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.pill.ok::before { content: "●"; }
.pill.warn { background: var(--warn-wash); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.pill.warn::before { content: "▲"; }
.pill.bad { background: var(--bad-wash); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 34%, transparent); }
.pill.bad::before { content: "■"; }
.pill.neutral { background: var(--raised); color: var(--muted); border-color: var(--line); }
.pill.neutral::before { content: "·"; font-size: 13px; }

.chip {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 3px;
  background: var(--raised);
  border: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}
.chip.accent { background: var(--accent-wash); border-color: color-mix(in srgb, var(--accent) 28%, transparent); color: var(--accent); }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 2px 20px; margin: 0; }
.facts > div { padding: 6px 0; border-top: 1px solid var(--line); }
.facts dt { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-size: 13.5px; }

.meter { display: flex; align-items: center; gap: 8px; }
.meter .track { flex: 1; min-width: 54px; height: 5px; border-radius: 3px; background: var(--raised); overflow: hidden; }
.meter .fill { height: 100%; background: var(--ok); }
.meter.warn .fill { background: var(--warn); }
.meter.bad .fill { background: var(--bad); }

/* ---------------------------------------------------------------- timeline ---- */

.callgrid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
@media (max-width: 1080px) { .callgrid { grid-template-columns: minmax(0, 1fr); } }

.aside { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 16px; }

.timeline { display: flex; flex-direction: column; }

.tl {
  display: grid;
  grid-template-columns: 66px 16px minmax(0, 1fr);
  gap: 0 10px;
  padding: 7px 16px 7px 12px;
  border-bottom: 1px solid var(--line);
}
.tl:last-child { border-bottom: none; }
.tl .at { font-family: var(--mono); font-size: 11.5px; font-variant-numeric: tabular-nums; color: var(--muted); padding-top: 3px; text-align: right; }
.tl .track { position: relative; }
.tl .track::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 0;
  bottom: -8px;
  width: 1px;
  background: var(--line);
}
.tl:last-child .track::before { bottom: 50%; }
.tl .dot { position: absolute; left: 1px; top: 7px; width: 11px; height: 11px; background: var(--surface); }

.tl.caller .dot { border-radius: 50%; background: var(--info); }
.tl.agent .dot { border-radius: 50%; border: 2.5px solid var(--accent); }
.tl.system .dot { border-radius: 2px; border: 1px solid var(--line-strong); background: var(--raised); }
.tl.system.sev-ok .dot { border-color: var(--ok); background: var(--ok); }
.tl.system.sev-warn .dot { border-color: var(--warn); background: var(--warn); }
.tl.system.sev-bad .dot { border-color: var(--bad); background: var(--bad); }

.tl .body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.tl .who { font-size: 11px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.tl .said {
  font-family: var(--deva);
  font-size: 15px;
  padding: 7px 11px;
  border-radius: 4px;
  overflow-wrap: anywhere;
}
.tl.caller .said { background: var(--info-wash); }
.tl.agent .said { background: var(--accent-wash); }

.tl .title { font-size: 13.5px; font-weight: 600; letter-spacing: -0.005em; }
.tl .title .chip { font-weight: 400; vertical-align: 1px; }
.tl.system .said { background: var(--raised); font-size: 14px; }
.tl.system.sev-warn { background: color-mix(in srgb, var(--warn-wash) 45%, transparent); }
.tl.system.sev-bad { background: color-mix(in srgb, var(--bad-wash) 45%, transparent); }

.kv { display: grid; grid-template-columns: minmax(90px, auto) minmax(0, 1fr); gap: 1px 12px; margin: 0; font-size: 12.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

.lat { display: flex; gap: 10px; flex-wrap: wrap; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.lat b { font-weight: 600; color: var(--text); }
.lat .slow { color: var(--warn); }
.lat .veryslow { color: var(--bad); }

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 11px; height: 11px; display: inline-block; }
.legend i.caller { border-radius: 50%; background: var(--info); }
.legend i.agent { border-radius: 50%; border: 2.5px solid var(--accent); }
.legend i.system { border-radius: 2px; border: 1px solid var(--line-strong); background: var(--raised); }

/* ---------------------------------------------------------------- basket ---- */

.lines { display: flex; flex-direction: column; gap: 8px; }
.line { border-top: 1px solid var(--line); padding-top: 8px; display: flex; flex-direction: column; gap: 3px; }
.line:first-child { border-top: none; padding-top: 0; }
.line .top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.line .name { font-weight: 600; }

.totals { display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; font-size: 13px; }
.totals .grand { border-top: 1px solid var(--line-strong); padding-top: 6px; margin-top: 3px; font-weight: 600; }
.totals span:nth-child(even) { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }

/* ---------------------------------------------------------------- login ---- */

.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login form { width: min(360px, 100%); display: flex; flex-direction: column; gap: 12px; }
.login .card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 26px; box-shadow: var(--shadow); }
.login input[type="password"] {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.login button {
  padding: 9px 14px;
  border: none;
  border-radius: 5px;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.login .error { color: var(--bad); font-size: 13px; }

.pager { display: flex; gap: 12px; align-items: center; font-size: 13px; color: var(--muted); }

.empty { padding: 26px 16px; text-align: center; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; height: auto; border-right: none; border-bottom: 1px solid var(--line); }
  .main { padding: 18px 16px 48px; }
}

/* ---------------------------------------------------------------- filters ---- */

/* A plain GET form, so what is on screen is what is in the address bar. Wraps rather than scrolls:
   an operator on a laptop should see every filter at once. */
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 14px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.filters label { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.filters label.grow { flex: 1 1 200px; }
.filters label > span {
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.filters select,
.filters input {
  font: inherit;
  font-size: 13px;
  padding: 5px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  max-width: 100%;
}
.filters input[type="date"] { font-family: var(--mono); font-size: 12px; }
.filters .actions { display: flex; align-items: center; gap: 10px; }
.filters button {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border: none;
  border-radius: 4px;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
}

.applied { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: -8px; }
.applied a.chip { text-decoration: none; color: var(--accent); border-color: color-mix(in srgb, var(--accent) 28%, transparent); }
.applied a.chip:hover { background: var(--accent-wash); }

/* the count beside the navigation item, so a waiting hold is visible from any page */
.badge {
  display: inline-block;
  margin-left: 6px;
  min-width: 17px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--warn);
  color: var(--bg);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 17px;
  text-align: center;
  vertical-align: 1px;
}
.nav a[aria-current="page"] .badge { background: var(--accent-ink); color: var(--accent); }

.panel-foot { padding: 10px 16px; border-top: 1px solid var(--line); }

/* an order that failed or was cancelled must not read like one that went through */
tbody tr.struck td { background: color-mix(in srgb, var(--bad-wash) 45%, transparent); }
tbody tr.struck td:first-child { box-shadow: inset 3px 0 0 var(--bad); }

/* ---------------------------------------------------------------- holds ---- */

.hold {
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: 5px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.hold.sev-warn { border-left-color: var(--warn); }
.hold.sev-bad { border-left-color: var(--bad); }
.hold.sev-ok { border-left-color: var(--ok); }
.hold-head { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; align-items: flex-start; }
.hold-what { font-weight: 600; font-size: 14.5px; }
.hold-figures { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.hold-figures .total { font-size: 15px; font-weight: 600; }

.why { display: flex; flex-direction: column; gap: 7px; }
.reason { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.reason > .pill { align-self: flex-start; }
