/* The Lighthouse fixture library — web UI (public site + admin console).
   Light theme by default, dark theme from prefers-color-scheme. AD-DA brand: cyan accent, steel grey. */

:root {
  color-scheme: light dark;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef2f5;
  --surface-3: #e3e9ee;
  --text: #15191d;
  --muted: #56626c;
  --border: #d3dbe1;
  --border-strong: #b7c2ca;
  --accent: #0b76a6;          /* AA on white (4.9:1) */
  --accent-hover: #095f86;
  --accent-soft: #e2f3fa;
  --accent-text: #ffffff;
  --brand: #1ba7d8;
  --ok: #17703a;
  --ok-soft: #e3f4e8;
  --warn: #8a5a00;
  --warn-soft: #fff3d6;
  --danger: #b42318;
  --danger-soft: #fde8e6;
  --focus: #1b8ccf;
  --shadow: 0 1px 2px rgba(16, 24, 32, .06), 0 2px 8px rgba(16, 24, 32, .05);
  --radius: 10px;
  --radius-sm: 6px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  /* DMX feature groups */
  --f-dimmer: #f2c14e; --f-color: #e0618f; --f-position: #4a90d9; --f-beam: #8e6bd8; --f-gobo: #3fae8c;
  --f-focus: #5bbcd6; --f-shapers: #c98a4b; --f-prism: #a5c94a; --f-control: #8d99a6; --f-video: #d96a4a; --f-other: #9aa5ad;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1215;
    --surface: #161c21;
    --surface-2: #1d252b;
    --surface-3: #263037;
    --text: #e5eaee;
    --muted: #9aa7b1;
    --border: #2b353d;
    --border-strong: #3b4851;
    --accent: #45bde8;
    --accent-hover: #74cff0;
    --accent-soft: #12303d;
    --accent-text: #061a23;
    --ok: #5fd08a;
    --ok-soft: #12301f;
    --warn: #f0c050;
    --warn-soft: #33290f;
    --danger: #ff8a80;
    --danger-soft: #3a1714;
    --focus: #6fd0f5;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 2px 10px rgba(0, 0, 0, .25);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); background: var(--bg); color: var(--text); min-height: 100vh; display: flex; flex-direction: column; }
img, svg { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.75rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75em; }
code, .mono { font-family: var(--mono); font-size: .88em; }
code { background: var(--surface-2); padding: .05em .35em; border-radius: 4px; overflow-wrap: anywhere; }
pre { font-family: var(--mono); font-size: 12px; background: var(--surface-2); padding: 8px; border-radius: var(--radius-sm); overflow: auto; max-height: 320px; }
hr { border: 0; border-top: 1px solid var(--border); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
h1:focus { outline: none; }

.sr-only, .offscreen { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--accent); color: var(--accent-text); padding: 8px 14px; border-radius: var(--radius-sm); font-weight: 600; }
.skip-link:focus { top: 8px; color: var(--accent-text); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.strong { font-weight: 600; }
.plain { list-style: none; margin: 0; padding: 0; }
.inline { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: center; }
.error-text { color: var(--danger); font-weight: 600; }
.ok-text { color: var(--ok); }
.icon { width: 1.1em; height: 1.1em; flex: none; vertical-align: -.18em; }

/* ------------------------------------------------------------ masthead, nav, footer */
.masthead { background: var(--surface); border-bottom: 1px solid var(--border); }
.topnav { max-width: 1240px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--surface); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; padding: 10px 0; font-size: 1.05rem; }
.brand:hover { color: var(--text); }
.brand img { border-radius: 6px; }
/* AD-DA.ca logo, top left (light / dark variant picked by prefers-color-scheme) */
.brand .logo { display: inline-flex; line-height: 0; }
.brand .logo img { height: 40px; width: auto; border-radius: 0; }
.brand .logo + span { border-left: 1px solid var(--border); padding-left: 10px; }
.login-brand .logo img { height: 56px; width: auto; }
.brand-sub { color: var(--muted); font-weight: 400; }
.topnav ul { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; flex-wrap: wrap; }
.topnav a[data-nav] { display: inline-flex; align-items: center; gap: 6px; padding: 14px 12px; color: var(--muted); text-decoration: none; font-weight: 500; border-bottom: 3px solid transparent; }
.topnav a[data-nav]:hover { color: var(--text); }
.topnav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--brand); }
.count { display: inline-block; min-width: 1.4em; padding: 0 .4em; border-radius: 999px; background: var(--accent); color: var(--accent-text); font-size: .75rem; font-weight: 700; text-align: center; line-height: 1.5; }
.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 24px 16px 40px; flex: 1; }
.site-footer { border-top: 1px solid var(--border); background: var(--surface); margin-top: auto; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding: 18px 16px; font-size: .9rem; }
.footer-inner p { margin: 0; }

