:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #f2f1ee;
  --surface-3: #e9e8e4;
  --border: #e4e2dd;
  --border-strong: #cfccc5;
  --text: #1b1b19;
  --text-2: #5f5d57;
  --text-3: #8f8c84;
  --accent: #2563eb;
  --accent-hover: #1d4fd8;
  --accent-soft: #e7eefe;
  --accent-text: #ffffff;
  --ok: #15803d;
  --ok-soft: #e3f4e8;
  --warn: #b45309;
  --warn-soft: #fdf1df;
  --danger: #c62828;
  --danger-soft: #fdeaea;
  --part: #2563eb;
  --tool: #7c3aed;
  --consumable: #0d9488;
  --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
  --shadow-sm: 0 1px 2px rgb(16 16 14 / .06);
  --shadow: 0 1px 2px rgb(16 16 14 / .05), 0 4px 16px rgb(16 16 14 / .06);
  --shadow-lg: 0 8px 40px rgb(16 16 14 / .16), 0 2px 6px rgb(16 16 14 / .06);
  --radius: 10px;
  --radius-sm: 7px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121211;
    --surface: #1a1a19;
    --surface-2: #222220;
    --surface-3: #2c2c29;
    --border: #2e2e2b;
    --border-strong: #42413d;
    --text: #edece8;
    --text-2: #a9a69e;
    --text-3: #7a776f;
    --accent: #6b9bff;
    --accent-hover: #86adff;
    --accent-soft: #1d2a45;
    --accent-text: #0b1220;
    --ok: #4ade80;
    --ok-soft: #14301f;
    --warn: #f5b454;
    --warn-soft: #3a2a12;
    --danger: #f87171;
    --danger-soft: #3a1818;
    --part: #6b9bff;
    --tool: #b18cff;
    --consumable: #3fd2bf;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 4px 16px rgb(0 0 0 / .3);
    --shadow-lg: 0 8px 40px rgb(0 0 0 / .55);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
svg.icon { flex: none; display: block; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ------------------------------------------------------------ layout */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 20px;
  height: 56px; padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; letter-spacing: -.01em; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: var(--text); color: var(--bg); }
.tabs { display: flex; gap: 2px; }
.tab {
  display: flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 12px; border: 0; border-radius: 8px;
  background: none; color: var(--text-2); cursor: pointer; font-weight: 500;
}
.tab:hover { background: var(--surface-2); color: var(--text); }
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border); }
.tab .count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--accent-text); font-size: 11px; font-weight: 600; display: grid; place-items: center; }
.topbar .spacer { flex: 1; }
.kbd { font: 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; padding: 3px 5px; border-radius: 4px; border: 1px solid var(--border); background: var(--surface); color: var(--text-3); }

.page { max-width: 1180px; margin: 0 auto; padding: 28px 24px 80px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 650; letter-spacing: -.02em; margin: 0; }
.page-head .grow { flex: 1; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .grow { flex: 1; min-width: 220px; }
.section-title { font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; margin: 28px 0 10px; display: flex; align-items: center; gap: 8px; }
.section-title .line { flex: 1; height: 1px; background: var(--border); }

/* ------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-weight: 500; cursor: pointer; white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: background .12s, border-color .12s, box-shadow .12s, transform .05s;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { transform: translateY(.5px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled { opacity: .5; cursor: default; }
.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); }
.btn.ghost { background: none; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.sm { height: 28px; padding: 0 9px; font-size: 13px; }
.btn.icon { width: 34px; padding: 0; }
.btn.icon.sm { width: 28px; }

/* ------------------------------------------------------------ form controls */
.input, .select, .textarea {
  width: 100%; height: 36px; padding: 0 11px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); box-shadow: var(--shadow-sm);
  transition: border-color .12s, box-shadow .12s;
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus, .focus-within:focus-within { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.input.lg { height: 42px; font-size: 17px; font-weight: 550; }
.input.invalid { border-color: var(--danger); }
.textarea { height: auto; min-height: 76px; padding: 9px 11px; resize: vertical; line-height: 1.5; }
.select {
  appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238f8c84' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
}
.select.auto { width: auto; }

.search { position: relative; }
.search > svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search .input { padding-left: 34px; padding-right: 40px; }
.search .kbd { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > .label { font-size: 13px; font-weight: 550; color: var(--text); display: flex; align-items: baseline; gap: 6px; }
.field > .label .hint { font-weight: 400; color: var(--text-3); font-size: 12px; }
.field .error { color: var(--danger); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }

/* segmented control */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); }
.seg button {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 11px; border: 0; border-radius: 6px;
  background: none; color: var(--text-2); cursor: pointer; font-weight: 500; font-size: 13px; white-space: nowrap;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
.seg button:focus-visible { outline: none; box-shadow: var(--ring); }
.seg.full { display: flex; }
.seg.full button { flex: 1; justify-content: center; height: 32px; }

/* toggle chip */
.toggle {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  color: var(--text-2); font-weight: 500; cursor: pointer; box-shadow: var(--shadow-sm);
}
.toggle.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, transparent); color: var(--accent); }

