:root {
  color-scheme: light;
  --ink: #102b3a; --muted: #486472; --paper: #f0f5f5; --line: #d7e5e5;
  --white: #fff; --teal: #087467; --mint: #d8f2eb; --shadow: 0 12px 36px #102b3a0b;
  font: 15px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--paper); }
button, input, select, textarea { font: inherit; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px;
  border: 1px solid var(--line); padding: 7px 13px; background: var(--white); color: var(--ink);
  border-radius: 9px; cursor: pointer; font-weight: 650; text-decoration: none; text-align: center;
}
button:hover, .button:hover { background: #eaf3f2; }
button:disabled { opacity: .55; cursor: wait; }
:focus-visible { outline: 3px solid #20a797; outline-offset: 2px; }
.primary { background: var(--teal); border-color: var(--teal); color: white; }
.primary:hover { background: #075e54; }
header {
  padding: 15px max(24px, calc((100vw - 1390px) / 2)); background: var(--ink); color: white;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.brand, .identity { display: flex; gap: 12px; align-items: center; }
.brand strong { font-size: 17px; }
.brand small { color: #a7c3c9; font-size: 10px; font-weight: 650; letter-spacing: .12em; }
.logo { font-size: 17px; font-weight: 850; color: var(--ink); background: #8ce4d4; padding: 7px 11px; border-radius: 8px; }
.ghost { color: white; background: transparent; border-color: #5b7680; }
.ghost:hover { background: #244554; }
small { display: block; color: var(--muted); font-size: .86em; }
.shell { display: grid; grid-template-columns: 168px minmax(0, 1fr); max-width: 1420px; margin: auto; }
nav { padding: 26px 8px 0 14px; display: flex; flex-direction: column; gap: 6px; }
nav button { justify-content: flex-start; border-color: transparent; background: transparent; text-align: left; color: var(--muted); }
nav button span { font-size: 18px; line-height: 1; width: 20px; text-align: center; }
nav button.active { background: var(--mint); color: #07574f; }
main { min-width: 0; padding: 28px 26px 54px; }
.shell:has(nav[hidden]) { display: block; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 12px; margin-bottom: 21px; }
.eyebrow { margin: 0 0 4px; letter-spacing: .13em; color: var(--teal); font-size: 11px; font-weight: 850; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(26px, 5vw, 36px); line-height: 1.18; letter-spacing: -.035em; }
h2 { font-size: 18px; line-height: 1.25; letter-spacing: -.012em; }
h1 + p, h2 + p { margin-top: 6px; }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 17px; box-shadow: var(--shadow); min-width: 0; }
.spaced { margin-top: 15px; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.section-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.dashboard { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 15px; }
.metrics div { border: 1px solid var(--line); background: white; border-radius: 13px; padding: 13px; }
.metrics b, .metrics span { display: block; }
.metrics b { font-size: 29px; color: var(--teal); line-height: 1.15; }
.metrics span { font-size: 13px; color: var(--muted); margin-top: 3px; }
.muted, dt { color: var(--muted); }
.empty { padding: 13px 0 0; color: var(--muted); }
.order-link { display: flex; width: 100%; justify-content: space-between; text-align: left; margin-top: 8px; }
.order-link small { font-weight: 450; }
.badge { background: var(--mint); color: #05594e; border-radius: 20px; padding: 3px 8px; font-size: 11px; font-weight: 750; white-space: nowrap; }
.badge.amber { background: #fff0ce; color: #754700; }
.badge.gray { background: #eef3f4; color: #486472; }
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.day { border: 1px solid var(--line); min-height: 126px; border-radius: 8px; padding: 6px; min-width: 0; }
.day.current { background: #f1fbf8; border-color: #72bfaf; }
.day-head { display: flex; align-items: center; gap: 4px; justify-content: space-between; font-size: 13px; }
.day-head button { min-height: 27px; padding: 0 6px; }
.cal-event { padding: 6px; min-height: 0; display: block; text-align: left; width: 100%; background: var(--mint); overflow-wrap: anywhere; margin-top: 5px; font-size: 12px; }
.cal-event.on-loan { background: #fff1d7; }
form { display: grid; gap: 10px; margin-top: 10px; }
label { display: grid; gap: 4px; font-size: 13px; font-weight: 700; color: var(--muted); min-width: 0; }
input, select, textarea { width: 100%; min-height: 42px; min-width: 0; border-radius: 8px; border: 1px solid #bfd1d4; background: white; padding: 8px 10px; color: var(--ink); font-size: 16px; }
textarea { resize: vertical; }
.checkbox { display: flex; align-items: center; gap: 8px; }
.checkbox input { width: 18px; min-height: 18px; }
.split, .triple { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.triple { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.inline-form { display: flex; align-items: end; flex-wrap: wrap; gap: 8px; }
.inline-form label { flex: 1 1 130px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; margin-top: 9px; text-align: left; }
th, td { padding: 9px; border-bottom: 1px solid var(--line); }
th { font-size: 12px; color: var(--muted); background: #f2f7f7; }
td:not(:first-child) { white-space: nowrap; }
.list-row { padding: 9px 0; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; overflow-wrap: anywhere; }
.catalog { max-height: 350px; overflow: auto; }
.details { display: flex; flex-wrap: wrap; gap: 10px 22px; }
dt { font-size: 12px; }
dd { margin: 0; font-weight: 650; }
.material { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-top: 8px; }
.material ul { margin: 0; padding: 0; list-style: none; }
.material li { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); padding: 6px 0; }
.material li small { display: inline; }
.preserve { white-space: pre-wrap; margin-bottom: 10px; }
.callout { background: #eff8f6; border: 1px solid var(--line); padding: 10px 12px; border-radius: 8px; margin-top: 10px; }
.scanner > .actions { margin-top: 10px; }
video { display: block; width: 100%; max-height: 340px; margin: 10px 0; background: var(--ink); border-radius: 10px; }
dialog { border: 1px solid var(--line); border-radius: 16px; padding: 18px; width: min(710px, calc(100% - 24px)); max-height: calc(100dvh - 26px); color: var(--ink); box-shadow: 0 18px 70px #102b3a4d; }
dialog::backdrop { background: #102b3a9b; }
dialog p + .actions, dialog p + .button { margin-top: 9px; }
dialog canvas { width: 100%; height: 125px; display: block; background: #f9fcfc; border: 1px dashed #88a6a7; border-radius: 8px; touch-action: none; }
dialog details summary { cursor: pointer; font-weight: 650; padding: 5px; }
hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }
.available { max-height: 160px; overflow-y: auto; margin: 0; }
.login { width: min(430px, 100%); margin: 6vh auto; padding: 24px; }
#toast { position: fixed; z-index: 20; bottom: 18px; right: 18px; max-width: min(430px, calc(100% - 36px)); background: var(--ink); color: white; padding: 11px 15px; border-radius: 10px; box-shadow: var(--shadow); }
#toast.error { background: #8e2d29; }
.dialog-error { background: #fff0ee; color: #821d1a; padding: 8px 10px; border-radius: 8px; margin-top: 8px; }
.labels { padding: 20px; background: white; }
.label-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 6px; }
.qr-label { border: 1px solid var(--line); display: flex; gap: 4px; align-items: center; padding: 4px; break-inside: avoid; }
.no-print { margin-bottom: 12px; }
@media (max-width: 1050px) {
  .calendar { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  header { padding: 10px 13px; }
  .brand { gap: 7px; }
  .brand strong { font-size: 14px; }
  .identity > span { display: none; }
  .shell { display: block; }
  main { padding: 17px 10px calc(83px + env(safe-area-inset-bottom)); }
  nav { position: fixed; z-index: 10; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; padding: 5px 5px calc(5px + env(safe-area-inset-bottom)); background: white; border-top: 1px solid var(--line); }
  nav button { min-height: 48px; flex-direction: column; justify-content: center; gap: 3px; font-size: 11px; padding: 2px; }
  #toast { bottom: calc(65px + env(safe-area-inset-bottom)); }
  .dashboard { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2, 1fr); gap: 7px; }
  .panel { padding: 11px; }
  .calendar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .day { min-height: 68px; }
  .triple { grid-template-columns: 1fr; }
}
@media print {
  header, nav, button, .button, #toast, .no-print { display: none !important; }
  body, .panel { background: white; box-shadow: none; }
  .shell { display: block; }
  main { padding: 0; }
  .material { break-inside: avoid; }
  .label-grid { grid-template-columns: repeat(3, 1fr); }
}