/* ------------------------------------------------------------ controls */
input, select, textarea, button { font: inherit; color: inherit; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 7px 10px; min-height: 38px; max-width: 100%;
}
textarea { width: 100%; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > label { font-weight: 600; font-size: .9rem; }
.field.grow { flex: 1 1 260px; }
.field .hint, .hint { color: var(--muted); font-size: .8rem; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 14px; min-height: 38px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; line-height: 1.2; }
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn:disabled, .btn.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-text); }
.btn-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 4px 9px; min-height: 32px; font-size: .85rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
.stack { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.stack-form { display: flex; flex-direction: column; gap: 12px; }
.stack-form > .btn { align-self: flex-start; }
.stack-form.narrow { max-width: 420px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-top: 10px; }
.inline-form > div[aria-live] { flex-basis: 100%; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 8px; }
.input-icon { position: relative; display: flex; }
.input-icon .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon input { padding-left: 34px !important; width: 100%; }

/* ------------------------------------------------------------ badges, callouts, chips */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: .75rem; font-weight: 600; line-height: 1.6;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
.badge-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge-accent, .badge-cat { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge-ver { background: transparent; color: var(--text); border-color: var(--border-strong); font-family: var(--mono); }
.badge-origin { background: transparent; }
.callout { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); margin: 0 0 14px; }
.callout > .icon { margin-top: .2em; }
.callout ul { margin: .4em 0 0; padding-left: 1.2em; }
.callout-danger { background: var(--danger-soft); border-color: transparent; color: var(--text); }
.callout-danger > .icon { color: var(--danger); }
.callout-warn { background: var(--warn-soft); border-color: transparent; }
.callout-warn > .icon { color: var(--warn); }
.callout-ok { background: var(--ok-soft); border-color: transparent; }
.callout-ok > .icon { color: var(--ok); }
.callout-info { background: var(--accent-soft); border-color: transparent; }
.callout-info > .icon { color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 4px 2px 9px; border-radius: 999px; background: var(--surface-2); font-size: .8rem; max-width: 100%; }
.chip > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-n { background: var(--surface); border-radius: 999px; padding: 0 7px; font-family: var(--mono); font-size: .75rem; }
.chip-more { padding-right: 9px; color: var(--muted); }

.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 20px 0; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.5s; } * { scroll-behavior: auto !important; transition: none !important; } }
.empty { color: var(--muted); padding: 18px 0; }
.empty-state { text-align: center; padding: 40px 16px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty-state .icon { width: 40px; height: 40px; }

/* ------------------------------------------------------------ panels, cards */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin: 0 0 18px; box-shadow: var(--shadow); min-width: 0; }
.panel > h2:first-child, .panel > legend { margin-top: 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.card-grid > li { display: flex; min-width: 0; }
.fixture-card { display: flex; flex-direction: column; gap: 8px; width: 100%; transition: border-color .15s; }
.fixture-card:hover, .fixture-card:focus-within { border-color: var(--accent); }
.fixture-card.is-deprecated { opacity: .85; }
.card-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.manufacturer { color: var(--muted); font-size: .85rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.card-title { font-size: 1.1rem; margin: 0; overflow-wrap: anywhere; }
.card-title a { color: var(--text); text-decoration: none; }
.card-title a:hover { color: var(--accent); text-decoration: underline; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: .85rem; }
.card-modes { margin: 0; font-size: .9rem; }
.card-actions { margin-top: auto; display: flex; justify-content: flex-end; padding-top: 4px; }

/* ------------------------------------------------------------ catalogue */
.hero { margin-bottom: 18px; }
.lead { font-size: 1.05rem; color: var(--muted); max-width: 70ch; }
.search-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); margin-bottom: 14px; }
.search-bar select { min-width: 180px; }
.result-count { color: var(--muted); font-size: .9rem; min-height: 1.5em; }
.results[aria-busy="true"] { opacity: .6; }
.pager { display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap; margin: 22px 0 6px; }
.page-numbers { display: flex; gap: 4px; flex-wrap: wrap; }
.page { display: inline-flex; align-items: center; gap: 4px; min-width: 38px; min-height: 38px; justify-content: center; padding: 0 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); text-decoration: none; color: var(--text); }
.page:hover { border-color: var(--accent); color: var(--accent); }
.page.current { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 700; }
.page.disabled { opacity: .45; }
.page.gap { border: 0; background: none; min-width: 20px; }