/* switch */
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; font-size: 13px; color: var(--text-2); }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 32px; height: 19px; border-radius: 10px; background: var(--surface-3); position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .25); transition: transform .15s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(13px); }
.switch input:focus-visible + .track { box-shadow: var(--ring); }

/* stepper */
.stepper { display: flex; align-items: stretch; height: 36px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow-sm); overflow: hidden; }
.stepper button { width: 34px; border: 0; background: none; color: var(--text-2); cursor: pointer; display: grid; place-items: center; }
.stepper button:hover { background: var(--surface-2); color: var(--text); }
.stepper input { flex: 1; min-width: 0; width: 60px; border: 0; border-left: 1px solid var(--border); border-right: 1px solid var(--border); text-align: center; background: none; font-variant-numeric: tabular-nums; font-weight: 550; }
.stepper input:focus { outline: none; }
.stepper input::-webkit-inner-spin-button { display: none; }
.stepper:focus-within { border-color: var(--accent); box-shadow: var(--ring); }

/* tag input + chips */
.chip {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%;
  height: 22px; padding: 0 8px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
  font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chip b { color: var(--text); font-weight: 550; }
.chip button { border: 0; background: none; padding: 0; margin-right: -3px; color: var(--text-3); cursor: pointer; display: grid; }
.chip button:hover { color: var(--text); }
.chip.add { cursor: pointer; border-style: dashed; background: none; }
.chip.add:hover { border-color: var(--accent); color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.tag-input { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; min-height: 36px; padding: 5px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow-sm); cursor: text; }
.tag-input input { flex: 1; min-width: 100px; border: 0; background: none; height: 24px; }
.tag-input input:focus { outline: none; }

/* combobox */
.combo { position: relative; }
.menu {
  position: absolute; z-index: 60; top: calc(100% + 4px); left: 0; right: 0;
  max-height: 280px; overflow-y: auto; padding: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.menu .opt { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 6px; cursor: pointer; }
.menu .opt.active { background: var(--surface-2); }
.menu .opt .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu .opt .sub { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.menu .empty-opt { padding: 10px; color: var(--text-3); font-size: 13px; }

/* specs editor */
.specs-editor { display: flex; flex-direction: column; gap: 6px; }
.spec-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr) 30px; gap: 6px; align-items: center; }
.spec-row .input { height: 32px; }
.spec-row .key { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }

/* disclosure */
details.more { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
details.more > summary { list-style: none; cursor: pointer; padding: 11px 14px; display: flex; align-items: center; gap: 8px; font-weight: 550; font-size: 13px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary svg { transition: transform .15s; color: var(--text-3); }
details.more[open] > summary svg { transform: rotate(90deg); }
details.more > .body { padding: 4px 14px 16px; }

/* ------------------------------------------------------------ data display */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }

.table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.table th { text-align: left; font-size: 12px; font-weight: 550; color: var(--text-3); padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface); }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.click { cursor: pointer; transition: background .08s; }
.table tbody tr.click:hover { background: var(--surface-2); }
.table tbody tr.selected { background: var(--accent-soft); }
.table .right { text-align: right; }
.table .shrink { width: 1%; white-space: nowrap; }

.item-cell { display: flex; align-items: center; gap: 11px; min-width: 0; }
.item-cell .name { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-cell .sub { font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kind-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.kind-icon.part { background: color-mix(in srgb, var(--part) 13%, transparent); color: var(--part); }
.kind-icon.tool { background: color-mix(in srgb, var(--tool) 13%, transparent); color: var(--tool); }
.kind-icon.consumable { background: color-mix(in srgb, var(--consumable) 13%, transparent); color: var(--consumable); }
.kind-icon.lg { width: 40px; height: 40px; border-radius: 10px; }

.stock { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.stock .qty { font-weight: 600; font-variant-numeric: tabular-nums; }
.stock .qty .unit { font-weight: 400; color: var(--text-3); margin-left: 3px; }
.stock .avail { font-size: 12px; }
.quick { display: flex; gap: 4px; opacity: 0; transition: opacity .1s; }
tr:hover .quick, .quick:focus-within { opacity: 1; }

.pill { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 550; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.planning { background: var(--surface-2); color: var(--text-2); }
.pill.active { background: var(--accent-soft); color: var(--accent); }
.pill.completed { background: var(--ok-soft); color: var(--ok); }
.pill.abandoned { background: var(--surface-2); color: var(--text-3); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.pill.plain::before { display: none; }

.ok-text { color: var(--ok); }
.warn-text { color: var(--warn); }
.danger-text { color: var(--danger); }

.bar { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; display: flex; }
.bar > span { height: 100%; }
.bar .used { background: var(--text-3); }
.bar .reserved { background: var(--ok); }
.bar .short { background: var(--danger); opacity: .75; }
.bar .fill { background: var(--accent); }

.banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--radius); border: 1px solid; margin-bottom: 8px; }
.banner.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 25%, transparent); color: var(--ok); }
.banner.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 25%, transparent); color: var(--warn); }
.banner .grow { flex: 1; }
.banner b { color: var(--text); }

