/* Coin Derby owner dashboard. A dark admin layout: top bar, a sticky section menu, slate cards,
   stat strips and compact tables. Every color is a token, so the light theme (sun button) only
   swaps the values below. Chart colors were checked for color-blind separation and 3:1 contrast
   on their card color in each theme. */

/* Manrope (variable, weights 200-800), served from /fonts (SIL Open Font License, fonts/OFL.txt;
   from @fontsource-variable/manrope 5.3.0). The browser fetches only the subsets a page uses. */
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 200 800; font-display: swap; src: url("/fonts/manrope-cyrillic-ext-wght-normal.woff2") format("woff2"); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 200 800; font-display: swap; src: url("/fonts/manrope-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: "Manrope"; font-style: normal; font-weight: 200 800; font-display: swap; src: url("/fonts/manrope-greek-wght-normal.woff2") format("woff2"); unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF; }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 200 800; font-display: swap; src: url("/fonts/manrope-vietnamese-wght-normal.woff2") format("woff2"); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 200 800; font-display: swap; src: url("/fonts/manrope-latin-ext-wght-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 200 800; font-display: swap; src: url("/fonts/manrope-latin-wght-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, 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: dark;
  --page: #1f2127;
  --surface: #252730;
  --surface-2: #2d303b;
  --ink: #e2e3ec;
  --ink-2: #a8abb8;
  --muted: #8d909e;
  --line: #343745;
  --line-strong: #4a4c55;
  --grid: #323543;
  --axis: #4a4c55;
  --brand: #5b7cf8;
  --primary: #3a61f6;
  --primary-hover: #4d70f7;
  --series-1: #5b7cf8;
  --series-2: #d9773f;
  --good: #34b1aa;
  --good-fill: #17837d;
  --critical: #f95f53;
  --count: #d63b30;
  --dep-bg: rgba(91, 124, 248, 0.16);
  --dep-ink: #aebfff;
  --wd-bg: rgba(217, 119, 63, 0.18);
  --wd-ink: #f3b78f;
  --ok-bg: rgba(52, 177, 170, 0.16);
  --ok-ink: #72d8d1;
  --no-bg: rgba(249, 95, 83, 0.15);
  --no-ink: #ff978f;
  --av-0: #5b7cf8;
  --av-1: #d9773f;
  --av-2: #34b1aa;
  --av-3: #b57cf0;
  --av-4: #e4b43c;
  --menu-shadow: 0 19px 34px -15px rgba(8, 8, 18, 0.75);
  --tip-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  --focus: #8ba3ff;
  --map-0: #343745;
  --map-1: #184f95;
  --map-2: #2a78d6;
  --map-3: #5598e7;
  --map-4: #9ec5f4;
  --map-line: #252730;
}
:root[data-theme="light"] {
  color-scheme: light;
  --page: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f1f2f5;
  --ink: #1f2027;
  --ink-2: #4b4f5c;
  --muted: #676c7c;
  --line: #e7e9ee;
  --line-strong: #d4d7df;
  --grid: #eceef2;
  --axis: #c6c9d2;
  --brand: #3a61f6;
  --primary: #3a61f6;
  --primary-hover: #2f55e8;
  --series-1: #3a61f6;
  --series-2: #e06a2c;
  --good: #0f7f79;
  --good-fill: #17837d;
  --critical: #d23a2f;
  --count: #d63b30;
  --dep-bg: rgba(58, 97, 246, 0.1);
  --dep-ink: #2846c9;
  --wd-bg: rgba(224, 106, 44, 0.12);
  --wd-ink: #a1431a;
  --ok-bg: rgba(15, 127, 121, 0.1);
  --ok-ink: #0b6b66;
  --no-bg: rgba(210, 58, 47, 0.1);
  --no-ink: #b3261e;
  --menu-shadow: 0 12px 24px -16px rgba(31, 33, 39, 0.28);
  --tip-shadow: 0 10px 28px rgba(31, 33, 39, 0.16);
  --focus: #3a61f6;
  --map-0: #eceef2;
  --map-1: #cde2fb;
  --map-2: #86b6ef;
  --map-3: #3987e5;
  --map-4: #1c5cab;
  --map-line: #ffffff;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink-2);
  font: 14px/1.5 "Manrope", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2 { margin: 0; color: var(--ink); }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.coin { width: 28px; height: 28px; flex: none; }
.error { margin: 0; color: var(--critical); font-size: 13px; }
.error:empty { display: none; }
.small { color: var(--muted); font-size: 12px; }
.nowrap { white-space: nowrap; }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 15px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { border-color: var(--muted); color: var(--ink); }
.btn .i { width: 16px; height: 16px; }
.btn-primary { border-color: var(--primary); background: var(--primary); color: #fff; }
.btn-primary:hover { border-color: var(--primary-hover); background: var(--primary-hover); color: #fff; }
.btn:disabled { opacity: 0.5; cursor: default; }
.icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn .i { width: 20px; height: 20px; }
.dot { position: absolute; top: 8px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--count); box-shadow: 0 0 0 2px var(--page); }

/* a button waiting for the server (admin-ui.js busy()): a small ring turning in the text's color
   and short words ("Saving..."); where motion is turned down the ring stays still and fades */
.spinner {
  display: inline-block;
  flex: none;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -2px;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 1; } to { opacity: 0.3; } }
.btn[aria-busy="true"] { opacity: 0.85; cursor: progress; }
/* the phone top bar shows Log out as its icon alone: the ring takes the icon's place */
#logout .spinner { position: static; display: inline-block; width: 14px; height: 14px; overflow: visible; clip: auto; }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation: fade 0.9s ease-in-out infinite alternate; }
}

/* show / hide password (admin-ui.js): an eye button inside the box's right edge */
.pw { position: relative; display: block; min-width: 0; }
.pw > input.has-eye { padding-right: 52px; }
.pw-eye {
  position: absolute;
  top: 50%;
  right: 5px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transform: translateY(-50%);
}
.pw-eye:hover { background: var(--surface-2); color: var(--ink); }
.pw-eye[aria-pressed="true"] { color: var(--ink); }
.pw-eye .i { width: 20px; height: 20px; }
/* Edge draws its own eye in a password box: one is enough */
input::-ms-reveal, input::-ms-clear { display: none; }

/* ------------------------------------------------------------------ brand */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-size: 21px; font-weight: 700; letter-spacing: -0.01em; text-decoration: none; }
.brand b { color: var(--brand); font-weight: 800; }
.tag { padding: 2px 9px; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }

/* ------------------------------------------------------------------ login */
.auth { display: grid; place-items: center; min-height: 100vh; padding: 32px 16px; }
.auth-box { width: min(100%, 380px); }
.auth h1 { margin-top: 30px; font-size: 18px; font-weight: 600; }
.auth-sub { margin: 4px 0 24px; color: var(--muted); font-size: 14px; }
.auth-form { display: grid; gap: 14px; }
.auth-form input {
  width: 100%;
  height: 50px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
}
.auth-form input::placeholder { color: var(--muted); }
.auth-form input:focus { border-color: var(--primary); }
.btn-lg { min-height: 52px; border-radius: 4px; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; }
.auth .error { margin-top: 14px; }
.auth-note { margin: 20px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }

