/* ──────────────────────────────────────────────────────────────────────
   Riglog design system — "calm, precise, native".
   One typeface (Inter), hairline borders, generous whitespace, GeoDrill
   blue only as accent. Brand layer stays swappable: tenant themes override
   the custom properties, never the components.
   ────────────────────────────────────────────────────────────────────── */

:root {
  --brand-primary: #0064AD;
  --brand-accent: #18B4E9;
  --brand-charcoal: #333E48;

  --rl-bg: #f7f8fa;
  --rl-surface: #ffffff;
  --rl-rail: #f1f3f6;
  --rl-text: #16191d;
  --rl-text-2: #5b6470;
  --rl-text-3: #8a93a0;
  --rl-border: rgba(22, 25, 29, 0.10);
  --rl-border-2: rgba(22, 25, 29, 0.18);
  --rl-accent: var(--brand-primary);
  --rl-accent-soft: rgba(0, 100, 173, 0.08);
  --rl-danger: #c5283d;
  --rl-danger-soft: #fbeaec;
  --rl-warning: #9a6700;
  --rl-warning-soft: #fdf3dc;
  --rl-success: #1a7f4e;
  --rl-success-soft: #e6f4ec;
  --rl-chart-grid: rgba(22, 25, 29, 0.06);
  --rl-chart-fill: rgba(0, 100, 173, 0.07);
  --rl-radius: 10px;
  --rl-radius-lg: 14px;
  --rl-font: "Inter", -apple-system, "Segoe UI", system-ui, sans-serif;
  /* Numerals read as instrument data, not prose ("Core Sample" direction) */
  --rl-mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, "Roboto Mono", monospace;
  --amma-orange: #F97316; /* Ammacatize mark — the A and i (AI) */
}

/* Dark is the default shell theme (set by the head script in base.html;
   light remains available from the header toggle). Palette is tuned to the
   foyer wall: #0c0f13 base, GeoDrill cyan #18B4E9 as the single accent. */
html[data-theme="dark"] {
  color-scheme: dark;
  /* "Core Sample": blue-steel greys biased toward the cyan accent — chosen
     neutrals, not flat black. Panels sit a step above the ground. */
  --rl-bg: #0C1218;
  --rl-surface: #10161D;
  --rl-rail: #0A0F14;
  --rl-text: #E6EDF3;
  --rl-text-2: #9FB0C0;
  --rl-text-3: #64798C;
  --rl-border: rgba(159, 193, 221, 0.10);
  --rl-border-2: rgba(159, 193, 221, 0.20);
  --rl-accent: #18B4E9;
  --rl-accent-soft: rgba(24, 180, 233, 0.10);
  --rl-danger: #E2604C;
  --rl-danger-soft: rgba(226, 96, 76, 0.14);
  --rl-warning: #E8B94A;
  --rl-warning-soft: rgba(232, 185, 74, 0.13);
  --rl-success: #43C88C;
  --rl-success-soft: rgba(67, 200, 140, 0.13);
  --rl-chart-grid: rgba(230, 237, 243, 0.05);
  --rl-chart-fill: rgba(24, 180, 233, 0.08);
}

/* ── Base ── */
body.rl-body {
  background: var(--rl-bg);
  color: var(--rl-text);
  font-family: var(--rl-font);
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  margin: 0;
}
/* Dark-only depth: a faint cyan wash bleeding from the top edge, the same
   trick the foyer wall uses. Invisible in light mode. */
