/* The statistics page, /admin. Colors of the marks were checked with the
   dataviz palette validator against these card surfaces (docs/admin.md). */

/* Heebo for Latin and Hebrew; Russian uses Roboto's Cyrillic under the same name (as in app.css). */
@font-face {
  font-family: Heebo;
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/roboto-cyrillic-wght-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: Heebo;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/heebo-hebrew-400-normal.woff2") format("woff2");
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}
@font-face {
  font-family: Heebo;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/heebo-hebrew-600-normal.woff2") format("woff2");
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}
@font-face {
  font-family: Heebo;
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/heebo-hebrew-700-normal.woff2") format("woff2");
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}
@font-face {
  font-family: Heebo;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/heebo-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: Heebo;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/heebo-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: Heebo;
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/heebo-latin-700-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  --page: #f7f9fc;
  --card: #ffffff;
  --raised: #ffffff;
  --border: #dde3ea;
  --text: #1b2430;
  --text-2: #55616f;
  --muted: #66727f;
  --grid: #e8ecf1;
  --axis: #b9c3ce;
  --primary: #1565c0;
  --on-primary: #ffffff;
  --link: #1565c0;
  --chip: #eef2f7;
  --wash: rgba(21, 101, 192, 0.07);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.06);
  --tip-shadow: 0 8px 24px rgba(16, 24, 40, 0.16);
  /* Series: Claude, Vision, and Not read stack in this order (validated as adjacent pairs). */
  --claude: #eb6834;
  --vision: #2a78d6;
  --not-read: #d03b3b;
  --speech: #6250d6;
  /* Status, fixed in both modes; always with a label. */
  --status-good: #0ca30c;
  --status-warning: #fab219;
  --status-critical: #d03b3b;
  --status-none: #9aa5b1;
  /* Words of a warning, of a loss and of a success, readable on the cards. */
  --warning-text: #9a5200;
  --good-text: #0a7a0a;
  --bad-text: #b42318;
  --bad-wash: rgba(180, 35, 24, 0.08);
  --good-wash: rgba(10, 122, 10, 0.1);
  --switch-off: #a9b4c0;
  font-family: Heebo, system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #121820;
    --card: #1b2430;
    --raised: #243140;
    --border: #2e3a48;
    --text: #e8eef6;
    --text-2: #b7c1cd;
    --muted: #93a0b0;
    --grid: #2a3544;
    --axis: #4a5869;
    --link: #90caf9;
    --chip: #243140;
    --wash: rgba(144, 202, 249, 0.08);
    --shadow: none;
    --tip-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    --claude: #d95926;
    --vision: #3987e5;
    --not-read: #d03b3b;
    --speech: #9085e9;
    --status-none: #6b7888;
    --warning-text: #f1b345;
    --good-text: #5fd35f;
    --bad-text: #f28b82;
    --bad-wash: rgba(242, 139, 130, 0.12);
    --good-wash: rgba(95, 211, 95, 0.13);
    --switch-off: #56657a;
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
}

button { font-family: inherit; cursor: pointer; }

a { color: var(--link); }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ------------------------------------------------------------ top */

.top {
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.top-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  flex: none;
  width: 36px;
  height: 36px;
  display: block;
  text-decoration: none;
}

.brand-mark img {
  width: 36px;
  height: 36px;
  display: block;
}

.top-title { min-width: 0; flex: 1; }

.top-title h1 {
  margin: 0;
  font-size: 20px;
  line-height: 26px;
  font-weight: 700;
}

.top-title p {
  margin: 0;
  color: var(--text-2);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-link {
  flex: none;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 8px;
}

.top-link:hover { background: var(--wash); }

/* ------------------------------------------------------------ layout */

.main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px 16px 48px;
}

/* Every block of the page stands 16px from the next. */
.dashboard {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* A new period or a refresh keeps the old numbers on screen, dimmed, until the new ones arrive. */
.dashboard .tiles,
.dashboard .card { transition: opacity 0.15s; }

.dashboard.is-loading .tiles,
.dashboard.is-loading .card { opacity: 0.55; }

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: 16px;
}

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

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 10px;
  background: var(--chip);
  border: 1px solid var(--border);
}

.segmented button {
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 7px;
  min-height: 34px;
}

.segmented button:hover { color: var(--text); }

.segmented button[aria-checked="true"] {
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow);
}