.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 56px 24px; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); color: var(--text-2); }
.empty .icon-wrap { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-3); }
.empty h3 { margin: 0; font-size: 15px; color: var(--text); }
.empty p { margin: 0; max-width: 380px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.project-card { padding: 16px; cursor: pointer; display: flex; flex-direction: column; gap: 10px; transition: border-color .12s, box-shadow .12s, transform .12s; text-align: left; }
.project-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.project-card h3 { margin: 0; font-size: 15px; font-weight: 600; }
.project-card .desc { color: var(--text-2); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.project-card .meta { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-3); }

.group-head { display: flex; align-items: center; gap: 8px; margin: 22px 0 8px; font-weight: 600; font-size: 13px; }
.group-head:first-child { margin-top: 0; }

/* ------------------------------------------------------------ overlays */
.backdrop { position: fixed; inset: 0; z-index: 40; background: rgb(15 15 14 / .28); animation: fade .15s ease-out; }
@keyframes fade { from { opacity: 0; } }
.drawer {
  position: fixed; z-index: 41; top: 0; right: 0; bottom: 0; width: min(560px, 100vw);
  display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg);
  animation: slide .2s cubic-bezier(.2, .8, .2, 1);
}
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
.drawer-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 16px; border-bottom: 1px solid var(--border); }
.drawer-head .titles { flex: 1; min-width: 0; }
.drawer-head h2 { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -.01em; line-height: 1.3; }
.crumbs { font-size: 12.5px; color: var(--text-3); display: flex; gap: 4px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 20px; }
.drawer-foot { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface); }
.drawer-foot .grow { flex: 1; }

.modal-wrap { position: fixed; inset: 0; z-index: 50; display: grid; place-items: start center; padding: 12vh 16px 16px; overflow-y: auto; }
.modal { width: min(460px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); animation: pop .16s cubic-bezier(.2, .8, .2, 1); }
.modal.wide { width: min(560px, 100%); }
@keyframes pop { from { transform: scale(.97) translateY(4px); opacity: 0; } }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-body h2 { margin: 0; font-size: 17px; font-weight: 650; }
.modal-body p { margin: 0; color: var(--text-2); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }

.popover {
  position: fixed; z-index: 70; width: 290px; padding: 14px;
  display: flex; flex-direction: column; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg);
  animation: pop .12s ease-out;
}
.popover h4 { margin: 0; font-size: 14px; font-weight: 600; }
.popover .row { display: flex; gap: 8px; justify-content: flex-end; }

