/* Operations console: dense, quiet, readable for a whole working day. */

:root {
  /* Light on every machine, on purpose. The console is one look — greige
     ground, white cards, green menu — and it does not follow the operating
     system into a dark theme: two palettes meant every colour decision here
     had to be made twice, and the letters this console previews are authored
     for a white mail client anyway. Declared rather than left at the default
     so the form controls and the scrollbars come up light too. */
  color-scheme: light;

  /* The three colours the customer chose, exactly as they arrive in the
     letters. Everything below is derived from them, so the console and the
     e-mails a customer receives are visibly the same product. Each one owns a
     meaning rather than decorating: sage is action and agreement, blue-grey is
     information, greige is a caution. */
  --brand-sage: #cbd4c2;
  --brand-blue: #d2dae1;
  --brand-greige: #d9d2ca;

  /* The ground is greige rather than near white: the console is a page of
     white cards, and they need something to be cards against. */
  --bg: #d6d3ce;
  --surface: #ffffff;
  --surface-2: #f6f5f2;
  --border: #ddd8d2;
  --text: #2b2b2b;
  --muted: #6b655e;

  /* The pastels are surfaces, not ink: at text size none of the three reaches
     a readable contrast on white, so every foreground is the same hue taken
     down to where it can be read. These are the letters' own button colours. */
  --accent: #55684e;
  --accent-soft: var(--brand-sage);
  --on-accent: #ffffff;

  --ok: #4a6b45;
  --ok-soft: #dfe6d9;
  --warn: #8a6a3c;
  --warn-soft: var(--brand-greige);
  --bad: #9c4436;
  --bad-soft: #f0ddd8;
  --info: #41586d;
  --info-soft: var(--brand-blue);

  --nav-width: 260px;
  /* The menu is chrome rather than content, so it does not take the surface
     tokens the cards use: it is one green panel, and everything drawn on it
     reads its colour from here. */
  --nav-bg: #4f6b2a;
  --nav-text: #f1f5ec;
  --nav-muted: #cbdcbb;
  --nav-hover: rgb(255 255 255 / 12%);
  --nav-current: rgb(255 255 255 / 22%);
  --nav-line: rgb(255 255 255 / 20%);

  --radius: 8px;
  --shadow: 0 1px 2px rgb(43 43 43 / 8%), 0 4px 12px rgb(43 43 43 / 6%);
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

/* The browser's own [hidden] rule loses to any class that sets display, and
   several blocks here do. Without this the "pick a lead" placeholder stays on
   screen underneath the detail it was replaced by. */
[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ---------------------------------------------------------------- topbar */

/* Chrome, like the menu, and the same green: the two meet at the top left
   corner and read as one piece of furniture the console sits inside. No border
   under it — green against greige is already an edge.

   The filter row below it stays a white surface on purpose: it belongs to the
   lead list, not to the console. It is hidden on every other view, which is
   what tells the two apart. */
.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 18px;
  color: var(--nav-text);
  background: var(--nav-bg);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
}

.brand h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

/* The service lamp. Green breathing means the API answered the last health
   check, red blinking means it did not, and pale still means it has not been
   asked yet. The pill beside it says the same in words and carries the reason,
   which is why the lamp itself stays aria-hidden: it is the version you can
   read from across the room, not a second fact. */
.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--nav-text);
  /* A dark rim, not a brighter hue, is what lifts the lamp off the olive
     behind it. No red that anyone would still call red reaches 3:1 on this
     green, and the rim makes the question moot for every colour it can take. */
  box-shadow: 0 0 0 1px rgb(28 38 14 / 55%);
}

.dot[data-state="ok"] {
  background: #b8f07d;
  /* Slow, and never fully out. The green one is on screen all day beside the
     product name: a lamp that pulses like a heartbeat is read as alive, and a
     lamp that flashes is read as a fault. */
  animation: led-breathe 2.6s ease-in-out infinite;
}

.dot[data-state="down"] {
  background: #ff6f5c;
  /* Hard edges and twice the rate, because this one does want the eye. */
  animation: led-alarm 1.1s steps(1, end) infinite;
}

@keyframes led-breathe {
  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 0 1px rgb(28 38 14 / 55%), 0 0 7px 1px rgb(184 240 125 / 55%);
  }
  50% {
    opacity: 0.45;
    box-shadow: 0 0 0 1px rgb(28 38 14 / 55%), 0 0 0 0 rgb(184 240 125 / 0%);
  }
}

@keyframes led-alarm {
  0%,
  49% {
    opacity: 1;
    box-shadow: 0 0 0 1px rgb(28 38 14 / 55%), 0 0 8px 1px rgb(255 111 92 / 65%);
  }
  50%,
  100% {
    opacity: 0.3;
    box-shadow: 0 0 0 1px rgb(28 38 14 / 55%), 0 0 0 0 rgb(255 111 92 / 0%);
  }
}

