/* Shared look for the tag apps (Switchboard, Placard, Mothball, Larder, Frostbite, Packrat): Tag Along's label-maker
   style. Each app sets --accent, --accent-ink and --tape in its own css/app.css. */
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url("../fonts/barlow-condensed-700.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url("../fonts/barlow-400.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url("../fonts/barlow-600.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 500; font-display: swap; src: url("../fonts/jetbrains-mono-500.woff2") format("woff2"); }

:root {
  --bg: #F1EFE8; --panel: #FFFFFF; --ink: #1D1E1B; --ink2: #5C5F57; --ink3: #696C64; --line: #D8D6CC; --soft: #E7E4DA;
  --accent: #1D1E1B; --accent-ink: #F6F4EC; --tape: #F3C22F; --tape-ink: #1D1E1B; --tape-edge: #C99A12;
  --ok: #2D794D; --ok-soft: #DDEFE3; --warn: #8A5A00; --warn-soft: #F7EAC8; --bad: #B3261E; --bad-soft: #F7DEDB;
  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161714; --panel: #20221E; --ink: #ECEAE2; --ink2: #B1B4AA; --ink3: #8F9289; --line: #33362F; --soft: #2A2C27;
    --ok: #6CC08B; --ok-soft: #1E3327; --warn: #E9C25A; --warn-soft: #3A3018; --bad: #F08A80; --bad-soft: #3E211F;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink); font: 17px/1.5 var(--body);
  padding: env(safe-area-inset-top, 0) 16px calc(16px + env(safe-area-inset-bottom, 0));
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
.wrap { max-width: 560px; margin: 0 auto; padding-top: 18px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--tape-edge); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.05; letter-spacing: .01em; }
h2 { font-size: 26px; margin: 26px 0 10px; text-transform: uppercase; }
h3 { font-size: 20px; margin: 20px 0 8px; text-transform: uppercase; }
code, .mono { font-family: var(--mono); font-size: .86em; }
small, .muted { color: var(--ink2); }

/* top bar */
.top { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 16px; }
.top .brand { flex: 1; min-width: 0; text-decoration: none; }
.top h1 { font-size: 38px; margin: 0; text-transform: uppercase; }
.top .sub { margin: 2px 0 0; color: var(--ink2); font-size: 15px; }
.top .icon-btn { flex: none; }
.icon-btn { border: 2px solid var(--line); background: var(--panel); border-radius: 10px; width: 44px; height: 44px; display: grid; place-items: center; font-size: 20px; line-height: 1; }
.sync { font: 500 12px/1 var(--mono); color: var(--ink3); letter-spacing: .02em; margin: -8px 0 14px; display: flex; gap: 6px; align-items: center; }
.sync::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ink3); }
.sync.synced::before, .sync.idle::before { background: var(--ok); }
.sync.pending::before { background: var(--warn); }
.sync.offline::before, .sync.unset::before { background: var(--bad); }
.sync.demo::before { background: var(--tape-edge); }

/* label-maker tape: the item's name */
.tape-wrap { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin: 4px 0 14px; }
.tape-cap { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink3); font-weight: 600; }
.tape {
  background: var(--tape); color: var(--tape-ink); padding: 8px 26px 5px; border-radius: 3px; max-width: 100%;
  box-shadow: 0 1px 0 var(--tape-edge), 0 10px 22px -14px rgba(0,0,0,.55);
  clip-path: polygon(0 0, 100% 0, 98% 50%, 100% 100%, 0 100%, 2% 50%);
  font: 700 clamp(30px, 9vw, 48px)/1.02 var(--display); text-transform: uppercase; letter-spacing: .02em; overflow-wrap: anywhere;
}

/* panels and rows */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin: 0 0 12px; }
.card > :first-child { margin-top: 0; } .card > :last-child { margin-bottom: 0; }
.list { display: flex; flex-direction: column; gap: 8px; margin: 0 0 14px; padding: 0; list-style: none; }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; text-decoration: none;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; min-height: 56px;
}
button.row:active, a.row:active { transform: scale(.995); }
.row .main { flex: 1; min-width: 0; }
.row .t { font-weight: 600; display: block; overflow-wrap: anywhere; }
.row .s { color: var(--ink2); font-size: 14px; display: block; }
.row .meta { flex: none; text-align: right; font: 500 13px/1.3 var(--mono); color: var(--ink2); }
.row.dim { opacity: .55; }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; margin: 0; }
.facts dt { color: var(--ink2); font-size: 14px; }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