@media (prefers-color-scheme: dark) {
  .segmented button[aria-checked="true"] { background: #33414f; }
}

.period {
  margin: 0;
  color: var(--text-2);
  font-size: 14px;
}

.filters-end {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.button-quiet {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  min-height: 34px;
}

.button-quiet:hover { background: var(--wash); }

.button-quiet:disabled { color: var(--muted); cursor: default; }

.load-error {
  margin: 0;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(208, 59, 59, 0.1);
  color: var(--text);
  border: 1px solid rgba(208, 59, 59, 0.35);
  font-size: 14px;
}

/* ------------------------------------------------------------ tiles */

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

@media (min-width: 760px) {
  .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
}

.tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 14px 16px;
  min-width: 0;
}

.tile-label {
  margin: 0;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
}

.tile-value {
  margin: 4px 0 2px;
  font-size: 28px;
  line-height: 34px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile-detail {
  margin: 0;
  color: var(--text-2);
  font-size: 13px;
  line-height: 18px;
}

.tile-detail .part { white-space: nowrap; }

.tile-detail .key {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  margin-inline-end: 4px;
  vertical-align: 0;
}

/* ------------------------------------------------------------ cards */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 16px;
  min-width: 0;
}

.card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.card-titles { flex: 1; min-width: 0; }

.card h2 {
  margin: 0;
  font-size: 16px;
  line-height: 22px;
  font-weight: 700;
}

.card-sub {
  margin: 2px 0 0;
  color: var(--text-2);
  font-size: 13px;
}

.view-toggle {
  flex: none;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 8px;
}

.view-toggle:hover { background: var(--wash); color: var(--text); }

.view-toggle[aria-pressed="true"] { color: var(--text); background: var(--chip); }

/* ------------------------------------------------------------ legend */

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
  color: var(--text-2);
  font-size: 13px;
}

.legend li { display: inline-flex; align-items: center; gap: 6px; }

.swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex: none;
}

.legend .count { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ column charts */

/* Time runs left to right in the charts in every language, as on a Hebrew business report. */
.chart {
  position: relative;
  width: 100%;
  direction: ltr;
}

.chart svg { display: block; width: 100%; overflow: visible; }

.chart svg:focus { outline: none; }

.chart svg:focus-visible { outline: 2px solid var(--primary); outline-offset: 4px; border-radius: 4px; }

.chart .grid-line { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }

.chart .base-line { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }

.chart .tick {
  fill: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.chart .x-label {
  fill: var(--muted);
  font-size: 11px;
}

.chart .column { transition: opacity 0.12s; }

.chart.is-hovering .column { opacity: 0.4; }

.chart.is-hovering .column.is-active { opacity: 1; }

.chart .hit { fill: transparent; cursor: default; }

.chart .hover-band { fill: var(--wash); }

.chart-empty {
  position: absolute;
  inset: 0 0 26px 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  pointer-events: none;
}

/* ------------------------------------------------------------ tooltip */

.tip {
  position: absolute;
  text-align: start;
  z-index: 5;
  min-width: 150px;
  max-width: 240px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--raised);
  border: 1px solid var(--border);
  box-shadow: var(--tip-shadow);
  pointer-events: none;
  font-size: 13px;
  line-height: 18px;
}

.tip-title { margin: 0 0 6px; color: var(--text-2); font-weight: 600; }

.tip-row { display: flex; align-items: center; gap: 8px; }

.tip-row + .tip-row { margin-top: 3px; }

.tip-key { width: 12px; height: 3px; border-radius: 2px; flex: none; }

.tip-value { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); min-width: 2ch; }

.tip-name { color: var(--text-2); }

.tip-total { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); }

/* ------------------------------------------------------------ bar lists */

.bars {
  list-style: none;
  margin: 0;
  padding: 0;
}

.bar-item { padding: 6px 0; border-radius: 8px; }

.bar-item + .bar-item { margin-top: 2px; }

.bar-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  color: var(--text);
}

.bar-share { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }

.bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  min-height: 16px;
}

.bar-fill {
  height: 12px;
  min-width: 2px;
  border-start-end-radius: 4px;
  border-end-end-radius: 4px;
  flex: none;
}

.bar-value {
  font-weight: 600;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.bar-item.is-zero .bar-label { color: var(--muted); }

.bars-empty {
  margin: 8px 0 4px;
  color: var(--muted);
  font-size: 14px;
}

/* ------------------------------------------------------------ tables */

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -16px;
  padding: 0 16px;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
}

th, td {
  padding: 8px 10px;
  text-align: start;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  background: var(--card);
}