/* Motion in a fixed corner of a screen someone works in front of all day is
   the one thing a console cannot take back once it is running. Off, the state
   is still the colour, and the words are still next to it. */
@media (prefers-reduced-motion: reduce) {
  .dot[data-state] {
    animation: none;
  }
}

.session {
  /* Carried the header's leftover space when the status counts lived up here;
     they are part of the filter chips now. */
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.user {
  color: var(--nav-muted);
}

/* Only ever the sign out link, and it lives on the green. */
.link {
  color: var(--nav-text);
  text-decoration: none;
}

.link:hover {
  text-decoration: underline;
}

/* ---------------------------------------------------------------- pills */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 550;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--muted);
}

.pill-muted {
  background: var(--surface-2);
  color: var(--muted);
}
.pill-ok {
  background: var(--ok-soft);
  color: var(--ok);
}
.pill-warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.pill-bad {
  background: var(--bad-soft);
  color: var(--bad);
}
.pill-info {
  background: var(--info-soft);
  color: var(--info);
}

.pill .n {
  font-variant-numeric: tabular-nums;
  opacity: 0.75;
}

/* ------------------------------------------------------- status colours */

/* Eight statuses, eight colours, written once. Anything carrying data-tone
   gets the pair, and the two things that carry it — the chip in the filter bar
   and the pill in the STAV column — cannot disagree about what green means.

   Each pair is an ink and the tint it is read on, and the hues are the console's
   own: no colour here is more saturated than the letters the customer receives.
   The ink clears 4.4:1 on its tint, and 6:1 under the white text a pressed chip
   uses, so both states of both components are legible without checking.

   The order is the lead's own: blue arrives, teal is working, green is worth
   money, violet means a person has it, amber waits, plum was turned down, grey
   is over, red is broken. */