/* ------------------------------------------------------------------ top bar and section menu */
.bar-in { display: flex; align-items: center; gap: 12px; max-width: 1440px; margin: 0 auto; padding: 0 24px; }
.topbar { border-bottom: 1px solid var(--line-strong); background: var(--page); }
.topbar .bar-in { height: 70px; }
.top-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.top-actions .btn { margin-left: 6px; }
.menubar { position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--line-strong); background: var(--page); box-shadow: var(--menu-shadow); }
.menu { height: 52px; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.menu::-webkit-scrollbar { display: none; }
.menu a {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 100%;
  padding: 0 16px;
  border-bottom: 2px solid transparent;
  color: var(--ink-2);
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
}
.menu a:first-child { padding-left: 0; }
.menu a:hover { color: var(--ink); }
.menu a[aria-current] { border-bottom-color: var(--primary); color: var(--ink); font-weight: 600; }
.count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--count); color: #fff; font-size: 11px; font-weight: 700; line-height: 20px; text-align: center; }

/* ------------------------------------------------------------------ page */
.content { max-width: 1440px; margin: 0 auto; padding: 28px 24px 40px; }
.content > *, .charts > .card { scroll-margin-top: 72px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 24px; margin-bottom: 26px; border-bottom: 1px solid var(--line-strong); }
.tabs { display: flex; flex-wrap: wrap; }
.tabs button {
  position: relative;
  padding: 12px 18px;
  border: 0;
  border-right: 1px solid var(--line-strong);
  background: none;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.tabs button:first-child { padding-left: 0; }
.tabs button:last-child { border-right: 0; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-pressed="true"] { color: var(--ink); }
.tabs button[aria-pressed="true"]::after { content: ""; position: absolute; right: 18px; bottom: -1px; left: 18px; height: 2px; border-radius: 2px 2px 0 0; background: var(--primary); }
.tabs button:first-child[aria-pressed="true"]::after { left: 0; }
.head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 8px 0; }
.updated { color: var(--muted); font-size: 12px; }
.loading .ranged { opacity: 0.55; transition: opacity 0.2s; }

/* stat strip: label, number, note */
.stats { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 20px 24px; margin-bottom: 28px; }
.stat { min-width: 0; }
.stat .label { color: var(--muted); font-size: 13px; font-weight: 500; }
.stat .value { margin: 2px 0 1px; color: var(--ink); font-size: 24px; font-weight: 700; line-height: 1.3; letter-spacing: -0.01em; white-space: nowrap; }
.stat .note { color: var(--ink-2); font-size: 12px; font-weight: 500; }

/* cards */
.card { min-width: 0; padding: 24px; border-radius: 15px; background: var(--surface); }
.card h2 { font-size: 16px; font-weight: 700; letter-spacing: -0.005em; }
.card-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 16px; margin-bottom: 18px; }
.card-head > div:first-child { flex: 1 1 240px; min-width: 0; }
.card-head > .btn, .card-head > .legend { flex: none; }
.card-sub { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.card-sub b { color: var(--ink); font-weight: 700; }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 24px; margin-bottom: 24px; }
.side { display: grid; align-content: start; gap: 24px; min-width: 0; }