td.num, th.num { text-align: end; font-variant-numeric: tabular-nums; }

tbody tr:hover td { background: var(--wash); }

tbody tr:last-child td { border-bottom: 0; }

.sticky-col {
  position: sticky;
  inset-inline-start: 0;
  z-index: 1;
  background: var(--card);
}

tbody tr:hover td.sticky-col { background: var(--card); box-shadow: inset 0 0 0 999px var(--wash); }

/* A sticky column stays over the side padding of its scrolling table too, so no scrolled number shows beside it. */
.table-wrap .sticky-col { inset-inline-start: -16px; }

.muted { color: var(--muted); }

.badge {
  display: inline-block;
  margin-inline-start: 6px;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: var(--chip);
  color: var(--text-2);
  vertical-align: 1px;
}

.result {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}

.dot.is-status { border-radius: 2px; transform: rotate(45deg); }

.table-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

/* ------------------------------------------------------------ facts line */

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 24px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
  color: var(--text-2);
}

.facts strong { color: var(--text); font-variant-numeric: tabular-nums; }

.blocked { margin-top: 12px; }

/* ------------------------------------------------------------ gate */

.gate {
  max-width: 440px;
  margin: 48px auto;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 24px;
  box-shadow: var(--shadow);
}

.gate h2 { margin: 0 0 8px; font-size: 20px; }

.gate p { margin: 0 0 20px; color: var(--text-2); }

.button {
  display: inline-block;
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 600;
  text-decoration: none;
  padding: 10px 18px;
  border-radius: 10px;
}

.loading-note { color: var(--muted); text-align: center; margin: 48px 0; }

button.button { border: 0; font-size: 15px; min-height: 44px; }

button.button:disabled { opacity: 0.6; cursor: default; }

/* ------------------------------------------------------------ tabs */

.tabs {
  display: flex;
  gap: 4px;
  margin: 0 0 16px;
  border-bottom: 1px solid var(--border);
}

.tabs button {
  border: 0;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  background: transparent;
  color: var(--text-2);
  font-size: 15px;
  font-weight: 600;
  padding: 10px 14px;
  min-height: 44px;
}

.tabs button:hover { color: var(--text); }

.tabs button[aria-selected="true"] {
  color: var(--text);
  border-bottom-color: var(--primary);
}

/* ------------------------------------------------------------ payments (docs/admin.md#payments) */

.pay-form { display: contents; }

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.check-row input,
.radio-row input {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--primary);
}

.choice {
  margin: 8px 0 0;
  padding: 0;
  border: 0;
}

.choice legend {
  padding: 0;
  margin-bottom: 4px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
}

.radio-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  cursor: pointer;
}

.radio-row input { margin-top: 1px; }

.radio-text { color: var(--text-2); }

.radio-text strong { color: var(--text); }

.pay-facts { margin-top: 12px; }

.is-warning { color: var(--warning-text); }

.facts li.is-warning,
.facts li.is-warning strong { color: var(--warning-text); }

.is-ok { color: var(--good-text); }

.field {
  display: grid;
  gap: 4px;
  margin-top: 12px;
}

.field > span,
.field > label {
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
}

.field input {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.field-note {
  color: var(--muted);
  font-size: 12px;
}

.field-note.is-warning { color: var(--warning-text); }

.field-short { max-width: 280px; }

.terminal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.button-danger { color: var(--status-critical); }

.check-result {
  display: grid;
  gap: 4px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
  overflow-wrap: anywhere;
}

/* The plans: a card each, closed to one line of what readers get, opened to edit. */

.plan-rows {
  display: grid;
  gap: 10px;
}

.plan-row {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.plan-row.is-open { box-shadow: var(--shadow); }

.plan-row.is-invalid { border-color: var(--status-critical); }

.plan-row-head {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  padding: 12px 16px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: start;
}

.plan-row-head:hover { background: var(--wash); }

.plan-row.is-open .plan-row-head { border-radius: 12px 12px 0 0; }

.plan-row-head:focus-visible { outline-offset: -2px; }

.plan-row-main {
  display: grid;
  flex: 1;
  gap: 2px;
  min-width: 0;
}

.plan-row-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 22px;
  overflow-wrap: anywhere;
}

.plan-row-sub {
  color: var(--text-2);
  font-size: 13px;
}

.plan-row-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.plan-row-price {
  flex: none;
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.plan-row-old {
  margin-inline-end: 2px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
}

.plan-row.is-off .plan-row-title,
.plan-row.is-off .plan-row-price { color: var(--muted); }

.plan-row-chevron {
  flex: none;
  width: 9px;
  height: 9px;
  margin: -4px 4px 0;
  border-right: 2px solid var(--text-2);
  border-bottom: 2px solid var(--text-2);
  transform: rotate(45deg);
  transition: transform 0.15s;
}

.plan-row-head[aria-expanded="true"] .plan-row-chevron {
  margin-top: 4px;
  transform: rotate(-135deg);
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--chip);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  line-height: 18px;
  white-space: nowrap;
}

.chip-new,
.chip-later { background: var(--wash); color: var(--link); }

.chip-sale { background: var(--good-wash); color: var(--good-text); }

.chip-once { background: var(--chip); color: var(--text); }

.plan-type { margin-bottom: 2px; }

.plan-type-note { margin: 6px 0 0; }

.chip-off { color: var(--muted); }

.plan-row-body {
  padding: 2px 16px 16px;
  border-top: 1px solid var(--border);
}

.plan-block { margin-top: 14px; }

.plan-block-title {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.plan-names {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.plan-numbers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 220px));
  gap: 12px;
}

