:root {
  --bg: #f7f4ee; --card: #fff; --line: #e3dcd0; --text: #1f1b16; --ink2: #3b342b; --sub: #857c70;
  --gold: #94703d; --tint: #7d5c2c; --track: #ece6da;
  --red: #b3261e; --red-bg: #fbe7e4; --amb: #8a5a00; --amb-bg: #fff1cf;
  --grn: #2e6b3a; --grn-bg: #e6f2e8; --blu: #2f5a8a; --blu-bg: #e7eff9;
  --serif: Georgia, "Times New Roman", serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--tint); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; color: var(--tint); }

/* ---------- top bar */
.bar { position: sticky; top: 0; z-index: 3; background: rgba(250, 248, 243, .94); border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); padding-top: env(safe-area-inset-top); }
.bar-in { max-width: 860px; margin: 0 auto; padding: 9px 16px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
.brand, .eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .28em; text-transform: uppercase; color: var(--gold); white-space: nowrap; }
.bar-right { display: flex; justify-content: flex-end; align-items: center; gap: 14px; white-space: nowrap; font-size: 14px; }
#save { font-size: 12.5px; color: var(--sub); }
#save.warn { color: var(--red); }
#settings-link.on { font-weight: 600; }

.seg { display: inline-flex; border: 1px solid var(--text); border-radius: 6px; overflow: hidden; }
.seg a, .seg button { padding: 5px 15px; font-size: 14px; color: var(--text); border-left: 1px solid var(--text); white-space: nowrap; }
.seg a:first-child, .seg button:first-child { border-left: 0; }
.seg .on { background: var(--text); color: #fff; }

#banner:not(:empty) { background: var(--amb-bg); border-bottom: 1px solid var(--line); text-align: center; padding: 7px 16px; font-size: 13.5px; }
#banner.warn:not(:empty) { background: var(--red-bg); }
#banner button { font-weight: 600; margin-left: 6px; }

/* ---------- page */
main { max-width: 860px; margin: 0 auto; padding: 8px 16px 80px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 24px 0 2px; }
h1 { font: 32px/1.12 var(--serif); margin: 0; overflow-wrap: anywhere; }
.head .act { padding-bottom: 4px; white-space: nowrap; font-weight: 600; }
.lede { color: var(--sub); font-size: 14px; padding-top: 3px; }
.back { display: inline-block; padding-top: 16px; font-size: 15px; }
.tools { padding-top: 14px; }
.note { margin-top: 14px; background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--gold); padding: 10px 14px; font-size: 14px; color: var(--ink2); white-space: pre-wrap; overflow-wrap: anywhere; }

.label { padding: 28px 2px 8px; font: 19px var(--serif); display: flex; align-items: baseline; gap: 10px; }
.label:empty { padding: 16px 0 0; }
.label span { font: 12.5px -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif; color: var(--sub); }
.foot { padding: 7px 2px 0; font-size: 12.5px; color: var(--sub); }
.group { background: var(--card); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }

.tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; padding-top: 20px; }
.tile { background: var(--card); border: 1px solid var(--line); border-top: 2px solid var(--gold); border-radius: 0 0 8px 8px; padding: 11px 14px 12px; }
.tile span { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--sub); }
.tile b { display: block; font: 28px/1.2 var(--serif); margin-top: 3px; }

