:root { color-scheme: light; font: 16px/1.45 system-ui, sans-serif; color: #183026; background: #f2f5f2; --line: #d1ddd4; --green: #1b684e; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
.shell { width: min(1180px, 100% - 2rem); margin: auto; }
header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.25rem 0; }
h1 { font-size: clamp(1.5rem, 4vw, 2.25rem); margin: .25rem 0; }
h2 { margin: 0 0 .55rem; font-size: 1.35rem; }
h3 { margin-bottom: .35rem; }
p { margin: .35rem 0 .7rem; }
a { color: var(--green); }
.card, dialog { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 1rem; }
.login { max-width: 420px; display: grid; gap: .8rem; }
button, input, select, textarea { font: inherit; border: 1px solid #a1b7a8; border-radius: 6px; padding: .55rem .65rem; min-height: 42px; background: white; color: inherit; }
input, select, textarea { width: 100%; }
textarea { resize: vertical; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
button.primary, button[aria-pressed=true] { color: #fff; background: var(--green); border-color: var(--green); }
label { display: grid; gap: .2rem; }
.toolbar, .toolbar form, nav, .actions, .dialog-bar { display: flex; flex-wrap: wrap; align-items: end; gap: .55rem; }
.toolbar { margin-bottom: .8rem; }
nav { margin-bottom: .7rem; }
.dialog-bar { justify-content: space-between; align-items: center; }
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
td, th { padding: .55rem; text-align: left; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
th { background: #edf3ee; }
dialog { width: min(940px, 100% - 1.2rem); max-height: 92dvh; overflow: auto; }
dialog::backdrop { background: #15291db0; }
form.grid, .fields { display: grid; grid-template-columns: repeat(auto-fit,minmax(175px,1fr)); gap: .7rem; align-items: end; }
.full { grid-column: 1/-1; }
.row { display: grid; grid-template-columns: minmax(160px,2fr) minmax(85px,1fr) auto; gap: .4rem; margin: .3rem 0; align-items: end; }
.thread { padding: .45rem 0; border-bottom: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; }
canvas { width: min(100%, 480px); height: 140px; display: block; background: white; border: 1px dashed #52725f; border-radius: 8px; touch-action: none; }
.signature { display: inline-block; margin: .25rem .6rem .5rem 0; padding: .4rem; border: 1px solid var(--line); }
.signature img { display: block; width: 200px; max-width: 100%; height: 72px; object-fit: contain; }
.break { overflow-wrap: anywhere; }
#status, #editor-status, #detail-status { color: #862922; }
@media(max-width: 540px) { header { align-items: start; } .toolbar form { width: 100%; } .toolbar form label { flex: 1; } td,th { padding: .4rem; } }
@media print {
  * { color: #000 !important; background: #fff !important; }
  body { margin: 0; } .shell { width: 100%; }
  header, nav, .toolbar, button, form, .no-print, [role=status] { display: none !important; }
  .card, dialog { border: 0; padding: 0; }
  dialog[open] { position: static; width: 100%; max-height: none; overflow: visible; margin: 0; }
  body:has(#detail[open]) #office { display: none; }
  table { font-size: 10pt; } th,td { border: 1px solid #999; }
  tr, .signature { break-inside: avoid; } .scroll { overflow: visible; }
}
.stock-status { font-weight: 700; }
.stock-healthy { background: #c5edcc; color: #175428; }
.stock-below-target { background: #fff1ad; color: #4f3d0d; }
.stock-near { background: #ffdead; color: #693408; }
.stock-low { background: #ffd2cf; color: #711715; }
.stock-empty { background: #a91f2e; color: white; }
.stock-unset { background: #e7ebee; color: #384149; }
