:root {
  --bg: #f3f4f1; --surface: #ffffff; --ink: #16272b; --muted: #5d6e72; --line: #d9ddd6;
  --accent: #0f5c63; --accent-ink: #ffffff; --head: #14363a; --head-ink: #eef4f3;
  --warn: #fff4d6; --err-bg: #fde8e6; --err: #a3261e; --ok-bg: #e3f3ea; --ok: #1d6b3f;
  --plus: #1d6b3f; --minus: #a3261e; --radius: 6px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1517; --surface: #162124; --ink: #e6eeee; --muted: #93a6a9; --line: #2a393c;
    --accent: #4fb3bb; --accent-ink: #062a2e; --head: #0a1c1e; --head-ink: #e6eeee;
    --warn: #3b3214; --err-bg: #3a1c1a; --err: #ff9d93; --ok-bg: #16301f; --ok: #8fd9a8;
    --plus: #8fd9a8; --minus: #ff9d93; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1517; --surface: #162124; --ink: #e6eeee; --muted: #93a6a9; --line: #2a393c;
  --accent: #4fb3bb; --accent-ink: #062a2e; --head: #0a1c1e; --head-ink: #e6eeee;
  --warn: #3b3214; --err-bg: #3a1c1a; --err: #ff9d93; --ok-bg: #16301f; --ok: #8fd9a8;
  --plus: #8fd9a8; --minus: #ff9d93; color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); padding-bottom: env(safe-area-inset-bottom); }
a { color: var(--accent); }
h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 1rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .big { font-size: 2rem; font-weight: 650; margin: 0 0 .5rem; letter-spacing: -.01em; }
.pre { white-space: pre-wrap; }

.topbar { background: var(--head); color: var(--head-ink); display: flex; align-items: center; gap: 1rem; padding: .6rem 1rem; padding-top: calc(.6rem + env(safe-area-inset-top)); flex-wrap: wrap; }
.topbar a, .topbar .ghost { color: var(--head-ink); }
.brand { font-weight: 700; font-size: 1.1rem; text-decoration: none; letter-spacing: .01em; }
.topnav { display: flex; gap: 1rem; flex: 1; }
.topnav a { text-decoration: none; opacity: .85; } .topnav a:hover { opacity: 1; text-decoration: underline; }
.topright { display: flex; align-items: center; gap: .6rem; margin-left: auto; }
.topright form { margin: 0; } .who { text-decoration: none; opacity: .85; }
.subnav { display: flex; gap: 1.1rem; align-items: baseline; flex-wrap: wrap; padding: .55rem 1rem; background: var(--surface); border-bottom: 1px solid var(--line); overflow-x: auto; white-space: nowrap; }
.subnav a { text-decoration: none; color: var(--ink); padding-bottom: 2px; border-bottom: 2px solid transparent; }
.subnav a:hover { border-color: var(--accent); }
.wh-name { margin-right: .5rem; }
.page { max-width: 1100px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.narrow { max-width: 420px; margin: 3rem auto; }
.form-narrow { max-width: 640px; margin-bottom: 1rem; } .form-wide { max-width: 900px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1rem; }
.empty { text-align: center; padding: 2rem 1rem; }
.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.head h1 { margin-bottom: .75rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.actions.wrap { margin: .75rem 0 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.wh-card { text-decoration: none; color: inherit; display: block; margin: 0; }
.wh-card:hover { border-color: var(--accent); }
.wh-card h2 { margin-bottom: .25rem; } .wh-card p { margin: .3rem 0; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; align-items: start; }

.btn, button { font: inherit; cursor: pointer; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: .45rem .85rem; text-decoration: none; display: inline-block; line-height: 1.3; }
.btn:hover, button:hover { border-color: var(--accent); }
.btn.primary, button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.ghost { background: transparent; border-color: transparent; padding: .3rem .5rem; }
.link { background: none; border: 0; padding: 0 .25rem; color: var(--accent); text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

input, select, textarea { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: .45rem .6rem; width: 100%; max-width: 100%; }
input[type=checkbox], input[type=radio] { width: auto; }
input[type=color] { width: 2.6rem; padding: 2px; height: 2.2rem; }
label { display: block; font-weight: 500; } label input, label select, label textarea { margin-top: .25rem; font-weight: 400; }
.label { font-weight: 500; display: block; }
.check { display: flex; align-items: center; gap: .45rem; font-weight: 400; } .check input { margin: 0; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .9rem; margin: 0; }
legend { padding: 0 .35rem; font-weight: 500; }
.stack > * + * { margin-top: .85rem; } .stack { display: block; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem; }
.hint { color: var(--muted); font-size: .88rem; margin: .25rem 0; }
.static { padding: .45rem 0; font-weight: 600; }
.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.filters input[type=search], .filters input:not([type]), .filters input[name=name], .filters input[name=title] { flex: 1 1 200px; width: auto; }
.filters select { width: auto; flex: 0 1 auto; }
form.inline { display: inline-flex; gap: .4rem; align-items: center; margin: 0; } form.inline.grow { flex: 1; } form.inline.grow input { flex: 1; }

.flash { padding: .65rem .9rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid transparent; }
.flash.ok { background: var(--ok-bg); color: var(--ok); } .flash.err { background: var(--err-bg); color: var(--err); }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 1rem; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: .55rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: .85rem; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.plus { color: var(--plus); } td.minus { color: var(--minus); }
tr.warn { background: var(--warn); }
input.qty { width: 7rem; text-align: right; }
.pager { display: flex; align-items: center; gap: .75rem; justify-content: flex-end; flex-wrap: wrap; }
.pager .muted { margin-right: auto; }

.pill { display: inline-block; padding: 0 .5rem; border-radius: 999px; border: 1px solid var(--accent); color: var(--accent); font-size: .8rem; }
.pill.muted { border-color: var(--line); color: var(--muted); }
.tag { display: inline-block; padding: 0 .5rem; margin: 0 .25rem .15rem 0; border-radius: 3px; font-size: .82rem; border-left: 4px solid var(--c, var(--accent)); background: color-mix(in srgb, var(--c, var(--accent)) 14%, transparent); }
ul.plain { list-style: none; margin: 0 0 .75rem; padding: 0; } ul.plain li { padding: .3rem 0; }
ul.plain li.line { display: flex; gap: .6rem; align-items: center; border-bottom: 1px solid var(--line); }
.summary { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.2rem; margin: 0 0 1rem; }
.summary dt { color: var(--muted); } .summary dd { margin: 0; }
.history li { border-bottom: 1px solid var(--line); }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: .5rem; margin-bottom: .75rem; }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); }

.rows { display: grid; gap: .6rem; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.row.item-row { padding: .5rem; border: 1px dashed var(--line); border-radius: var(--radius); }
.lookup { position: relative; flex: 1 1 260px; min-width: 200px; }
.suggest { position: absolute; z-index: 10; left: 0; right: 0; top: 100%; margin: 2px 0 0; padding: 0; list-style: none; background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius); max-height: 16rem; overflow: auto; box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.suggest li { padding: .45rem .6rem; cursor: pointer; } .suggest li:hover, .suggest li:focus { background: var(--bg); }
.dest-box { flex: 1 1 220px; }

.steps { display: flex; gap: .5rem; list-style: none; padding: 0; margin: 0 0 1.25rem; flex-wrap: wrap; counter-reset: s; }
.steps li { flex: 1 1 90px; padding: .35rem .6rem; border-bottom: 3px solid var(--line); color: var(--muted); font-size: .9rem; }
.steps li.on { border-color: var(--accent); color: var(--ink); font-weight: 600; } .steps li.done { border-color: var(--accent); }
.wizard-nav { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1.25rem; }
[hidden] { display: none !important; }

@media (max-width: 640px) {
  .two { grid-template-columns: 1fr; }
  .page { padding: 1rem .75rem 3rem; }
  .topnav { order: 3; flex-basis: 100%; }
  .summary { grid-template-columns: 1fr; gap: 0; } .summary dd { margin-bottom: .5rem; }
  th, td { padding: .5rem .55rem; }
  input.qty { width: 100%; }
}
@media (prefers-reduced-motion: no-preference) { .btn, button { transition: border-color .12s; } }
