:root {
  --paper: #f3ecdf;
  --paper-2: #fffaf3;
  --ink: #1e1a16;
  --muted: #6b6056;
  --line: #e4d7c4;
  --olive: #1f3330;
  --olive-2: #2a4541;
  --copper: #c56a3a;
  --copper-ink: #8c3f1e;
  --moss: #2f6a4a;
  --brick: #8d3b3b;
  --gold: #8d6b2f;
  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", "Songti SC", "Noto Serif SC", serif;
  --sans: "Avenir Next", "Segoe UI", "PingFang SC", "Noto Sans SC", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
}
a, a:visited { color: var(--copper-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: 0; margin: 0; }
h1 { font-size: 2rem; line-height: 1.2; }
h2 { font-size: 1.15rem; }
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side {
  background: var(--olive);
  color: #f3ecdf;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; gap: 12px; align-items: flex-start; color: inherit; text-decoration: none; margin-bottom: 22px; }
.brand strong { display: block; font-family: var(--serif); font-size: 1.12rem; line-height: 1.3; white-space: nowrap; }
.brand small { color: #d9cbb8; }
.mark { width: 28px; height: 28px; flex: 0 0 28px; margin-top: 2px; border-radius: 4px; background: var(--copper); display: inline-block; box-shadow: inset 0 0 0 6px var(--olive); }
.side nav { overflow: auto; flex: 1; }
.nav-group { margin-bottom: 16px; }
.nav-group p { margin: 0 0 6px; color: #c8b8a4; font-size: 12px; letter-spacing: 0.08em; }
.nav-group a, .side-foot a {
  display: block;
  color: #f6f0e6;
  text-decoration: none;
  border-radius: 6px;
  padding: 8px 10px;
}
.nav-group a[aria-current="page"] { background: var(--copper); color: white; }
.nav-group a:hover { background: var(--olive-2); }
.side-foot { border-top: 1px solid #3d564f; padding-top: 12px; }
.side-foot p { margin: 8px 0 0; color: #d9cbb8; font-size: 13px; }
.side-foot button {
  background: transparent;
  color: #f6f0e6;
  border: 0;
  padding: 8px 10px;
  cursor: pointer;
}
.main { padding: 28px 32px 56px; min-width: 0; }
.page-head { margin-bottom: 18px; }
.lead, .muted, .hint { color: var(--muted); }
.hint { display: block; font-size: 13px; margin-top: 4px; }
.card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
  min-width: 0;
  overflow-x: auto;
}
.card:has(.product-pick) { overflow: visible; }
.card-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.grid-2 { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 20px; align-items: start; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}
.stat span { display: block; color: var(--muted); font-size: 14px; }
.stat strong { display: block; margin-top: 8px; font-family: var(--serif); font-size: 1.75rem; line-height: 1.15; }
.toolbar, .inline-form, .actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.toolbar, .actions { margin-bottom: 16px; }
.toolbar label, .inline-form label, .actions label { margin: 0; flex: 1 1 160px; min-width: 0; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.tabs a { margin: 0; }
.tabs a[aria-current="page"] { font-weight: 700; }
label { display: block; margin-bottom: 12px; font-size: 14px; }
input, select, textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  background: white;
  border: 1px solid #d9cbb6;
  border-radius: 6px;
  padding: 10px 12px;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--copper);
  outline-offset: 2px;
}
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: auto; margin: 0; }
.checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.btn, .btn.secondary, .btn.quiet, .btn.danger {
  border-radius: 10px;
  padding: 9px 16px;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  line-height: 1.3;
}
.btn { background: var(--copper-ink); color: white; }
.btn.secondary { background: transparent; color: var(--olive); border-color: var(--olive); }
.btn.quiet { background: white; color: var(--copper-ink); border-color: var(--line); }
.btn.danger { background: var(--brick); color: white; }
.inline-form input, .inline-form select, .toolbar input, .toolbar select { width: 100%; margin-top: 6px; }
td form { margin: 0 0 8px; }
td form:last-child { margin-bottom: 0; }
td.wrap { white-space: normal; min-width: 8rem; }
td .inline-form { flex-wrap: nowrap; }
td .inline-form select { width: 11rem; flex: 0 0 11rem; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: top; white-space: nowrap; }
th { color: var(--muted); font-size: 13px; font-weight: 600; }
tr.low td { background: #f8ead7; }
.pill {
  display: inline-block;
  border-radius: 8px;
  padding: 2px 8px;
  background: #efe4d4;
  font-size: 13px;
  white-space: nowrap;
}
.pill-done, .pill-approved, .pill-active, .pill-received { background: #e5f0e6; color: var(--moss); }
.pill-cancelled, .pill-rejected, .pill-inactive { background: #f6e4e1; color: var(--brick); }
.pill-pending, .pill-review, .pill-open, .pill-ordered { background: #f8ecd4; color: var(--gold); }
.pill-sorting, .pill-doing, .pill-delivering, .pill-processing { background: #efe0d4; color: var(--copper-ink); }
.flash { border-radius: 6px; padding: 12px 14px; margin-bottom: 16px; }
.flash-ok { background: #e7f2e4; color: #20462d; }
.flash-error { background: #f8e4df; color: #6d2c22; }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.bars { display: flex; align-items: end; gap: 10px; min-height: 190px; overflow-x: auto; }
.bar { display: flex; flex-direction: column; align-items: center; justify-content: end; min-width: 64px; height: 190px; }
.bar span { display: block; width: 28px; background: var(--olive); border-radius: 8px 8px 2px 2px; }
.bar em, .bar small { font-style: normal; font-size: 12px; color: var(--muted); }
.role-form { padding: 12px 0; border-bottom: 1px solid var(--line); }
.role-form h3 { margin-bottom: 8px; }
.gate {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 1.05fr) minmax(300px, 0.95fr);
  gap: 24px;
  background:
    linear-gradient(105deg, rgba(18, 28, 26, 0.88) 0%, rgba(18, 28, 26, 0.62) 42%, rgba(18, 28, 26, 0.28) 100%),
    url("/assets/login-bg.jpg") center / cover no-repeat;
}
.gate-copy { color: #f6f0e6; padding: 12vh 8vw; }
.gate-copy h1 { font-size: 3.4rem; max-width: none; }
.eyebrow { letter-spacing: 0.14em; text-transform: none; margin: 0 0 8px; color: #e7c2ae; }
.gate-card, .gate .flash { margin: 12vh 8vw 0; }
.gate-card {
  background: var(--paper-2);
  border-radius: 12px;
  padding: 28px;
  box-shadow: 0 20px 50px rgba(31, 26, 22, 0.18);
}
.gate .flash { max-width: 420px; }
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; z-index: 3; height: auto; padding: 12px; }
  .brand { margin-bottom: 8px; }
  .side nav { display: flex; gap: 14px; overflow-x: auto; }
  .nav-group { display: flex; gap: 8px; align-items: center; margin: 0; }
  .nav-group p { margin: 0 4px 0 0; white-space: nowrap; }
  .nav-group a { white-space: nowrap; }
  .side-foot { display: flex; gap: 8px; align-items: center; border-top: 0; padding-top: 8px; }
  .side-foot p { margin: 0; }
  .stats, .grid-2, .gate, .split, .checks { grid-template-columns: 1fr; }
  .main { padding: 18px; }
  .gate-copy { padding: 32px 20px 0; }
  .gate-copy h1 { font-size: 2.2rem; }
  .gate-card, .gate .flash { margin: 20px; }
}
.print-head { display: none; }
.product-pick { position: relative; }
.pick-menu {
  position: absolute;
  z-index: 4;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  max-height: 240px;
  overflow: auto;
  box-shadow: 0 10px 24px rgba(31, 26, 22, 0.08);
}
.pick-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 8px 12px;
  cursor: pointer;
}
.pick-menu button:hover { background: #f6efe4; }
.bare { min-height: 100vh; background: var(--paper); padding: 24px 16px 48px; }
.bare-card {
  max-width: 680px;
  margin: 24px auto;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 28px;
}
.bare-card h1 { margin-bottom: 12px; }
.bare-card p { margin: 8px 0; }
@media print {
  .side, .no-print, .flash, .toolbar, .hint { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  .print-head { display: flex; justify-content: space-between; margin-bottom: 12px; }
  .card { border: 0; padding: 0; }
}