/* ------------------------------------------------------------ fixture page */
.breadcrumb { font-size: .9rem; color: var(--muted); margin-bottom: 10px; }
.fixture-head { margin-bottom: 16px; }
.fixture-head h1 { margin: 2px 0 8px; font-size: 2rem; overflow-wrap: anywhere; }
.fixture-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.fixture-side { position: sticky; top: 12px; }
.modes-pick { border: 0; padding: 0; margin: 0 0 12px; }
.modes-pick ul li { padding: 3px 0; }
.modes-pick .check { width: 100%; }
.modes-pick .check > span:nth-child(2) { flex: 1; overflow-wrap: anywhere; }
.versions { list-style: none; margin: 0; padding: 0; }
.versions li { padding: 10px 0; border-top: 1px solid var(--border); }
.versions li:first-child { border-top: 0; padding-top: 0; }
.version-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.version-note { margin: 4px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.converter-notes { margin: 14px 0; }
.converter-notes summary { cursor: pointer; color: var(--muted); }

.mode-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.mode-tab { display: inline-flex; gap: 8px; align-items: baseline; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; font-weight: 600; }
.mode-tab:hover { border-color: var(--accent); }
.mode-tab[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.mode-tab[aria-selected="true"] .muted { color: inherit; opacity: .85; }

.footprint { margin: 0 0 16px; }
.fp-strip { display: flex; flex-wrap: wrap; gap: 3px; }
.fp-cell { width: 58px; min-height: 48px; border-radius: 5px; padding: 3px 4px; display: flex; flex-direction: column; justify-content: space-between;
  background: var(--surface-2); border-top: 4px solid var(--fc, var(--f-other)); font-size: .72rem; overflow: hidden; }
.fp-cell.fp-fine { opacity: .7; border-top-style: dashed; }
.fp-empty { border-top-color: var(--border); color: var(--muted); }
.fp-n { font-family: var(--mono); color: var(--muted); }
.fp-a { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.footprint figcaption { margin-top: 6px; font-size: .8rem; }
.f-dimmer { --fc: var(--f-dimmer); } .f-color { --fc: var(--f-color); } .f-position { --fc: var(--f-position); } .f-beam { --fc: var(--f-beam); }
.f-gobo { --fc: var(--f-gobo); } .f-focus { --fc: var(--f-focus); } .f-shapers { --fc: var(--f-shapers); } .f-prism { --fc: var(--f-prism); }
.f-control { --fc: var(--f-control); } .f-video { --fc: var(--f-video); } .f-other { --fc: var(--f-other); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--fc, var(--f-other)); margin-right: 6px; vertical-align: middle; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--border-strong); margin-right: 5px; vertical-align: middle; }
.attr { white-space: nowrap; }

/* ------------------------------------------------------------ tables */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 2px solid var(--border); white-space: nowrap; }
table.data td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data tbody tr:hover { background: var(--surface-2); }
table.channels tr.virtual td { color: var(--muted); }
.fns { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; min-width: 200px; }
.fns summary { cursor: pointer; }
ul.sets { list-style: none; margin: 4px 0 4px 12px; padding: 0 0 0 10px; border-left: 2px solid var(--border); }
.row-actions { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
table.api td:first-child { width: 80px; }
.method { font-family: var(--mono); font-size: .75rem; font-weight: 700; padding: 2px 6px; border-radius: 4px; background: var(--surface-2); }
.method-get { color: var(--ok); } .method-post { color: var(--accent); } .method-delete { color: var(--danger); } .method-patch, .method-put { color: var(--warn); }

@media (max-width: 760px) {
  table.data.responsive thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.data.responsive, table.data.responsive tbody, table.data.responsive tr, table.data.responsive td { display: block; width: 100%; }
  table.data.responsive tr { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 10px; padding: 6px 0; background: var(--surface); }
  table.data.responsive td { border: 0; padding: 4px 12px; display: flex; gap: 10px; }
  table.data.responsive td::before { content: attr(data-label); flex: 0 0 34%; font-size: .75rem; font-weight: 700; text-transform: uppercase; color: var(--muted); padding-top: 2px; }
  table.data.responsive td[data-label=""]::before { content: none; }
  table.data.responsive td > * { min-width: 0; }
  .row-actions { justify-content: flex-start; }
}

/* ------------------------------------------------------------ basket, docs */
.basket-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.basket-items { display: flex; flex-direction: column; gap: 12px; }
.basket-item-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.basket-item.is-missing { border-color: var(--danger); }
.mode-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 14px; }
.mode-grid .check { width: 100%; }
.mode-grid .check > span:nth-child(2) { flex: 1; overflow-wrap: anywhere; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 14px; }
.stats > div { background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 10px; }
.stats dt { font-size: .75rem; color: var(--muted); text-transform: uppercase; font-weight: 700; }
.stats dd { margin: 0; font-size: 1.25rem; font-weight: 700; }
.help details { border-top: 1px solid var(--border); padding: 8px 0; }
.help summary { cursor: pointer; font-weight: 600; }
.help ol { padding-left: 1.2em; margin: 8px 0 0; }
.help li { margin-bottom: 6px; }
.url { user-select: all; }
.toc { margin-bottom: 16px; }
.api-group { scroll-margin-top: 12px; }