/* chips */
.chip { display: inline-block; font: 600 12px/1 var(--body); letter-spacing: .06em; text-transform: uppercase; padding: 5px 8px; border-radius: 999px; background: var(--soft); color: var(--ink2); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.acc { background: var(--accent); color: var(--accent-ink); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 2px solid var(--accent); background: var(--accent); color: var(--accent-ink); border-radius: 10px; padding: 10px 16px; font-weight: 600; min-height: 44px; text-decoration: none; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger.ghost { background: transparent; color: var(--bad); border-color: var(--bad-soft); }
.btn.big { width: 100%; min-height: 64px; font-size: 20px; border-radius: 14px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; }
.btns.stack { flex-direction: column; }
.btns .grow, .sheet-bar .grow { flex: 1; }
.linkish { background: none; border: 0; padding: 0; color: var(--ink2); text-decoration: underline; font-size: 15px; }

/* meters */
.meter { height: 12px; border-radius: 6px; background: var(--soft); overflow: hidden; margin: 6px 0 4px; }
.meter > i { display: block; height: 100%; background: var(--ok); border-radius: 6px; }
.meter.warn > i { background: var(--warn); } .meter.bad > i { background: var(--bad); }

/* notices */
.notice { border-radius: 10px; padding: 12px 14px; margin: 0 0 14px; background: var(--soft); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.notice p { margin: 0 0 6px; } .notice p:last-child { margin: 0; }
.empty { text-align: center; color: var(--ink2); padding: 26px 10px; }

/* search */
.search { width: 100%; border: 2px solid var(--line); background: var(--panel); border-radius: 12px; padding: 12px 14px; margin: 0 0 12px; }

/* forms in the sheet */
dialog.sheet { border: 0; border-radius: 18px 18px 0 0; padding: 18px 16px calc(16px + env(safe-area-inset-bottom, 0)); width: 100%; max-width: 560px; margin: auto auto 0; background: var(--bg); color: var(--ink); max-height: 92vh; overflow: auto; }
dialog.sheet::backdrop { background: rgba(0,0,0,.45); }
dialog.sheet h2 { margin: 0 0 12px; }
.field { display: flex; flex-direction: column; gap: 4px; margin: 0 0 12px; font-weight: 600; font-size: 15px; }
.field input, .field select, .field textarea { border: 2px solid var(--line); background: var(--panel); border-radius: 10px; padding: 10px 12px; font-weight: 400; font-size: 17px; width: 100%; }
.field small { font-weight: 400; }
.sheet-bar { display: flex; gap: 8px; align-items: center; margin-top: 6px; position: sticky; bottom: -16px; background: var(--bg); padding: 8px 0; }

/* toast */
.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0)); transform: translate(-50%, 140%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; transition: transform .2s ease; max-width: calc(100vw - 32px); z-index: 10; }
.toast.show { transform: translate(-50%, 0); }
.toast.bad { background: var(--bad); color: #fff; }

/* NFC panel (write a sticker) */
.nfc { border: 2px dashed var(--line); border-radius: 12px; padding: 12px 14px; margin: 0 0 14px; }
.nfc .url { font: 500 13px/1.4 var(--mono); color: var(--ink2); overflow-wrap: anywhere; display: block; margin: 2px 0 8px; }
.nfc .msg { margin: 6px 0 0; font-size: 15px; }
.nfc .msg.ok { color: var(--ok); } .nfc .msg.bad { color: var(--bad); } .nfc .msg.wait { color: var(--warn); }

/* the drawer footer */
.jd-foot { margin: 36px 0 8px; text-align: center; font-size: 13px; color: var(--ink3); }
.jd-foot a { color: inherit; text-decoration: none; }
.jd-foot a:hover, .jd-foot a:focus-visible { text-decoration: underline; }
.jd-foot span { margin: 0 6px; }

@media print {
  body { background: #fff; color: #000; padding: 0; }
  .no-print, .jd-foot, .top .icon-btn, .sync { display: none !important; }
}

/* tables */
.tbl { overflow-x: auto; margin: 0 0 12px; }
.tbl table { border-collapse: collapse; width: 100%; font-size: 15px; }
.tbl th, .tbl td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink3); }
.tbl td.m { font-family: var(--mono); font-size: 14px; }
.msg { margin: 6px 0 0; font-size: 15px; }
.msg.ok { color: var(--ok); } .msg.bad { color: var(--bad); } .msg.wait { color: var(--warn); }