html[data-theme="dark"] body.rl-body {
  background:
    radial-gradient(1100px 480px at 72% -140px, rgba(24, 180, 233, 0.07), transparent 60%),
    var(--rl-bg);
  background-attachment: fixed;
}
/* Cyan accent is too light to carry white text — flip to ink on dark. */
html[data-theme="dark"] .rl-btn.primary,
html[data-theme="dark"] .rl-w-btn.primary,
html[data-theme="dark"] .rl-w-seg input:checked + span { color: #08222c; }
html[data-theme="dark"] .rl-rail-item.active { box-shadow: 0 0 0 1px rgba(24, 180, 233, 0.12), 0 1px 8px rgba(0, 0, 0, 0.35); }
.rl-body h1, .rl-body h2, .rl-body h3, .rl-body h4 { font-weight: 600; letter-spacing: -0.015em; color: var(--rl-text); }
.rl-body a { color: var(--rl-accent); text-decoration: none; }
.rl-body a:hover { text-decoration: underline; }

/* ── App frame ── */
.rl-app { display: flex; min-height: 100vh; }
.rl-rail {
  width: 232px; flex: none; background: var(--rl-rail);
  border-right: 1px solid var(--rl-border);
  padding: 18px 12px; display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.rl-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rl-header {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 28px; border-bottom: 1px solid var(--rl-border);
  background: var(--rl-surface); position: sticky; top: 0; z-index: 50;
}
.rl-content { padding: 26px 28px 48px; max-width: 1280px; width: 100%; margin: 0 auto; }

/* ── Rail ── */
.rl-logo { display: flex; align-items: center; gap: 10px; padding: 2px 10px 16px; }
.rl-logo-mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--brand-primary);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; flex: none;
}
.rl-logo-mark img { width: 20px; height: 20px; display: block; }
.rl-logo-name { font-weight: 600; font-size: 14.5px; line-height: 1.15; }
.rl-logo-tenant { font-size: 11.5px; color: var(--rl-text-3); }
.rl-rail-section {
  padding: 14px 10px 5px; font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.07em; text-transform: uppercase; color: var(--rl-text-3);
}
/* .rl-app prefix outweighs the `.rl-body a` accent rule — rail links stay muted. */
.rl-app .rl-rail-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7.5px 10px; border-radius: 8px;
  color: var(--rl-text-2); font-weight: 500; font-size: 13.5px;
  text-decoration: none !important; cursor: pointer;
}
.rl-rail-item i { font-size: 16px; width: 18px; text-align: center; flex: none; }
.rl-rail-item:hover { background: var(--rl-accent-soft); color: var(--rl-text); }
.rl-rail-item.active { background: var(--rl-surface); color: var(--rl-text); border: 1px solid var(--rl-border); box-shadow: 0 1px 2px rgba(16,19,23,0.04); }
.rl-rail-item.active i { color: var(--rl-accent); }
.rl-rail-item.locked { color: var(--rl-text-3); cursor: default; }
.rl-rail-item.locked:hover { background: transparent; color: var(--rl-text-3); }
.rl-soon {
  margin-left: auto; font-size: 9.5px; font-weight: 600; letter-spacing: 0.05em;
  background: var(--rl-accent-soft); color: var(--rl-accent);
  padding: 2px 7px; border-radius: 99px; text-transform: uppercase;
}

/* ── Header ── */
.rl-search {
  display: flex; align-items: center; gap: 8px; flex: 1; max-width: 460px;
  border: 1px solid var(--rl-border); border-radius: 9px;
  padding: 7px 12px; color: var(--rl-text-3); background: var(--rl-bg);
}
.rl-search input { border: 0; outline: 0; background: transparent; flex: 1; font: inherit; color: var(--rl-text); }
.rl-avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--rl-accent-soft);
  color: var(--rl-accent); display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; flex: none;
}

/* ── Page scaffolding ── */
.rl-page-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.rl-page-title { font-size: 21px; margin: 0; }
.rl-page-sub { color: var(--rl-text-2); font-size: 13px; margin: 3px 0 0; }
.rl-page-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* ── Cards & stats ── */
.rl-card {
  background: var(--rl-surface); border: 1px solid var(--rl-border);
  border-radius: var(--rl-radius-lg); padding: 18px 20px;
}
.rl-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 24px; }
.rl-stat {
  background: linear-gradient(180deg, var(--rl-surface), var(--rl-bg) 160%);
  border: 1px solid var(--rl-border); border-radius: var(--rl-radius-lg); padding: 14px 16px;
}
.rl-stat-label {
  font-size: 10.5px; color: var(--rl-text-3); font-weight: 600;
  letter-spacing: 0.11em; text-transform: uppercase;
}
.rl-stat-value {
  font-size: 25px; font-weight: 600; letter-spacing: -0.02em; margin-top: 5px;
  font-family: var(--rl-mono); font-variant-numeric: tabular-nums;
}
.rl-stat-hint { font-size: 11.5px; color: var(--rl-text-3); margin-top: 3px; }
/* A figure the platform is suppressing rather than guessing. It must not read
   as a value — the whole point is that there isn't one — so it drops to the
   muted foreground and lets the hint underneath carry the reason. */