/* ------------------------------------------------------------------ tables */
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  padding: 0 10px 12px;
  border-bottom: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-align: right;
  text-transform: uppercase;
  white-space: nowrap;
}
td { padding: 12px 10px; border-bottom: 1px solid var(--line); color: var(--ink-2); text-align: right; vertical-align: middle; font-variant-numeric: tabular-nums; }
th:first-child, td:first-child { padding-left: 0; text-align: left; }
th:last-child, td:last-child { padding-right: 0; }
tbody tr:last-child td { border-bottom: 0; }
summary { cursor: pointer; }
details pre {
  max-height: 220px;
  margin: 8px 0 0;
  padding: 10px;
  overflow: auto;
  border-radius: 8px;
  background: var(--page);
  color: var(--ink-2);
  font-size: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.crash-msg { min-width: 220px; color: var(--ink); text-align: left; white-space: normal; overflow-wrap: anywhere; font-variant-numeric: normal; }
.table-box { max-height: 520px; overflow: auto; }
.table-box table { min-width: 1180px; }
.table-box th { position: sticky; top: 0; z-index: 1; padding-top: 2px; background: var(--surface); }
#table td:first-child { color: var(--ink); font-weight: 600; white-space: nowrap; }

/* badges */
.badge { display: inline-block; padding: 3px 9px; border-radius: 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.02em; white-space: nowrap; }
.badge.deposit { background: var(--dep-bg); color: var(--dep-ink); }
.badge.withdraw { background: var(--wd-bg); color: var(--wd-ink); }
.badge.approved { background: var(--ok-bg); color: var(--ok-ink); }
.badge.rejected { background: var(--no-bg); color: var(--no-ink); }

/* ------------------------------------------------------------------ cashier requests */
.cashier table { min-width: 720px; }
.cashier th, .cashier td { text-align: left; }
.cashier td { vertical-align: top; }
.who { display: flex; align-items: center; gap: 12px; min-width: 210px; }
.who .name { color: var(--ink); font-weight: 700; }
.who .mail { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.av { position: relative; display: grid; place-items: center; flex: none; width: 38px; height: 38px; overflow: hidden; border-radius: 50%; color: var(--ink); font-size: 13px; font-weight: 700; }
/* a person's picture (CoinAdmin.face): over the two letters, which stay if it can't load */
.av > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.av.c0 { background: color-mix(in srgb, var(--av-0) 26%, var(--surface)); }
.av.c1 { background: color-mix(in srgb, var(--av-1) 26%, var(--surface)); }
.av.c2 { background: color-mix(in srgb, var(--av-2) 26%, var(--surface)); }
.av.c3 { background: color-mix(in srgb, var(--av-3) 26%, var(--surface)); }
.av.c4 { background: color-mix(in srgb, var(--av-4) 26%, var(--surface)); }
.amount { margin-top: 5px; color: var(--ink); font-weight: 700; white-space: nowrap; }
.facts div { white-space: nowrap; }
.facts .strong { color: var(--ink); font-weight: 600; }
.cashier td.note { max-width: 200px; overflow-wrap: anywhere; }
.actions { display: grid; gap: 8px; width: 210px; margin-left: auto; }
.actions input { width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: transparent; color: var(--ink); font-size: 13px; }
.actions input::placeholder { color: var(--muted); }
.actions .btns { display: flex; gap: 8px; }
.actions .btn { flex: 1; min-height: 34px; padding: 0 10px; }
.btn.approve { border-color: var(--good-fill); background: var(--good-fill); color: #fff; }
.btn.approve:hover { border-color: var(--good-fill); background: var(--good-fill); color: #fff; filter: brightness(1.12); }
.btn.reject { border-color: var(--critical); color: var(--critical); }
.btn.reject:hover { background: var(--no-bg); color: var(--critical); }
.actions :disabled { opacity: 0.5; cursor: default; }
.empty { display: flex; align-items: center; gap: 14px; padding: 10px 0 6px; color: var(--ink-2); }
.empty-ic { display: grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 50%; background: var(--ok-bg); color: var(--good); }
.empty b { display: block; color: var(--ink); }
.past { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.past summary { color: var(--ink-2); font-size: 13px; font-weight: 600; }
.past .scroll { margin-top: 12px; }
.cashier > .error { margin-bottom: 12px; }

/* ------------------------------------------------------------------ right now */
.now-label { display: flex; align-items: center; gap: 8px; margin-top: 14px; color: var(--muted); font-size: 13px; }
.live { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 4px var(--ok-bg); }
.now-value { color: var(--good); font-size: 40px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.now-peak { color: var(--muted); font-size: 12px; }
.rooms { display: grid; gap: 14px; margin: 18px 0 0; padding: 0; list-style: none; }
.rooms li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 12px; }
.rooms .rname { color: var(--ink); font-size: 13px; font-weight: 600; }
.rooms .phase { margin-left: 8px; color: var(--muted); font-size: 12px; font-weight: 500; }
.rooms .rcount { color: var(--ink-2); font-size: 13px; font-variant-numeric: tabular-nums; }
.rooms .bar { grid-column: 1 / -1; height: 5px; overflow: hidden; border-radius: 7px; background: var(--surface-2); }
.rooms .bar span { display: block; height: 100%; border-radius: inherit; background: var(--series-1); }
.rooms .none { display: block; color: var(--muted); font-size: 13px; }

/* free coins and cashier list */
.list { margin: 6px 0 0; padding: 0; list-style: none; }
.list li { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 1px 14px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { padding-bottom: 0; border-bottom: 0; }
.list .ic { display: grid; grid-row: span 2; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--surface-2); color: var(--ink-2); }
.list .label { color: var(--ink); font-size: 13px; font-weight: 600; }
.list .value { grid-row: span 2; color: var(--ink); font-size: 18px; font-weight: 700; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.list .note { grid-column: 2; color: var(--muted); font-size: 12px; }

/* ------------------------------------------------------------------ charts */
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin-bottom: 24px; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: 220px; overflow: visible; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; padding-top: 2px; color: var(--ink-2); font-size: 12px; }
.legend:empty { display: none; }
.legend span { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.legend span::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--key); }
.tip {
  position: absolute;
  z-index: 5;
  min-width: 140px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-2);
  box-shadow: var(--tip-shadow);
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
}
.tip .day { margin-bottom: 4px; color: var(--muted); font-weight: 600; }
.tip .line { display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.tip .line b { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.tip .key { width: 9px; height: 9px; border-radius: 50%; background: var(--key); }

/* ------------------------------------------------------------------ footer */
.footer { border-top: 1px solid var(--line-strong); color: var(--muted); font-size: 12px; }
.footer .bar-in { flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; padding-top: 20px; padding-bottom: 28px; }

/* ------------------------------------------------------------------ login: team member, setup code, owner key */
.auth-tabs { display: flex; margin: 0 0 18px; border-bottom: 1px solid var(--line-strong); }
.auth-tabs button { position: relative; padding: 10px 16px 10px 0; border: 0; background: none; color: var(--ink-2); font-size: 13px; font-weight: 600; cursor: pointer; }
.auth-tabs button + button { padding-left: 16px; border-left: 1px solid var(--line-strong); }
.auth-tabs button[aria-pressed="true"] { color: var(--ink); }
.auth-tabs button[aria-pressed="true"]::after { content: ""; position: absolute; right: 16px; bottom: -1px; left: 0; height: 2px; border-radius: 2px 2px 0 0; background: var(--primary); }
.auth-tabs button + button[aria-pressed="true"]::after { left: 16px; right: 0; }
.auth-form .auth-sub { margin: 0 0 4px; }
.link-btn { justify-self: start; padding: 2px 0; border: 0; background: none; color: var(--brand); font-size: 13px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link-btn:hover { color: var(--ink); }

/* who is logged in (top bar) */
.me-chip { display: inline-flex; align-items: center; gap: 10px; margin-left: 6px; padding: 4px 10px 4px 4px; border-radius: 999px; background: var(--surface-2); }
.me-chip .av { width: 32px; height: 32px; font-size: 12px; }
/* the chip is a button: it opens My profile */
button.me-chip { border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; }
button.me-chip:hover { box-shadow: inset 0 0 0 1px var(--line-strong); }
button.me-chip:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
/* My profile */
.profile-pic { display: flex; align-items: center; gap: 18px; margin-bottom: 16px; }
.profile-pic > .av { width: 96px; height: 96px; font-size: 30px; }
.profile-pic-side { display: grid; gap: 6px; min-width: 0; }
.profile-pic-side .tool-row { margin: 0; }
.profile-pic-side .small { margin: 0; }
.profile-pic-side .error-note { color: var(--critical); }
.status-line { margin: 8px 0 0; }
.status-line:empty { display: none; }
.me-text { display: grid; line-height: 1.2; }
.me-text b { color: var(--ink); font-size: 13px; }
.me-text small { color: var(--muted); font-size: 11px; }
.no-access { margin-bottom: 24px; }
.sub-title { margin: 22px 0 4px; color: var(--ink); font-size: 14px; font-weight: 700; }

/* ------------------------------------------------------------------ players */
.players { margin-bottom: 24px; }
.search { position: relative; display: flex; align-items: center; flex: 0 1 320px; min-width: 220px; }
.search .i { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.search input { width: 100%; height: 38px; padding: 0 12px 0 38px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface-2); color: var(--ink); font-size: 13px; }
.search input::placeholder { color: var(--muted); }
.players-table { min-width: 560px; }
.players-table th, .players-table td { text-align: left; }
.who-btn { display: flex; align-items: center; gap: 12px; width: 100%; padding: 2px 0; border: 0; background: none; color: inherit; text-align: left; cursor: pointer; }
.who-btn:hover .name { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.who-text { display: grid; min-width: 0; }
.who-text .name { color: var(--ink); font-weight: 700; }
.who-text .mail { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.badge.plain { background: var(--surface-2); color: var(--ink-2); }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-top: 14px; color: var(--muted); font-size: 12px; }
.pager-btns { display: flex; gap: 8px; }
td.by { color: var(--ink-2); white-space: nowrap; }

/* ------------------------------------------------------------------ dialogs */
.dialog { width: min(100% - 32px, 860px); max-height: min(100vh - 48px, 920px); padding: 24px; overflow: auto; border: 1px solid var(--line-strong); border-radius: 15px; background: var(--surface); color: var(--ink-2); box-shadow: var(--tip-shadow); }
.dialog.narrow { width: min(100% - 32px, 520px); }
.dialog::backdrop { background: rgba(8, 9, 14, 0.62); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.dialog-head h2 { font-size: 18px; }
.who.big .av { width: 48px; height: 48px; font-size: 16px; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.facts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px 18px; margin: 6px 0 4px; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); }
.fact .label { color: var(--muted); font-size: 12px; }
.fact .value { color: var(--ink); font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
.tools { display: grid; gap: 12px; margin-top: 18px; }
.tool { padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; }
.tool .sub-title { margin-top: 0; }
.tool.danger { border-color: color-mix(in srgb, var(--critical) 45%, var(--line)); }
.tool-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 4px; }
.tool-row input, .tool-row select, .note-form textarea, .form-grid input, .input-unit input {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
}
.tool-row input[type="number"] { width: 120px; }
.tool-row input[type="text"] { flex: 1 1 220px; min-width: 0; }
.dsec { margin-top: 8px; }
.note-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; margin: 8px 0 10px; }
.note-form textarea { flex: 1 1 320px; min-height: 60px; height: auto; padding: 8px 10px; resize: vertical; font: inherit; font-size: 13px; }
.note-item { padding: 10px 0; border-top: 1px solid var(--line); }
.note-text { color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.ledger-box { max-height: 300px; overflow: auto; }
.ledger td:nth-child(2) { font-weight: 700; }
.ledger td.plus { color: var(--good); }
.ledger td.minus { color: var(--critical); }
.ledger td:last-child, .ledger th:last-child { text-align: left; }

/* ------------------------------------------------------------------ team */
.team { margin-top: 24px; }
.team-table { min-width: 760px; }
.team-table th, .team-table td { text-align: left; }
.chips-cell { max-width: 260px; }
.chip { display: inline-block; margin: 2px 4px 2px 0; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font-size: 11px; font-weight: 700; white-space: nowrap; }
.chip.risky { background: var(--no-bg); color: var(--no-ink); }
.limits div:first-child { color: var(--ink); white-space: nowrap; }
.row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.row-actions .btn { min-height: 32px; padding: 0 10px; font-size: 12px; }
.table-box.short { max-height: 420px; }
.log-table th, .log-table td { text-align: left; }
.log-table td:first-child, .log-table td:last-child { white-space: nowrap; }
.form-grid { display: grid; grid-template-columns: 110px minmax(0, 1fr); align-items: center; gap: 12px 14px; }
.form-grid > label { color: var(--ink-2); font-size: 13px; font-weight: 600; }
.form-grid input:disabled { opacity: 0.6; }
.form-note { grid-column: 1 / -1; margin: -4px 0 0; }
.perms { grid-column: 1 / -1; display: grid; gap: 8px; margin: 4px 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; }
.perms legend { padding: 0 6px; color: var(--ink-2); font-size: 13px; font-weight: 600; }
.perm { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: 13px; cursor: pointer; }
.perm input { width: 16px; height: 16px; accent-color: var(--primary); }
.perm .chip { margin-left: auto; }
.input-unit { display: flex; align-items: center; gap: 8px; }
.input-unit input { width: 160px; }
.input-unit span { color: var(--muted); font-size: 13px; }
.code-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 12px 0; }
.code-row code { padding: 10px 16px; border-radius: 10px; background: var(--surface-2); color: var(--ink); font: 700 22px/1.2 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: 0.12em; user-select: all; }

/* ------------------------------------------------------------------ smaller screens */
@media (max-width: 1319px) {
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .split { grid-template-columns: minmax(0, 1fr); }
  .side { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 991px) {
  .charts { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767px) {
  .side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .bar-in { padding: 0 16px; }
  .content { padding: 20px 16px 32px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 16px; }
  .card { padding: 18px; }
  .tag { display: none; }
  /* icon only, still named for screen readers */
  #logout span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .tabs button { padding: 10px 12px; }
  .tabs button[aria-pressed="true"]::after { right: 12px; left: 12px; }
}
/* waiting requests in a card narrower than their table (tablets, phones): one stacked block per
   request, so Approve and Reject stay on screen */
@container (max-width: 759px) {
  .cashier table.requests { min-width: 0; }
  .requests thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .requests tbody { display: block; }
  .requests tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--line); }
  .requests tbody tr:first-child { padding-top: 4px; }
  .requests tbody tr:last-child { border-bottom: 0; }
  .requests td { display: block; position: static; padding: 0; border: 0; background: none; }
  .requests td:nth-child(2) { text-align: right; }
  .requests td.facts, .requests td.note, .requests td:last-child { grid-column: 1 / -1; }
  .requests td.note { max-width: none; }
  .requests td.note:empty, .requests td.note.blank { display: none; }
  .requests .actions { width: 100%; grid-template-columns: minmax(0, 1fr) auto; }
  .requests .who { min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .loading .ranged { transition: none; }
}

/* a team member without stats: the cashier takes the whole width */
.split:has(> .side[hidden]) { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 640px) {
  /* who is logged in: the avatar only (the name and role stay for screen readers) */
  .me-chip { margin-left: 2px; padding: 0; background: none; }
  .me-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .profile-pic { flex-direction: column; align-items: flex-start; }
  .search { flex-basis: 100%; }
  .dialog { padding: 18px; }
}
@media (max-width: 359px) {
  .me-chip { display: none; }
}

/* ------------------------------------------------------------------ online now, map, screens */
.now-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.now-value.second { color: var(--ink); }
.now-screens { margin: 10px 0 0; }
.map-card, #activity { margin-bottom: 24px; }
.seg { display: inline-flex; flex: none; padding: 3px; border-radius: 8px; background: var(--surface-2); }
.seg button { min-height: 30px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--ink-2); font-size: 12px; font-weight: 600; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); }
.map-layout { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(240px, 1fr); gap: 24px; align-items: start; }
.map-box { position: relative; min-width: 0; }
.map-box svg { display: block; width: 100%; height: auto; }
.map-box path { transition: opacity 0.15s; }
.map-box path:hover { opacity: 0.8; }
.map-tip { position: absolute; }
.map-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 12px; color: var(--ink-2); font-size: 12px; }
.key-item { display: inline-flex; align-items: center; gap: 6px; }
.key-item::before, .swatch { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--key); box-shadow: inset 0 0 0 1px rgba(127, 127, 127, 0.25); }
.swatch { margin-right: 8px; vertical-align: -1px; }
.map-side .scroll { max-height: 380px; overflow: auto; }
.map-credit { margin: 10px 0 0; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.sub-title.first { margin-top: 0; }
.activity-table th, .activity-table td { text-align: left; }
.activity-table td:nth-child(2), .activity-table th:nth-child(2), .activity-table td:nth-child(3), .activity-table th:nth-child(3) { text-align: right; }
.activity-table .muted { color: var(--muted); }
.cell-bar { width: 90px; height: 6px; overflow: hidden; border-radius: 6px; background: var(--surface-2); }
.cell-bar span { display: block; height: 100%; border-radius: inherit; background: var(--series-1); }
@media (max-width: 991px) {
  .map-layout, .two-col { grid-template-columns: minmax(0, 1fr); }
}
/* long ids and names wrap instead of widening the box */
.brand span { white-space: nowrap; }
.dialog-head > .who { min-width: 0; }
#player-sub { overflow-wrap: anywhere; }
.dialog .tool-row > * { max-width: 100%; }
@media (max-width: 400px) {
  .topbar .bar-in { gap: 8px; }
  .top-actions { gap: 2px; }
  .brand { font-size: 19px; }
}

/* ------------------------------------------------------------------ game settings (admin-settings.js) */
.settings { margin-top: 24px; }
.btn.btn-sm { min-height: 30px; padding: 0 10px; font-size: 12px; }
.icon-btn.sm { width: 32px; height: 32px; flex: none; }
.icon-btn.sm .i { width: 17px; height: 17px; }
.icon-btn:disabled { opacity: 0.4; cursor: default; }
.icon-btn:disabled:hover { background: transparent; color: var(--ink-2); }

/* the parts, as a segmented control; a dot marks unsaved changes */
.set-tabs { margin-bottom: 18px; }
.set-tabs button { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 0 14px; font-size: 13px; }
.set-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--wd-ink); }
.settings > .error { margin-bottom: 12px; }
.set-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-bottom: 16px; }
.badge.unsaved { background: var(--wd-bg); color: var(--wd-ink); }

/* fields: label, box (with its unit), hint */
.set-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 24px; margin-top: 14px; }
.field { display: grid; align-content: start; gap: 6px; min-width: 0; }
.field > label, .field-label { color: var(--ink-2); font-size: 13px; font-weight: 600; }
.field .hint { color: var(--muted); font-size: 12px; line-height: 1.45; }
.settings input[type="number"], .settings input[type="text"], .settings input[type="datetime-local"], .settings select {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}
.settings input[type="number"] { font-variant-numeric: tabular-nums; }
.settings .field > input[type="text"], .settings .field > select { width: 100%; min-width: 0; }
.settings input:focus, .settings select:focus, .settings textarea:focus { border-color: var(--primary); }
.settings input::placeholder, .settings textarea::placeholder { color: var(--muted); }
.set-fields .input-unit input { width: 140px; }
.set-lead { margin: 0 0 4px; }
.settings .sub-title + .small { margin: 0; }

