
:root {
  --forge: #000000;
  --page: #F4F1EC;
  --yellow: #D5C947;
  --bg: #F4F1EC;
  --surface: #FFFFFF;
  --text: #000000;
  --muted: #5d5953;
  --line: #d8d2c9;
  --field: #FFFFFF;
  --s-in: #dcebd8;
  --s-out: #d4e5ee;
  --s-repair: #f2dfc4;
  --s-missing: #f2d0c8;
  --s-retired: #e3dfd8;
  --focus: #0083AB;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0e0d;
    --surface: #1a1918;
    --text: #F4F1EC;
    --muted: #a7a199;
    --line: #34312d;
    --field: #141413;
    --s-in: #213623;
    --s-out: #1b3340;
    --s-repair: #45341c;
    --s-missing: #48241e;
    --s-retired: #2a2826;
    --focus: #4fb4d8;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
.hint:empty { display: none; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Denim Ink", "Inter", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
input[type=checkbox] { accent-color: var(--text); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header */
.bar { background: var(--forge); color: var(--page); }
.bar-top { max-width: 1000px; margin: 0 auto; padding: 16px 20px 6px; display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.wordmark { height: 20px; width: auto; color: var(--page); align-self: center; }
.bar h1 { font-size: 18px; font-weight: 600; margin: 0; }
.stats { margin-left: auto; display: flex; gap: 16px; font-size: 13px; color: #c9c3ba; flex-wrap: wrap; }
.stats b { color: var(--page); font-weight: 600; font-variant-numeric: tabular-nums; }
.stats .tolabel b { color: var(--yellow); }
.tabs { max-width: 1000px; margin: 0 auto; padding: 0 12px; display: flex; gap: 2px; }
.tabs button { background: none; border: 0; color: #b5afa6; font: inherit; font-size: 15px; padding: 10px 10px 11px; cursor: pointer; border-bottom: 3px solid transparent; }
.tabs button[aria-selected="true"] { color: var(--page); border-bottom-color: var(--yellow); }

main { max-width: 1000px; margin: 0 auto; padding: 26px 20px 90px; }
.view[hidden] { display: none; }
.narrow { max-width: 620px; }
h2 { font-size: 22px; font-weight: 600; margin: 0 0 4px; }
.lede { color: var(--muted); margin: 0 0 22px; }

/* Forms */
fieldset { border: 0; padding: 0; margin: 0 0 24px; min-width: 0; }
legend { font-weight: 600; font-size: 16px; margin-bottom: 10px; padding: 0; }
.f { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.f > span { display: block; margin-bottom: 4px; }
input[type=text], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; font: inherit; font-size: 15px; color: var(--text); background: var(--field);
  border: 1px solid var(--line); border-radius: 6px; padding: 9px 10px; min-height: 40px;
}
textarea { min-height: 70px; resize: vertical; }
select:disabled { opacity: .55; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 14px; }
@media (max-width: 600px) { .row2, .row3 { grid-template-columns: 1fr; } }
.hint { font-size: 13px; color: var(--muted); margin: -4px 0 12px; min-height: 1em; }
.newmodel { border-left: 3px solid var(--yellow); padding: 10px 0 2px 14px; margin: 4px 0 14px; }
details { margin: 0 0 24px; }
details summary { cursor: pointer; font-weight: 600; margin-bottom: 10px; }
.photo-preview img { max-width: 180px; max-height: 140px; border-radius: 4px; display: block; margin: 6px 0; }

.btn {
  font: inherit; font-size: 15px; font-weight: 600; border-radius: 6px; padding: 10px 16px; cursor: pointer;
  border: 1px solid var(--text); background: var(--text); color: var(--bg); display: inline-block; text-decoration: none;
}
.btn.ghost { background: transparent; color: var(--text); }
.btn.small { font-size: 14px; padding: 7px 12px; }
.btn:disabled { opacity: .5; cursor: progress; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.primary-wide { width: 100%; padding: 13px 16px; font-size: 16px; }

/* The label strip: what comes out of the P-touch */
.saved { background: var(--forge); color: var(--page); border-radius: 8px; padding: 26px 24px 24px; }
.saved p { margin: 14px 0 20px; color: #d4cec5; }
.saved .btn { background: var(--page); color: var(--forge); border-color: var(--page); }
.saved .btn.ghost { background: transparent; color: var(--page); }
.tape {
  display: inline-flex; align-items: center; gap: 14px; background: #ffffff; color: #000000;
  padding: 10px 20px 10px 10px; border-radius: 2px; max-width: 100%;
  box-shadow: 0 1px 0 rgba(0,0,0,.35);
}
.tape .qr { width: 62px; height: 62px; flex: none; }
.tape .qr svg { width: 100%; height: 100%; display: block; }
.tape .tid { font-size: clamp(22px, 6vw, 36px); font-weight: 600; letter-spacing: .02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tape .thome { font-size: clamp(13px, 3.2vw, 16px); font-weight: 500; letter-spacing: .03em; margin-top: 2px; }
.tape .tdesc { font-size: .72em; font-weight: 400; letter-spacing: .01em; }
.tape.sm .qr { width: 44px; height: 44px; }
.tape.sm .tid { font-size: 24px; }
.saved-anim { animation: peel .35s ease-out; }
@keyframes peel { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .saved-anim { animation: none; } }

/* Gear list */
.res { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--line); }
.res .pick { width: 18px; height: 18px; margin: 0 6px; flex: none; }
.res.sel { background: var(--surface); }
.selbar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--forge); color: var(--page); z-index: 15;
  display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px max(20px, calc((100% - 960px) / 2)); }
.selbar .btn { background: var(--page); color: var(--forge); border-color: var(--page); }
.selbar .btn.ghost { background: transparent; color: var(--page); }
.cart-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.cart-row small { display: block; color: var(--muted); font-size: 13px; }
.skipped { font-size: 14px; color: var(--muted); margin: 10px 0 0; }
.rcard { border-bottom: 1px solid var(--line); padding: 14px 4px; }
.rcard .top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.rcard p { margin: 6px 0 10px; font-size: 14px; }
.due { color: var(--muted); font-size: 13px; }

.filters { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 10px; margin-bottom: 10px; }
@media (max-width: 760px) { .filters { grid-template-columns: 1fr 1fr; } .filters .q { grid-column: 1 / -1; } }
.find-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 6px 0 12px; flex-wrap: wrap; }
.count { color: var(--muted); font-size: 14px; }
.check { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; color: var(--muted); }
.results { border-top: 1px solid var(--line); }
.res .open {
  display: grid; grid-template-columns: 170px 1fr 120px 88px; gap: 12px; align-items: center; flex: 1; min-width: 0;
  padding: 11px 6px 11px 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.res:hover { background: var(--surface); }
.rid { font-weight: 600; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 8px; }
.rid.unl::before { content: ""; width: 9px; height: 9px; background: var(--yellow); border-radius: 1px; flex: none; }
.rname small { display: block; color: var(--muted); font-size: 13px; }
.rhome { color: var(--muted); font-size: 14px; }
@media (max-width: 640px) { .res .open { grid-template-columns: 1fr auto; } .res .open .rhome { display: none; } .res .open .rname { grid-column: 1 / -1; grid-row: 2; } }
main { padding-bottom: 120px; }
.pill { font-size: 13px; padding: 2px 9px; border-radius: 999px; justify-self: start; white-space: nowrap; color: var(--text); }
.s-In { background: var(--s-in); } .s-Out { background: var(--s-out); } .s-Repair { background: var(--s-repair); }
.s-Missing { background: var(--s-missing); } .s-Retired { background: var(--s-retired); }
.empty { padding: 30px 6px; color: var(--muted); }

/* Drawer */
.drawer { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; justify-content: flex-end; z-index: 20; }
.drawer[hidden] { display: none; }
.panel { background: var(--bg); width: min(580px, 100%); height: 100%; overflow-y: auto; padding: 18px 22px 70px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.outwith { margin: 8px 0 0; font-size: 14px; }
.item-name { font-size: 19px; font-weight: 600; margin: 14px 0 4px; }
dl.facts { display: grid; grid-template-columns: 140px 1fr; gap: 6px 14px; margin: 18px 0 22px; font-size: 14px; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .panel .actions .btn { flex: 1 1 calc(50% - 10px); text-align: center; padding: 12px 10px; font-size: 15px; }
}
.actarea { border-left: 3px solid var(--line); padding: 4px 0 4px 14px; margin: 16px 0 6px; }
.actarea:empty { display: none; }
.history { list-style: none; padding: 0; margin: 8px 0 0; font-size: 14px; }
.history li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.history .when { color: var(--muted); }
h3 { font-size: 16px; margin: 26px 0 4px; }

/* Labels */
.lrow { display: grid; grid-template-columns: 28px 170px 1fr 130px; gap: 10px; align-items: center; padding: 9px 4px; border-bottom: 1px solid var(--line); }
@media (max-width: 640px) { .lrow { grid-template-columns: 28px 1fr; } .lrow .rname, .lrow .rhome { grid-column: 2; } }
.lhead { font-weight: 600; font-size: 14px; color: var(--muted); }
.drive-note { font-size: 14px; color: var(--muted); margin-top: 10px; }
.steps { font-size: 14px; color: var(--muted); max-width: 640px; padding-left: 18px; }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--forge); color: var(--page);
  padding: 11px 16px; border-radius: 6px; font-size: 14px; max-width: min(560px, calc(100% - 32px)); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 40; }
.toast.show { opacity: 1; }
.toast.bad { background: #8a2a17; }
#loading { max-width: 1000px; margin: 40px auto; padding: 0 20px; color: var(--muted); }

.account-btn{background:none;color:var(--page);border:0;cursor:pointer;font:inherit;font-size:12px;padding:6px}.res,.cart-row,.rcard,.history li,.lrow{border-bottom:0}.results{border-top:0}.res:nth-child(even),.cart-row:nth-child(even),.lrow:nth-child(even){background:var(--surface)}.tabs{overflow:auto}.res,.lrow{border-radius:5px;margin-bottom:4px}

@media(max-width:600px){.panel-head{flex-wrap:wrap}.panel-head #i-close{order:-1;margin-left:auto}.panel-head #item-tape{width:100%;min-width:0}.tape.sm .tid{font-size:clamp(16px,5.2vw,24px);white-space:normal;overflow-wrap:anywhere}.facts dd{overflow-wrap:anywhere}}

.test-qr{padding:18px;background:var(--surface);border-radius:8px}.test-qr h3{margin-top:0}.test-qr-code{width:min(100%,300px);background:#fff;margin:16px auto}.test-qr-code svg{display:block;width:100%;height:auto}.test-qr a{overflow-wrap:anywhere}

#location-context { margin-bottom: 24px; }
#location-context h2 { overflow-wrap: anywhere; }