.rl-stat-value.rl-stat-none { color: var(--rl-text-3); font-weight: 400; }
.rl-stat-value.danger { color: var(--rl-danger); }
.rl-stat-value.warning { color: var(--rl-warning); }
.rl-stat-value.success { color: var(--rl-success); }
/* The one figure the page leads with — a single cyan-carried hero KPI. */
.rl-stat.hero { border-color: rgba(24, 180, 233, 0.35); box-shadow: 0 0 0 1px rgba(24, 180, 233, 0.12), 0 10px 26px -20px var(--rl-accent); }
.rl-stat.hero .rl-stat-value { color: var(--rl-accent); }

/* ── Lists / tables ── */
/* overflow-x:auto, NOT hidden: `hidden` clipped every wide table on a phone
   with no way to reach the cut-off columns (the workshop runs this on phones —
   35 list screens were affected). `.rl-list` has no height constraint, so
   overflow-y never triggers and no vertical scrollbar appears; the radius
   still clips. */
.rl-list { background: var(--rl-surface); border: 1px solid var(--rl-border); border-radius: var(--rl-radius-lg); overflow-x: auto; }
.rl-list-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; border-bottom: 1px solid var(--rl-border);
  font-weight: 600; font-size: 13.5px;
}
table.rl-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.rl-table th {
  text-align: left; font-size: 11px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--rl-text-3);
  padding: 10px 18px; border-bottom: 1px solid var(--rl-border);
}
.rl-table td { padding: 11px 18px; border-bottom: 1px solid var(--rl-border); vertical-align: middle; }
.rl-table tbody tr:last-child td { border-bottom: 0; }
.rl-table tbody tr { cursor: default; }
.rl-table tbody tr[data-href] { cursor: pointer; }
.rl-table tbody tr[data-href]:hover { background: var(--rl-accent-soft); }
.rl-table .num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--rl-mono); font-size: 12.5px; }
/* Read-only data tables (performance pages): quiet row highlight on hover. */
.rl-table.rl-hover tbody tr:hover td { background: var(--rl-accent-soft); }

/* ── In-cell margin bar (Project P&L GP column) ──
   A hairline of data-ink under the number: filled to the margin %, coloured
   by health. The number stays primary; the bar makes the column scannable. */
.rl-gpcell { position: relative; }
.rl-gpcell .rl-gpbar {
  position: absolute; left: 18px; right: 18px; bottom: 5px; height: 2px;
  background: var(--rl-border); border-radius: 2px; overflow: hidden;
}
.rl-gpbar i { display: block; height: 100%; border-radius: 2px; background: var(--rl-success); }
.rl-gpbar i.warn { background: var(--rl-warning); }
.rl-gpbar i.crit { background: var(--rl-danger); }

/* ── Status ── */
.rl-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 7px; vertical-align: 1px; }
.rl-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600; padding: 3px 10px; border-radius: 99px;
}
.rl-pill.ok, .rl-pill.active, .rl-pill.closed, .rl-pill.completed { background: var(--rl-success-soft); color: var(--rl-success); }
.rl-pill.warn, .rl-pill.due, .rl-pill.maintenance, .rl-pill.in_progress { background: var(--rl-warning-soft); color: var(--rl-warning); }
.rl-pill.bad, .rl-pill.overdue, .rl-pill.down { background: var(--rl-danger-soft); color: var(--rl-danger); }
.rl-pill.muted, .rl-pill.upcoming, .rl-pill.raised, .rl-pill.assigned, .rl-pill.sold, .rl-pill.retired, .rl-pill.cancelled { background: var(--rl-accent-soft); color: var(--rl-text-2); }

