/* Distrolio - shared styles. Light/dark via prefers-color-scheme. */
:root {
  --bg: #f6f7f9; --panel: #ffffff; --ink: #14181f; --muted: #5b6472; --line: #e3e6ea;
  --brand: #0f6e56; --brand-ink: #ffffff; --brand-soft: #e4f3ee; --accent: #c7641a;
  --ok: #1d7a46; --warn: #a66b00; --bad: #b3261e; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 6px 20px rgba(20,24,31,.06);
  --radius: 10px; --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1216; --panel: #171b21; --ink: #e8ebef; --muted: #9aa4b1; --line: #2a3139;
    --brand: #35b391; --brand-ink: #06130f; --brand-soft: #14312a; --accent: #e08a45; --shadow: 0 1px 2px rgba(0,0,0,.4);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); }
a { color: var(--brand); text-decoration: none; } a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; } h1 { font-size: 2rem; } h2 { font-size: 1.35rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; } .muted { color: var(--muted); } .small { font-size: .85rem; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  padding: 9px 16px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none !important; }
.btn:hover { border-color: var(--brand); } .btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.danger { border-color: var(--bad); color: var(--bad); } .btn.sm { padding: 5px 10px; font-size: .85rem; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.grid { display: grid; gap: 16px; } .grid.cols-3 { grid-template-columns: repeat(3, 1fr); } .grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 800px) { .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; } }
label { display: block; font-weight: 600; font-size: .9rem; margin: 10px 0 4px; }
input, select, textarea { width: 100%; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
input[type="checkbox"] { width: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; } th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
tr:hover td { background: color-mix(in srgb, var(--brand) 5%, transparent); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--brand-soft); color: var(--brand); }
.pill.off { background: var(--line); color: var(--muted); } .pill.bad { background: #fde8e6; color: var(--bad); } .pill.warn { background: #fff3d6; color: var(--warn); }
.msg { padding: 10px 12px; border-radius: 8px; margin: 10px 0; font-size: .92rem; }
.msg.err { background: #fde8e6; color: var(--bad); } .msg.ok { background: var(--brand-soft); color: var(--brand); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; } .spread { justify-content: space-between; }
.toggle { position: relative; width: 42px; height: 24px; border-radius: 999px; background: var(--line); border: 0; cursor: pointer; flex: none; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .15s; }
.toggle.on { background: var(--brand); } .toggle.on::after { left: 21px; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .02em; color: var(--ink); text-decoration: none !important; }
.logo .mark { width: 30px; height: 30px; border-radius: 8px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-size: .8rem; }
dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--ink); padding: 22px; width: min(560px, 94vw); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0,0,0,.35); }

/* point-and-click (app/nav.js) */
a.ent { color: inherit; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--brand) 45%, transparent); text-underline-offset: 2px; }
a.ent:hover { color: var(--brand); text-decoration-color: var(--brand); }
a.ent.drill { color: inherit; }
#peek { position: absolute; z-index: 60; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 28px rgba(0,0,0,.18); padding: 12px 14px; font-size: .9rem; }
#peek .peek-h { margin-bottom: 2px; }
#peek .peek-f { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 8px 0; }
#peek dt { color: var(--muted); } #peek dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
#peek .peek-a { gap: 8px; }
.rel-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 999px; padding: 5px 12px; font: inherit; font-size: .85rem; cursor: pointer; }
.chip:hover { border-color: var(--brand); } .chip.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: .85rem; margin: -4px 0 10px; color: var(--muted); }
.crumbs a { color: var(--brand); max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs .sep { color: var(--muted); } .crumbs .here { color: var(--ink); font-weight: 600; max-width: 28ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 600px) { .crumbs a:not(:nth-last-of-type(1)) { display: none; } .crumbs .sep:not(:nth-last-of-type(2)) { display: none; } }

/* date boxes: the whole box opens the calendar (shared/datepick.js); calendar icon follows light / dark */
input[type="date"], input[type="month"], input[type="week"], input[type="time"], input[type="datetime-local"] { cursor: pointer; color-scheme: light; min-height: 38px; }
input[type="date"]::-webkit-calendar-picker-indicator, input[type="month"]::-webkit-calendar-picker-indicator, input[type="datetime-local"]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .75; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) input[type="date"], :root:not([data-theme="light"]) input[type="month"], :root:not([data-theme="light"]) input[type="week"], :root:not([data-theme="light"]) input[type="time"], :root:not([data-theme="light"]) input[type="datetime-local"] { color-scheme: dark; } }

/* Administration: category menu + search for long admin pages (app/adminnav.js) */
.adm-wrap { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 20px; align-items: start; margin-top: 14px; }
.adm-cats { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 8px; max-height: calc(100vh - 24px); overflow-y: auto; }
.adm-q { margin: 0; }
.adm-list { display: flex; flex-direction: column; gap: 2px; }
.adm-cat { display: flex; justify-content: space-between; align-items: center; gap: 8px; text-align: left; width: 100%; border: 0; background: none;
  color: var(--ink); font: inherit; font-weight: 600; padding: 8px 12px; border-radius: 8px; cursor: pointer; }
.adm-cat:hover { background: var(--brand-soft); }
.adm-cat.on { background: var(--brand); color: var(--brand-ink); }
.adm-cat.dim { opacity: .45; }
.adm-cat .n { font-size: .78rem; font-weight: 600; min-width: 22px; text-align: center; padding: 1px 7px; border-radius: 10px; background: var(--line); color: var(--ink); }
.adm-cat.on .n { background: rgba(255,255,255,.25); color: inherit; }
.adm-pick { display: none; margin: 0; }
.adm-group { display: flex; flex-direction: column; }
.adm-head { justify-content: flex-start; }
.adm-head .t { flex: 1; } .adm-head .chev { width: 12px; color: var(--muted); font-size: .8rem; }
.adm-head.cur .t { color: var(--brand); }
.adm-subs { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 6px 18px; border-left: 2px solid var(--line); padding-left: 6px; }
.adm-sub { text-align: left; border: 0; background: none; color: var(--ink); font: inherit; font-size: .9rem; padding: 6px 10px; border-radius: 6px; cursor: pointer; }
.adm-sub:hover { background: var(--brand-soft); }
.adm-sub.on { background: var(--brand); color: var(--brand-ink); font-weight: 600; }
.adm-sub.dim { opacity: .45; }
.adm-body > * { margin: 0 0 16px !important; max-width: 880px !important; }
.adm-body > [hidden] { display: none !important; }
.adm-body > .card { overflow-x: auto; }
.adm-body[data-empty]::before { content: attr(data-empty); display: block; color: var(--muted); padding: 20px 4px; }
@media (max-width: 900px) {
  .adm-wrap { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .adm-cats, .adm-body { min-width: 0; }
  .adm-cats { position: static; max-height: none; overflow: visible; }
  .adm-list { display: none; }
  .adm-pick { display: block; }
}