.plan-discount-grid {
  display: grid;
  grid-template-columns: minmax(0, 140px) repeat(2, minmax(0, 190px));
  gap: 12px;
}

.plan-numbers .field,
.plan-discount-grid .field { margin-top: 0; }

/* A field with a mark inside its box: the language of a name, ₪, %. */
.adorned {
  display: flex;
  align-items: stretch;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  overflow: hidden;
}

.field > .adorned {
  color: var(--text);
  font-size: 15px;
  font-weight: 400;
}

.adorned:focus-within {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.adorned input {
  flex: 1;
  min-width: 0;
  min-height: 0;
  padding: 8px 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.adorned input:focus-visible { outline: none; }

.adorn {
  display: flex;
  flex: none;
  align-items: center;
  padding: 0 10px;
  background: var(--chip);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 700;
}

.adorn:first-child { border-inline-end: 1px solid var(--border); }

.adorn:last-child { border-inline-start: 1px solid var(--border); }

.field input.is-invalid,
.adorned.is-invalid {
  border-color: var(--status-critical);
  box-shadow: 0 0 0 1px var(--status-critical);
}

/* A switch: a checkbox drawn as a track and a knob. */
.switch-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 16px;
  cursor: pointer;
}

.switch {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: none;
  width: 40px;
  height: 24px;
  margin: 0;
  border-radius: 12px;
  background: var(--switch-off);
  cursor: pointer;
  transition: background-color 0.15s;
}

.switch::before {
  content: "";
  position: absolute;
  top: 3px;
  inset-inline-start: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.3);
  transition: transform 0.15s;
}

.switch:checked { background: var(--primary); }

.switch:checked::before { transform: translateX(16px); }

[dir="rtl"] .switch:checked::before { transform: translateX(-16px); }

.switch-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.switch-text strong { font-size: 15px; }

.switch-text small {
  color: var(--text-2);
  font-size: 13px;
}

.plan-discount-fields {
  margin: 12px 0 0;
  padding-inline-start: 52px;
}

.plan-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  color: var(--text-2);
  font-size: 13px;
}

.chip-button {
  min-height: 30px;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.chip-button:hover { background: var(--wash); }

.plan-row-note {
  margin: 10px 0 0;
  color: var(--text-2);
  font-size: 14px;
}

.plan-row-note:empty { display: none; }

.plan-row-note.is-good { color: var(--good-text); }

.plan-row-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.plan-add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  margin-top: 10px;
  border: 1.5px dashed var(--axis);
  border-radius: 12px;
  background: transparent;
  color: var(--link);
  font-size: 15px;
  font-weight: 600;
}

.plan-add:hover {
  border-color: var(--primary);
  background: var(--wash);
}

.plan-add-plus {
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
}