/* ── Buttons & forms ── */
.rl-btn {
  display: inline-flex; align-items: center; gap: 7px;
  font: inherit; font-weight: 550; font-size: 13px;
  padding: 7.5px 14px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--rl-border-2); background: var(--rl-surface); color: var(--rl-text);
  text-decoration: none !important; transition: background 0.12s ease, transform 0.05s ease;
}
.rl-btn:hover { background: var(--rl-bg); }
.rl-btn:active { transform: scale(0.98); }
.rl-btn.primary { background: var(--rl-accent); border-color: var(--rl-accent); color: #fff; }
.rl-btn.primary:hover { filter: brightness(1.07); background: var(--rl-accent); }
.rl-btn.danger { color: var(--rl-danger); border-color: var(--rl-danger); }
.rl-btn.sm { padding: 4.5px 10px; font-size: 12px; border-radius: 7px; }

.rl-field { margin-bottom: 14px; }
.rl-field label { display: block; font-size: 12.5px; font-weight: 550; margin-bottom: 5px; color: var(--rl-text-2); }
.rl-input, .rl-field input[type="text"], .rl-field input[type="number"], .rl-field input[type="date"],
.rl-field input[type="datetime-local"], .rl-field input[type="email"], .rl-field input[type="password"],
.rl-field input[type="file"], .rl-field select, .rl-field textarea {
  width: 100%; box-sizing: border-box; font: inherit; color: var(--rl-text);
  background: var(--rl-surface); border: 1px solid var(--rl-border-2);
  border-radius: 9px; padding: 8px 11px; outline: none;
}
.rl-field input:focus, .rl-field select:focus, .rl-field textarea:focus, .rl-input:focus {
  border-color: var(--rl-accent); box-shadow: 0 0 0 3px var(--rl-accent-soft);
}
.rl-error { color: var(--rl-danger); font-size: 12.5px; margin-top: 4px; }
.rl-help { color: var(--rl-text-3); font-size: 12px; margin-top: 4px; }

/* ── Home module launcher — the shell's sections as titled tile groups.
   Renders from shell_sections, so it is role- and permission-filtered the
   same way the rail is: a user only sees the groups they can enter. ── */
.rl-launcher { display: grid; gap: 20px; margin-bottom: 28px; }
.rl-launch-title {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.11em;
  text-transform: uppercase; color: var(--rl-text-3); margin-bottom: 8px;
}
.rl-launch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 8px; }
.rl-launch-tile {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  background: var(--rl-surface); border: 1px solid var(--rl-border);
  border-radius: var(--rl-radius); color: var(--rl-text);
  font-weight: 550; font-size: 13px; text-decoration: none !important;
}
.rl-launch-tile i { font-size: 17px; color: var(--rl-accent); flex: none; }
.rl-launch-tile:hover { border-color: var(--rl-border-2); background: var(--rl-accent-soft); }

/* ── Collapsible groups (rail sections + home launcher) ──
   Native <details>: keyboard- and screen-reader-accessible for free; the
   chevron mirrors state and the choice persists per user (base.html JS). */
.rl-rail-group > summary, .rl-launch-group > summary {
  cursor: pointer; user-select: none; list-style: none;
  display: flex; align-items: center; gap: 6px;
}
.rl-rail-group > summary::-webkit-details-marker,
.rl-launch-group > summary::-webkit-details-marker { display: none; }
.rl-rail-group > summary:focus-visible, .rl-launch-group > summary:focus-visible {
  outline: 2px solid var(--rl-accent); outline-offset: 2px; border-radius: 4px;
}
.rl-collapse-chev {
  margin-left: auto; font-size: 10px; color: var(--rl-text-3);
  transition: transform 0.15s ease;
}
details:not([open]) > summary .rl-collapse-chev { transform: rotate(-90deg); }
@media (prefers-reduced-motion: reduce) { .rl-collapse-chev { transition: none; } }
/* Collapsed rail groups keep a little rhythm between headings. */
.rl-rail-group { margin: 0; }
.rl-rail-group > summary.rl-rail-section { padding-right: 10px; }