/* the server refused this field (or list) */
.settings .bad:is(input, select, textarea) { border-color: var(--critical); box-shadow: 0 0 0 1px var(--critical); }
.settings div.bad { outline: 2px solid var(--critical); outline-offset: 4px; border-radius: 10px; }

/* on/off switch: a checkbox under a track */
.switch { position: relative; display: inline-flex; align-items: center; gap: 9px; color: var(--ink); font-size: 13px; font-weight: 600; cursor: pointer; user-select: none; }
.switch input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; }
.switch .track { position: relative; flex: none; width: 36px; height: 20px; border-radius: 999px; background: var(--line-strong); transition: background-color 0.15s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); transition: transform 0.15s; }
.switch input:checked + .track { background: var(--good-fill); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch.sm { gap: 6px; font-size: 11px; }
.switch.sm .track { width: 28px; height: 16px; }
.switch.sm .track::after { top: 3px; left: 3px; width: 10px; height: 10px; }
.switch.sm input:checked + .track::after { transform: translateX(12px); }
.switch-rows { display: grid; gap: 12px; margin-top: 12px; }
.switch-row { display: grid; gap: 2px; }
.switch-row .small { padding-left: 45px; }

/* a kind of free coins (with its switch) */
.set-block { margin-top: 16px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; }
.set-block:first-child { margin-top: 0; }
.set-block-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 4px; }
.set-block-head h3 { margin: 0; color: var(--ink); font-size: 14px; font-weight: 700; }
.set-block > .small { margin: 0; }
.set-block.off > :not(.set-block-head) { opacity: 0.55; }