.plan-limit {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.plan-limit .field { margin-top: 0; }

.plan-limit .field-note { margin: 6px 0 0; }

@media (max-width: 640px) {
  .plan-row-head {
    flex-wrap: wrap;
    gap: 6px 10px;
    padding: 12px 14px;
  }

  .plan-row-chips {
    order: 3;
    flex-basis: 100%;
    justify-content: flex-start;
  }

  .plan-row-body { padding: 2px 14px 14px; }

  .plan-names,
  .plan-numbers,
  .plan-discount-grid { grid-template-columns: minmax(0, 1fr); }

  .plan-discount-fields { padding-inline-start: 0; }
}

@media (forced-colors: active) {
  .switch { border: 1px solid CanvasText; }
  .switch::before { background: CanvasText; }
  .switch:checked { background: Highlight; }
}

.pay-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.pay-saved {
  margin: 0;
  color: var(--text-2);
  font-size: 14px;
}

.pay-saved.is-warning { color: var(--warning-text); }

@media (max-width: 520px) {
  .top-link { padding: 8px; font-size: 13px; }
  .filters-end { margin-inline-start: 0; width: 100%; justify-content: space-between; }
  .tile { padding: 12px; }
  .tile-value { font-size: 24px; line-height: 30px; }
  .card { padding: 14px; border-radius: 12px; }
  .table-wrap { margin: 0 -14px; padding: 0 14px; }
  .table-wrap .sticky-col { inset-inline-start: -14px; }
}

@media (prefers-reduced-motion: reduce) {
  .dashboard .tiles, .dashboard .card, .chart .column { transition: none; }
}

@media (forced-colors: active) {
  .bar-fill, .swatch, .dot, .tip-key { forced-color-adjust: none; }
}

/* ------------------------------------------------------------ credits (docs/admin.md#credits) */

.grant-account-field { max-width: 480px; }

/* The account field and its own list of accounts under it: the same on a phone as on a computer, not the suggestions of
   the browser or of the keyboard. */
.combo { position: relative; }

/* The field and its ×, left to right like the email in it, also in Hebrew. */
.combo-field { position: relative; }

.combo-field input { padding-inline-end: 44px; }

.combo-clear {
  position: absolute;
  inset-inline-end: 4px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.combo-clear:hover { background: var(--wash); color: var(--text); }

.combo-clear:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

.combo-list {
  position: absolute;
  inset-inline: 0;
  top: calc(100% + 4px);
  z-index: 5;
  max-height: 232px;
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--tip-shadow);
}

.combo-item {
  display: grid;
  gap: 1px;
  min-height: 44px;
  align-content: center;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.combo-item:hover,
.combo-item[aria-selected="true"] { background: var(--wash); }

.combo-item.is-current .combo-email { font-weight: 700; }

.combo-email {
  color: var(--text);
  font-size: 15px;
  overflow-wrap: anywhere;
}

.combo-balance {
  color: var(--muted);
  font-size: 12px;
}

.combo-empty {
  padding: 10px;
  color: var(--muted);
  font-size: 14px;
}

.grant-fields {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
  align-items: start;
  gap: 0 16px;
  max-width: 760px;
}

.grant-actions { margin-top: 16px; }

/* The title of the history keeps its room; Only this account goes under it when the card is narrow. */
.grants-head { flex-wrap: wrap; }

.grants-head .card-titles { flex: 1 1 220px; }

.grants-only {
  flex: none;
  min-height: 32px;
  font-size: 14px;
}

.grants-more { margin-top: 12px; }

td.grant-why {
  white-space: normal;
  min-width: 180px;
  max-width: 360px;
  overflow-wrap: anywhere;
}

/* + by an account on Statistics: the Credits tab with that account. */
.row-give {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-inline-start: 8px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--card);
  color: var(--link);
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
  cursor: pointer;
}

.row-give:hover { background: var(--wash); }

.row-give:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

@media (max-width: 640px) {
  .grant-fields { grid-template-columns: minmax(0, 1fr); }
}

/* A phone: Back to the reader takes two lines rather than the room of the title. The four tabs share the width, closer;
   where they need more room than the screen (Russian under 353 px), they scroll sideways rather than wrap, and the
   chosen one is kept in sight (keepTabInView in admin.js). */
@media (max-width: 520px) {
  .top-link { max-width: 8em; text-align: end; line-height: 1.25; }
  .tabs { gap: 0; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { flex: 1 0 auto; padding: 10px 6px; font-size: 14px; }
}

@media (max-width: 380px) {
  .tabs button { font-size: 13px; }
}

/* ------------------------------------------------------------ customers (docs/admin.md#customers) */

.economics-prices {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
  color: var(--text-2);
  font-size: 14px;
  line-height: 20px;
}

.economics-line.is-warning { color: var(--warning-text); }

.economics-line.is-alarm {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(208, 59, 59, 0.08);
  color: var(--text);
}

.economics-alarm { color: var(--bad-text); }

.economics-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 13rem));
  gap: 12px;
  align-items: start;
}