[data-tone="new"] { --tone: #41586d; --tone-soft: #d2dae1; }
[data-tone="progress"] { --tone: #2f6360; --tone-soft: #d0e0dd; }
[data-tone="qualified"] { --tone: #4a6b45; --tone-soft: #dfe6d9; }
[data-tone="handed"] { --tone: #5a4b7a; --tone-soft: #e2ddec; }
[data-tone="nurture"] { --tone: #6e522b; --tone-soft: #d9d2ca; }
[data-tone="rejected"] { --tone: #7a4a58; --tone-soft: #ecdbe0; }
[data-tone="closed"] { --tone: #5f5a53; --tone-soft: #e4e0da; }
[data-tone="error"] { --tone: #9c4436; --tone-soft: #f0ddd8; }

.pill[data-tone] {
  background: var(--tone-soft, var(--surface-2));
  color: var(--tone, var(--muted));
}

/* ---------------------------------------------------------------- filters */

.filters {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.search {
  flex: 1 1 320px;
  min-width: 220px;
}

input,
select,
button {
  font: inherit;
  color: inherit;
}

input[type="search"],
select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

input[type="search"]:focus-visible,
select:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.chips {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--tone-soft, var(--bg));
  color: var(--tone, var(--muted));
  font-size: 12px;
  cursor: pointer;
}

/* Colour is the status, so it is on whether the filter is or not, and the
   pressed state cannot use hue to say anything. It inverts instead: the tint
   and the ink swap places. That reads across the whole row at a glance, holds
   up in every one of the eight hues, and is a shape rather than a shade, so it
   survives a screen nobody has calibrated. */
.chip[aria-pressed="true"] {
  background: var(--tone, var(--accent));
  border-color: var(--tone, var(--accent));
  color: var(--on-accent);
  font-weight: 600;
}

/* A zero is dimmed to keep the eye off it, but 0.35 of white on a filled chip
   is not dim, it is gone. */
.chip[aria-pressed="true"] .n[data-empty="true"] {
  opacity: 0.6;
}

/* The count the header used to show. Tabular figures so the chips stop
   twitching sideways every time the list reloads. */
.chip .n {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  opacity: 0.85;
}

.chip .n[data-empty="true"] {
  opacity: 0.35;
  font-weight: 400;
}

.ghost {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
}

.ghost:hover:not(:disabled) {
  background: var(--surface-2);
}

.ghost:disabled {
  opacity: 0.45;
  cursor: default;
}

/* ---------------------------------------------------------------- layout */

/* The middle column is the drag handle. --split-left is set from the pointer
   while dragging and is the one value here that cannot be a class: it is a
   position the operator chose, not a state the stylesheet knows about. Without
   it the fraction below decides, which is the sensible default. */
.split {
  flex: 1;
  display: grid;
  grid-template-columns: var(--split-left, minmax(420px, 1.15fr)) auto minmax(380px, 1fr);
  gap: 8px;
  padding: 14px 18px 18px;
  min-height: 0;
}

.split-handle {
  align-self: stretch;
  width: 6px;
  border-radius: 3px;
  background: var(--border);
  cursor: col-resize;
  touch-action: none;
}

.split-handle:hover,
.split-handle.is-dragging {
  background: var(--accent);
}

.split-handle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* While dragging, the pointer is over the panels rather than the handle, and
   without this every move selects the text it passes over. */
body.is-resizing {
  user-select: none;
  cursor: col-resize;
}

@media (max-width: 1100px) {
  .split {
    /* Stacked: there is no left and right to divide, so the handle goes too. */
    grid-template-columns: 1fr;
  }

  .split-handle {
    display: none;
  }
}

.list,
.detail {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------------------------------------------------------------- table */

.table-wrap {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  padding: 9px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

/* The sort control fills its cell rather than sitting in it: the target is the
   whole heading, which is what anyone aiming at a column heading expects. */
thead th:has(.sort) {
  padding: 0;
}

.sort {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: inherit;
  cursor: pointer;
}

.num .sort {
  justify-content: flex-end;
}

.sort:hover {
  color: var(--text);
}

/* The caret is drawn from aria-sort, so the thing a screen reader announces and
   the thing everyone else looks at are the same fact.

   Borders rather than an arrow character: U+2191 and its neighbours are not in
   the system UI stack this console asks for, and the browser drew the missing
   glyph box with the codepoint printed inside it. A triangle made of borders
   has no font to be missing from, and it takes currentColor, so it darkens with
   the heading instead of needing its own palette entry. */
.sort::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  /* Idle columns keep a faint one. A heading with no mark does not look like it
     does anything, and a mark that appears only on hover is invisible to
     whoever is still deciding whether to reach for the mouse. */
  opacity: 0.28;
}

th[aria-sort="ascending"] .sort::after {
  border-top: 0;
  border-bottom: 5px solid currentColor;
  opacity: 1;
}

th[aria-sort="descending"] .sort::after {
  opacity: 1;
}

th[aria-sort="ascending"] .sort,
th[aria-sort="descending"] .sort {
  color: var(--text);
}

tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover {
  background: var(--surface-2);
}

tbody tr[aria-selected="true"] {
  background: var(--accent-soft);
}

tbody tr[aria-selected="true"] td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

.placeholder td {
  padding: 28px 12px;
  text-align: center;
  color: var(--muted);
  cursor: default;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.who {
  font-weight: 600;
}

.sub {
  color: var(--muted);
  font-size: 12px;
  font-family: var(--mono);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border-top: 1px solid var(--border);
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

/* ---------------------------------------------------------------- detail */

.detail {
  overflow: auto;
}

.empty {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--muted);
}

.detail-body {
  padding: 16px 18px 22px;
}

.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.detail-head h2 {
  margin: 0 0 3px;
  font-size: 17px;
}

.detail-head p {
  margin: 0;
}

.detail-score {
  text-align: right;
  white-space: nowrap;
}

.rating {
  display: block;
  font-size: 13px;
  font-weight: 650;
}

.score {
  display: block;
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 14px;
  margin: 14px 0 4px;
  font-size: 13px;
}

.facts dt {
  color: var(--muted);
}

.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------- tabs */

.tabs {
  display: flex;
  gap: 2px;
  margin: 18px 0 12px;
  border-bottom: 1px solid var(--border);
}

.tab {
  padding: 8px 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}

.tab[aria-selected="true"] {
  color: var(--text);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.badge {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 11px;
  text-align: center;
}

/* ---------------------------------------------------------------- panels */

.panel h3 {
  margin: 16px 0 6px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.panel h3:first-child {
  margin-top: 0;
}

.prose {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.callout {
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--surface-2);
}

.bullets {
  margin: 0;
  padding-left: 18px;
}

.bullets li {
  margin-bottom: 3px;
}

.message {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
}

.message > summary {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 11px;
  background: var(--surface-2);
  cursor: pointer;
  list-style: none;
}

.message > summary::-webkit-details-marker {
  display: none;
}

.message .subject {
  flex: 1;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message .body {
  margin: 0;
  padding: 11px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: var(--mono);
  font-size: 12.5px;
  max-height: 340px;
  overflow: auto;
}

.log-table {
  font-size: 13px;
}

.log-table td,
.log-table th {
  padding: 6px 9px;
}

.mono {
  font-family: var(--mono);
  font-size: 12px;
}

.error-text {
  color: var(--bad);
  font-family: var(--mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------- toast */

/* Middle of the screen rather than the bottom edge. It reports the outcome of
   something the operator just did to a customer - a lead closed, a message
   filed - and at the bottom of a tall list that is read after the fact, if at
   all. Green unless it is a failure: it was red for everything, so a lead
   closed exactly as asked announced itself in the colour of a problem. */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: min(440px, calc(100vw - 48px));
  padding: 14px 20px;
  border-radius: var(--radius);
  background: var(--ok-soft);
  color: var(--ok);
  border: 1px solid var(--ok);
  box-shadow: var(--shadow);
  text-align: center;
  line-height: 1.45;
  z-index: 10;
}

.toast[data-kind='bad'] {
  background: var(--bad-soft);
  color: var(--bad);
  border-color: var(--bad);
}

/* ---------------------------------------------------------------- signin */

.signin {
  display: grid;
  place-items: center;
  height: 100vh;
  margin: 0;
}

.signin-card {
  width: min(360px, 90vw);
  padding: 28px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.signin-card h1 {
  margin: 0 0 6px;
  font-size: 18px;
}

.signin-card p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 13px;
}

.btn-primary {
  display: inline-block;
  padding: 9px 20px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
}



/* --------------------------------------------------------------- navigation */

.hamburger {
  display: grid;
  gap: 4px;
  padding: 10px 8px;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
}

.hamburger:hover {
  background: var(--nav-hover);
  border-color: var(--nav-line);
}

.hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--nav-text);
  border-radius: 2px;
}

.sidenav {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: var(--nav-width);
  height: 100dvh;
  padding: 64px 12px 12px;
  /* The e-mail list under Šablóny is as long as there are templates, and a
     fixed panel has nowhere to put the overflow. */
  overflow-y: auto;
  /* The panel carries its own foreground colour: everything inside it would
     otherwise inherit the page's dark ink and land on a dark green. No border
     either — a green panel against a greige page is already an edge. */
  color: var(--nav-text);
  background: var(--nav-bg);
  /* Off canvas until asked for, on every width. The console is used on a phone
     in the showroom as often as on a desk. */
  transform: translateX(-100%);
  transition: transform 160ms ease;
}

/* The accent outline is a dark green and disappears into both green panels. */
.sidenav button:focus-visible,
.topbar button:focus-visible,
.topbar .link:focus-visible {
  outline-color: var(--nav-text);
}

.sidenav[data-open='true'] {
  transform: translateX(0);
  /* Only while open: a shadow on a panel parked off screen bleeds a visible
     strip down the left edge. */
  box-shadow: var(--shadow);
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgb(8 12 18 / 45%);
}

/* Pinned, the panel stops being a drawer: it keeps its column, the console
   moves over beside it, and choosing a view leaves it standing. Whether that is
   on is app.js's call — it also weighs the window width — and this attribute is
   the answer, not the preference behind it. */
body[data-nav-docked='true'] .sidenav {
  transform: none;
  box-shadow: none;
}

/* The panel runs the full height, and the header's left corner is inside its
   first 260 pixels. Docked there is no scrim to think about, so the header can
   simply come out on top and keep its hamburger clickable. */
body[data-nav-docked='true'] .topbar {
  position: relative;
  z-index: 41;
}

body[data-nav-docked='true'] > .filters,
body[data-nav-docked='true'] > main {
  margin-left: var(--nav-width);
}

.nav-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 2px 0 14px;
  padding: 0 6px;
}

.nav-brand img {
  display: block;
  width: 100%;
  max-width: 176px;
  height: auto;
}

/* Right aligned and quiet: this is a preference about the furniture, not one of
   the places the menu is there to take you. */
.nav-head {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 6px;
}

.nav-pin {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--nav-muted);
  background: none;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
}

.nav-pin:hover {
  background: var(--nav-hover);
  border-color: var(--nav-line);
}

/* Pinned, the pill turns inside out. On a panel that is already one colour a
   filled chip is the only "on" that cannot be mistaken for a hover. */
.nav-pin[aria-pressed='true'] {
  color: var(--nav-bg);
  background: var(--nav-text);
  border-color: transparent;
}

.nav-pin svg {
  width: 14px;
  height: 14px;
  flex: none;
}

.nav-item {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  font: inherit;
  color: var(--nav-text);
  text-align: left;
  background: none;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}

.nav-item:hover {
  background: var(--nav-hover);
}

/* Lit rather than tinted: on a coloured panel a lighter patch of the same green
   is the only mark that stays legible in both themes. */
.nav-item[aria-current='true'] {
  color: var(--nav-text);
  background: var(--nav-current);
  font-weight: 600;
}

.nav-icon {
  width: 1.2em;
  text-align: center;
  opacity: 0.7;
}

/* Pushed to the right edge so the count reads as a queue depth, not as part of
   the label. Hidden entirely at zero: an empty queue is not news. */
.nav-badge {
  margin-left: auto;
  padding: 1px 7px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--warn);
  background: var(--warn-soft);
  border-radius: 999px;
}

.nav-section {
  margin-top: 14px;
  border-top: 1px solid var(--nav-line);
  padding-top: 12px;
}

.nav-label {
  margin: 0 0 6px 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--nav-muted);
  text-transform: uppercase;
}

.nav-flow {
  display: block;
  width: 100%;
  padding: 8px 12px;
  font: inherit;
  font-size: 13px;
  color: var(--nav-muted);
  text-align: left;
  background: none;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}

.nav-flow:hover {
  background: var(--nav-hover);
}

.nav-flow[aria-current='true'] {
  color: var(--nav-text);
  background: var(--nav-current);
  box-shadow: inset 2px 0 0 var(--nav-text);
}

/* The second line of a template entry, dimmer than the first but still on
   green: the shared .sub is written for a white card. */
.nav-flow .sub {
  color: var(--nav-muted);
  opacity: 0.8;
}

/* -------------------------------------------------------------------- flows */

.flows {
  padding: 20px 24px 40px;
  overflow: auto;
}

.flow-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: baseline;
  margin-bottom: 20px;
}

/* The lead table takes every pixel a monitor has, because a row is worth more
   the more of it is visible at once. These two pages are the other kind: the
   call plan is an hour bar and a four week calendar, the preview is a 600px
   letter, and neither reads any better for being stretched. Left against the
   edge of a wide screen they look like a page that lost its right half, so they
   get a column, and the column sits in the middle.

   Set on the children, not on the <main>: docked, the menu holds the main's
   left margin, and an id selector centring the main itself would win that
   argument and slide the page back under the panel. */
.calling,
#callingView > .flow-head,
#templatesView > * {
  max-width: 900px;
  margin-inline: auto;
}

.flow-head h2 {
  margin: 0;
  font-size: 18px;
}

.flow-canvas {
  position: relative;
}

/* The lines sit under the boxes and are drawn after layout, because the text
   decides how wide a box ends up and only the browser knows that. */
.flow-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

/* Capped column tracks, not `auto`. Auto tracks stretch to the container and
   the boxes then sit at the left of tracks hundreds of pixels wide, which is
   what pushed the branch column off to the far side. Equal widths also line the
   box centres up, so a step down a column is a straight line rather than a
   wobble between two different midpoints.

   The minimum is a floor, not 0. A 0 minimum also zeroes the items' own
   automatic minimum size, and a three column diagram on a phone then squeezes
   tracks to ~88px, where an unbreakable word like "Deterministické," renders
   outside the box border. A floor keeps the words intact and lets `.flows`
   scroll instead, which is what its `overflow: auto` is there for. It is a
   length rather than `min-content` so that squeezed tracks stay equal to each
   other: min-content resolves per column and the boxes come out ragged. */
.flow-grid {
  position: relative;
  display: grid;
  grid-auto-columns: minmax(150px, 300px);
  /* Centred in the pane. `safe` matters: a plain `center` on content wider
     than the container pushes the first column outside the scroll range, where
     no amount of scrolling reaches it. The safe keyword falls back to `start`
     in exactly that case, and browsers that do not know it keep the plain
     `center` on the line above. */
  justify-content: center;
  justify-content: safe center;
  gap: 36px 56px;
}

.flow-node {
  position: relative;
  z-index: 1;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--muted);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.flow-node h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
}

.flow-node p {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

.flow-node[data-kind='start'] { border-left-color: var(--info); }
.flow-node[data-kind='email'] { border-left-color: var(--accent); }
.flow-node[data-kind='call'] { border-left-color: var(--warn); }
.flow-node[data-kind='sms'] { border-left-color: var(--warn); }
.flow-node[data-kind='decision'] { border-left-color: var(--info); }
.flow-node[data-kind='crm'] { border-left-color: var(--accent); }
.flow-node[data-kind='end'] { border-left-color: var(--ok); }

/* The ink the boxes are written in. The line used to be --border, which is a
   hairline meant for the edge of a white card: drawn on the page itself it came
   out at about 1.05:1 against the greige and the diagram lost its arrows. */
.flow-edge {
  fill: none;
  stroke: var(--text);
  stroke-width: 1.5;
}

.flow-edge[data-kind='branch'] {
  stroke-dasharray: 4 4;
}

/* The head is the half that says which way the lead moves, so it is the same
   ink as the line rather than a lighter grey behind it. */
.flow-arrow {
  fill: var(--text);
}

/* The halo is what keeps a label legible where it crosses a line. */
.flow-edge-label {
  font-size: 10px;
  fill: var(--muted);
  paint-order: stroke;
  stroke: var(--bg);
  stroke-width: 3px;
  stroke-linejoin: round;
}

@media (max-width: 720px) {
  .flow-grid {
    grid-auto-columns: minmax(150px, 220px);
    gap: 26px 32px;
  }
}

/* ---------------------------------------------------------------- templates */

.templates {
  padding: 20px 24px 40px;
  overflow: auto;
}

.template-code {
  padding: 2px 8px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 4px;
}

.template-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  margin: 0 0 20px;
  font-size: 12px;
}

.template-facts dt {
  color: var(--muted);
}

.template-facts dd {
  margin: 0;
  font-family: var(--mono);
  overflow-wrap: anywhere;
}

.template-preview {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.template-subject {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.template-subject .muted {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* The mail is authored for a white mail client, so the frame keeps a white
   ground even when the console is dark. Anything else misrepresents it.

   The height is set from the rendered letter once it loads; this is only the
   floor, so an empty or still loading frame does not collapse. Capping it here
   would put a long template behind its own scrollbar on a screen that has the
   room to show the whole thing. */
.template-frame {
  display: block;
  width: 100%;
  min-height: 360px;
  background: #ffffff;
  border: 0;
}

.template-plain {
  margin-top: 18px;
  font-size: 12px;
}

.template-plain summary {
  cursor: pointer;
  color: var(--muted);
}

.template-plain pre {
  margin: 10px 0 0;
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  background: var(--surface-2);
  border-radius: var(--radius);
}

/* The only warning in the console drawn on the page itself rather than inside
   a white card, and the ground it lands on is now a greige a shade off the
   caution greige. The outline is what keeps it a block instead of a smudge. */
.template-warning {
  margin: 0 0 16px;
  padding: 10px 14px;
  font-size: 12px;
  color: var(--warn);
  background: var(--warn-soft);
  border: 1px solid var(--warn);
  border-radius: var(--radius);
}

/* -------------------------------------------------------- template upload */

.template-upload {
  margin-top: 18px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.template-upload summary {
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.upload-form {
  display: grid;
  gap: 12px;
  max-width: 520px;
  margin-top: 14px;
}

.upload-form p {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
}

.upload-form label {
  display: grid;
  gap: 4px;
  font-size: 12px;
}

.upload-form label span {
  color: var(--muted);
}

.upload-form label em {
  font-style: normal;
  opacity: 0.75;
}

.upload-form input[type='file'] {
  font: inherit;
  font-size: 12px;
  color: var(--text);
}

.upload-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 4px;
}

.upload-form button {
  padding: 8px 16px;
  font: inherit;
  font-size: 13px;
  color: var(--on-accent);
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}

.upload-form button:disabled {
  cursor: progress;
  opacity: 0.6;
}

#uploadState {
  font-size: 12px;
}

#uploadState[data-state='bad'] {
  color: var(--bad);
}

#uploadState[data-state='ok'] {
  color: var(--ok);
}

/* ------------------------------------------------------------- manual close */

/* A <details>, not a button. The module has been contacting this customer on a
   schedule and this stops it, so one stray click on the lead detail should not
   be enough: the reason field has to be opened and filled first. */
.lead-close {
  margin: 0 0 16px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 13px;
}

.lead-close summary {
  cursor: pointer;
  font-weight: 600;
}

.lead-close p {
  margin: 8px 0 10px;
  font-size: 12px;
  line-height: 1.5;
}

.lead-close-label {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--muted);
}

.lead-close-choice {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.lead-close-choice label {
  display: flex;
  gap: 8px;
  align-items: baseline;
  cursor: pointer;
  font-size: 12px;
}

/* The two outcomes read differently on purpose: which one is chosen decides
   whether a salesperson is handed a customer or a lead is written off. */
.lead-close-choice em {
  color: var(--muted);
  font-style: normal;
}

/* Overrides the full width rule below, which is written for the reason box. */
.lead-close input[type="radio"] {
  width: auto;
  margin: 0;
}

.lead-close input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: inherit;
  font: inherit;
  font-size: 13px;
}

.lead-close-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
}

.danger {
  padding: 6px 14px;
  border: 1px solid var(--bad);
  border-radius: var(--radius);
  background: var(--bad-soft);
  color: var(--bad);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.danger:hover:not(:disabled) {
  background: var(--bad);
  color: var(--bg);
}

.danger:disabled {
  cursor: progress;
  opacity: 0.6;
}

.lead-close-state {
  font-size: 12px;
  color: var(--muted);
}

/* Only 'bad' is reachable: the outcome of a close goes to a toast, because the
   panel is hidden by the refresh that follows it. */
.lead-close-state[data-state='bad'] { color: var(--bad); }

/* ------------------------------------------------------- unmatched inbound */

.unmatched-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 900px;
}

.unmatched-item {
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--muted);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* Two causes, two colours. AMBIGUOUS is ours to fix — the sender is known and
   has several open leads. NO_MATCH is not: nobody in the system knows the
   address, and no rule will ever place it. */
.unmatched-item[data-reason='AMBIGUOUS'] { border-left-color: var(--warn); }
.unmatched-item[data-reason='NO_MATCH'] { border-left-color: var(--info); }

.unmatched-head {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: baseline;
  margin-bottom: 6px;
}

.unmatched-subject {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
}

.unmatched-body {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* A row that has been dealt with keeps its place in the 'all' list but stops
   asking for attention: the colour on the left says which queue it is in, and
   grey is the queue nobody has to work. */
.unmatched-item[data-resolution] { border-left-color: var(--border); }

.unmatched-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.unmatched-tabs button {
  padding: 4px 10px;
  font-size: 12px;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
}

.unmatched-tabs button[aria-current='true'] {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--accent);
}

.unmatched-body {
  max-height: 340px;
  overflow: auto;
}

.unmatched-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

.unmatched-actions .ghost {
  padding: 4px 10px;
  font-size: 12px;
}

.unmatched-resolved {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: center;
  font-size: 12px;
}

.unmatched-state {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.unmatched-state[data-state='bad'] { color: var(--bad); }

.unmatched-picker {
  margin-top: 10px;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.unmatched-search {
  width: 100%;
  max-width: 420px;
  padding: 6px 10px;
  font: inherit;
  font-size: 12px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.unmatched-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.unmatched-results p {
  margin: 0;
  font-size: 12px;
}

/* One row per candidate lead, and every fact needed to say "yes, that one":
   who it is, which address the lead carries — the message came from a
   different one, that is why it is here — and where the lead stands. */
.unmatched-choice {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: center;
  padding: 6px 10px;
  font: inherit;
  font-size: 12px;
  color: var(--text);
  text-align: left;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}

.unmatched-choice:hover:not(:disabled) { border-color: var(--accent); }
.unmatched-choice:disabled { opacity: 0.45; cursor: default; }

/* ------------------------------------------------------------- volania */

.calling {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.calling-card {
  padding: 16px 18px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.calling-card h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.calling-card > p.muted {
  margin: 0 0 12px;
  font-size: 13px;
}

.calling-now {
  margin: 8px 0 6px;
  font-size: 16px;
  font-weight: 600;
}

.calling-now.is-open { color: var(--ok); }
.calling-now.is-shut { color: var(--muted); }

.calling-warning {
  margin: 0 0 12px;
  padding: 9px 12px;
  background: var(--warn-soft);
  color: var(--warn);
  border-radius: var(--radius);
  font-size: 13px;
}

/* The top bar pill is a button, because it leads to the switch. It keeps the
   pill's look and loses the button's. */
.calls-pill {
  border: 0;
  cursor: pointer;
}

.calls-pill:hover {
  filter: brightness(0.96);
}

/* A phone has no room for four things in a row that will not wrap. The lamp in
   the brand already says whether the service answers, and the address is on
   the sign-in page, so those two give way; the telephone keeps its place and
   shortens rather than pushing everything off the edge. */
@media (max-width: 720px) {
  .session {
    min-width: 0;
    gap: 8px;
  }

  .session #serviceState,
  .session .user {
    display: none;
  }

  .calls-pill {
    max-width: 46vw;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

.calls-balance {
  margin: 0 0 4px;
  font-size: 14px;
}

.calls-balance strong {
  font-variant-numeric: tabular-nums;
}

.calls-switch {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}

.calls-switch h4 {
  margin: 0 0 4px;
  font-size: 14px;
}

.calls-switch > p {
  margin: 0 0 12px;
  font-size: 12px;
  line-height: 1.5;
}

.calls-switch input {
  width: 100%;
  max-width: 480px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  font-size: 13px;
}

/* The day, drawn once. The bar is the working window, the pins are the two
   hours the plan actually dials at. */
.day-bar-wrap {
  margin: 6px 0 18px;
}

/* Auto sized columns, so the number of hours the script draws is the number of
   columns without the count being written down twice. */
.day-bar,
.day-bar-scale {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
}

.day-bar {
  height: 20px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.day-bar-hour {
  border-right: 1px solid var(--border);
}

.day-bar-hour:last-child {
  border-right: 0;
}

.day-bar-hour.is-open {
  background: var(--accent-soft);
}

.day-bar-hour.is-call {
  background: var(--accent);
}

.day-bar-scale {
  margin-top: 5px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

.day-bar-scale .is-call {
  color: var(--accent);
  font-weight: 700;
}

/* The same three fills the bar uses, so the key cannot drift from the picture
   it explains: change a colour above and the swatches follow. */
.day-bar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
}

.day-bar-key {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.day-bar-key i {
  width: 12px;
  height: 12px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface-2);
}

.day-bar-key i.is-open {
  background: var(--accent-soft);
}

.day-bar-key i.is-call {
  background: var(--accent);
}

.calling-plan {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.calling-plan li {
  display: grid;
  grid-template-columns: 60px 160px 1fr;
  gap: 10px;
  align-items: baseline;
  padding: 7px 0;
  border-top: 1px solid var(--border);
  font-size: 13px;
}

.calling-hour {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--accent);
}

.calling-step { font-weight: 600; }

/* Four weeks at a glance. Every cell says what kind of day it is, so "why is
   nobody being called on Friday" is answered by looking rather than asking. */
.day-strip {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  gap: 4px;
  margin: 4px 0 12px;
}

.day-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 6px 2px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
}

.day-cell.is-work {
  background: var(--ok-soft);
  border-color: var(--ok);
}

.day-cell.is-weekend {
  background: var(--surface-2);
  color: var(--muted);
}

.day-cell.is-holiday {
  background: var(--info-soft);
  border-color: var(--info);
  color: var(--info);
}

.day-name {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.75;
}

.day-num {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
}

.day-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12px;
  color: var(--muted);
}

.day-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.day-legend-item i {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.day-legend-item i.is-work { background: var(--ok-soft); border-color: var(--ok); }
.day-legend-item i.is-holiday { background: var(--info-soft); border-color: var(--info); }

.holiday-year { margin-bottom: 12px; }

.holiday-year h4 {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--muted);
  font-family: var(--mono);
}

.holiday-days {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.holiday-day {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 3px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
}

.holiday-date {
  font-family: var(--mono);
  color: var(--muted);
  white-space: nowrap;
}

.calling-queue {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.calling-queue th {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-weight: 600;
}

.calling-queue td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
}

.calling-queue tbody tr {
  cursor: pointer;
}

.calling-queue tbody tr:hover {
  background: var(--surface-2);
}

@media (max-width: 720px) {
  .day-strip { grid-template-columns: repeat(7, 1fr); }
  .calling-plan li { grid-template-columns: 56px 1fr; }
  .calling-plan li .muted { grid-column: 1 / -1; }
}

/* ------------------------------------------------------------- prehľad */

/* The overview by channel: a column like the call plan, because it is read
   as a page rather than scanned as a table. The colours are the console's own
   three: sage for what reaches a salesperson, blue-grey for the rest that has
   a verdict, greige for what has none yet. */

.report,
#reportView > .flow-head {
  max-width: 980px;
  margin-inline: auto;
}

.report {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.report-periods {
  flex-basis: 100%;
  margin-top: 4px;
}

.report-stamp {
  flex-basis: 100%;
  margin: 0;
  font-size: 12px;
}

.report-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.report-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 0;
}

.report-tile.is-lead {
  border-color: var(--accent);
  box-shadow: inset 0 3px 0 var(--accent), var(--shadow);
}

.report-tile-label {
  font-size: 12px;
  color: var(--muted);
}

.report-tile-value {
  font-size: 26px;
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.report-tile-note {
  font-size: 12px;
  color: var(--muted);
}

.report-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--muted);
}

.report-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.report-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.report-outcome {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.report-orow {
  display: grid;
  grid-template-columns: minmax(120px, 180px) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.report-olabel {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  min-width: 0;
}

.report-olabel .muted {
  font-size: 12px;
}

.report-obar {
  display: flex;
  height: 28px;
  border-radius: 6px;
  overflow: hidden;
}

.report-part {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--text);
  cursor: default;
}

.outcome-new { background: var(--accent); color: var(--on-accent); }
.outcome-known { background: var(--accent-soft); }
.outcome-two { background: var(--info-soft); color: var(--info); }
.outcome-one { background: var(--warn-soft); color: var(--warn); }
.outcome-running {
  background: repeating-linear-gradient(135deg, var(--border) 0 4px, var(--surface-2) 4px 8px);
}
.outcome-error { background: var(--bad-soft); color: var(--bad); }
.outcome-closed { background: var(--border); color: var(--muted); }

.report-table-wrap {
  overflow-x: auto;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.report-table th {
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-align: right;
  vertical-align: bottom;
  border-bottom: 1px solid var(--border);
}

.report-table td {
  padding: 6px 8px;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid var(--surface-2);
}

.report-table th:first-child,
.report-table td:first-child {
  text-align: left;
}

.report-table tr.is-total td {
  font-weight: 600;
  border-top: 1px solid var(--border);
  border-bottom: none;
}

.report-cellbar {
  display: inline-block;
  height: 6px;
  margin-right: 6px;
  vertical-align: middle;
  border-radius: 3px;
  background: var(--accent);
}

.report-chart {
  display: block;
  width: 100%;
  height: auto;
}

.report-chart text {
  fill: var(--muted);
  font-size: 12px;
}

.report-chart text.is-strong {
  fill: var(--text);
}

.report-grid { stroke: var(--surface-2); stroke-width: 1; }
.report-reference { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 3; }
.report-band { stroke: var(--accent-soft); stroke-width: 10; stroke-linecap: round; }
.report-dot { fill: var(--accent); }

/* A channel keeps its shade across the periods (renderReport), so the
   legend and the bars agree wherever they appear. */
/* Red last: it is the console's colour for a fault, and a channel is not one. */
.report-source-0 { fill: var(--accent); background: var(--accent); }
.report-source-1 { fill: var(--info); background: var(--info); }
.report-source-2 { fill: #a3b394; background: #a3b394; }
.report-source-3 { fill: var(--warn); background: var(--warn); }
.report-source-4 { fill: #8a9bab; background: #8a9bab; }
.report-source-5 { fill: var(--bad); background: var(--bad); }
.report-source-other { fill: var(--border); background: var(--border); }

.report-definitions {
  display: grid;
  grid-template-columns: minmax(140px, 200px) minmax(0, 1fr);
  gap: 6px 16px;
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

.report-definitions dt {
  font-weight: 600;
}

.report-definitions dd {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 640px) {
  .report-orow,
  .report-definitions {
    grid-template-columns: minmax(0, 1fr);
  }
}
