/* Rory Admin portal — web mirror of the Rory look (ultramarine + neutrals).
   Member app tokens live in app/lib/style.dart; this is an internal tool and
   deliberately does not share the tenant theming contract. */

:root {
  --rory-blue: #2e3dff;      /* Electric Ultramarine */
  --rory-blue-deep: #1B24C4;
  --rory-foam: #eaecff;
  --rory-periwinkle: #98a2ff;
  --ink: #14161f;
  --ink-2: #565b6b;
  --line: #e4e6ee;
  --bg: #f6f7fb;
  --card: #ffffff;
  --danger: #E5484D;
  --danger-deep: #C13640;    /* text-safe on light tints */
  --warning: #F59E0B;
  --warning-deep: #8a6116;   /* text-safe on light tints */
  --radius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 14px; }
.hidden { display: none !important; }
.muted { color: var(--ink-2); }
.error { color: var(--danger-deep); }
h1, h2 { margin: 0; font-weight: 650; }
h2 { font-size: 17px; }

/* Login gate */
.gate { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.gate-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 36px; width: 340px; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.gate-mark { width: 56px; height: 56px; margin: 0 auto; border-radius: 15px; background: var(--rory-blue); color: #fff; font-size: 24px; font-weight: 700; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.gate-mark img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gate-card .env-chip { margin: 0 auto; }
.gate-card input { text-align: center; }

/* Shell */
.topbar { display: flex; align-items: center; gap: 24px; padding: 14px 24px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--rory-blue); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 15px; overflow: hidden; }
.brand-mark img { width: 100%; height: 100%; object-fit: cover; display: block; }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.env-chip { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 3px 8px; border-radius: 999px; }
.env-chip.staging { background: #fdf3df; color: var(--warning-deep); }
.env-chip.production { background: #fbeaea; color: #a63a3f; }
.env-chip.local { background: var(--bg); color: var(--ink-2); }
.env-switch { width: auto; font-size: 12px; padding: 6px 8px; border-radius: 8px; color: var(--ink-2); }
.tab { border: 0; background: none; padding: 8px 14px; border-radius: 999px; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.tab.active { background: var(--rory-foam); color: var(--rory-blue-deep); font-weight: 600; }

.view { display: flex; gap: 24px; padding: 24px; align-items: flex-start; }
.list-pane { flex: 1; min-width: 0; }
.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }

/* Table */
.table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-2); font-weight: 600; background: #fafbfe; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: #f6f8ff; }
.table tbody tr.selected { background: var(--rory-foam); }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

.inst-cell { display: flex; align-items: center; gap: 12px; }
.inst-mark { width: 34px; height: 34px; border-radius: 10px; color: #fff; font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; flex: none; }
.inst-name { font-weight: 600; }
.inst-sub { color: var(--ink-2); font-size: 12px; }
.swatches { display: flex; gap: 6px; }
.swatch { width: 18px; height: 18px; border-radius: 6px; border: 1px solid rgba(0,0,0,0.12); }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--rory-foam); color: var(--rory-blue-deep); }
.badge.live { background: #e8f6ee; color: #1c7a4b; }
/* Lifecycle law: green means money moved or a thing completed. Everything
   else that just needs emphasis wears the brand foam. */
.badge.brand { background: var(--rory-foam); color: var(--rory-blue-deep); }

/* Editor */
.editor { width: 460px; flex: none; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; position: sticky; top: 80px; max-height: calc(100vh - 104px); overflow-y: auto; }
.fields { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; flex: 1; }
.field.small { flex: 0 0 90px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.field small { color: var(--ink-2); font-size: 11px; }
.field-row { display: flex; gap: 12px; }
.field-group { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 12px; margin: 0; }
.field-group legend { font-size: 12px; font-weight: 600; color: var(--ink-2); padding: 0 6px; }
input, select { border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; font-size: 14px; font-family: inherit; background: #fff; color: var(--ink); width: 100%; }
input:focus, select:focus { outline: 2px solid var(--rory-periwinkle); border-color: var(--rory-blue); }
input:disabled { background: var(--bg); color: var(--ink-2); }
.color-pair { display: flex; gap: 8px; align-items: center; }
.color-pair input[type="color"] { width: 40px; height: 36px; padding: 2px; flex: none; cursor: pointer; }
.color-pair .hex { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

/* Brand preview */
.preview { display: flex; gap: 12px; margin-bottom: 18px; }
.preview-card { flex: 1; border-radius: var(--radius); padding: 14px; border: 1px solid var(--line); }
.preview-card.dark { background: #171921; border-color: #171921; }
.preview-lockup { display: flex; align-items: center; gap: 10px; }
.preview-logo { width: 30px; height: 30px; border-radius: 9px; color: #fff; font-weight: 700; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.preview-fi { font-weight: 650; font-size: 13px; }
.preview-card.light .preview-fi { color: var(--ink); }
.preview-card.dark .preview-fi { color: #f2f3f8; }
.preview-chip { margin-top: 10px; display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.preview-note { margin-top: 10px; font-size: 11px; }
.preview-card.light .preview-note { color: var(--ink-2); }
.preview-card.dark .preview-note { color: #9aa0b2; }

/* Logo upload */
.logo-upload { display: flex; align-items: center; gap: 10px; }
.logo-upload small { flex: 1; }
.preview-logo-img { width: 30px; height: 30px; border-radius: 9px; object-fit: contain; background: #fff; border: 1px solid var(--line); }
.preview-logo-img.broken { visibility: hidden; }

/* Users navigator */
.user-filters { display: flex; gap: 10px; flex: 1; max-width: 520px; }
.user-filters select { width: auto; flex: none; max-width: 200px; }
#view-users .user-filters { max-width: 760px; justify-content: flex-end; }
#view-users .user-filters input { min-width: 220px; }
.user-filters .btn { flex: 0 0 auto; width: auto; white-space: nowrap; }
.detail-kind { font-size: 12px; font-weight: 600; color: var(--ink-2); margin: 16px 0 4px; }
.detail-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 7px 2px; border-bottom: 1px solid var(--line); font-size: 13px; }
.detail-row:last-child { border-bottom: 0; }
.detail-label { font-weight: 500; flex: none; }
.detail-value { text-align: right; }
.detail-value code { background: var(--bg); border-radius: 5px; padding: 1px 5px; font-size: 12px; }

/* Buttons */
.btn { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 9px 16px; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn:hover { border-color: var(--rory-periwinkle); }
.btn.primary { background: var(--rory-blue); border-color: var(--rory-blue); color: #fff; }
.btn.primary:hover { background: var(--rory-blue-deep); }
.btn.ghost { border: 0; background: none; color: var(--ink-2); }
.btn.danger { background: none; border-color: #f0d4d4; color: var(--danger-deep); }
.btn.danger:hover { border-color: var(--danger); }
.btn.small-remove { border: 0; background: none; color: var(--danger-deep); }
.editor-actions { display: flex; gap: 10px; align-items: center; padding-top: 4px; }
.spacer { flex: 1; }

/* Keyboard focus: tabs, buttons, and clickable table rows all show the ring. */
.tab:focus-visible,
.btn:focus-visible,
.table tbody tr:focus-visible { outline: 2px solid var(--rory-blue); outline-offset: 2px; }

/* Banno cards */
.banno-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.banno-card .fields { margin-top: 12px; }
.banno-head { display: flex; align-items: center; gap: 10px; }
.banno-head code { background: var(--rory-foam); color: var(--rory-blue-deep); border-radius: 6px; padding: 2px 8px; font-size: 12px; }
.secret-ref { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--ink-2); }

/* Task toggles */
.task-note { font-size: 11px; margin: 0; }
.task-kind { font-size: 12px; font-weight: 600; color: var(--ink-2); margin: 6px 0 2px; }
.task-row { display: flex; align-items: center; gap: 10px; padding: 7px 2px; border-bottom: 1px solid var(--line); }
.task-row:last-child { border-bottom: 0; }
.task-row input[type="checkbox"] { width: 16px; height: 16px; flex: none; accent-color: var(--rory-blue); cursor: pointer; }
.task-row .task-label { flex: 1; font-weight: 500; }
.task-row.off .task-label { color: var(--ink-2); text-decoration: line-through; }
.task-row .task-verify { flex: none; font: inherit; font-size: 12px; padding: 3px 6px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: inherit; cursor: pointer; }
.task-meta { color: var(--ink-2); font-size: 11px; white-space: nowrap; }
.task-fuel { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; background: var(--bg); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; color: var(--ink-2); }

/* Vehicle VIN editor */
.vin-row { margin: 8px 0 6px; }
.vin-row > input, .vin-row > select { flex: 1 1 auto; min-width: 0; }
.vin-row > .btn { flex: 0 0 auto; width: auto; white-space: nowrap; }
.vin-row input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; text-transform: uppercase; }
.vin-photo { max-width: 100%; max-height: 170px; display: block; margin: 10px auto 0; }

/* Verification queue */
.review-card { display: flex; gap: 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px; }
.review-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.review-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.review-reason { font-size: 13px; }
.review-evidence { width: 170px; flex: none; display: flex; align-items: center; justify-content: center; }
.review-evidence img { max-width: 170px; max-height: 130px; border-radius: 8px; border: 1px solid var(--line); object-fit: cover; }
.badge.danger-badge { background: #fbeaea; color: var(--danger-deep); }

/* Learn & earn lesson editor */
.lesson-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.lesson-card.off { opacity: 0.65; }
.lesson-card textarea { resize: vertical; font: inherit; }
.lesson-actions { display: flex; align-items: center; gap: 8px; }
.lesson-actions .task-row { border-bottom: 0; padding: 0; }

/* Offer art picker: thumbnails from the bundled card art collection. */
.offer-art { display: flex; gap: 8px; flex-wrap: wrap; }
.offer-art .art-choice { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; font-size: 11px; color: var(--ink-2); min-width: 72px; }
.offer-art .art-choice img { width: 44px; height: 44px; object-fit: contain; }
.offer-art .art-choice.none { justify-content: center; }
.offer-art input[type=radio] { display: none; }
.offer-art .art-choice:has(input:checked) { border-color: var(--rory-blue); outline: 2px solid var(--rory-blue); outline-offset: -2px; }

/* Full-page institution editor: editing hides the list so the tenant gets
   the whole page to work from. */
.view.editing .list-pane { display: none; }
.view.editing .editor { width: 100%; position: static; max-height: none; }
.view.editing .editor .fields { max-width: 900px; }
.lesson-head .field.small { max-width: 110px; }

/* Toast */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 13px; z-index: 20; }
.toast.error { background: var(--danger-deep); }

@media (max-width: 980px) {
  .view { flex-direction: column; }
  .editor { width: 100%; position: static; max-height: none; }
  #view-users .pane-head { align-items: flex-start; }
  #view-users .user-filters { flex-wrap: wrap; }
}

/* Palette contrast verdicts (where the tenant brand may show) */
.palette-checks { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 10px; }
.palette-checks:empty { display: none; }
.pcheck { font-size: 12px; font-weight: 600; border-radius: 999px; padding: 4px 10px; }
.pcheck em { font-style: normal; font-weight: 500; opacity: 0.85; }
.pcheck.pass { background: #e5f6ec; color: #17734a; }
.pcheck.warn { background: #fdf3df; color: var(--warning-deep); }
.pcheck.fail { background: #fdeaea; color: #a63a3f; }

/* Institution editor sections collapse (the page was getting crowded).
   Brand opens by default; everything else expands on demand. */
details.field-group > summary { font-size: 12px; font-weight: 600; color: var(--ink-2); cursor: pointer; list-style: none; display: flex; align-items: center; gap: 7px; user-select: none; }
details.field-group > summary::-webkit-details-marker { display: none; }
details.field-group > summary::before { content: "▸"; font-size: 10px; transition: transform 0.12s; }
details.field-group[open] > summary::before { transform: rotate(90deg); }
details.field-group > summary:hover { color: var(--ink); }

/* Reconciliation panel: attention without alarm — warning accent, ink text. */
.recon-card { background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--warning); border-radius: var(--radius); margin-bottom: 16px; padding: 12px 16px; }
.recon-card table { width: 100%; margin-top: 8px; font-size: 12px; }

/* Expanded payment row */
.pay-detail td { background: #fafbfe; cursor: default; padding: 16px 18px; }
.pd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px 18px; margin-bottom: 14px; }
.pd-cell { display: flex; flex-direction: column; gap: 2px; }
.pd-key { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-2); }
.pd-val { font-size: 13px; }
.pd-val code, .pd-event code { background: var(--rory-foam); border-radius: 5px; padding: 1px 5px; font-size: 11px; word-break: break-all; }
.pd-section { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-2); margin: 12px 0 6px; border-top: 1px solid var(--line); padding-top: 10px; }
.pd-event { display: flex; align-items: baseline; gap: 10px; padding: 5px 0; font-size: 12.5px; flex-wrap: wrap; }
.pd-event-at { color: var(--ink-2); font-size: 11.5px; white-space: nowrap; }
.pd-event-bits { flex: 1; min-width: 200px; }

/* Demo state personas (user editor) */
.persona-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin: 10px 0; }
.btn.persona { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 10px 12px; height: auto; }
.btn.persona small { font-weight: 400; line-height: 1.3; }

.pm-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.pm-actions .btn { padding: 4px 10px; font-size: 12px; }

/* auto.dev playground: simple by default, details on demand. */
/* width: 100% so the column never sizes to a wide table (.view stacks
   with align-items: flex-start on narrow screens). */
.ad-page { flex: 1; min-width: 0; width: 100%; max-width: 1080px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
#ad-body { display: flex; flex-direction: column; gap: 18px; }
.ad-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.ad-top p { margin: 4px 0 0; }
.ad-account { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12px; }
.ad-quota { color: var(--ink-2); }
.ad-quota.low { color: var(--warning-deep); font-weight: 600; }

.ad-search { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.ad-search-row { display: flex; gap: 10px; }
.ad-vin { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 18px; letter-spacing: 0.06em; text-transform: uppercase; padding: 13px 16px; border-radius: 12px; }
.ad-vin::placeholder { text-transform: none; letter-spacing: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif; font-size: 15px; color: #a9adbb; }
.btn.ad-go { padding: 0 26px; font-size: 15px; border-radius: 12px; }
.ad-search-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.ad-samples { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12.5px; }
.ad-chip { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 4px 11px; font-size: 12.5px; color: var(--ink); cursor: pointer; }
.ad-chip:hover { border-color: var(--rory-periwinkle); background: var(--rory-foam); }
.ad-budget { font-size: 12px; }
.ad-more { border-top: 1px solid var(--line); padding-top: 10px; }
.ad-more > summary { cursor: pointer; font-size: 13px; font-weight: 600; list-style: none; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.ad-more > summary::-webkit-details-marker { display: none; }
.ad-more > summary::before { content: "▸"; font-size: 10px; color: var(--ink-2); transition: transform 0.12s; }
.ad-more[open] > summary::before { transform: rotate(90deg); }
.ad-more > summary .muted { font-weight: 400; font-size: 12px; }
.ad-inputs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.ad-source { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px 12px; margin: 0; min-width: 0; }
.ad-source legend { font-size: 12px; font-weight: 700; padding: 0 6px; }
.ad-note { font-size: 11.5px; margin: 0 0 8px; }
.ad-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ad-field input::placeholder { color: #b3b7c4; }
.ad-field input[data-key="plate"], .ad-field input[data-key="plateState"] { text-transform: uppercase; }
.ad-field input[data-key="plate"]::placeholder, .ad-field input[data-key="plateState"]::placeholder { text-transform: none; }

/* Empty state */
.ad-empty { display: flex; gap: 18px; align-items: flex-start; background: var(--card); border: 1px dashed var(--line); border-radius: 16px; padding: 22px; }
.ad-empty-art { font-size: 30px; width: 56px; height: 56px; flex: none; border-radius: 16px; background: var(--rory-foam); display: flex; align-items: center; justify-content: center; }
.ad-empty h3 { margin: 0 0 4px; font-size: 16px; }
.ad-empty p { margin: 0; }
.ad-empty-list { margin: 10px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 13px; }
.ad-empty-list li::before { content: "✓"; color: var(--rory-blue); font-weight: 700; margin-right: 8px; }
.ad-empty-note { margin-top: 10px !important; font-size: 12.5px; }

/* Vehicle summary */
.ad-vehicle { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; display: grid; grid-template-columns: 220px minmax(0, 1fr) auto; gap: 20px; align-items: center; }
.ad-vehicle.none { grid-template-columns: 1fr; }
.ad-vehicle.none h3 { margin: 2px 0 4px; }
.ad-vehicle.none p { margin: 0; }
.ad-vehicle-photo { width: 220px; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; background: linear-gradient(135deg, var(--rory-foam), var(--bg)); }
.ad-vehicle-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ad-vehicle-photo:empty::after, .ad-vehicle-photo.empty::after { content: "No photo"; display: flex; height: 100%; align-items: center; justify-content: center; color: var(--ink-2); font-size: 12px; }
.ad-vehicle-kicker { font-size: 11px; color: var(--ink-2); }
.ad-vehicle-kicker code { letter-spacing: 0.05em; }
.ad-vehicle h3 { font-size: 22px; font-weight: 700; margin: 4px 0 8px; }
.ad-facts { display: flex; flex-wrap: wrap; gap: 6px; }
.ad-facts span { font-size: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }
.ad-flag { margin: 10px 0 0; font-size: 12px; color: var(--warning-deep); }
.ad-vehicle-stats { display: grid; gap: 12px; min-width: 190px; border-left: 1px solid var(--line); padding-left: 20px; }
.ad-stat-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-2); }
.ad-stat-value { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ad-stat-sub { font-size: 11.5px; color: var(--ink-2); min-height: 1em; }

/* Endpoint rows */
.ad-list, .ad-rest { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.ad-list-head { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 18px 10px; font-size: 12px; }
.ad-list-head h3 { font-size: 14px; margin: 0; }
.ad-row { border-top: 1px solid var(--line); }
.ad-row-head { width: 100%; display: flex; align-items: center; gap: 12px; padding: 13px 18px; background: none; border: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.ad-row-head:hover { background: #fafbfe; }
.ad-row-head:focus-visible { outline: 2px solid var(--rory-blue); outline-offset: -2px; }
.ad-row-label { font-weight: 600; flex: 0 0 170px; }
.ad-row-line { flex: 1; min-width: 0; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ad-chev { color: var(--ink-2); font-size: 18px; line-height: 1; transition: transform 0.15s; }
.ad-row.open .ad-chev { transform: rotate(90deg); }
.ad-dot { width: 22px; height: 22px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; background: var(--bg); color: var(--ink-2); border: 1px solid var(--line); }
.ad-dot.ok { background: #e5f6ec; color: #17734a; border-color: transparent; }
.ad-dot.warn { background: #fdf3df; color: var(--warning-deep); border-color: transparent; }
.ad-dot.fail { background: #fdeaea; color: #a63a3f; border-color: transparent; }
.ad-dot.locked { font-size: 10px; }
.ad-dot.idle { border-style: dashed; }
.ad-dot.running { border: 2px solid var(--rory-foam); border-top-color: var(--rory-blue); animation: ad-spin 0.8s linear infinite; }
@keyframes ad-spin { to { transform: rotate(360deg); } }
.ad-row-body { padding: 2px 18px 18px 52px; display: flex; flex-direction: column; gap: 12px; }
.ad-detail-blurb { margin: 0; font-size: 13px; }
.ad-detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 20px; font-size: 12.5px; background: var(--bg); border-radius: 10px; padding: 12px 14px; }
.ad-detail-key { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-2); margin-bottom: 4px; }
.ad-detail-actions { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.ad-meta { font-size: 11.5px; margin: 4px 0 0; }
.ad-needs { display: flex; flex-wrap: wrap; gap: 5px; }
.ad-need { font-size: 11px; border-radius: 6px; padding: 2px 7px; background: var(--card); color: var(--ink-2); border: 1px solid var(--line); }
.ad-need.have { background: var(--rory-foam); color: var(--rory-blue-deep); border-color: transparent; }
.ad-need.missing { border-color: var(--warning); color: var(--warning-deep); }
.ad-url { font-size: 11px; word-break: break-all; }
.ad-why { margin: 0; font-size: 12.5px; padding: 9px 12px; border-radius: 9px; background: var(--bg); }
.ad-why.fail { background: #fdf2f2; }
.ad-why.warn, .ad-why.locked { background: #fdf8ec; }
.ad-why code { background: rgba(0,0,0,0.05); border-radius: 5px; padding: 1px 5px; font-size: 11px; }
.ad-kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 16px; margin: 0; }
.ad-kv dt { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-2); }
.ad-kv dd { margin: 1px 0 0; font-size: 13px; overflow-wrap: anywhere; }
.ad-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; }
.ad-photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 7px; display: block; background: var(--bg); }
.ad-table-wrap { overflow-x: auto; }
.ad-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.ad-table th, .ad-table td { padding: 6px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.ad-table th { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-2); }
.ad-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.ad-raw > summary { font-size: 12px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.ad-raw .link-btn { margin: 8px 0 0; display: inline-block; }
.ad-raw pre { max-height: 320px; overflow: auto; background: #171921; color: #e6e8f2; border-radius: 9px; padding: 12px; font-size: 11.5px; margin: 8px 0 0; }
.ad-page .link-btn { border: 0; background: none; color: var(--rory-blue); font-size: 12px; font-weight: 600; cursor: pointer; padding: 0; text-decoration: none; }
.ad-page .link-btn:hover { text-decoration: underline; }

/* Collapsed "more endpoints" */
.ad-rest > summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 14px 18px; font-weight: 600; flex-wrap: wrap; }
.ad-rest > summary::-webkit-details-marker { display: none; }
.ad-rest > summary > span:first-child::before { content: "▸"; font-size: 10px; color: var(--ink-2); margin-right: 8px; display: inline-block; transition: transform 0.12s; }
.ad-rest[open] > summary > span:first-child::before { transform: rotate(90deg); }
.ad-rest > summary .muted { font-weight: 400; font-size: 12px; }
.ad-rest-note { margin: 0; padding: 0 18px 12px; font-size: 12.5px; }
.ad-rest-title { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2); padding: 12px 18px 6px; border-top: 1px solid var(--line); }
.ad-rest-group .ad-row:first-of-type { border-top: 0; }

.ad-plan { font-size: 11px; font-weight: 700; border-radius: 999px; padding: 3px 9px; white-space: nowrap; background: var(--bg); color: var(--ink-2); border: 1px solid var(--line); }
.ad-plan.plan-free { background: var(--rory-foam); color: var(--rory-blue-deep); border-color: transparent; }
.ad-plan.plan-growth { background: #fdf3df; color: var(--warning-deep); border-color: transparent; }
.ad-plan.plan-scale { background: #f1e9fb; color: #6a3fa0; border-color: transparent; }
.ad-pill { font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 3px 9px; }
.ad-pill.fail { background: #fdeaea; color: #a63a3f; }
.btn.small { padding: 6px 14px; font-size: 13px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.ad-skeleton { height: 54px; width: 100%; border-radius: 12px; background: linear-gradient(90deg, var(--bg) 25%, #eceef6 50%, var(--bg) 75%); background-size: 200% 100%; animation: ad-shimmer 1.1s linear infinite; }
.ad-skeleton.tall { height: 150px; grid-column: 1 / -1; }
@keyframes ad-shimmer { to { background-position: -200% 0; } }

@media (max-width: 900px) {
  .ad-inputs { grid-template-columns: 1fr; }
  .ad-vehicle { grid-template-columns: 1fr; }
  .ad-vehicle-photo { width: 100%; max-height: 220px; }
  .ad-vehicle-photo:empty, .ad-vehicle-photo.empty { display: none; }
  .ad-vehicle-stats { border-left: 0; padding-left: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); padding-top: 14px; }
  .ad-detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .ad-search-row { flex-direction: column; }
  .btn.ad-go { padding: 12px; }
  .ad-row-head { flex-wrap: wrap; }
  .ad-row-label { flex: 1 1 auto; }
  .ad-row-line { flex: 1 1 100%; order: 3; padding-left: 34px; white-space: normal; }
  .ad-row-body { padding-left: 18px; }
  .ad-fields { grid-template-columns: 1fr; }
  .ad-vehicle-stats { grid-template-columns: 1fr; }
}