/* The switch under a field: the number comes from the Bank of Israel, or from the invoice of ElevenLabs. */
.economics-auto {
  min-height: 32px;
  font-size: 14px;
  font-weight: 500;
}

.field .economics-auto input {
  width: 18px;
  height: 18px;
  min-height: 0;
  padding: 0;
  border: 0;
}

.field input:disabled {
  background: var(--chip);
  color: var(--text-2);
  cursor: default;
}

@media (max-width: 960px) {
  .economics-fields { grid-template-columns: repeat(2, minmax(0, 16rem)); }
}

.customers-head {
  flex-wrap: wrap;
  gap: 8px 16px;
}

.customers-search {
  min-height: 38px;
  min-width: 0;
  width: 16rem;
  max-width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.customers-table td { vertical-align: top; }

.customers-table .cell-main {
  display: block;
  font-weight: 600;
}

.customers-table .cell-sub {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 16px;
}

.customers-table tr.customers-total td {
  background: var(--chip);
  border-bottom: 2px solid var(--border);
}

.customers-table th button.sort {
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.customers-table th button.sort:hover { color: var(--text); }

.customers-table .sort-mark { font-size: 10px; }

.customers-result.is-gain .cell-main { color: var(--good-text); }

.customers-result.is-loss .cell-main { color: var(--bad-text); }

.customers-result.is-even .cell-main { color: var(--text-2); }

@media (max-width: 640px) {
  .economics-fields { grid-template-columns: minmax(0, 1fr); }
  .customers-search { width: 100%; }
  /* The email wraps inside a narrow first column (after its @ first), so the numbers stay in sight beside it while the
     table scrolls. */
  .customers-table .customers-who .cell-main,
  .customers-table .customers-who .cell-sub { width: 10.5em; white-space: normal; overflow-wrap: break-word; }
  .customers-table .customers-who .badge { white-space: nowrap; }
}

/* ------------------------------------------------------------ tests (docs/admin.md#tests) */

.tests-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.tests-actions .pay-saved { margin: 0; }

.tests-run { margin-top: 16px; }

.tests-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 16px;
}

.tests-title-run { margin: 0; font-weight: 600; }

.tests-counts {
  margin: 0;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.tests-bar {
  position: relative;
  height: 8px;
  margin: 10px 0 6px;
  border-radius: 4px;
  background: var(--chip);
  overflow: hidden;
}

.tests-bar span {
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 0;
  border-radius: 4px;
  background: var(--primary);
  transition: width 0.3s;
}

.tests-bar.is-passed span { background: var(--status-good); }

.tests-bar.is-failing span,
.tests-bar.is-failed span { background: var(--status-critical); }

.tests-current {
  min-height: 1.3em;
  margin: 0;
  overflow-wrap: anywhere;
}

.tests-result {
  margin: 8px 0;
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 600;
}

.tests-result.is-passed { background: var(--good-wash); color: var(--good-text); }

.tests-result.is-failed { background: var(--bad-wash); color: var(--bad-text); }

.tests-result.is-stopped { background: var(--chip); color: var(--warning-text); }

.tests-bar.is-stopped span { background: var(--status-none); }

.tests-only { margin-top: 4px; }

.tests-log {
  max-height: 60vh;
  margin: 6px 0 0;
  padding: 8px 0;
  overflow: auto;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--page);
  font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.tests-log:empty { display: none; }

.tests-log li {
  padding: 1px 12px;
  color: var(--text-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.tests-log .tests-mark {
  display: inline-block;
  width: 1.5em;
  font-weight: 700;
}

.tests-log .is-ok-line .tests-mark { color: var(--good-text); }

.tests-log .is-fail-line {
  background: var(--bad-wash);
  color: var(--bad-text);
  font-weight: 600;
}

.tests-log .is-summary-line { margin-top: 6px; color: var(--text); font-weight: 700; }

.tests-log .is-recap-line { color: var(--bad-text); }

.tests-log.only-failures .is-ok-line { display: none; }

.tests-run-row { cursor: pointer; }

.tests-run-row.is-shown td { background: var(--wash); }

.tests-run-row:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }

.tests-status.is-passed { color: var(--good-text); font-weight: 600; }

.tests-status.is-failed,
.tests-status.is-broken { color: var(--bad-text); font-weight: 600; }

.tests-status.is-running { color: var(--link); }

.tests-status.is-stopped { color: var(--warning-text); }
