@font-face {
  font-family: 'Roboto Condensed';
  src: url('/fonts/RobotoCondensed.ttf') format('truetype');
  font-weight: 100 900;
  font-display: block;
}

:root {
  --ink: #141412;
  --muted: #6b675e;
  --line: #e2ddd2;
  --bg: #f6f3ec;
  --card: #fff;
  --gold: #c9a227;
  --gold-dark: #9a7a12;
  --night: #0a0a09;
  --ok: #2f7d32;
  --warn: #b26a00;
  --err: #b3261e;
  --radius: 14px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); -webkit-text-size-adjust: 100%; }
button, input, select { font: inherit; color: inherit; }
.boot { padding: 40px 16px; text-align: center; color: var(--muted); }

/* header */
.top {
  position: sticky; top: 0; z-index: 5;
  background: var(--night); color: #f3ead2;
  padding: calc(env(safe-area-inset-top) + 8px) 12px 0;
}
.top-row { display: flex; align-items: center; gap: 10px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .02em; }
.brand img { width: 26px; height: 26px; filter: invert(72%) sepia(52%) saturate(560%) hue-rotate(5deg); }
.spacer { flex: 1; }
.chip {
  border: 1px solid #3a372f; background: #1b1a17; color: #f3ead2;
  border-radius: 999px; padding: 6px 12px; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.chip.ok { border-color: #2f5f31; }
.chip.warn { border-color: var(--warn); color: #ffcf8a; }
.linkish { background: none; border: 0; color: #c9c1ad; font-size: 14px; cursor: pointer; padding: 6px 4px; }
nav.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 8px 0 0; scrollbar-width: none; }
nav.tabs a {
  color: #c9c1ad; text-decoration: none; padding: 10px 12px; border-radius: 10px 10px 0 0;
  font-size: 15px; white-space: nowrap;
}
nav.tabs a.on { background: var(--bg); color: var(--ink); font-weight: 600; }

main { max-width: 720px; margin: 0 auto; padding: 16px 16px calc(env(safe-area-inset-bottom) + 32px); }
h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 0 10px; }
h2:first-child { margin-top: 4px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.notice { border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; font-size: 15px; }
.notice.warn { background: #fff4e0; border: 1px solid #f0c98a; }
.notice.err { background: #fdecea; border: 1px solid #f2b8b5; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* buttons & inputs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--card); border-radius: 12px;
  padding: 12px 16px; font-size: 16px; cursor: pointer; text-decoration: none; color: var(--ink);
}
.btn.primary { background: var(--night); border-color: var(--night); color: #f3ead2; font-weight: 600; }
.btn.gold { background: var(--gold); border-color: var(--gold-dark); color: var(--night); font-weight: 700; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.huge { font-size: 22px; padding: 18px; border-radius: 16px; }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=password], input[type=number], input[type=date], select {
  width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 10px;
  padding: 11px 12px; font-size: 16px;
}
input:focus, select:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 16px; padding: 6px 0; }
.check input { width: 22px; height: 22px; accent-color: var(--night); }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 140px; }

/* packing */
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.product {
  border: 2px solid var(--line); background: var(--card); border-radius: var(--radius);
  padding: 14px 12px; text-align: left; cursor: pointer; min-height: 72px;
}
.product b { display: block; font-size: 17px; line-height: 1.2; }
.product small { color: var(--muted); }
.product.on { border-color: var(--night); background: #fffaf0; box-shadow: inset 0 0 0 1px var(--night); }
.weight { position: relative; }
.weight input {
  font-size: 44px; font-weight: 700; padding: 10px 56px 10px 16px; text-align: right;
  font-variant-numeric: tabular-nums; height: 78px;
}
.weight em { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font-style: normal; font-size: 26px; color: var(--muted); }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; margin: 12px 0 4px; font-size: 15px; }
.facts dt { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.facts dd { margin: 0; font-weight: 600; }
.preview { background: #fff; border: 1px dashed #cfc8b8; border-radius: 10px; padding: 8px; text-align: center; }
.preview canvas { width: 100%; max-width: 576px; image-rendering: pixelated; display: block; margin: 0 auto; }
.pending { margin-top: 12px; }
.connect-hint { margin: 8px 0 0; }
.linkish.inline { color: inherit; text-decoration: underline; }
#print { margin-top: 16px; }

/* lists */
.list { display: flex; flex-direction: column; gap: 8px; }
.item { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; gap: 12px; align-items: center; }
.item .main { flex: 1; min-width: 0; }
.item .title { font-weight: 600; }
.item .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.badge { display: inline-block; font-size: 11px; padding: 2px 7px; border-radius: 999px; background: #eee8da; margin-left: 6px; vertical-align: 1px; }
.badge.warn { background: #ffe6c2; }
.badge.off { background: #e9e9e9; color: #777; }
.summary { margin: 8px 0 12px; font-size: 15px; }

/* login */
.login { max-width: 380px; margin: 12vh auto 0; padding: 0 16px; }
.login .logo { display: block; width: 120px; margin: 0 auto 18px; }

#toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 20px); transform: translateX(-50%) translateY(20px);
  background: var(--night); color: #f3ead2; padding: 12px 18px; border-radius: 12px; font-size: 16px;
  opacity: 0; pointer-events: none; transition: .2s; max-width: calc(100% - 32px); z-index: 20;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--err); color: #fff; }
