/* ---- Theme tokens ---- */
:root, [data-theme="dark"] {
  --bg: #0e1116;
  --panel: #161b22;
  --panel-2: #1c232b;
  --border: #2a3038;
  --border-strong: #3d444d;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #58a6ff;
  --accent-strong: #1f6feb;
  --accent-fg: #0d1117;
  --hover: #1c232b;
  --active: #1f2933;
  --ok: #3fb950;
  --warn: #d29922;
  --error: #f85149;
  --code-bg: var(--bg);
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
  /* v2.5.39: backdrop for transparent-bg channel logos. In dark mode the
     panel bg is already dark — white-on-transparent logos render fine
     against it, so we just match the panel. */
  --logo-bg: var(--panel-2);
}

[data-theme="light"] {
  --bg: #ffffff;
  --panel: #f6f8fa;
  --panel-2: #eaeef2;
  --border: #d0d7de;
  --border-strong: #afb8c1;
  --text: #1f2328;
  --muted: #59636e;
  --accent: #0969da;
  --accent-strong: #0550ae;
  --accent-fg: #ffffff;
  --hover: #eaeef2;
  --active: #ddf4ff;
  --ok: #1a7f37;
  --warn: #9a6700;
  --error: #cf222e;
  --code-bg: #eaeef2;
  --shadow: 0 1px 2px rgba(31, 35, 40, 0.08);
  /* v2.5.39: in light mode the rest of the page is white, but IPTV channel
     logos are overwhelmingly white-on-transparent PNGs designed for the
     dark backgrounds of media players (Tivimate etc). A hardcoded dark
     backdrop on the logo IMG only — not the row — keeps white content
     visible. Black-on-transparent logos still render OK because they
     retain colored/outlined glyphs in practice. */
  --logo-bg: #2a3038;
}

/* v2.5.43: expiration-status text styling. Applied wherever expires_at
   is rendered (users.html, sub_users.html, dashboard.html). Templates
   pass `now=datetime.utcnow()` and decide which class to apply. */
