:root {
  color-scheme: light;
  --ink: #2a2222;
  --muted: #625757;
  --forest: #420000;
  --green: #a80000;
  --surface: #fff;
  --paper: #f7f6f6;
  --line: #e5dddd;
  --wash: #f7eaea;
  --amber: #7a4a12;
  --red: #962d35;
  --nav-height: 70px;
  font: 16px/1.5 system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
button, input, textarea, select { font: inherit; color: inherit; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
a { color: var(--green); text-underline-offset: .18em; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #a36a21; outline-offset: 3px; }
.skip-link { position: fixed; top: -5em; left: 12px; z-index: 10; background: var(--surface); padding: 10px; }
.skip-link:focus { top: 8px; }
.topbar { background: var(--forest); color: #fbfff8; padding: env(safe-area-inset-top) 0 0; }
.topbar-inner { max-width: 760px; padding: 10px 16px; min-height: 65px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand { display: flex; gap: 9px; align-items: center; color: inherit; text-decoration: none; line-height: 1.15; min-width: 0; }
.brand img { border-radius: 9px; border: 1px solid #966c6c; flex: none; }
.brand strong { display: block; font-size: 17px; }
.brand small { color: #f2d5d5; display: block; font-size: 12px; margin-top: 4px; }
.status { border: 1px solid #a57272; border-radius: 999px; background: #642424; color: white; padding: 8px 10px; min-height: 44px; font-size: 12px; font-weight: 700; text-align: left; }
.status[data-tone="warn"] { background: #ffe8b7; color: #452d12; border-color: #ffe8b7; }
.status[data-tone="offline"] { background: #e8efe5; color: #224237; border-color: #e8efe5; }
main { width: min(100%, 760px); margin: 0 auto; padding: 20px 16px calc(var(--nav-height) + env(safe-area-inset-bottom) + 24px); }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(28px, 6vw, 42px); line-height: 1.1; letter-spacing: -.035em; margin-bottom: 8px; overflow-wrap: anywhere; }
h2 { font-size: 21px; line-height: 1.2; overflow-wrap: anywhere; }
h3 { font-size: 17px; line-height: 1.25; overflow-wrap: anywhere; }
p + p { margin-top: 8px; }
.eyebrow { color: var(--green); font-weight: 750; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 7px; }
.lede, .quiet, .row-meta, .hint { color: var(--muted); }
.lede { margin-bottom: 18px; }
.quiet, .hint { font-size: 14px; }
.panel, .empty, .list { border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.panel, .empty { padding: 16px; }
.empty p { margin-top: 5px; }
.section { margin-top: 22px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 9px; }
.grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 185px), 1fr)); }
.card { text-align: left; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); padding: 12px; min-height: 68px; display: grid; gap: 4px; align-content: start; min-width: 0; }
.card strong, .row-name { overflow-wrap: anywhere; }
.card small { color: var(--muted); }
.card--me { background: var(--wash); }
.card:hover, .row-action:hover { background: var(--wash); }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; min-height: 60px; padding: 9px 12px; gap: 8px; }
.row + .row { border-top: 1px solid var(--line); }
.row-action { text-align: left; width: 100%; color: inherit; background: transparent; border: 0; border-radius: 0; }
.row-action:first-child { border-radius: 14px 14px 0 0; }
.row-action:last-child { border-radius: 0 0 14px 14px; }
.row-action:only-child { border-radius: 14px; }
.row-name { display: block; font-weight: 730; line-height: 1.25; }
.row-meta { display: block; font-size: 13px; margin-top: 3px; overflow-wrap: anywhere; }
.row-tail { font-weight: 750; font-size: 14px; text-align: right; max-width: 9em; overflow-wrap: anywhere; }
.chevron { color: var(--green); font-size: 20px; font-weight: 450; padding-left: 4px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.toolbar > * { flex: 0 0 auto; }
.btn { border: 1px solid transparent; border-radius: 10px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 13px; background: var(--wash); color: var(--forest); text-decoration: none; font-weight: 700; text-align: center; line-height: 1.25; }
.btn:hover { filter: brightness(.95); }
.primary { background: var(--green); color: white; }
.secondary { background: var(--surface); border-color: var(--line); }
.btn-danger { color: var(--red); background: #faebeb; }
.btn-text { background: transparent; padding-inline: 0; text-decoration: underline; text-underline-offset: .18em; }
.btn-small { font-size: 14px; }
.search { display: block; margin: 0; }
.search input, .field input:not([type="checkbox"]), .field textarea, .field select {
  width: 100%; min-width: 0; border: 1px solid #bbadad; background: var(--surface); border-radius: 10px; min-height: 46px; padding: 8px 11px;
}
.search > span, .field > span:first-child { display: block; margin-bottom: 4px; font-weight: 700; }
.field { display: grid; align-content: start; min-width: 0; margin: 0; }
.field textarea { resize: vertical; min-height: 96px; }
.field input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--green); }
.field .hint { margin-top: 4px; }
.form { display: grid; gap: 12px; }
.form-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); gap: 10px; }
.form-actions { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 8px; }
.form-actions > .primary { flex: 1 1 150px; }
.form-error { min-height: 0; color: var(--red); font-size: 14px; font-weight: 650; }
.form-error:empty { display: none; }
.checkline { display: flex; gap: 9px; align-items: center; min-height: 44px; font-size: 14px; }
.checkline input { width: 18px; height: 18px; accent-color: var(--green); }
details > summary { cursor: pointer; min-height: 44px; padding-block: 10px; font-weight: 700; }
details .form { padding-bottom: 4px; }
.navigation { position: fixed; z-index: 3; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--line); display: flex; justify-content: center; padding: 5px max(7px, env(safe-area-inset-left)) calc(5px + env(safe-area-inset-bottom)) max(7px, env(safe-area-inset-right)); min-height: var(--nav-height); }
.nav-button { flex: 1 1 0; max-width: 150px; min-width: 0; min-height: 54px; border-radius: 10px; background: transparent; border: 0; color: var(--muted); display: grid; justify-items: center; align-content: center; gap: 2px; line-height: 1.1; padding: 4px 0; font-size: 11px; font-weight: 700; }
.nav-button[aria-current="page"] { background: var(--wash); color: var(--forest); }
.nav-button svg { width: 23px; height: 23px; }
dialog { color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; max-width: min(100% - 24px, 560px); width: 100%; max-height: min(87dvh, 780px); padding: 0; }
dialog::backdrop { background: #2e1818c4; }
.sheet-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1; }
.sheet-body { padding: 14px 16px 18px; }
.close { flex: 0 0 44px; min-width: 44px; padding: 0; font-size: 24px; }
.notice { position: fixed; z-index: 4; bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 10px); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px); background: var(--forest); color: white; border-radius: 9px; padding: 10px 14px; font-size: 14px; box-shadow: 0 4px 14px #0003; }
.notice:empty { display: none; }
.mini-list { display: grid; gap: 6px; max-height: 240px; overflow: auto; margin-top: 8px; }
.mini-choice { display: block; width: 100%; min-height: 44px; background: var(--surface); border: 1px solid var(--line); text-align: left; border-radius: 9px; padding: 6px 9px; overflow-wrap: anywhere; }
.mini-choice[aria-pressed="true"] { background: var(--wash); border-color: var(--green); }
.badge { display: inline-block; background: var(--wash); color: var(--green); padding: 3px 7px; border-radius: 999px; font-size: 12px; font-weight: 750; }
.badge-open { color: var(--amber); background: #f9ecd5; }
.transfer-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; align-items: center; padding: 9px; }
.transfer-row + .transfer-row { border-top: 1px solid var(--line); }
.transfer-qty { display: flex; align-items: center; gap: 5px; }
.transfer-qty input { width: 63px; min-height: 44px; border: 1px solid #bbadad; border-radius: 8px; padding: 4px; text-align: center; }
.transfer-qty .btn { min-width: 44px; padding-inline: 8px; }
.conflict { background: #fff0db; border: 1px solid #eacda0; border-radius: 10px; padding: 10px; }
.muted-list { margin: 6px 0; padding-left: 20px; }
.photo-preview { display: block; max-width: 100%; max-height: 160px; object-fit: contain; border-radius: 8px; }
.readout { display: grid; gap: 6px; margin: 10px 0; }
.readout div { display: grid; grid-template-columns: minmax(84px,.35fr) minmax(0,1fr); gap: 8px; }
.readout dt { color: var(--muted); }
.readout dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 480px) {
  dialog { max-width: 100%; width: 100%; margin: auto 0 0; border-radius: 18px 18px 0 0; max-height: 91dvh; }
  .sheet-body { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
}
@media (min-width: 640px) {
  .topbar-inner, main { padding-inline: 26px; }
  main { padding-top: 30px; }
}

.stock-group + .stock-group { margin-top: 16px; }
.stock-group h3 { margin: 8px 0 6px; color: var(--green); font-size: 15px; }
.move-list { max-height: min(46dvh, 480px); overflow: auto; }
.transfer-qty .btn[aria-pressed="true"] { color: white; background: var(--green); }
.photo-fields { border: 0; padding: 0; margin: 0; min-width: 0; }
.photo-fields legend { font-weight: 750; }
.photo-button { position: relative; cursor: pointer; }
.photo-button:focus-within { outline: 3px solid #a36a21; outline-offset: 3px; }
.photo-button input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.preserve-lines { white-space: pre-wrap; overflow-wrap: anywhere; }


.stock-location { margin-bottom: 10px; }
.stock-choice-list { max-height: min(42dvh, 340px); }
.choice-label { margin-top: 5px; color: var(--muted); font-size: 12px; font-weight: 750; }
.stock-selected { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stock-selected > p { overflow-wrap: anywhere; font-weight: 730; }
.stock-fields { display: grid; gap: 12px; min-width: 0; }
.stock-count { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.stock-contents { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: end; }
.count-hint { margin-top: -8px; }
.stock-sentence { min-height: 44px; padding: 9px 11px; border-radius: 9px; background: var(--wash); color: var(--forest); font-size: 14px; overflow-wrap: anywhere; }
.new-stock-type { display: grid; gap: 4px; border-top: 1px solid var(--line); margin-top: 16px; padding-top: 10px; }
.new-type-button { justify-self: start; background: var(--forest); color: #fff; }
.remove-stock { color: var(--red); }
@media (max-width: 360px) {
  .stock-contents { grid-template-columns: minmax(0, 1fr); }
}
.issue-row { align-items: start; gap: .7rem; }
.issue-thumbnail {
  width: 62px;
  height: 62px;
  flex: 0 0 62px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--wash);
}
.issue-summary {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: .91rem;
}
