:root {
  --charcoal: #232323;
  --red: #A31E2D;
  --canvas: #E9EAEC;
  --panel: #FFFFFF;
  --ink: #232323;
  --muted: #62666D;
  --line: #D5D7DB;
  --avail: #2F8F6B;
  --oncall: #2D63A8;
  --break: #B87914;
  --off: #9AA0A6;
  --ring: #6B4FA0;
  --font: "Barlow", "Segoe UI", system-ui, sans-serif;
  --num: "Barlow Condensed", "Arial Narrow", "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.45 var(--font); color: var(--ink); background: var(--canvas); }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--oncall); outline-offset: 2px; }
h1, h2, h3 { font-weight: 600; margin: 0; }
h2 { font-size: 1.15rem; }

/* brand */
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 600; font-size: 1.05rem; }
.brand-mark { width: 22px; height: 22px; border-radius: 5px; background: var(--red);
  background-image: linear-gradient(90deg, transparent 18%, #fff 18% 32%, transparent 32% 44%, #fff 44% 58%, transparent 58% 70%, #fff 70% 84%, transparent 84%);
  -webkit-mask: none; flex: none; }

/* login */
.login { min-height: 100%; display: grid; place-items: center; background: var(--charcoal); padding: 1.5rem; }
.login-card { background: var(--panel); width: min(380px, 100%); padding: 2rem; border-radius: 10px; display: grid; gap: .9rem; }
.login-sub { margin: 0 0 .4rem; color: var(--muted); }
label { display: grid; gap: .3rem; font-size: .88rem; color: var(--muted); }
input, select { border: 1px solid var(--line); border-radius: 6px; padding: .5rem .65rem; background: #fff; color: var(--ink); }
.form-error { color: var(--red); min-height: 1.2em; margin: 0; font-size: .9rem; }

.btn { border: 1px solid var(--line); background: #fff; padding: .5rem .9rem; border-radius: 6px; cursor: pointer; font-weight: 500; }
.btn.primary { background: var(--charcoal); border-color: var(--charcoal); color: #fff; }
.btn.ghost { background: transparent; }
.btn:hover { border-color: var(--charcoal); }
.link { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; }

/* shell */
.shell { display: grid; grid-template-columns: 210px 1fr; min-height: 100%; }
.rail { background: var(--charcoal); color: #ECECEC; padding: 1.25rem 1rem; display: flex; flex-direction: column; gap: 1.75rem; position: sticky; top: 0; height: 100vh; }
.rail nav { display: grid; gap: .15rem; }
.rail nav a { color: #C9C9C9; text-decoration: none; padding: .55rem .7rem; border-radius: 6px; border-left: 3px solid transparent; }
.rail nav a:hover { color: #fff; background: #2E2E2E; }
.rail nav a.active { color: #fff; background: #2E2E2E; border-left-color: var(--red); }
.rail-foot { margin-top: auto; font-size: .85rem; color: #A9A9A9; display: grid; gap: .35rem; }
.who strong { color: #fff; font-weight: 500; display: block; }
main { min-width: 0; }
.topbar { display: flex; align-items: end; justify-content: space-between; gap: 1rem; padding: 1rem 1.5rem; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 5; }
.tenant-pick select { min-width: 260px; font-weight: 600; color: var(--ink); }
.topbar-right { display: flex; align-items: center; gap: .9rem; }
.conn { width: 10px; height: 10px; border-radius: 50%; background: var(--off); }
.conn.up { background: var(--avail); }
#view { padding: 1.5rem; display: grid; gap: 1.5rem; }

.panel { background: var(--panel); border-radius: 8px; border: 1px solid var(--line); }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding: .9rem 1.1rem; border-bottom: 1px solid var(--line); }
.panel-head .note { color: var(--muted); font-size: .85rem; }
.panel-body { padding: 1rem 1.1rem; }
.empty { color: var(--muted); padding: 1.25rem 1.1rem; }
.alert { background: #F8E7E9; border: 1px solid #E6B9BE; color: #6E1420; padding: .75rem 1rem; border-radius: 8px; }

/* ---- the queue board: one signage strip per queue ---- */
.totals { display: flex; flex-wrap: wrap; gap: 2.25rem; padding: .25rem .1rem; }
.total { display: grid; }
.total .v { font: 600 2rem/1 var(--num); }
.total .k { color: var(--muted); font-size: .85rem; }
.board { display: grid; gap: 2px; background: var(--charcoal); border-radius: 8px; overflow: hidden; border: 2px solid var(--charcoal); }
.strip { display: grid; grid-template-columns: minmax(150px, 1.3fr) 110px minmax(170px, 1.4fr) minmax(170px, 1.2fr) minmax(260px, 2fr); align-items: center; gap: 1.25rem; background: var(--panel); padding: .9rem 1.1rem; }
.strip.board-head { background: var(--charcoal); color: #BDBDBD; font-size: .8rem; padding: .45rem 1.1rem; }
.strip .qname { font-weight: 600; font-size: 1.05rem; overflow-wrap: anywhere; }
.strip .waiting { font: 700 2.9rem/1 var(--num); text-align: center; color: var(--ink); }
.strip .waiting.hot { color: var(--red); }
.longest .t { font: 600 1.45rem/1 var(--num); }
.meter { height: 6px; background: #ECEDEF; border-radius: 3px; margin-top: .45rem; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--avail); transition: width .6s ease; }
.meter i.warn { background: var(--break); }
.meter i.over { background: var(--red); }
.staff { display: flex; gap: .9rem; flex-wrap: wrap; font-size: .9rem; }
.staff b { font: 600 1.3rem/1 var(--num); margin-right: .2rem; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: .3rem; vertical-align: middle; }
.dot.avail { background: var(--avail); } .dot.oncall { background: var(--oncall); } .dot.break { background: var(--break); } .dot.off { background: var(--off); }
.todayline { display: grid; grid-template-columns: repeat(4, auto); gap: .2rem 1.1rem; font-size: .82rem; color: var(--muted); }
.todayline b { display: block; font: 600 1.25rem/1.1 var(--num); color: var(--ink); }
.todayline b.bad { color: var(--red); }

.cols { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1.5rem; align-items: start; }
.agents { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .6rem; padding: 1rem 1.1rem; }
.agent { border: 1px solid var(--line); border-left: 5px solid var(--off); border-radius: 6px; padding: .55rem .7rem; display: grid; gap: .1rem; }
.agent.avail { border-left-color: var(--avail); } .agent.oncall { border-left-color: var(--oncall); }
.agent.break { border-left-color: var(--break); } .agent.ring { border-left-color: var(--ring); }
.agent .n { font-weight: 600; overflow-wrap: anywhere; }
.agent .s { font-size: .82rem; color: var(--muted); }
.agent .tm { font: 600 1.15rem/1 var(--num); }
.agent .tdy { font-size: .78rem; color: var(--muted); }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .5rem .75rem; border-bottom: 1px solid #ECEDEF; white-space: nowrap; }
th { font-weight: 600; color: var(--muted); font-size: .8rem; background: #F6F7F8; position: sticky; top: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.total-row td { font-weight: 600; border-top: 2px solid var(--line); }
.table-wrap { overflow-x: auto; max-height: 560px; overflow-y: auto; }
.tag { font-size: .78rem; padding: .1rem .45rem; border-radius: 4px; background: #EEF0F2; }
.tag.answered { background: #E3F1EB; color: #1F6249; } .tag.abandoned { background: #F8E7E9; color: #7A1A25; }
.tag.timeout, .tag.breakout, .tag.exit_key { background: #F6EEDD; color: #6B4609; }

/* reports */
.filters { display: flex; flex-wrap: wrap; gap: .8rem; align-items: end; }
.presets { display: flex; gap: .25rem; }
.presets button { border: 1px solid var(--line); background: #fff; padding: .45rem .7rem; border-radius: 6px; cursor: pointer; }
.presets button[aria-pressed="true"] { background: var(--charcoal); color: #fff; border-color: var(--charcoal); }
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--line); padding: 0 1.1rem; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: .8rem .8rem; cursor: pointer; border-bottom: 3px solid transparent; color: var(--muted); font-weight: 500; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--red); }
.chart-box { position: relative; height: 300px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.toolbar { display: flex; gap: .6rem; align-items: end; flex-wrap: wrap; }

/* wallboard: full screen, charcoal, readable across a room */
body.wall .rail, body.wall .topbar { display: none; }
body.wall .shell { grid-template-columns: 1fr; }
body.wall { background: var(--charcoal); }
body.wall #view { padding: 1.25rem; }
body.wall .totals .v { color: #fff; font-size: 2.6rem; }
body.wall .totals .k { color: #BDBDBD; }
body.wall .strip .waiting { font-size: 4rem; }
body.wall .strip .qname { font-size: 1.4rem; }
body.wall .panel { background: #2C2C2C; border-color: #3A3A3A; color: #EEE; }
body.wall .panel-head { border-color: #3A3A3A; }
body.wall .agent { border-top-color: #444; border-right-color: #444; border-bottom-color: #444; }
body.wall .agent .s, body.wall .agent .tdy { color: #BDBDBD; }
body.wall .wall-exit { position: fixed; right: 1rem; bottom: 1rem; opacity: .35; }
body.wall .wall-exit:hover { opacity: 1; }
body.wall td, body.wall th { border-color: #3A3A3A; } body.wall th { background: #333; color: #BDBDBD; }

@media (max-width: 1100px) {
  .strip { grid-template-columns: 1fr 90px 1fr; }
  .strip .staff, .strip .todayline { grid-column: 1 / -1; }
  .strip.board-head { display: none; }
  .cols, .split { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 1rem; padding: .8rem 1rem; }
  .rail nav { display: flex; }
  .rail-foot { margin: 0 0 0 auto; }
  .tenant-pick select { min-width: 0; width: 100%; }
  #view { padding: 1rem; }
}
@media (prefers-reduced-motion: reduce) { .meter i { transition: none; } }
a.btn { color: inherit; text-decoration: none; display: inline-block; }