.exp-past { color: var(--error); font-weight: 500; }
.exp-warn { color: var(--warn); font-weight: 500; }
.exp-banner {
  background: color-mix(in srgb, var(--error) 12%, transparent);
  border-left: 3px solid var(--error);
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  border-radius: 4px;
}
.exp-banner a { color: var(--error); font-weight: 500; }
.exp-filter-bar {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-bottom: 12px;
  font-size: 12px;
}
.exp-filter-bar .filter-btn {
  padding: 3px 10px; border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel);
  text-decoration: none; color: var(--text);
}
.exp-filter-bar .filter-btn.active {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}
.exp-filter-bar .filter-btn.danger {
  background: color-mix(in srgb, var(--error) 14%, transparent);
  border-color: color-mix(in srgb, var(--error) 30%, var(--border));
  color: var(--error);
  font-weight: 500;
}
.exp-filter-bar .filter-btn.danger.active {
  background: var(--error);
  color: white;
  border-color: var(--error);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  transition: background 0.15s, color 0.15s;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.error { color: var(--error); }

/* ---- Topbar / nav ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  gap: 24px;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
}

.brand-link { color: var(--text); text-decoration: none; }
.brand-name { font-weight: 600; font-size: 16px; }
.brand-version { color: var(--muted); margin-left: 6px; font-size: 11px; }

.topnav { display: flex; gap: 4px; }
.topnav a {
  padding: 6px 12px; border-radius: 4px;
  color: var(--muted); text-decoration: none;
  font-size: 13px;
}
.topnav a:hover { background: var(--panel-2); color: var(--text); }
.topnav a.active { background: var(--bg); color: var(--text); }

.user-menu { display: flex; align-items: center; gap: 12px; }
.user-link { color: var(--muted); }

/* ---- Theme toggle slider ---- */
.theme-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
  cursor: pointer;
  flex-shrink: 0;
}
.theme-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.slider {
  position: absolute;
  inset: 0;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5px;
  font-size: 12px;
  color: var(--muted);
}
.slider::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: var(--accent);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
  z-index: 1;
}
.theme-switch input:checked + .slider::before {
  transform: translateX(24px);
}
.slider-icon { z-index: 0; line-height: 1; }
.icon-sun { opacity: 0.6; }
.icon-moon { opacity: 0.6; }
[data-theme="dark"]  .icon-moon { opacity: 1; }
[data-theme="light"] .icon-sun  { opacity: 1; color: #ffb700; }

.theme-switch:hover .slider { border-color: var(--border-strong); }
.theme-switch:focus-within .slider {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---- Layout ---- */
.container { max-width: 1200px; margin: 24px auto; padding: 0 24px; }

.page-title { font-size: 20px; margin: 0 0 16px; font-weight: 600; }
section { margin-bottom: 28px; }
section h2 { font-size: 15px; margin: 0 0 8px; font-weight: 600; }
section h3 { font-size: 14px; margin: 0; font-weight: 600; }

/* ---- Cards ---- */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.login-card { max-width: 380px; margin: 80px auto; }
.login-card h1 { font-size: 18px; margin: 0 0 16px; }

/* ---- Forms ---- */
form { margin: 0; }

label { display: block; margin-bottom: 12px; }
label > span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 12px; }

input[type="text"], input[type="password"], input[type="email"], select {
  width: 100%; padding: 8px 10px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }
input:disabled { opacity: 0.5; }

input.input-tight { padding: 4px 6px; font-size: 13px; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}
.form-grid .full { grid-column: 1 / -1; }
.form-grid label { margin-bottom: 0; }

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

.checkbox-row {
  display: flex; align-items: center; gap: 8px;
}
.checkbox-row input { width: auto; }
.checkbox-row > span { margin-bottom: 0; color: var(--text); }

/* ---- Buttons ---- */
.btn-primary {
  background: var(--accent); color: var(--accent-fg); border: none;
  padding: 8px 16px; border-radius: 4px; font-weight: 600; cursor: pointer;
  font-size: 13px;
}
.btn-primary:hover { background: var(--accent-strong); }

.btn-small {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 4px 10px; font-size: 12px; cursor: pointer;
  text-decoration: none;
  display: inline-block;
  font-family: inherit;
}
.btn-small:hover { background: var(--border); text-decoration: none; }

.btn-danger {
  border-color: rgba(207, 34, 46, 0.4);
  color: var(--error);
}
.btn-danger:hover { background: rgba(207, 34, 46, 0.1); }

.btn-link {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 13px; padding: 4px 8px;
  font-family: inherit;
}
.btn-link:hover { color: var(--text); text-decoration: underline; }

.inline-form { display: inline-block; margin: 0; }

/* ---- Tables ---- */
table.data {
  width: 100%; border-collapse: collapse;
  background: var(--panel); border: 1px solid var(--border); border-radius: 6px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
table.data th, table.data td {
  padding: 8px 12px; text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data th { background: var(--bg); color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
table.data tr:last-child td { border-bottom: none; }
table.data .actions { display: flex; gap: 6px; flex-wrap: wrap; }

.data-channels td { padding: 4px 8px; }
.data-channels .row-form { display: contents; }

table.urls-table {
  width: 100%;
  margin-top: 12px;
  font-size: 12px;
}
table.urls-table td {
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
}
table.urls-table td:first-child { color: var(--muted); width: 140px; }
table.urls-table tr:last-child td { border-bottom: none; }

code {
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 12px;
  word-break: break-all;
  border: 1px solid var(--border);
}

/* ---- Badges & status ---- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}
.badge-ok { color: var(--ok); border-color: rgba(63, 185, 80, 0.4); }
.badge-warn { color: var(--warn); border-color: rgba(210, 153, 34, 0.4); }
.badge-err { color: var(--error); border-color: rgba(207, 34, 46, 0.4); }

.status-ok { color: var(--ok); }
.status-err { color: var(--error); }

/* ---- Stats grid ---- */
.stats-grid {
  display: grid;
  /* v2.5.134: shrink min from 140px → 100px so 6 cards fit on one
     narrower row, and cards take less horizontal space. */
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  /* v2.5.134: 16px → 8px padding, less box-shadow weight. */
  padding: 8px 10px;
  text-align: center;
  box-shadow: var(--shadow);
}
/* v2.5.134: 24px → 18px value, 12px → 10.5px label */
.stat-value { font-size: 18px; font-weight: 700; color: var(--text); }
.stat-label { color: var(--muted); font-size: 10.5px; margin-top: 2px; text-transform: uppercase; letter-spacing: 0.4px; }
.stat-label a { color: var(--muted); }
.stat-label a:hover { color: var(--accent); }

/* v2.5.135: per-source cards grid — same visual family as .stat-card
   but each card holds multiple lines (channels / movies / series /
   episodes) for one source. Operator wanted "boxes for each source"
   matching the top totals, not the table v2.5.134 shipped. */
.source-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}
.source-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  box-shadow: var(--shadow);
  font-size: 12px;
}
.source-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
  margin-bottom: 6px;
}
.source-card-name { font-weight: 600; color: var(--text); font-size: 13px; }
.source-card-kind { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.4px; }
.source-card-row {
  display: flex;
  justify-content: space-between;
  line-height: 1.6;
}
.source-card-row .lbl { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.3px; }
.source-card-row .val { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.source-card-row .val.zero { color: var(--muted); font-weight: 400; }

/* v2.5.135: generic collapsable dashboard panel — used by all the
   below-the-fold sections (currently streaming, sharing watch,
   upstream subs, per-source breakdown, sources, playlists). Each
   .dash-panel needs a [data-collapse-key=...] identifier so the
   collapse state persists per-section in localStorage. Optional
   [data-collapse-fp=...] fingerprint: when it changes between page
   loads, the saved collapse flag is invalidated and the section
   re-expands automatically (e.g. a new sharer appears). */
.dash-panel {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 14px;
}
.dash-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}
.dash-panel-title {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 12px;
  color: var(--muted);
  margin: 0;
  font-weight: normal;
}
.dash-panel-actions { display: flex; gap: 10px; align-items: baseline; }
.dash-panel-toggle {
  font-size: 11px;
  padding: 2px 8px;
  cursor: pointer;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
}
.dash-panel-toggle:hover { color: var(--text); }
.dash-panel-body.collapsed { display: none; }
/* Visual variants used for the sharing-watch (yellow) and
   active-streams (green) cards so the existing color cues survive. */
.dash-panel.warn { border-color: #b45309; background: rgba(180, 83, 9, 0.07); }
.dash-panel.warn .dash-panel-title { color: #b45309; }
.dash-panel.live { border-color: #16a34a; background: rgba(22, 163, 74, 0.06); }
.dash-panel.live .dash-panel-title { color: #16a34a; }

/* ---- Filter bar ---- */
.filter-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
  gap: 12px;
}
.filter-form { display: flex; align-items: center; gap: 8px; flex: 1; max-width: 600px; }
.filter-form input, .filter-form select { width: auto; flex: 1; min-width: 0; }
.filter-form select { flex: 0 1 180px; }

/* ---- Playlist card ---- */
.playlist-card { margin-bottom: 16px; }
.playlist-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 4px;
}
.playlist-meta { margin-bottom: 8px; }

/* ---- Flash messages ---- */
.flash {
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 16px;
  border: 1px solid;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.flash-ok  { background: rgba(63, 185, 80, 0.1); border-color: rgba(63, 185, 80, 0.3); color: var(--ok); }
.flash-err { background: rgba(207, 34, 46, 0.1); border-color: rgba(207, 34, 46, 0.3); color: var(--error); }
.flash-close {
  margin-left: auto;
  background: none;
  border: none;
  color: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  opacity: 0.6;
}
.flash-close:hover { opacity: 1; }

/* ---- Playlist connection blocks ---- */
.connection-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 12px;
}
.connection-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
}
.connection-block.recommended {
  border-color: rgba(63, 185, 80, 0.4);
  border-left-width: 3px;
}
.connection-block.fallback {
  opacity: 0.92;
}
.connection-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 4px;
}
.connection-title { font-weight: 600; font-size: 14px; }
.recommended-badge {
  background: rgba(63, 185, 80, 0.15); color: var(--ok);
  padding: 1px 8px; border-radius: 3px; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.fallback-badge {
  background: var(--panel-2); color: var(--muted);
  padding: 1px 8px; border-radius: 3px; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.connection-desc { margin: 4px 0 8px; }
.connection-note { margin: 6px 0 0; }

/* ---- Pagination ---- */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 8px;
  margin: 16px 0;
  flex-wrap: wrap;
}
.pagination .btn-small.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* ---- Misc ---- */
.kv { margin: 0; display: grid; grid-template-columns: 140px 1fr; gap: 8px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.urls { line-height: 1.8; }
.logout-form { margin: 0; }

/* ---- Responsive ---- */
@media (max-width: 720px) {
  .topbar { padding: 8px 12px; gap: 12px; }
  .topnav { gap: 0; flex-wrap: wrap; }
  .topnav a { padding: 4px 8px; font-size: 12px; }
  .container { padding: 0 12px; margin: 16px auto; }
  .form-grid { grid-template-columns: 1fr; }
  table.data { font-size: 12px; }
  table.data th, table.data td { padding: 6px 8px; }
}

/* ---- Bulk action toolbar (channels page + review page) ---- */
.bulk-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 12px;
  margin: 12px 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  flex-wrap: wrap;
}

.bulk-bar .bulk-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.bulk-bar label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.center { text-align: center; }

/* ============================================================
   v2.5.174 — mobile-friendly fixes
   Goals from the iPhone audit:
   - Stop char-by-char vertical wrapping in IP/URL/mono cells
   - Long tables (Currently streaming, NXTDASH, Audit, EPG-ids
     etc.) horizontally scroll instead of getting squished
   - Channels editor (sidebar | grid | inspector) stacks vertically
     below ~900px instead of trying to fit 3 columns on a phone
   Pure CSS — no template changes — so it's reversible by deleting
   this block.
   ============================================================ */

/* 1. Break long monospace strings (IPs, URLs, EPG ids, tokens) at
      any character so they don't render one-char-per-line. */
table.data td code,
table.data td .mono,
table.data .badge,
.mono,
code {
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: normal;
}

/* 2. Wrap-friendly tables in narrow containers. Dashboard tables
      (currently-streaming, sources, upstream-subs, sharing,
      playlists, NXTDASH, audit, EPG, etc.) all use the same
      `table.data` class. Give them an outer horizontal scroll. */
.card,
.dash-panel,
section.card {
  overflow-x: auto;
}

/* 3. On narrow screens, let tables take their natural content
      width and scroll horizontally instead of squishing column
      widths to oblivion. */
@media (max-width: 720px) {
  table.data {
    min-width: max-content;
  }
  table.data td,
  table.data th {
    white-space: normal;
  }
}

/* 4. Channels editor — `ch35-cols` is the 3-column layout container
      (sidebar | main | inspector). On phone, stack vertically and
      let each pane be full-width.

      v2.5.176: the previous attempt used attribute selectors
      `[class*="ch35-sidebar"]` etc which matched EVERY descendant
      (ch35-sidebar-entry, ch35-sidebar-list, ch35-main-header,
      ch35-inspector-body, etc) and forced all of them to
      `width: 100% !important`. That collapsed the channel table
      layout and rows disappeared. This version targets only the
      three direct children of ch35-cols by exact class name. */
@media (max-width: 900px) {
  .ch35-cols {
    display: flex !important;
    flex-direction: column !important;
  }
  .ch35-cols > .ch35-sidebar,
  .ch35-cols > .ch35-main,
  .ch35-cols > .ch35-inspector {
    width: 100% !important;
    max-width: 100% !important;
    flex: 1 1 auto !important;
  }
  .ch35-cols > .ch35-inspector {
    border-top: 1px solid var(--border);
    margin-top: 8px;
    padding-top: 12px;
  }
}

/* 5. Tighten the topnav further on the smallest phones — drop the
      letter spacing and bring lines closer so the 14-item menu
      doesn't dominate the viewport. */
@media (max-width: 480px) {
  .topnav { gap: 0 4px; row-gap: 4px; }
  .topnav a { padding: 3px 6px; font-size: 11px; }
}

/* 6. Inputs on phone: let them be full-width instead of cropping
      their tail. */
@media (max-width: 720px) {
  input[type="text"],
  input[type="url"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  textarea,
  select {
    max-width: 100%;
    box-sizing: border-box;
  }
}

/* 7. Long EPG-id badges (which look like
      `<code>FilmRisestree21JumpStreet.us</code>`) get extra wrap
      help — same as #1 but also applies outside table.data. */
.epg-id-badge,
[class*="epg-id"] {
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: normal;
}

/* ============================================================
   v2.5.250: help-mode toggle + button hint labels.
   The "?" button in the top-bar toggles `body.help-mode`. When on,
   every button (and button-styled link) with a `title=""` renders
   its title as a small inline label below the button. Operators
   can discover what every control does without hovering — useful
   on touch devices where native hover tooltips don't fire.
   ============================================================ */
.help-mode-toggle {
  background: none;
  border: 1px solid transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 2px 7px;
  border-radius: 50%;
  margin-right: 4px;
}
.help-mode-toggle:hover {
  border-color: var(--border);
  color: var(--text);
}
body.help-mode .help-mode-toggle {
  background: #fde7c4;
  color: #7a4a00;
  border-color: #d6c878;
}
.help-mode-glyph { font-weight: 700; }

/* Inline label below every button with a `title` attribute when the
   toggle is on. Absolute-positioned so it doesn't push neighboring
   elements around. Long titles wrap up to 220px wide. */
body.help-mode button[title]:not([title=""]),
body.help-mode a.btn-small[title]:not([title=""]),
body.help-mode a.btn-primary[title]:not([title=""]),
body.help-mode a.btn-link[title]:not([title=""]),
body.help-mode a.btn-danger[title]:not([title=""]),
body.help-mode input[type="submit"][title]:not([title=""]) {
  position: relative;
  overflow: visible;
}
body.help-mode button[title]:not([title=""])::after,
body.help-mode a.btn-small[title]:not([title=""])::after,
body.help-mode a.btn-primary[title]:not([title=""])::after,
body.help-mode a.btn-link[title]:not([title=""])::after,
body.help-mode a.btn-danger[title]:not([title=""])::after,
body.help-mode input[type="submit"][title]:not([title=""])::after {
  content: attr(title);
  position: absolute;
  top: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%);
  background: #fff8b8;
  color: #3a2a00;
  border: 1px solid #d6c878;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px;
  line-height: 1.25;
  white-space: normal;
  max-width: 220px;
  width: max-content;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  text-align: center;
  z-index: 100;
  pointer-events: none;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
/* Dark theme — flip the hint to a darker plate so it stays readable. */
:root[data-theme="dark"] body.help-mode button[title]:not([title=""])::after,
:root[data-theme="dark"] body.help-mode a.btn-small[title]:not([title=""])::after,
:root[data-theme="dark"] body.help-mode a.btn-primary[title]:not([title=""])::after,
:root[data-theme="dark"] body.help-mode a.btn-link[title]:not([title=""])::after,
:root[data-theme="dark"] body.help-mode a.btn-danger[title]:not([title=""])::after,
:root[data-theme="dark"] body.help-mode input[type="submit"][title]:not([title=""])::after {
  background: #2a2410;
  color: #fde7c4;
  border-color: #6a5318;
  box-shadow: 0 1px 2px rgba(0,0,0,0.4);
}
/* Help-mode hints can be clipped at the bottom of the page; give
   the main container a bit of extra padding when on. */
body.help-mode main.container { padding-bottom: 60px; }