/* ── Filter bar ── */
.rl-filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.rl-filters select, .rl-filters input {
  font: inherit; font-size: 13px; color: var(--rl-text);
  background: var(--rl-surface); border: 1px solid var(--rl-border-2);
  border-radius: 8px; padding: 6.5px 10px; outline: none;
}

/* ── Misc ── */
.rl-empty { padding: 38px 20px; text-align: center; color: var(--rl-text-3); font-size: 13.5px; }
.rl-empty i { font-size: 26px; display: block; margin-bottom: 8px; }
.rl-flash { border-radius: var(--rl-radius); padding: 11px 16px; margin-bottom: 16px; font-size: 13.5px; border: 1px solid; }
.rl-flash.success { background: var(--rl-success-soft); color: var(--rl-success); border-color: transparent; }
.rl-flash.error, .rl-flash.danger { background: var(--rl-danger-soft); color: var(--rl-danger); border-color: transparent; }
.rl-flash.info, .rl-flash.warning { background: var(--rl-warning-soft); color: var(--rl-warning); border-color: transparent; }
.rl-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 16px; }
.rl-kv { width: 100%; font-size: 13.5px; }
.rl-kv td { padding: 6px 0; }
.rl-kv td:first-child { color: var(--rl-text-2); width: 42%; }

/* ── Assistant panel ── */
.rl-asst {
  position: fixed; right: 18px; bottom: 18px; z-index: 200;
  width: 360px; max-width: calc(100vw - 24px); height: 480px; max-height: calc(100vh - 36px);
  display: flex; flex-direction: column;
  background: var(--rl-surface); border: 1px solid var(--rl-border-2);
  border-radius: var(--rl-radius-lg); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
/* The `hidden` attribute is how the panel closes — an author display rule
   would otherwise override it and the panel could never be dismissed. */
.rl-asst[hidden] { display: none; }
.rl-asst-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-bottom: 1px solid var(--rl-border); font-size: 13.5px;
}
.rl-asst-head .rl-btn:first-of-type { margin-left: auto; }
.rl-asst-status { font-size: 11.5px; color: var(--rl-text-3); }
.rl-asst-voice {
  margin-left: auto; max-width: 140px;
  font: inherit; font-size: 11.5px; color: var(--rl-text-2);
  background: var(--rl-bg); border: 1px solid var(--rl-border-2);
  border-radius: 7px; padding: 3px 6px; outline: none; cursor: pointer;
}
/* When the voice picker is visible it owns the right-push; cancel the button's
   auto-margin so the group isn't double-gapped. When the picker is hidden (no
   voices installed) this doesn't match, so the button still pushes right. */
.rl-asst-head .rl-asst-voice:not([hidden]) ~ .rl-btn:first-of-type { margin-left: 0; }
.rl-asst-log { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.rl-asst-msg {
  max-width: 85%; padding: 8px 12px; border-radius: 12px;
  font-size: 13.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: break-word;
}
.rl-asst-msg.user { align-self: flex-end; background: var(--rl-accent); color: #fff; border-bottom-right-radius: 4px; }
html[data-theme="dark"] .rl-asst-msg.user { color: #08222c; }
.rl-asst-msg.assistant { align-self: flex-start; background: var(--rl-bg); border: 1px solid var(--rl-border); border-bottom-left-radius: 4px; }
.rl-asst-msg.error { color: var(--rl-danger); border-color: var(--rl-danger-soft); }
.rl-asst-msg.pending { color: var(--rl-text-3); }
.rl-asst-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-top: 1px solid var(--rl-border);
}
.rl-asst-bar input {
  flex: 1; min-width: 0; font: inherit; font-size: 13.5px; color: var(--rl-text);
  background: var(--rl-bg); border: 1px solid var(--rl-border-2);
  border-radius: 9px; padding: 8px 11px; outline: none;
}
.rl-asst-bar input:focus { border-color: var(--rl-accent); box-shadow: 0 0 0 3px var(--rl-accent-soft); }
.rl-asst-mic {
  flex: none; width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--rl-border-2); background: var(--rl-surface);
  color: var(--rl-accent); font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  /* Hold-to-talk: the press must not become a scroll/long-press gesture. */
  touch-action: none; -webkit-user-select: none; user-select: none;
}
.rl-asst-mic.live {
  background: var(--rl-danger); border-color: var(--rl-danger); color: #fff;
  animation: rl-asst-pulse 1.2s ease-in-out infinite;
}
/* While recording the ring tracks your actual voice level (--rl-level, 0–1),
   so "it isn't hearing me" is visible instead of guessed. The timed pulse
   above covers the moment before the meter reports. */
.rl-asst-mic.live[style*="--rl-level"] {
  animation: none;
  box-shadow: 0 0 0 calc(var(--rl-level, 0) * 14px) var(--rl-danger-soft);
  transition: box-shadow 80ms linear;
}
@keyframes rl-asst-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--rl-danger-soft); }
  50% { box-shadow: 0 0 0 9px transparent; }
}
@media (max-width: 600px) {
  .rl-asst { right: 8px; bottom: 8px; height: 70vh; }
  /* A bigger target on a phone — hit it with a knuckle, gloves on. */
  .rl-asst-mic { width: 52px; height: 52px; font-size: 20px; }
}