/* lists of numbers: chips, days of the streak, coin packs */
.item-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px 16px; margin-top: 14px; }
.item { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; min-width: 0; padding: 8px 8px 8px 14px; border-radius: 10px; background: var(--surface-2); }
.item-label { min-width: 50px; color: var(--ink); font-size: 13px; font-weight: 700; white-space: nowrap; }
.item .input-unit input { width: 110px; }
.item .icon-btn { margin-left: auto; }
.radio { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 12px; font-weight: 600; cursor: pointer; }
.radio input { width: 15px; height: 15px; margin: 0; accent-color: var(--primary); }
.list-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 12px; }
.chip-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 14px; }
.game-chip { padding: 3px 10px; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--ink); font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
.game-chip.on { border-color: var(--primary); background: var(--primary); color: #fff; }

/* odds: the payout line and the board (staircase like the game's) */
.rtp-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin: 18px 0 4px; padding: 12px 16px; border-radius: 12px; background: var(--surface-2); }
.rtp-line:empty { display: none; }
.rtp-value { color: var(--ink); font-size: 26px; font-weight: 800; line-height: 1.2; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; transition: opacity 0.15s; }
.rtp-line > div { flex: 1 1 260px; min-width: 0; }
.rtp-text { color: var(--ink); font-weight: 700; }
.rtp-line.stale .rtp-value { opacity: 0.5; }
.rtp-line.warn { background: var(--no-bg); }
.rtp-line.warn .rtp-value, .rtp-line.warn .rtp-text { color: var(--no-ink); }
.board-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.board { display: grid; grid-template-columns: 26px repeat(5, minmax(0, 1fr)); gap: 8px; max-width: 880px; }
.board-head, .board-label { display: grid; place-items: center; color: var(--brand); font-size: 16px; font-weight: 800; }
.board-head { padding: 2px 0; }
.pair { display: grid; align-content: start; gap: 7px; min-width: 0; padding: 8px 9px 7px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface-2); }
.pair-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 6px; }
.pair-key { color: var(--ink); font-size: 14px; font-weight: 800; letter-spacing: 0.02em; }
.settings .pair input[type="number"] { width: 100%; min-width: 0; height: 32px; padding: 0 8px; }
.pair-pv { min-height: 16px; overflow: hidden; color: var(--muted); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; transition: opacity 0.15s; }
.pair-pv.hot { color: var(--wd-ink); }
.board.stale .pair-pv { opacity: 0.45; }
.pair.fixed { border-color: color-mix(in srgb, var(--brand) 60%, var(--line-strong)); }
.pair.fixed input[type="number"] { font-weight: 700; }
.pair.closed { border-style: dashed; background: repeating-linear-gradient(135deg, transparent 0 7px, color-mix(in srgb, var(--line-strong) 45%, transparent) 7px 8px), var(--surface); }
.pair.closed .pair-key { color: var(--muted); text-decoration: line-through; }

/* free-coin events */
.event { margin-top: 12px; padding: 12px 14px 14px; border-radius: 10px; background: var(--surface-2); }
.event-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.event-when { min-width: 0; }
.event-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.event .set-fields { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); margin-top: 10px; }
.date-row { display: flex; align-items: center; gap: 4px; min-width: 0; }
.date-row input { flex: 1 1 auto; min-width: 0; }
.check { display: inline-flex; align-items: flex-start; gap: 8px; margin-top: 12px; color: var(--ink); font-size: 13px; cursor: pointer; }
.check input { flex: none; width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--primary); }

/* Mobile numbers: a search box over the country codes, how many it shows, and all on / all off
   for the ones shown; the codes (about 240) scroll in their own box, the headings staying on top */
.phone-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 18px; }
.phone-tools .search { flex: 1 1 260px; max-width: 360px; min-width: 0; }
.phone-shown { flex: 1 1 200px; }
.phone-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.phone-box { max-height: min(68vh, 640px); margin-top: 12px; overflow: auto; }
.phone-box thead th { position: sticky; top: 0; z-index: 3; padding-top: 8px; background: var(--surface); box-shadow: inset 0 -1px 0 var(--line-strong); }
.phone-none { margin: 12px 0 0; }