.toasts { position: fixed; z-index: 90; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast { display: flex; align-items: center; gap: 12px; min-width: 240px; max-width: 420px; padding: 10px 12px 10px 14px; border-radius: 10px; background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); animation: pop .15s ease-out; font-size: 13.5px; }
.toast.danger { background: var(--danger); color: #fff; }
.toast .grow { flex: 1; }
.toast button { border: 0; background: color-mix(in srgb, var(--bg) 18%, transparent); color: inherit; font-weight: 600; padding: 4px 10px; border-radius: 6px; cursor: pointer; }

/* ------------------------------------------------------------ item drawer view */
.stock-card { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.stock-card .top { display: flex; align-items: center; gap: 12px; }
.stock-card .big { font-size: 30px; font-weight: 650; letter-spacing: -.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.stock-card .big .unit { font-size: 15px; font-weight: 500; color: var(--text-3); margin-left: 5px; letter-spacing: 0; }
.kv { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 8px 16px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.timeline { display: flex; flex-direction: column; }
.timeline .ev { display: flex; gap: 12px; padding: 7px 0; font-size: 13px; border-bottom: 1px dashed var(--border); }
.timeline .ev:last-child { border-bottom: 0; }
.timeline .delta { width: 56px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.timeline .delta.pos { color: var(--ok); }
.timeline .delta.neg { color: var(--text-2); }
.prose { white-space: pre-wrap; color: var(--text-2); font-size: 13.5px; margin: 0; }
.link-row { display: flex; gap: 8px; flex-wrap: wrap; }

.inline-num { width: 70px; height: 30px; padding: 0 8px; text-align: right; border: 1px solid transparent; border-radius: 6px; background: none; font-variant-numeric: tabular-nums; font-weight: 550; }
.inline-num:hover { border-color: var(--border); background: var(--surface); }
.inline-num:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); background: var(--surface); }

.quick-add { display: flex; gap: 8px; padding: 10px; align-items: center; margin-bottom: 18px; }
.quick-add .input { box-shadow: none; }

@media (max-width: 720px) {
  .topbar { padding: 0 16px; gap: 10px; }
  .brand span { display: none; }
  .tab { padding: 0 9px; }
  .tab .label { display: none; }
  .topbar .kbd-hint { display: none; }
  .page { padding: 20px 16px 80px; }
  .hide-sm { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .quick { opacity: 1; }
  .toasts { left: 16px; right: 16px; }
}

.pill-select { height: 34px; border-radius: 999px; font-weight: 550; padding-left: 14px; }
.quick-add .grow { flex: 1; min-width: 0; }
.group + .group { margin-top: 24px; }
.group .group-head { margin-top: 0; }
.nowrap { white-space: nowrap; }
.sub .inline-icon { display: inline-flex; align-items: center; gap: 4px; }
@media (max-width: 720px) {
  .table td:first-child { max-width: 0; width: 100%; }
  .nowrap { white-space: normal; }
  .table th, .table td { padding: 10px; }
}
/* Toasts never block clicks on what's underneath, except their own action button. */
.toasts { pointer-events: none; }
.toast button { pointer-events: auto; }

/* warning toast (e.g. reservations trimmed) */
.toast.warn { background: var(--warn); color: #fff; }
@media (prefers-color-scheme: dark) { .toast.warn { color: #1b1206; } }

.dupe-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.dupe-list .dupe { display: flex; gap: 10px; align-items: center; padding: 9px 12px; font-size: 13.5px; }
.dupe-list .dupe + .dupe { border-top: 1px solid var(--border); }
.dupe-list .grow { flex: 1; min-width: 0; }

/* ------------------------------------------------------------ import */
.modal.xl { width: min(940px, 100%); }
.modal-wrap:has(.modal.xl) { padding-top: 6vh; }
.textarea.mono { font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre; overflow-x: auto; }
.import-src { display: flex; align-items: center; gap: 10px; }
.import-src .grow { flex: 1; }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 8px 18px; }
.map-row { display: grid; grid-template-columns: minmax(0, 1fr) 14px minmax(0, 1.2fr); align-items: center; gap: 8px; color: var(--text-3); }
.map-row .col-name { color: var(--text); font-weight: 550; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-row .select { height: 32px; font-size: 13px; color: var(--text); }
.form-grid.three { grid-template-columns: 1.2fr 1fr 1fr; }
.preview-wrap { max-height: 42vh; overflow: auto; border-radius: var(--radius); }
.table.compact td { padding: 7px 12px; }
.table.compact th { padding: 8px 12px; position: sticky; top: 0; z-index: 1; }
.table.compact .chips { margin-top: 3px; }
.table tr.muted-row td { opacity: .55; }
.table tr.dup-row td { background: color-mix(in srgb, var(--warn-soft) 55%, transparent); }
.dup-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.dup-cell .pill { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.check input { accent-color: var(--accent); margin: 0; }
@media (max-width: 720px) { .form-grid.three { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------ categories */
.cat-name { display: flex; align-items: center; gap: 9px; min-width: 0; color: var(--text-3); position: relative; }
.cat-name .name { color: var(--text); font-weight: 550; }
.cat-name .sub { font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-name .elbow { width: 10px; height: 10px; margin-left: -16px; margin-top: -10px; border-left: 1.5px solid var(--border-strong); border-bottom: 1.5px solid var(--border-strong); border-bottom-left-radius: 4px; flex: none; }
.chip.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; }
.btn.ghost.danger { color: var(--text-3); }
.btn.ghost.danger:hover { color: var(--danger); background: var(--danger-soft); }

/* ------------------------------------------------------------ login (hosted mode) */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login { width: min(360px, 100%); padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.login .brand { font-size: 16px; }
.login h1 { margin: 0; font-size: 18px; }