/* ── Powered by Ammacatize ── */
.rl-powered { font-size: 10.5px; color: var(--rl-text-3); }
.rl-powered-mark { color: var(--rl-text-2) !important; font-weight: 600; text-decoration: none !important; }
.rl-powered-mark span { color: var(--amma-orange); }
.rl-powered-footer { display: block; text-align: center; padding: 28px 0 0; }

@media (max-width: 860px) {
  .rl-rail { display: none; }
  .rl-content { padding: 18px 14px 40px; }
}

/* ──────────────────────────────────────────────────────────────────────
   Workshop mode — mobile-first, glove-and-sunlight UI (/w/).
   Huge tap targets, maximum contrast, minimal text per screen.
   Reuses the rl tokens above; no new colours.
   ────────────────────────────────────────────────────────────────────── */
.rl-w { max-width: 480px; margin: 0 auto; }
.rl-w-title { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 4px; }
.rl-w-sub { font-size: 15px; color: var(--rl-text-2); margin: 0 0 18px; }
.rl-w-label {
  display: block; font-size: 13px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--rl-text-2); margin: 18px 0 8px;
}

.rl-w-grid { display: grid; gap: 14px; margin: 16px 0; }

.rl-w-btn {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; box-sizing: border-box; min-height: 64px;
  font: inherit; font-size: 17px; font-weight: 600; line-height: 1.3;
  padding: 12px 18px; border-radius: 14px; cursor: pointer;
  border: 1px solid var(--rl-border-2); background: var(--rl-surface); color: var(--rl-text);
  text-decoration: none !important; text-align: center;
}
.rl-w-btn i { font-size: 22px; flex: none; }
.rl-w-btn:active { transform: scale(0.98); }
.rl-w-btn.primary { background: var(--rl-accent); border-color: var(--rl-accent); color: #fff; }
.rl-w-btn.danger { background: var(--rl-danger); border-color: var(--rl-danger); color: #fff; }
.rl-w-btn.success { background: var(--rl-success); border-color: var(--rl-success); color: #fff; }
/* An action that exists but isn't available yet — rendered as a div, so it is
   neither tappable nor focusable; the label carries the reason. */
.rl-w-btn.disabled {
  background: transparent; color: var(--rl-text-3);
  border-style: dashed; cursor: default; font-weight: 500;
}
.rl-w-btn.disabled:active { transform: none; }

.rl-w-badge {
  min-width: 28px; height: 28px; padding: 0 8px; border-radius: 99px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--rl-danger); color: #fff; font-size: 14px; font-weight: 700;
}
.rl-w-btn.primary .rl-w-badge, .rl-w-btn.danger .rl-w-badge { background: #fff; color: var(--rl-danger); }

/* Huge numeric display input (meter readings, hours) */
.rl-w-num {
  width: 100%; box-sizing: border-box;
  font: inherit; font-size: 34px; font-weight: 600; text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--rl-text); background: var(--rl-surface);
  border: 1px solid var(--rl-border-2); border-radius: 14px;
  padding: 14px 16px; outline: none;
}
.rl-w-num:focus { border-color: var(--rl-accent); box-shadow: 0 0 0 4px var(--rl-accent-soft); }

/* Big search / manual-entry input */
.rl-w-search {
  width: 100%; box-sizing: border-box; font: inherit; font-size: 18px;
  color: var(--rl-text); background: var(--rl-surface);
  border: 1px solid var(--rl-border-2); border-radius: 14px;
  min-height: 56px; padding: 12px 16px; outline: none;
}
.rl-w-search:focus { border-color: var(--rl-accent); box-shadow: 0 0 0 4px var(--rl-accent-soft); }

/* Big list rows */
.rl-w-rows {
  background: var(--rl-surface); border: 1px solid var(--rl-border);
  border-radius: 14px; overflow: hidden; margin: 16px 0;
}
.rl-w-row {
  display: flex; align-items: center; gap: 14px;
  min-height: 56px; padding: 12px 16px;
  border-bottom: 1px solid var(--rl-border);
  color: var(--rl-text); font-size: 16px; text-decoration: none !important;
}
.rl-w-row:last-child { border-bottom: 0; }
.rl-w-row:active { background: var(--rl-accent-soft); }
.rl-w-row-main { flex: 1; min-width: 0; }
.rl-w-row-title { font-weight: 600; }
.rl-w-row-sub { font-size: 13.5px; color: var(--rl-text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rl-w-row i.bi-chevron-right { color: var(--rl-text-3); flex: none; }

/* Segmented toggle — works without JS (hidden radios + labels) */
.rl-w-seg {
  display: flex; border: 1px solid var(--rl-border-2); border-radius: 14px;
  overflow: hidden; background: var(--rl-surface);
}
.rl-w-seg label { flex: 1; position: relative; cursor: pointer; }
.rl-w-seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rl-w-seg span {
  display: flex; align-items: center; justify-content: center;
  min-height: 56px; padding: 8px 6px;
  font-size: 16px; font-weight: 600; color: var(--rl-text-2);
  border-left: 1px solid var(--rl-border);
}
.rl-w-seg label:first-child span { border-left: 0; }
.rl-w-seg input:checked + span { background: var(--rl-accent); color: #fff; }
.rl-w-seg input:focus-visible + span { box-shadow: inset 0 0 0 3px var(--rl-accent-soft); }
.rl-w-seg.danger-last label:last-child input:checked + span { background: var(--rl-danger); }

/* Stepper (− value +) */
.rl-w-stepper { display: flex; align-items: stretch; gap: 10px; }
.rl-w-step {
  flex: none; width: 72px; min-height: 64px;
  font: inherit; font-size: 30px; font-weight: 700; cursor: pointer;
  border: 1px solid var(--rl-border-2); border-radius: 14px;
  background: var(--rl-surface); color: var(--rl-text);
}
.rl-w-step:active { background: var(--rl-accent-soft); transform: scale(0.97); }
.rl-w-stepper .rl-w-num { flex: 1; min-width: 0; }

/* Big error + status */
.rl-w-error {
  background: var(--rl-danger-soft); color: var(--rl-danger);
  border: 2px solid var(--rl-danger); border-radius: 14px;
  font-size: 17px; font-weight: 600; padding: 14px 16px; margin: 0 0 16px;
}
.rl-w-pill { font-size: 14px; padding: 6px 14px; }
.rl-w-big { font-size: 44px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.rl-w-meter { display: flex; align-items: baseline; gap: 10px; font-size: 16px; color: var(--rl-text-2); }
.rl-w-meter strong { font-size: 22px; color: var(--rl-text); font-variant-numeric: tabular-nums; }

.rl-w-back {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 48px; padding: 8px 4px; margin-bottom: 6px;
  font-size: 16px; font-weight: 600; color: var(--rl-text-2);
  text-decoration: none !important;
}
.rl-w-back:active { color: var(--rl-text); }

.rl-w-video {
  width: 100%; min-height: 260px; border-radius: 14px;
  background: #000; object-fit: cover; display: block;
}
.rl-w-textarea {
  width: 100%; box-sizing: border-box; font: inherit; font-size: 17px;
  color: var(--rl-text); background: var(--rl-surface);
  border: 1px solid var(--rl-border-2); border-radius: 14px;
  padding: 14px 16px; outline: none;
}
.rl-w-textarea:focus { border-color: var(--rl-accent); box-shadow: 0 0 0 4px var(--rl-accent-soft); }
.rl-w-file { font-size: 15px; }

/* ── Work record — the description laid out as the crews wrote it.
   The substance of a work order, so it reads at body size, not as a footnote. */
.rl-rec { font-size: 14.5px; line-height: 1.6; color: var(--rl-text); }
.rl-rec-sect { padding: 11px 0; border-top: 1px solid var(--rl-border); }
.rl-rec-sect:first-child { border-top: 0; padding-top: 0; }
.rl-rec-lbl {
  font-size: 11px; letter-spacing: .05em; text-transform: uppercase;
  color: var(--rl-text-3); font-weight: 600; margin: 0 0 6px;
}
.rl-rec p, .rl-rec li { max-width: 68ch; }
.rl-rec-kv { display: grid; grid-template-columns: 92px 1fr; gap: 7px 14px; align-items: baseline; }
.rl-rec-facts { display: flex; flex-wrap: wrap; gap: 8px; }
.rl-rec-fact {
  background: var(--rl-accent-soft); border: 1px solid var(--rl-border-2);
  border-radius: 6px; padding: 4px 9px; font-size: 12px; color: var(--rl-text-2);
}
.rl-rec-fact b { color: var(--rl-text); font-weight: 600; font-variant-numeric: tabular-nums; }
.rl-rec-steps { list-style: none; margin: 0; padding: 0; counter-reset: rl-step; }
.rl-rec-steps li { display: flex; gap: 11px; padding: 5px 0; }
.rl-rec-steps li::before {
  counter-increment: rl-step; content: counter(rl-step);
  flex: none; width: 19px; height: 19px; margin-top: 2px; border-radius: 50%;
  background: var(--rl-accent-soft); border: 1px solid var(--rl-border-2);
  color: var(--rl-accent); font-size: 10.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.rl-rec-badge {
  display: inline-block; font-size: 10.5px; padding: 3px 9px; border-radius: 20px;
  font-weight: 700; letter-spacing: .05em; background: var(--rl-accent-soft); color: var(--rl-text-2);
}
.rl-rec-fail { background: var(--rl-danger-soft); color: var(--rl-danger); }
.rl-rec-caution { background: var(--rl-warning-soft); color: var(--rl-warning); }
.rl-rec-src { font-size: 11px; color: var(--rl-text-3); margin: 10px 0 0; font-style: italic; }
/* Workshop screens are read at arm's length with gloves on. */
.rl-w .rl-rec { font-size: 16px; }
.rl-w .rl-rec-kv { grid-template-columns: 104px 1fr; }

/* ── Service certificate — one block per service, not one table row.
   A row could hold a truncated title and nothing else, which is why the
   narrative ended up in a tooltip that never printed. Colours come from the
   --rl-* tokens so the certificate's print block, which redefines the tokens
   rather than allow-listing components, recolours these for paper too. */
.rl-svc { padding: 18px 20px; }
.rl-svc + .rl-svc { border-top: 1px solid var(--rl-border); }
.rl-svc-head { margin-bottom: 12px; }
.rl-svc-grade { margin: 0 0 4px; font-size: 16px; font-weight: 700; color: var(--rl-text); }
.rl-svc-meta { font-size: 12.5px; color: var(--rl-text-2); line-height: 1.7; }
.rl-svc-title { margin: 0 0 12px; font-size: 14.5px; color: var(--rl-text); max-width: 68ch; }
.rl-svc-rec { margin: 0 0 12px; }
.rl-svc-lbl {
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--rl-accent); font-weight: 700; margin: 0 0 6px;
}
.rl-svc-none { margin: 0 0 12px; font-size: 13.5px; color: var(--rl-text-3); font-style: italic; }
.rl-svc-basis { margin: 0; font-size: 11.5px; color: var(--rl-text-3); }