/* texts, next to how the game shows them (a black screen in both themes) */
.text-block { margin-top: 18px; }
.text-cols { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px 24px; align-items: start; }
.text-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-bottom: 6px; }
.settings textarea { display: block; width: 100%; min-height: 96px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; line-height: 1.55; resize: vertical; }
.count-note { font-variant-numeric: tabular-nums; }
.count-note.near { color: var(--wd-ink); font-weight: 700; }
.text-shown .field-label { display: block; margin-bottom: 6px; }
.game-text { min-height: 96px; padding: 12px 14px; border: 2px solid #d4372c; border-radius: 4px; background: #000; color: #f4f4f4; font: 700 12px/1.6 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: 0.04em; overflow-wrap: anywhere; }
.game-text p { margin: 0 0 10px; }
.game-text p:last-child { margin-bottom: 0; }
.game-text .game-empty { color: #8a8a8a; }

/* save, discard, reset; what happened */
.set-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.set-actions .btn-primary { min-width: 140px; }
/* the partner settings' Save gets the form's whole row (in the label column it stuck out, and longer words clipped) */
.partner-settings .set-actions { grid-column: 1 / -1; }
.set-pane > .error { margin-top: 14px; }
.set-ok { margin: 14px 0 0; color: var(--good); font-size: 13px; font-weight: 600; }
.set-ok:empty { display: none; }
.set-notice { margin: 0 0 16px; padding: 12px 14px; border-radius: 10px; background: var(--wd-bg); color: var(--ink); font-size: 13px; }
.set-notice p { margin: 0 0 10px; }
.set-notice-actions { display: flex; flex-wrap: wrap; gap: 8px; }

@media (max-width: 760px) {
  /* the board as a list of boxes, each with its pair on it */
  .board { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
  .board-corner, .board-head, .board-label, .board-empty { display: none; }
  .text-cols { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .set-tabs { display: flex; flex-wrap: wrap; width: 100%; }
  .set-tabs button { flex: 1 1 28%; justify-content: center; padding: 0 8px; }
  .set-fields, .event .set-fields, .item-list { grid-template-columns: minmax(0, 1fr); }
  .set-block { padding: 14px; }
  .event { padding: 12px 10px; }
  .set-actions .btn { flex: 1 1 auto; }
  .switch-row .small { padding-left: 0; }
  /* a list row: label, box and remove on one line (a chip's Default under its box) */
  .item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px 10px; padding-left: 12px; }
  .item-label { min-width: 44px; }
  .item .input-unit { min-width: 0; }
  .item .input-unit input { width: 100%; min-width: 0; max-width: 120px; }
  .item .radio { grid-row: 2; grid-column: 2; }
  .item .icon-btn { grid-row: 1; grid-column: 3; margin-left: 0; }
  .settings input[type="datetime-local"] { padding: 0 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .switch .track, .switch .track::after, .rtp-value, .pair-pv { transition: none; }
}

/* ------------------------------------------------------------------ support chat */
.support { margin-bottom: 24px; }
.live-state { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.live-dot.on { background: var(--good); box-shadow: 0 0 0 4px var(--ok-bg); }
.support > .error, .support > .set-notice { margin-bottom: 12px; }
.support-layout { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 20px; align-items: start; }
.support-side { display: grid; gap: 12px; min-width: 0; }
.support-tabs { display: flex; width: 100%; }
.support-tabs button { display: inline-flex; flex: 1; align-items: center; justify-content: center; gap: 6px; }
.count.plain { background: var(--line-strong); color: var(--ink); }
.conv-list { display: grid; gap: 6px; max-height: 560px; overflow: auto; }
.conv { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%; padding: 10px; border: 1px solid transparent; border-radius: 10px; background: var(--surface-2); color: inherit; text-align: left; cursor: pointer; }
.conv:hover { border-color: var(--line-strong); }
.conv.on { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, var(--surface-2)); }
.conv-body { display: grid; gap: 2px; min-width: 0; }
.conv-top { display: flex; justify-content: space-between; gap: 8px; min-width: 0; }
.conv-name { overflow: hidden; color: var(--ink-2); font-weight: 700; white-space: nowrap; text-overflow: ellipsis; }
.conv-when { flex: none; color: var(--muted); font-size: 11px; }
.conv-preview { overflow: hidden; color: var(--muted); font-size: 12px; white-space: nowrap; text-overflow: ellipsis; }
.conv.unread .conv-name, .conv.unread .conv-preview { color: var(--ink); }
.conv-tags { display: flex; flex-wrap: wrap; }
.conv-tags .chip { margin: 3px 4px 0 0; font-size: 11px; }
.support-thread { min-width: 0; border: 1px solid var(--line); border-radius: 12px; }
.thread-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 360px; padding: 24px; color: var(--muted); text-align: center; }
.thread-empty .i { width: 34px; height: 34px; }
.thread-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.thread-head .who { min-width: 0; }
.thread-head .who > div { min-width: 0; }
.thread-head .name { color: var(--ink); font-weight: 700; overflow-wrap: anywhere; }
.thread-head .small { overflow-wrap: anywhere; }
.thread-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.thread-actions select, .mute-tool select, .mute-tool input { height: 30px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--ink); font-size: 12px; }
.thread-flags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 10px 16px 0; }
.thread-flags .badge { white-space: normal; }
.mute-tool { padding: 8px 16px 0; }
.mute-tool summary { color: var(--ink-2); font-size: 12px; font-weight: 600; }
.mute-tool .tool-row { margin: 8px 0 2px; }
.mute-tool input { flex: 1 1 180px; min-width: 0; }
.thread-msgs { display: flex; flex-direction: column; gap: 10px; height: 420px; margin-top: 10px; padding: 12px 16px; overflow-y: auto; border-block: 1px solid var(--line); background: color-mix(in srgb, var(--page) 55%, var(--surface)); }
.msg { display: flex; flex-direction: column; max-width: 78%; }
.msg.theirs { align-self: flex-start; align-items: flex-start; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.bubble { padding: 8px 12px; border-radius: 14px; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.theirs .bubble { border-bottom-left-radius: 4px; background: var(--surface-2); }
.msg.mine .bubble { border-bottom-right-radius: 4px; background: color-mix(in srgb, var(--primary) 30%, var(--surface)); }
.bubble.pic { padding: 4px; }
.msg .meta { margin: 3px 4px 0; color: var(--muted); font-size: 11px; }
.msg-note { align-self: center; color: var(--muted); font-size: 12px; text-align: center; }
.thumb { display: block; padding: 0; border: 0; border-radius: 10px; background: transparent; cursor: zoom-in; }
.thumb:disabled { cursor: default; }
.thumb img { display: block; max-width: 100%; height: auto; border-radius: 10px; background: var(--surface); }
.thread-form { display: flex; align-items: flex-end; gap: 8px; padding: 12px 16px 4px; }
.thread-form textarea { flex: 1 1 auto; min-width: 0; min-height: 44px; max-height: 160px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; resize: vertical; }
.thread-form textarea:focus { border-color: var(--primary); outline: none; }
.thread-form textarea:disabled { opacity: 0.55; }
.pic-btn { min-height: 44px; padding: 0 12px; cursor: pointer; }
.pic-btn.disabled { opacity: 0.45; pointer-events: none; }
.thread-form .btn-primary { min-height: 44px; }
.thread-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; padding: 0 16px 12px; }
/* a picture on its way: the busy ring before "Sending..." */
#support-busy:not(:empty) { display: inline-flex; align-items: center; gap: 6px; }
.closed-note { margin: 10px 16px 0; }
.bell-count { position: absolute; top: 3px; right: 1px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--count); color: #fff; font-size: 10px; font-weight: 800; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--page); }
.dialog.viewer { width: auto; max-width: min(100% - 32px, 1100px); padding: 8px; background: #000; cursor: zoom-out; }
.dialog.viewer img { display: block; max-width: 100%; max-height: calc(100vh - 80px); margin: auto; border-radius: 6px; }
/* the back button shows only where the list and the chat take turns (below) */
.thread-back { display: none; }
@media (max-width: 980px) {
  /* one column: the list of chats, then (tapping one) the chat alone, with a back button
     (admin-support.js sets has-thread while a chat is open); the chat fills the screen so the
     answer box sits near the bottom, under the thumb */
  .support-layout { grid-template-columns: minmax(0, 1fr); }
  .conv-list { max-height: none; }
  .support-layout.has-thread .support-side, .support-layout:not(.has-thread) .support-thread { display: none; }
  .thread-back { display: inline-grid; flex: none; margin: -4px -4px -4px -8px; }
  .support-thread { scroll-margin-top: 64px; }
  .thread-msgs { height: clamp(240px, calc(100vh - 450px), 640px); height: clamp(240px, calc(100dvh - 450px), 640px); }
}
@media (max-width: 640px) {
  .thread-head { padding: 12px 12px 10px; }
  .thread-flags { padding: 10px 12px 0; }
  .mute-tool { padding: 2px 12px 0; }
  .thread-msgs { padding: 10px; }
  .msg { max-width: 92%; }
  .thread-form { padding: 10px; }
  .thread-foot { padding: 0 12px 10px; }
  .closed-note { margin: 10px 12px 0; }
  /* who takes it, close, the player: one row across the chat */
  .thread-actions { width: 100%; }
  .thread-actions > select { flex: 1 1 100px; min-width: 0; padding: 0 4px; }
  .thread-actions > .btn { flex: 1 0 auto; padding: 0 10px; }
  .thread-actions > select ~ .btn { flex-grow: 0; }
}

/* ------------------------------------------------------------------ phones and tablets
   1320px and wider keeps the layout above unchanged. Narrower, the page is one column and the
   section menu a sideways strip. Tables follow the width of their own card or dialog (container
   queries): a card narrower than its table stacks it, one block per row, each cell under its
   column's name (admin.js copies the headings into data-label), or the table scrolls inside the
   card with its first column kept in view. 640px and under is the phone layout. Touch screens
   get 40px controls and 16px text in every field (iOS zooms into smaller text). A pane added
   later with the same classes (.btn, .seg, .field, .set-fields, .tool-row, .form-grid, .switch,
   .log-table, a table in a .scroll box) gets all of this without rules of its own. */
.card, .dialog:not(.viewer) { container-type: inline-size; }

@media (max-width: 1319px) {
  /* the section menu scrolls sideways when it doesn't fit, its edges fading to show there is
     more (admin.js scrolls the current section's link into view) */
  .menu {
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 28px), transparent);
  }
  /* a chart's key wraps under its title when the card is narrow */
  .card-head > .legend { flex: 0 1 auto; min-width: 0; }
  /* a table wider than its card scrolls inside it, its first column staying in view (on the
     card's color: tables sit on cards and dialogs) */
  :where(.scroll > table) :where(th, td):first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); }
  .table-box th:first-child { z-index: 2; }
  .table-box.short table { min-width: 0; }
}
@media (max-width: 991px) {
  .cashier table { min-width: 0; }
}

