/* MyLCOG — one stylesheet, no framework. Brand colours come from the church logo. */

:root {
  --brand: #0b57b8;
  --brand-strong: #08418c;
  --brand-soft: #e6effa;
  --accent: #f08a00;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #1b2430;
  --muted: #5b6776;
  --line: #dde3ec;
  --ok: #17803d;
  --ok-soft: #e4f5ea;
  --warn: #9a5b00;
  --warn-soft: #fff1d6;
  --danger: #b42318;
  --danger-soft: #fdeceb;
  --info-soft: #e6effa;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --focus: 0 0 0 3px rgba(11, 87, 184, .35);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand: #6aa8ff;
    --brand-strong: #8fbcff;
    --brand-soft: #16263d;
    --accent: #ffa733;
    --bg: #0f141b;
    --surface: #171e28;
    --surface-2: #1c2431;
    --text: #e8edf4;
    --muted: #9aa7b8;
    --line: #2a3443;
    --ok: #5dd28a;
    --ok-soft: #12301f;
    --warn: #ffc566;
    --warn-soft: #3a2b0e;
    --danger: #ff8a80;
    --danger-soft: #3a1a18;
    --info-soft: #16263d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --focus: 0 0 0 3px rgba(106, 168, 255, .45);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--brand); text-underline-offset: 2px; }
a:hover { color: var(--brand-strong); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.right { text-align: right; }
.mt { margin-top: 1.25rem; }
.nowrap { white-space: nowrap; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }

/* ---------- Top bar ---------- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: .6rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--text); font-weight: 700; font-size: 1.15rem; }
.brand img { width: 34px; height: 34px; object-fit: contain; }
.brand span b { color: var(--accent); }
.nav { display: flex; gap: .25rem; flex: 1; flex-wrap: wrap; }
.nav a {
  padding: .45rem .8rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
}
.nav a:hover { background: var(--brand-soft); color: var(--brand); }
.nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); }
.account { display: flex; align-items: center; gap: .75rem; font-size: .9rem; }
.account .who { text-align: right; line-height: 1.2; }
.account .who small { display: block; color: var(--muted); }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 1.5rem 1rem 3rem; flex: 1; }
.narrow { max-width: 460px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); margin: .15rem 0 0; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

.footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; padding: 1rem; text-align: center; }
.footer a { color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; margin-bottom: 1.25rem; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 1.25rem; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid > .card { margin-bottom: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .55rem 1rem; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; line-height: 1.2;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.primary, .btn.primary:hover { color: #08121f; } }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.small { padding: .3rem .65rem; font-size: .875rem; }
.btn[disabled] { opacity: .6; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; cursor: pointer; text-decoration: underline; }

.google-btn {
  display: flex; align-items: center; justify-content: center; gap: .75rem;
  width: 100%; padding: .75rem 1rem; border-radius: 8px; border: 1px solid #dadce0;
  background: #fff; color: #3c4043; font: inherit; font-weight: 600; text-decoration: none;
}
.google-btn:hover { background: #f7f8f8; color: #202124; box-shadow: var(--shadow); }
.google-btn svg { width: 20px; height: 20px; }

/* ---------- Alerts ---------- */
.alert { border-radius: 8px; padding: .75rem 1rem; margin-bottom: 1rem; border: 1px solid transparent; display: flex; gap: .75rem; justify-content: space-between; align-items: flex-start; }
.alert.success { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.alert.error { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.alert.info { background: var(--info-soft); color: var(--brand); border-color: var(--brand); }
.alert.warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }
.alert .close { background: none; border: 0; color: inherit; font-size: 1.25rem; line-height: 1; cursor: pointer; }
.alert-big { font-weight: 700; }

/* ---------- Forms ---------- */
label { display: block; font-weight: 600; margin-bottom: .25rem; font-size: .9rem; }
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: .55rem .7rem; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
}
textarea { min-height: 7rem; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; box-shadow: var(--focus); border-color: var(--brand); }
.field { margin-bottom: 1rem; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
.error-text { color: var(--danger); font-size: .85rem; margin-top: .25rem; }
.help { color: var(--muted); font-size: .85rem; margin-top: .25rem; }
.form-grid { display: grid; gap: 0 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; margin: 0; }
.check input { width: 1.1rem; height: 1.1rem; }
.checks { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.form-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1rem; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 700; font-size: 1.05rem; padding: 0; margin-bottom: .75rem; }

.rating-table { width: 100%; border-collapse: collapse; }
.rating-table td, .rating-table th { padding: .4rem .5rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.rating-table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.rating-table select { min-width: 5rem; }

/* ---------- Filters ---------- */
.filters { display: grid; gap: .75rem 1rem; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: end; }
.filters .field { margin: 0; }
.filters .wide { grid-column: span 2; }
.filters .buttons { display: flex; gap: .5rem; align-items: center; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
table.data { width: 100%; border-collapse: collapse; min-width: 720px; }
table.data th, table.data td { padding: .65rem .8rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data thead th { background: var(--surface-2); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); white-space: nowrap; }
table.data thead th a { color: inherit; text-decoration: none; }
table.data thead th a:hover { color: var(--brand); }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.name a { font-weight: 700; text-decoration: none; }
table.data td.name a:hover { text-decoration: underline; }
tr.inactive td { color: var(--muted); }
.empty { padding: 2rem; text-align: center; color: var(--muted); }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 700; line-height: 1.5; border: 1px solid transparent; white-space: nowrap; }
.badge.status-0 { background: var(--surface-2); color: var(--muted); border-color: var(--line); }
.badge.status-1 { background: var(--brand-soft); color: var(--brand); }
.badge.status-2 { background: var(--ok-soft); color: var(--ok); }
.badge.danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.badge.muted { background: var(--surface-2); color: var(--muted); border-color: var(--line); }
.badge.role { background: var(--warn-soft); color: var(--warn); }
.tags { display: flex; flex-wrap: wrap; gap: .25rem; }
.tag { background: var(--brand-soft); color: var(--brand); border-radius: 6px; padding: .05rem .45rem; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.tag.alt { background: var(--warn-soft); color: var(--warn); }

/* ---------- Profile ---------- */
.kv { display: grid; grid-template-columns: 9rem 1fr; gap: .45rem 1rem; margin: 0; }
.kv dt { color: var(--muted); font-weight: 600; font-size: .9rem; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.notes { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.score { font-variant-numeric: tabular-nums; font-weight: 700; }
.bar { height: .45rem; border-radius: 99px; background: var(--line); overflow: hidden; min-width: 5rem; }
.bar > i { display: block; height: 100%; background: var(--accent); }

/* ---------- Stats / admin tiles ---------- */
.stats { display: flex; gap: 1rem; flex-wrap: wrap; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem 1rem; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 1.4rem; line-height: 1.2; }
.stat span { color: var(--muted); font-size: .85rem; }
.tile { display: block; text-decoration: none; color: inherit; }
.tile:hover { border-color: var(--brand); }
.tile h2 { color: var(--brand); }

/* ---------- Pager ---------- */
.pager { display: flex; gap: .35rem; flex-wrap: wrap; justify-content: center; margin-top: 1rem; align-items: center; }
.pager a, .pager span { padding: .3rem .7rem; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; background: var(--surface); }
.pager span.current { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
@media (prefers-color-scheme: dark) { .pager span.current { color: #08121f; } }
.pager span.gap { border: 0; background: none; }

/* ---------- Auth pages ---------- */
.auth-wrap { min-height: 70vh; display: grid; place-items: center; }
.auth-card { width: 100%; max-width: 420px; text-align: center; padding: 2rem 1.75rem; }
.auth-card img { width: 84px; height: 84px; object-fit: contain; margin-bottom: .75rem; }
.auth-card h1 { margin-bottom: .25rem; }

/* ---------- Legal text ---------- */
.prose { max-width: 820px; margin: 0 auto; }
.prose h1, .prose h2, .prose h3 { margin-top: 1.5em; }
.prose p, .prose li { color: var(--text); overflow-wrap: anywhere; }
.prose a { overflow-wrap: anywhere; }

/* ---------- Dialog ---------- */
dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 1.5rem; max-width: 420px; box-shadow: 0 10px 40px rgba(0, 0, 0, .3); }
dialog::backdrop { background: rgba(10, 15, 25, .55); }
dialog .actions { justify-content: flex-end; margin-top: 1.25rem; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .filters { grid-template-columns: 1fr; }
  .filters .wide { grid-column: auto; }
  .kv { grid-template-columns: 1fr; gap: 0; }
  .kv dd { margin-bottom: .6rem; }
  .account .who { display: none; }
  .page-head h1 { font-size: 1.35rem; }
}

@media print {
  .topbar, .footer, .actions, .no-print { display: none !important; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border-color: #bbb; break-inside: avoid; }
}

/* ---------- Small helpers added by templates ---------- */
.left { text-align: left; }
.btn.block { width: 100%; }
.mt-s { margin-top: .5rem; }
form.inline { display: inline; }
.narrow-form { max-width: 520px; }
.bar > i.w0 { width: 0%; }
.bar > i.w1 { width: 4%; }
.bar > i.w2 { width: 8%; }
.bar > i.w3 { width: 12%; }
.bar > i.w4 { width: 16%; }
.bar > i.w5 { width: 20%; }
.bar > i.w6 { width: 24%; }
.bar > i.w7 { width: 28%; }
.bar > i.w8 { width: 32%; }
.bar > i.w9 { width: 36%; }
.bar > i.w10 { width: 40%; }
.bar > i.w11 { width: 44%; }
.bar > i.w12 { width: 48%; }
.bar > i.w13 { width: 52%; }
.bar > i.w14 { width: 56%; }
.bar > i.w15 { width: 60%; }
.bar > i.w16 { width: 64%; }
.bar > i.w17 { width: 68%; }
.bar > i.w18 { width: 72%; }
.bar > i.w19 { width: 76%; }
.bar > i.w20 { width: 80%; }
.bar > i.w21 { width: 84%; }
.bar > i.w22 { width: 88%; }
.bar > i.w23 { width: 92%; }
.bar > i.w24 { width: 96%; }
.bar > i.w25 { width: 100%; }

/* ---------- Logo tile (the logo artwork has a white background) ---------- */
.brand img, .auth-card img { background: #fff; border-radius: 8px; padding: 2px; }

/* ---------- Phones ---------- */
@media (max-width: 700px) {
  .topbar-inner { gap: .4rem 1rem; }
  .nav { order: 3; flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; }
  .account { margin-left: auto; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters .wide { grid-column: 1 / -1; }

  /* Lists become one card per row instead of scrolling sideways */
  .table-wrap:has(table.stack) { border: 0; background: none; box-shadow: none; overflow: visible; }
  table.data.stack { min-width: 0; }
  table.data.stack thead { display: none; }
  table.data.stack, table.data.stack tbody, table.data.stack tr, table.data.stack td { display: block; width: 100%; }
  table.data.stack tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: .65rem .85rem; margin-bottom: .75rem; }
  table.data.stack td { border: 0; padding: .2rem 0; }
  table.data.stack td.name { font-size: 1.05rem; }
  table.data.stack td[data-label]::before { content: attr(data-label); display: block; color: var(--muted); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
  table.data.stack td.name::before { display: none; }
  table.data.stack td.none { display: none; }
}
@media (max-width: 400px) {
  .filters { grid-template-columns: 1fr; }
}

/* ---------- Rating meters (native <meter>, so no inline styles are needed) ---------- */
meter { -webkit-appearance: none; appearance: none; width: 100%; min-width: 5rem; height: .5rem; border: 0; border-radius: 99px; background: var(--line); overflow: hidden; }
meter::-webkit-meter-bar { background: var(--line); border: 0; border-radius: 99px; height: .5rem; }
meter::-webkit-meter-optimum-value, meter::-webkit-meter-suboptimum-value, meter::-webkit-meter-even-less-good-value { background: var(--accent); border-radius: 99px; }
meter::-moz-meter-bar { background: var(--accent); border-radius: 99px; }

/* ---------- Maintenance (CMMS) ---------- */
.subnav { background: var(--surface-2); border-bottom: 1px solid var(--line); }
.subnav-inner { max-width: 1200px; margin: 0 auto; padding: .35rem 1rem; display: flex; gap: .25rem; flex-wrap: wrap; }
.subnav a { padding: .35rem .75rem; border-radius: 8px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .92rem; }
.subnav a:hover { background: var(--brand-soft); color: var(--brand); }
.subnav a[aria-current="page"] { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.indent { display: inline-block; }
.indent-1 { padding-left: 1.25rem; }
.indent-2 { padding-left: 2.5rem; }
.indent-3 { padding-left: 3.75rem; }
.indent-4 { padding-left: 5rem; }
.indent-5 { padding-left: 6.25rem; }
.indent-6 { padding-left: 7.5rem; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.gallery figure { margin: 0; }
.gallery img { width: 100%; height: 130px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); display: block; }
.gallery figcaption { margin-top: .25rem; overflow-wrap: anywhere; }
.upload { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); max-width: 520px; }
.flag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .6rem 1.25rem; }
.wide-kv { grid-template-columns: 15rem 1fr; }
@media (max-width: 560px) { .wide-kv { grid-template-columns: 1fr; } }

/* ---------- Work orders ---------- */
.timeline { list-style: none; margin: 1rem 0 0; padding: 0; }
.timeline li { border-left: 3px solid var(--line); padding: .25rem 0 .6rem .8rem; margin-left: .3rem; }
.timeline li.comment { border-left-color: var(--brand); }
hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }
a.stat { text-decoration: none; color: inherit; }
a.stat:hover { border-color: var(--brand); }

/* ---------- Parts ---------- */
tr.best td { background: var(--ok-soft); }
details > summary { cursor: pointer; font-weight: 600; color: var(--brand); }
details[open] > summary { margin-bottom: .5rem; }

/* ---------- Alternate UPCs ---------- */
fieldset.alt-upcs { border: 0; padding: 0; margin: 0 0 1rem; min-width: 0; }
fieldset.alt-upcs legend { font-weight: 600; padding: 0; margin-bottom: .25rem; }
.alt-upc-grid { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); }

/* ---------- Admin: field tabs ---------- */
nav.tabs { display: flex; gap: .25rem; flex-wrap: wrap; margin: 0 0 1rem; }
nav.tabs a { padding: .4rem .8rem; border-radius: 8px; text-decoration: none; color: var(--muted); font-weight: 600; border: 1px solid var(--line); background: var(--surface); }
nav.tabs a:hover { background: var(--brand-soft); color: var(--brand); }
nav.tabs a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); border-color: var(--brand); }

/* ---------- Barcode scanner ---------- */
dialog.scan-dialog { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; max-width: min(32rem, 94vw); background: var(--surface); color: var(--text); }
dialog.scan-dialog video { width: 100%; max-height: 60vh; background: #000; border-radius: 8px; display: block; }
dialog.scan-dialog::backdrop { background: rgba(0, 0, 0, .5); }
.scan-btn { margin-top: .35rem; }

/* ---------- Printed reports ---------- */
.report-bar { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; margin: 0 0 1rem; }
.report-sheet { background: #fff; color: #000; border: 1px solid var(--line); border-radius: 4px; padding: .4in; margin: 0 auto 2rem; max-width: 100%; box-sizing: border-box; overflow-x: auto; }
.report-sheet.paper-letter { width: 8.5in; }
.report-sheet h1 { font-size: 16pt; margin: 0 0 .1in; color: #000; }
.report-sheet p { margin: 0 0 .06in; color: #000; }
.report-head { border-bottom: 2px solid #000; margin-bottom: .12in; padding-bottom: .06in; }
.report-meta { font-size: 9pt; color: #333; }
.report-warn { font-weight: 700; }
.report-table { width: 100%; border-collapse: collapse; font-size: 10pt; table-layout: fixed; }
.report-table col.rpt-type { width: 0.85in; }
.report-table col.rpt-id { width: 2.55in; }
.report-table th { text-align: left; font-size: 8pt; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid #000; padding: .04in .06in; background: #fff; color: #000; }
.report-table td { border-bottom: 1px solid #aaa; padding: .07in .06in; vertical-align: middle; overflow-wrap: anywhere; color: #000; background: #fff; }
.report-table thead { display: table-header-group; }
.report-table tr { break-inside: avoid; page-break-inside: avoid; }
.report-table svg.barcode { height: .45in; display: block; max-width: none; }
.rpt-small { font-size: 8pt; color: #444; }
.rpt-idtext { font: 8pt/1.2 "Courier New", monospace; margin-top: .02in; }
.rpt-idcell { overflow-wrap: normal; }
@media print {
  html, body { background: #fff !important; }
  .container { max-width: none; padding: 0; }
  .report-sheet { border: 0; border-radius: 0; padding: 0; margin: 0; width: auto !important; overflow: visible; }
  .report-sheet h1 { font-size: 15pt; }
}

/* ---------- Barcode reader page ---------- */
.reader-controls { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .75rem; }
video.reader-video { width: 100%; max-height: 60vh; background: #000; border-radius: 8px; display: block; margin-bottom: .5rem; }
video.reader-video[hidden] { display: none; }
.reader-result { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: 1rem; }
.reader-result[hidden], #reader-start[hidden], #reader-stop[hidden] { display: none; }

/* ---------- Maintenance header menus ---------- */
.menu-bar { align-items: center; }
details.menu { position: relative; }
details.menu > summary { list-style: none; cursor: pointer; padding: .45rem .8rem; border-radius: 8px; color: var(--muted); font-weight: 600; user-select: none; }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu > summary::after { content: " \25BE"; font-size: .8em; }
details.menu > summary:hover, details.menu[open] > summary, details.menu[data-current] > summary { background: var(--brand-soft); color: var(--brand); }
details.menu > summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.menu-list { position: absolute; top: calc(100% + .3rem); left: 0; min-width: 13rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 28px rgba(0, 0, 0, .28); padding: .35rem; z-index: 30; display: flex; flex-direction: column; gap: .1rem; }
.menu-list a { display: block; white-space: nowrap; }
@media (max-width: 700px) {
  /* On a phone an open menu is a panel the width of the header, under the menu names */
  .nav.menu-bar { position: relative; overflow: visible; flex-wrap: wrap; }
  details.menu { position: static; }
  .menu-list { left: 0; right: 0; min-width: 0; }
  .menu-list a { padding: .7rem .8rem; }
}

.camera-pick[hidden], #reader-camera-wrap[hidden] { display: none; }
.camera-pick { margin-top: .75rem; }

.footer-credit { margin-top: .35rem; font-size: .8rem; }

/* ---------- Profile layout (ordering) ---------- */
ol.order-list { list-style: none; margin: 0; padding: 0; }
.order-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.order-row:last-child { border-bottom: 0; }
.order-buttons { display: flex; gap: .35rem; flex-shrink: 0; }

/* ---------- Drag-and-drop ordering ---------- */
.drag-handle { border: 0; background: none; color: var(--muted); cursor: grab; font-size: 1.15rem; line-height: 1; padding: .35rem .5rem; margin-right: .35rem; border-radius: 6px; touch-action: none; user-select: none; }
.drag-handle:hover, .drag-handle:focus-visible { background: var(--brand-soft); color: var(--brand); }
.drag-handle:focus-visible { outline: 2px solid var(--brand); }
[data-id].dragging { background: var(--brand-soft); box-shadow: 0 6px 18px rgba(0, 0, 0, .25); outline: 2px dashed var(--brand); outline-offset: -2px; }
tr[data-id].dragging td { background: var(--brand-soft); }
body.is-sorting, body.is-sorting * { cursor: grabbing !important; user-select: none; }
.sort-toast { position: fixed; right: 1rem; bottom: 1rem; z-index: 60; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-left: 4px solid var(--ok); border-radius: var(--radius); box-shadow: var(--shadow); padding: .6rem .9rem; opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .15s, transform .15s; max-width: min(24rem, 90vw); }
.sort-toast.show { opacity: 1; transform: none; }
.sort-toast.bad { border-left-color: var(--danger); }
td.handle-cell { width: 1%; white-space: nowrap; }
.order-row .order-name { display: flex; align-items: center; }

/* Locations: a list inside a list, each level dragged on its own */
ol.loc-list { list-style: none; margin: 0; padding: 0; }
ol.loc-list ol.loc-list { margin-left: 1.6rem; border-left: 2px solid var(--line); }
li.loc-item { border-bottom: 1px solid var(--line); }
ol.loc-list ol.loc-list > li.loc-item:last-child { border-bottom: 0; }
.loc-row { display: grid; grid-template-columns: auto minmax(0, 1fr) 9rem 5rem auto; align-items: center; gap: .5rem; padding: .5rem .4rem; }
.loc-row .loc-name { overflow-wrap: anywhere; }
.loc-head { display: grid; grid-template-columns: auto minmax(0, 1fr) 9rem 5rem auto; gap: .5rem; padding: .4rem; color: var(--muted); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--line); }
@media (max-width: 700px) {
  .loc-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .loc-row .loc-kind, .loc-row .loc-assets { display: none; }
  .loc-head { display: none; }
  ol.loc-list ol.loc-list { margin-left: 1rem; }
}