/* ------------------------------------------------------------ toasts, dialog */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: var(--radius-sm); box-shadow: var(--shadow); transition: opacity .3s, transform .3s; }
.toast-ok .icon { color: var(--ok); }
.toast-danger { background: var(--danger); color: #fff; }
.toast.leaving { opacity: 0; transform: translateY(8px); }
@media (prefers-color-scheme: dark) { .toast-ok .icon { color: #17703a; } .toast-danger { color: #1a0605; } }
.modal { border: 1px solid var(--border); border-radius: var(--radius); padding: 0; background: var(--surface); color: var(--text); width: min(480px, calc(100vw - 32px)); box-shadow: 0 10px 40px rgba(0, 0, 0, .3); }
.modal::backdrop { background: rgba(10, 14, 18, .55); }
.dialog-body { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.dialog-body h2 { margin: 0; }
.dialog-body .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* ------------------------------------------------------------ admin console */
.code-copy { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0 12px; }
.code-copy pre { flex: 1; margin: 0; white-space: pre-wrap; word-break: break-all; max-height: none; }
.console-app { display: grid; grid-template-columns: 240px minmax(0, 1fr); flex: 1; min-height: 0; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); padding: 12px; display: flex; flex-direction: column; gap: 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { padding: 4px 6px 10px; font-size: .98rem; border-bottom: 1px solid var(--border); }
.side-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; font-weight: 500; }
.side-nav a:hover { background: var(--surface-2); color: var(--text); }
.side-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.side-nav .count { margin-left: auto; }
.user-box { margin-top: auto; border-top: 1px solid var(--border); padding-top: 10px; font-size: .9rem; display: flex; flex-direction: column; gap: 8px; }
.user-links { display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; }
.console-main { padding: 22px 26px 48px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.page-head h1 { margin: 0; overflow-wrap: anywhere; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.head-meta { margin-bottom: 16px; }
.login-main { flex: 1; display: flex; align-items: flex-start; justify-content: center; padding: 48px 16px; }
.login-card { width: min(400px, 100%); display: flex; flex-direction: column; gap: 14px; }
.login-card .btn-primary { width: 100%; }
.login-brand { display: flex; gap: 12px; align-items: center; }
.login-brand h1 { font-size: 1.4rem; margin: 0; }
.login-brand p { margin: 0; }
.console-app.is-login { display: flex; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin: 14px 0 18px; }
.stat-tile { display: flex; flex-direction: column; gap: 4px; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); border-left: 5px solid var(--border-strong); text-decoration: none; color: var(--text); box-shadow: var(--shadow); }
.stat-tile:hover { border-color: var(--accent); color: var(--text); }
.stat-ok { border-left-color: var(--ok); } .stat-warn { border-left-color: var(--warn); } .stat-accent { border-left-color: var(--brand); }
.stat-value { font-size: 2rem; font-weight: 800; line-height: 1; }
.stat-label { color: var(--muted); font-weight: 600; font-size: .9rem; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 0 18px; align-items: start; }
.list-rows > li { padding: 8px 0; border-top: 1px solid var(--border); }
.list-rows > li:first-child { border-top: 0; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.diff h3 { margin-top: 14px; }
.diff-mode { border-top: 1px solid var(--border); padding-top: 6px; margin-top: 10px; }
.diff-add { color: var(--ok); font-weight: 600; }
.diff-del { color: var(--danger); font-weight: 600; }
.diff-chg { color: var(--warn); font-weight: 600; }
.warnings { margin: 8px 0 0; padding-left: 1.1em; font-size: .9rem; }
.warnings li { margin-bottom: 4px; }
.warnings-box summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; list-style-position: inside; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 26px 16px; border: 2px dashed var(--border-strong); border-radius: var(--radius); text-align: center; cursor: pointer; background: var(--surface-2); }
.dropzone .icon { width: 28px; height: 28px; color: var(--accent); }
.dropzone.over, .dropzone:hover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.upload-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.upload-row { border: 1px solid var(--border); border-left: 4px solid var(--border-strong); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.upload-row.ok { border-left-color: var(--ok); }
.upload-row.failed { border-left-color: var(--danger); }
.upload-row .callout { margin: 4px 0; }
.upload-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
progress { width: 100%; height: 8px; accent-color: var(--accent); }
.share-result:not(:empty) { margin-top: 6px; }
.aliases summary { cursor: pointer; }
.inline-h { display: inline; font-size: 1.15rem; }
.token-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.token { font-size: .85rem; padding: 6px 8px; user-select: all; }
.filters .field { min-width: 160px; }

/* builder */
.builder-mode legend { display: flex; align-items: center; gap: 8px; font-weight: 700; padding: 0 6px; }
fieldset.panel { margin-top: 0; }
.mode-name { width: 180px; }
table.data.builder-table td { vertical-align: middle; }  /* beats table.data td (top) */
.builder-table input.num { width: 80px; }
.builder-table input.sets-input { width: 100%; min-width: 220px; }
.attr-pick { display: flex; gap: 4px; flex-wrap: wrap; }
.attr-pick select { max-width: 240px; }
.attr-other { width: 150px; }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: 10px 0; border-top: 1px solid var(--border); z-index: 5; }
.builder-result { margin-top: 12px; }
details.help > summary { cursor: pointer; font-weight: 600; margin: 10px 0; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1000px) {
  .fixture-layout, .basket-layout, .detail-layout { grid-template-columns: minmax(0, 1fr); }
  .fixture-side { position: static; }
}
@media (max-width: 860px) {
  .console-app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: 8px 12px; gap: 6px; }
  .sidebar .brand { border-bottom: 0; padding-bottom: 0; }
  .side-nav ul { flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 4px; }
  .side-nav a { white-space: nowrap; padding: 7px 10px; }
  .user-box { margin-top: 0; padding-top: 6px; flex-direction: row; justify-content: space-between; align-items: center; flex-wrap: wrap; }
  .console-main { padding: 18px 16px 40px; }
  .two-col { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  h1 { font-size: 1.45rem; }
  .fixture-head h1 { font-size: 1.6rem; }
  .topnav { padding: 0 12px; }
  .topnav a[data-nav] { padding: 10px 8px; }
  .brand-sub { display: none; }
  .search-bar > .field:not(.grow) { flex: 1 1 45%; }
  .search-bar select { min-width: 0; width: 100%; }
  .card-grid { grid-template-columns: minmax(0, 1fr); }
  .fp-cell { width: 50px; }
  .stats dd { font-size: 1.1rem; }
  .panel { padding: 14px; }
  .page-numbers .page:not(.current) { display: none; }
}
@media print {
  .masthead, .site-footer, .sidebar, .fixture-side, .toasts { display: none; }
  body { background: #fff; color: #000; }
}
table.data time, table.audit code { white-space: nowrap; }
/* the console sidebar takes 240px: stack detail pages earlier */
@media (max-width: 1200px) { .detail-layout { grid-template-columns: minmax(0, 1fr); } }
@media (min-width: 761px) and (max-width: 1200px) { .detail-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 18px; align-items: start; } }