/* ---------- rows */
.row { position: relative; display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 16px; color: inherit; }
.row + .row { border-top: 1px solid var(--line); }
a.row:hover, .row-main:hover { background-color: rgba(148, 112, 61, .04); }
.row-main { flex: 1; min-width: 0; padding: 10px 0; cursor: pointer; }
.row-title { overflow-wrap: anywhere; }
.row-sub { font-size: 13px; color: var(--sub); overflow-wrap: anywhere; margin-top: 1px; }
.row-side { font-size: 13.5px; color: var(--sub); white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.is-done .row-title { color: var(--sub); text-decoration: line-through; text-decoration-color: #c9c1b5; }
.is-current .row-title { font-weight: 600; }
.chev { color: #c9c1b5; font-size: 20px; line-height: 1; }
.red { color: var(--red); } .amb { color: var(--amb); } .green { color: var(--grn); }
.empty { padding: 14px 16px; color: var(--sub); font-style: italic; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 11.5px; font-weight: 700; background: var(--track); color: var(--ink2); white-space: nowrap; }
.pill.red { background: var(--red-bg); color: var(--red); } .pill.amb { background: var(--amb-bg); color: var(--amb); }
.pill.grn { background: var(--grn-bg); color: var(--grn); } .pill.blu { background: var(--blu-bg); color: var(--blu); }
.pill.grey { background: none; color: var(--sub); font-weight: 400; padding: 2px 0; }

.check { flex: none; width: 23px; height: 23px; border-radius: 50%; border: 1.5px solid #cfc7ba; background: #fff center/13px no-repeat; }
.check:hover { border-color: var(--gold); }
.check.on { border-color: var(--gold); background-color: var(--gold);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M2.5 7.5l3 3 6-7' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }

.prog { height: 5px; background: var(--track); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.prog i { display: block; height: 100%; background: var(--gold); }
.prog.full i { background: var(--grn); }

.kv { justify-content: space-between; font-size: 15px; }
.kv > span:first-child { flex: none; color: var(--sub); }
.kv > span:last-child { text-align: right; overflow-wrap: anywhere; min-width: 0; padding: 11px 0; white-space: pre-wrap; }

input.mini, select.mini { border: 1px solid var(--line); border-radius: 5px; background: #fff; padding: 3px 6px; font-size: 13px; color: var(--ink2); }
.add { gap: 10px; background: #fdfcfa; }
.add > input:first-child { flex: 1 1 180px; min-width: 0; border: 0; background: none; padding: 12px 0; outline: none; }
.add select { flex: 0 1 auto; max-width: 170px; border: 1px solid var(--line); border-radius: 5px; background: #fff; padding: 4px 6px; font-size: 13px; color: var(--ink2); }
.add.wrap { flex-wrap: wrap; padding-bottom: 8px; row-gap: 0; }
.action { justify-content: center; color: var(--tint); width: 100%; font-weight: 600; font-size: 15px; }
.action.danger { color: var(--red); font-weight: 400; }
.btn { display: inline-block; background: var(--text); color: #fff; border-radius: 6px; padding: 11px 24px; font-weight: 600; }
.btn.small { padding: 5px 14px; font-size: 14px; }

/* ---------- forms */
.frow { position: relative; display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 16px; }
.frow + .frow { border-top: 1px solid var(--line); }
.frow > span { flex: none; width: 92px; font-size: 13px; font-weight: 600; color: var(--sub); }
.frow input, .frow select, .frow textarea { flex: 1; min-width: 0; border: 0; background: none; padding: 12px 0; outline: none; }
.frow textarea, .block textarea { resize: vertical; line-height: 1.4; }
.block { display: block; padding: 11px 16px; }
.block input { width: 100%; border: 0; outline: none; font-weight: 700; font-size: 13px; letter-spacing: .04em; color: var(--ink2); padding: 0 0 7px; background: none; }
.block input[readonly] { text-transform: uppercase; color: var(--sub); font-size: 11px; letter-spacing: .07em; }
.block textarea { width: 100%; border: 0; outline: none; background: none; padding: 0; display: block; }

.scrim { position: fixed; inset: 0; z-index: 5; background: rgba(31, 27, 22, .45); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 12px 12px; overflow: auto; }
.sheet { width: 100%; max-width: 540px; background: var(--bg); border-radius: 10px; border-top: 3px solid var(--gold); overflow: hidden; padding: 0 14px 18px; }
.sheet-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 14px 2px 12px; }
.sheet-bar b { font: 19px var(--serif); }
.sheet-bar button:last-child { justify-self: end; background: var(--text); color: #fff; border-radius: 6px; padding: 5px 16px; font-weight: 600; font-size: 14px; }
.sheet-bar button:first-child { justify-self: start; }
.sheet .gap { height: 12px; }
.sheet .gap:first-of-type { height: 0; }

.gate { text-align: center; padding: 16vh 24px 0; }
.gate h1 { margin: 8px 0 12px; font-size: 36px; }
.gate p { color: var(--sub); max-width: 420px; margin: 0 auto 22px; }

@media (max-width: 720px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .tile:last-child { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .brand { display: none; }
  .bar-in { grid-template-columns: auto 1fr; padding: 8px 12px; }
  .seg a { padding: 5px 10px; }
  #save:not(.warn) { display: none; }
  main { padding: 4px 12px 80px; }
  h1 { font-size: 28px; }
  .row { padding: 0 12px; gap: 10px; }
  .scrim { padding: 0; align-items: flex-end; }
  .sheet { border-radius: 12px 12px 0 0; max-height: 94vh; overflow: auto; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
}

/* ---------- inventory */
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 6px; background: #fff; overflow: hidden; }
.stepper button { width: 30px; height: 28px; font-size: 17px; line-height: 1; color: var(--ink2); }
.stepper button:hover { background: var(--track); }
.stepper b { min-width: 34px; text-align: center; font-weight: 600; color: var(--text); font-size: 14px; }
@media (max-width: 560px) { .seg a { padding: 5px 7px; font-size: 13px; } }

.head .seg { margin-bottom: 4px; flex: none; }