/* touch screens (phones, and tablets at any width): every control at least 40px tall, and 16px
   text in every field */
@media (max-width: 640px), (pointer: coarse) {
  .btn, .btn.btn-sm, .actions .btn, .row-actions .btn, .seg button, .set-tabs button, .link-btn, .topbar .brand { min-height: 40px; }
  .icon-btn.sm { width: 40px; height: 40px; }
  .tabs button, .auth-tabs button { min-height: 44px; }
  summary { min-height: 40px; padding-block: 10px; }
  .switch, .perm, .radio { min-height: 40px; }
  .check { min-height: 40px; margin-top: 2px; padding-block: 10px; }
  #board :is(input:not([type="checkbox"], [type="radio"], [type="file"]), select), #login input { min-height: 40px; font-size: 16px; }
  #board textarea { font-size: 16px; }
}

@media (max-width: 640px) {
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

  /* top bar: brand, bell, theme, who (avatar), log out (icon) */
  .topbar .bar-in { height: 60px; }
  .top-actions .icon-btn { width: 40px; height: 40px; }
  #logout { width: 40px; margin-left: 2px; padding: 0; }

  /* section menu: tighter links */
  .menu a { gap: 7px; padding: 0 12px; }
  .menu a:first-child { padding-left: 0; }

  /* date range: the four tabs share the width */
  .page-head { gap: 0 16px; margin-bottom: 20px; }
  .tabs { flex-wrap: nowrap; width: 100%; }
  .tabs button { flex: 1 1 auto; padding: 0 6px; }
  .tabs button:first-child { flex-grow: 0; padding: 0 12px 0 0; }
  .tabs button[aria-pressed="true"]::after { right: 6px; left: 6px; }
  .tabs button:first-child[aria-pressed="true"]::after { right: 12px; left: 0; }
  .page-head > .head-actions { width: 100%; justify-content: space-between; padding: 8px 0 12px; }
  .card-head > .head-actions { width: 100%; justify-content: space-between; padding: 0; }

  /* cards closer together */
  .split, .charts { gap: 16px; margin-bottom: 16px; }
  .side { gap: 16px; }
  .players, .support, .map-card, #activity, .no-access { margin-bottom: 16px; }
  .team, .settings { margin-top: 16px; }
  .card-head { margin-bottom: 14px; }
  .card-head > .seg { flex: 1 1 100%; }
  .card-head > .seg button { flex: 1 1 0; }
  .stat .value { font-size: 22px; }
  .now-value { font-size: 34px; }

  /* a chart's tooltip wraps instead of running off the card */
  .tip { max-width: 100%; white-space: normal; }

  /* long words (addresses, links, ids) wrap instead of widening their box */
  .card-sub, .small, .fact .value, .code-row code, .who .name, .who-text .name { overflow-wrap: anywhere; }

  /* the player and partner boxes: facts two by two; in the tools, text fields take the row and
     buttons share one */
  .facts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; padding: 12px 14px; }
  .tool-row > input[type="text"] { flex: 1 1 100%; }
  .tool-row > input[type="number"] { flex: 1 1 96px; width: auto; min-width: 0; }
  .tool-row > .btn, .note-form .btn { flex: 1 1 auto; }
  .note-form > :is(h3, p, input, textarea), .note-form > .dialog-actions { flex: 1 1 100%; }
  .form-grid { gap: 6px 14px; }
  .form-grid > label:not(:first-child), .form-grid > .field-label { margin-top: 8px; }
  .perm input { flex: none; }

  /* dialogs: nearly the whole screen; the title (with Close) and the form's buttons stay in
     view while the box scrolls */
  .dialog, .dialog.narrow { width: calc(100% - 16px); max-width: none; max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); padding: 16px; border-radius: 14px; }
  /* (a sticky box in a scrolling box with padding sticks at the padding's inner edge: -16px puts
     these at the dialog's very edge) */
  .dialog-head { position: sticky; top: -16px; z-index: 3; margin: -16px -16px 14px; padding: 16px 16px 12px; border-bottom: 1px solid var(--line); background: var(--surface); }
  .dialog-head > .icon-btn { flex: none; }
  .who.big .av { width: 40px; height: 40px; font-size: 14px; }
  .dialog form > .dialog-actions { position: sticky; bottom: -16px; z-index: 3; margin: 18px -16px -16px; padding: 12px 16px 16px; border-top: 1px solid var(--line); background: var(--surface); }
  .dialog-actions .btn { flex: 1 1 auto; }
  .dialog.viewer { max-width: calc(100% - 16px); padding: 6px; }
  .dialog.viewer img { max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); }

  /* the day table scrolls both ways in its card; the days and the headings stay */
  .table-box { max-height: min(520px, 70vh); }
  #table :is(th, td) { padding-inline: 8px; }
  #table :is(th, td):first-child { padding: 12px 10px 12px 0; box-shadow: inset -1px 0 0 var(--line-strong); }
  #table th:first-child { padding-top: 2px; }
}

/* a table with buttons on each row, in a card narrower than the table (tablets, phones): one
   block per row, the first cell on top, the others under their column's name, the buttons last */
@container (max-width: 759px) {
  .team-table { min-width: 0; }
  .team-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .team-table tbody { display: block; }
  .team-table tr { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px 16px; padding: 16px 0; border-bottom: 1px solid var(--line); }
  .team-table tbody tr:first-child { padding-top: 4px; }
  .team-table tbody tr:last-child { border-bottom: 0; }
  .team-table td { display: block; position: static; min-width: 0; max-width: none; padding: 0; border: 0; background: none; text-align: left; }
  .team-table td:first-child, .team-table td:not([data-label]) { grid-column: 1 / -1; }
  .team-table td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 3px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
  .team-table td:first-child::before { content: none; }
  .team-table .who { min-width: 0; }
  .team-table .limits div:first-child { white-space: normal; }
  .team-table .row-actions { justify-content: flex-start; }
  .team-table .row-actions .btn { flex: 1 1 auto; }
}

/* the other lists, in a phone-wide card or dialog: one block per row too. Players, decided
   requests and crashes put the player (or the error) on top; logs label every cell, and a
   cell with a bold line (what happened, who to pay) gets the whole width */
@container (max-width: 479px) {
  :is(.players-table, .log-table, .past table, .charts table, .dsec table:not(.ledger)) { min-width: 0; }
  :is(.players-table, .log-table, .past table, .charts table, .dsec table:not(.ledger)) thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  :is(.players-table, .log-table, .past table, .charts table, .dsec table:not(.ledger)) tbody { display: block; }
  :is(.players-table, .log-table, .past table, .charts table, .dsec table:not(.ledger)) tr { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
  :is(.players-table, .log-table, .past table, .charts table, .dsec table:not(.ledger)) tbody tr:first-child { padding-top: 4px; }
  :is(.players-table, .log-table, .past table, .charts table, .dsec table:not(.ledger)) tbody tr:last-child { border-bottom: 0; }
  :is(.players-table, .log-table, .past table, .charts table, .dsec table:not(.ledger)) td { display: block; position: static; min-width: 0; max-width: none; padding: 0; border: 0; background: none; text-align: left; white-space: normal; }
  :is(.players-table, .log-table, .past table, .charts table, .dsec table:not(.ledger)) td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 2px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
  :is(.players-table, .log-table, .past table, .charts table, .dsec table:not(.ledger)) td:not([data-label]) { grid-column: 1 / -1; }
  :is(.players-table, .past table, .charts table) td:first-child { grid-column: 1 / -1; }
  :is(.players-table, .past table, .charts table) td[data-label]:first-child::before { content: none; }
  :is(.log-table, .dsec table) td:has(> .strong) { grid-column: 1 / -1; }
  :is(.players-table, .past table) .who { min-width: 0; }
  .scroll > .players-table tbody tr { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  /* a waiting request: the reason on its own row, Approve and Reject side by side under it */
  .requests .actions { grid-template-columns: minmax(0, 1fr); }

  /* screens, taps and countries: short tables that fit, with narrower bars */
  .activity-table th { white-space: normal; }
  .activity-table :is(th, td) { padding-inline: 5px; }
  .activity-table :is(th, td):first-child { padding-left: 0; }
  .activity-table :is(th, td):last-child { padding-right: 0; }
  .activity-table .cell-bar { width: 44px; }
}

/* ------------------------------------------------------------------ language picker
   A <select data-lang-select> (admin-i18n.js fills it with each language in its own name) in a
   label with a globe: in the top bar beside the theme button, like the other top-bar buttons, and
   on the login card. On a phone the top bar shows only the globe (a 40px button); the select is
   still there, invisible over it, so a tap opens the phone's own list. */
.lang-pick { position: relative; display: inline-flex; flex: none; align-items: center; gap: 6px; height: 40px; padding: 0 8px 0 10px; border-radius: 8px; color: var(--ink-2); cursor: pointer; }
.lang-pick:hover { background: var(--surface-2); color: var(--ink); }
.lang-pick .i { width: 18px; height: 18px; }
.lang-pick select { height: 100%; margin: 0; padding: 0 18px 0 0; border: 0; background: transparent; color: inherit; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; appearance: none; -webkit-appearance: none; }
.lang-pick select:focus-visible { outline: none; }
.lang-pick:has(select:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.lang-pick select option { background: var(--surface); color: var(--ink); }
/* the select's arrow (the native one is hidden so it matches the other buttons) */
.lang-pick::after { content: ""; position: absolute; top: 50%; right: 12px; width: 6px; height: 6px; margin-top: -5px; border-right: 1.8px solid currentColor; border-bottom: 1.8px solid currentColor; transform: rotate(45deg); pointer-events: none; }
/* the login card: the brand, and the picker as a bordered button across from it */
.auth-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.auth-top .lang-pick { height: 36px; border: 1px solid var(--line-strong); }
@media (max-width: 640px), (pointer: coarse) {
  #login .lang-pick { height: 40px; }
  #login select { font-size: 16px; }
}
@media (max-width: 640px) {
  .top-lang { justify-content: center; width: 40px; padding: 0; }
  .top-lang .i { width: 20px; height: 20px; }
  .top-lang::after { content: none; }
  .top-lang select { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; padding: 0; opacity: 0; }
}
/* small phones: the bar's five buttons (bell, language, theme, log out, and the avatar) keep the
   16px edge: 36px wide each (still 40px tall), and under 375px the avatar goes (its name and role
   stay for screen readers) */
@media (max-width: 400px) {
  .top-actions .icon-btn, .top-lang, #logout { width: 36px; }
}
@media (max-width: 374px) {
  .me-chip { margin-left: 0; }
  .me-chip .av { display: none; }
}
/* a phone's support chat, the owner's "who takes it" list: a row of its own, so the chosen name
   ("Chủ sở hữu (bạn)", a long team name) isn't cut beside the translated buttons, which share the
   row under it */
@media (max-width: 640px) {
  .thread-actions > select { flex-basis: 100%; }
  .thread-actions > select ~ .btn { flex: 1 1 0; }
  /* Waiting / Answered / Closed with their counts: a little more room for the words ("Đang chờ") */
  .support-tabs button { gap: 4px; padding: 0 6px; }
}

/* ------------------------------------------------------------------ team chat (admin-chat.js)
   The support chat's list and thread (.support-layout, .conv, .thread...) with a few parts of
   its own: setting this browser up, device approvals with their codes, safety codes, sender
   names in groups and the group dialog's people. */
.team-chat > .error { margin-bottom: 12px; }
.chat-setup { display: grid; gap: 6px; max-width: 680px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; }
.chat-setup .sub-title { margin-top: 0; }
.chat-setup .card-sub, .chat-setup .set-notice { margin: 0; }
/* the password box sits in its eye wrapper (admin-ui.js): the wrapper is the row's item */
.chat-setup-form > input, .chat-setup-form > .pw { flex: 1 1 240px; min-width: 0; }
.chat-setup-form .pw > input { width: 100%; }
.chat-side-head { display: grid; gap: 8px; }
.chat-side-head #chat-new { justify-self: start; }
.chat-side-note { margin: 0 2px 4px; }
.chat-face { display: contents; }
.group-av { background: color-mix(in srgb, var(--primary) 24%, var(--surface-2)); color: var(--ink); }
.group-av .i { width: 20px; height: 20px; }
.chat-note { display: block; width: 100%; margin: 0; padding: 9px 12px; border: 0; border-radius: 10px; background: var(--wd-bg); color: var(--ink); font: inherit; font-size: 12px; text-align: left; }
button.chat-note { cursor: pointer; font-weight: 700; }
.warn-text { color: var(--wd-ink); }
#chat-list .sub-title { margin: 12px 2px 0; }
#chat-list .sub-title:first-child { margin-top: 2px; }
#chat-list > .small { margin: 0 2px; }
.chat-device { display: grid; gap: 8px; padding: 10px; border: 1px solid transparent; border-radius: 10px; background: var(--surface-2); }
.chat-device.waiting { border-color: var(--wd-ink); }
.chat-device-head { display: grid; grid-template-columns: 38px minmax(0, 1fr); align-items: center; gap: 10px; }
.chat-device .tool-row { margin: 0; }
.chat-code-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.chat-code-line code { color: var(--ink); font: 700 14px/1.35 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: 0.06em; user-select: all; }
.code-row.chat-code { margin: 6px 0 0; }
.code-row.chat-code code { padding: 8px 12px; font-size: 16px; }
.chat-flags { display: grid; gap: 8px; }
.chat-flags .set-notice, .chat-flags > .small { margin: 0; }
.chat-safety { display: grid; gap: 6px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.chat-safety .small:last-child { margin: 2px 0 0; }
.msg-from { margin: 0 4px 3px; color: var(--muted); font-size: 11px; font-weight: 700; }
.bubble.bad { color: var(--muted); font-style: italic; }
.pic-caption { padding: 6px 8px 4px; }
.chat-earlier { align-self: center; }
#chat-busy:not(:empty) { display: inline-flex; align-items: center; gap: 6px; }
.chat-picks { display: grid; gap: 6px; max-height: min(46vh, 380px); margin-top: 10px; overflow: auto; }
.chat-pick { display: grid; grid-template-columns: auto 38px minmax(0, 1fr); align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); cursor: pointer; }
.chat-pick input { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); }
.chat-tool .tool-row { margin-top: 4px; }
