:root {
  --bg: #FAF6EF; --card: #FFFFFF; --ink: #2E2924; --muted: #7A7066; --line: #E8DFD2;
  --accent: #B8643A; --accent-dark: #8F4A27; --accent-soft: #F5E3D6; --olive: #667A4F; --olive-soft: #E6ECD9;
  --warn: #B54A32; --warn-soft: #F8E2DC; --sand: #F1E9DC;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  --tab-h: 64px; --radius: 18px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); }
body { font: 18px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif; -webkit-text-size-adjust: 100%; overscroll-behavior-y: none; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
a { color: var(--accent-dark); }

#app { min-height: 100vh; min-height: 100dvh; }
.screen { padding: calc(var(--safe-t) + 14px) 18px calc(var(--tab-h) + var(--safe-b) + 110px); max-width: 640px; margin: 0 auto; }
.screen.no-tabs { padding-bottom: calc(var(--safe-b) + 40px); }
.screen.has-bar { padding-bottom: calc(var(--tab-h) + var(--safe-b) + 150px); }

h1 { font: 700 30px/1.15 Georgia, "Iowan Old Style", "Times New Roman", serif; margin: 6px 0 4px; letter-spacing: -0.2px; }
h2 { font-size: 20px; margin: 26px 0 10px; }
.sub { color: var(--muted); margin: 0 0 14px; font-size: 16px; }
.topline { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--sand); font-size: 14px; color: var(--muted); border: 0; min-height: 34px; }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.ok { background: var(--olive-soft); color: var(--olive); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; display: inline-block; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(60,40,20,.05); }
.list { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; gap: 12px; padding: 14px 14px; min-height: 64px; text-decoration: none; color: inherit; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--card); border-radius: var(--radius); }
.row:active { background: var(--sand); }
.row .main { flex: 1; min-width: 0; }
.row .t { font-weight: 600; display: block; overflow-wrap: anywhere; }
.row .s { color: var(--muted); font-size: 15px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .chev { color: var(--muted); font-size: 22px; }
.sdot { width: 14px; height: 14px; border-radius: 50%; flex: none; background: #CFC6B8; }
.chip { font-size: 14px; padding: 4px 10px; border-radius: 999px; background: var(--sand); color: var(--ink); white-space: nowrap; flex: none; }
.chip.late { background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.chip.soon { background: var(--accent-soft); color: var(--accent-dark); }

.s-0 { background: #CFC6B8; } .s-1 { background: #E3C77A; } .s-2 { background: #D9A441; } .s-3 { background: #C9733F; }
.s-4 { background: #9BB07F; } .s-5 { background: #7FA06A; } .s-6 { background: #4F8A55; } .s-7 { background: #3F7A7A; }
.s-8 { background: #4A6FA0; } .s-9 { background: #6B5CA0; }

.empty { text-align: center; color: var(--muted); padding: 26px 10px; }
.seeall { display: block; text-align: center; padding: 14px; color: var(--accent-dark); font-weight: 600; background: none; border: 0; width: 100%; }

/* inputs */
label.f { display: block; font-size: 15px; color: var(--muted); margin: 16px 0 6px; font-weight: 600; }
input[type=text], input[type=password], input[type=search], input[type=date], input[type=url], select, textarea {
  width: 100%; min-height: 54px; padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: #fff; font-size: 18px; appearance: none; -webkit-appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 22px) 24px, calc(100% - 16px) 24px; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 40px; }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 56px; padding: 0 22px; border-radius: 16px; border: 0; background: var(--accent); color: #fff; font-weight: 700; font-size: 18px; text-decoration: none; cursor: pointer; }
.btn:active { background: var(--accent-dark); }
.btn.alt { background: var(--accent-soft); color: var(--accent-dark); }
.btn.ghost { background: transparent; color: var(--accent-dark); border: 1.5px solid var(--line); }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; }
.btn.small { min-height: 44px; font-size: 16px; padding: 0 16px; border-radius: 12px; }
.iconbtn { width: 48px; height: 48px; border-radius: 14px; border: 1.5px solid var(--line); background: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 22px; flex: none; }
.back { background: none; border: 0; color: var(--accent-dark); font-weight: 600; font-size: 18px; padding: 6px 0; min-height: 44px; display: inline-flex; align-items: center; gap: 4px; }

/* tab bar (thumb zone) */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; background: rgba(250,246,239,.96); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); display: flex; justify-content: space-around; z-index: 20; }
.tab { flex: 1; height: var(--tab-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 0; background: none; color: var(--muted); font-size: 12px; font-weight: 600; text-decoration: none; }
.tab svg { width: 26px; height: 26px; }
.tab.on { color: var(--accent-dark); }
.tab.plus .bubble { width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; margin-top: -22px; box-shadow: 0 4px 12px rgba(143,74,39,.35); }
.tab.plus .bubble svg { width: 28px; height: 28px; }
.tab.plus span.l { margin-top: 0; }

.snap { position: fixed; right: 16px; bottom: calc(var(--tab-h) + var(--safe-b) + 16px); z-index: 25; height: 60px; padding: 0 22px 0 18px; border-radius: 30px; background: var(--olive); color: #fff; display: flex; align-items: center; gap: 10px; font-weight: 700; box-shadow: 0 6px 16px rgba(60,70,40,.35); cursor: pointer; }
.snap svg { width: 26px; height: 26px; }
.snap:active { filter: brightness(.9); }

.actionbar { position: fixed; left: 0; right: 0; bottom: calc(var(--tab-h) + var(--safe-b)); padding: 10px 16px; display: flex; gap: 10px; background: linear-gradient(to top, var(--bg) 70%, rgba(250,246,239,0)); z-index: 15; }
.actionbar .btn { flex: 1; }

/* sheet */
.scrim { position: fixed; inset: 0; background: rgba(40,30,20,.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg); width: 100%; max-width: 640px; max-height: 92dvh; max-height: 92vh; overflow-y: auto; border-radius: 24px 24px 0 0; padding: 12px 18px calc(var(--safe-b) + 22px); animation: up .2s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet .grab { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
.sheet h3 { margin: 4px 0 8px; font-size: 22px; }
.seg { display: flex; background: var(--sand); border-radius: 14px; padding: 4px; gap: 4px; }
.seg button { flex: 1; min-height: 46px; border: 0; background: transparent; border-radius: 11px; font-weight: 600; color: var(--muted); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

.toast { position: fixed; left: 16px; right: 16px; bottom: calc(var(--tab-h) + var(--safe-b) + 90px); z-index: 60; background: var(--ink); color: #fff; padding: 14px 16px; border-radius: 16px; display: flex; gap: 12px; align-items: center; justify-content: space-between; max-width: 608px; margin: 0 auto; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.toast button { background: none; border: 0; color: #F5C9A8; font-weight: 700; font-size: 17px; min-height: 40px; }

/* gallery */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ph { position: relative; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--sand); border: 0; padding: 0; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph .badge { position: absolute; left: 6px; bottom: 6px; background: rgba(46,41,36,.78); color: #fff; font-size: 12px; padding: 2px 8px; border-radius: 999px; }
.ph .pick { position: absolute; right: 6px; top: 6px; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.ph.sel { outline: 3px solid var(--accent); }
.viewer { position: fixed; inset: 0; z-index: 70; background: #14110e; display: flex; flex-direction: column; }
.viewer .top { padding: calc(var(--safe-t) + 10px) 14px 10px; display: flex; justify-content: space-between; align-items: center; color: #fff; }
.viewer .top button { background: rgba(255,255,255,.14); color: #fff; border: 0; border-radius: 12px; min-height: 46px; padding: 0 16px; font-weight: 600; }
.viewer .imgwrap { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer .bot { padding: 12px 14px calc(var(--safe-b) + 16px); display: flex; gap: 10px; }
.viewer .bot button { flex: 1; }
.cmp { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; }
.cmp.stack { grid-template-columns: 1fr; }
.cmp .slot { background: var(--sand); border-radius: 16px; min-height: 52vh; display: flex; flex-direction: column; overflow: hidden; border: 0; padding: 0; }
.cmp.stack .slot { min-height: 34vh; }
.cmp .slot img { width: 100%; flex: 1; min-height: 0; object-fit: contain; background: #1b1713; }
.cmp .slot .cap { padding: 8px; font-size: 14px; color: var(--muted); text-align: center; }
.cmp .slot.empty { align-items: center; justify-content: center; color: var(--muted); font-weight: 600; }

.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; font-size: 16px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.note { background: var(--sand); border-radius: 14px; padding: 12px 14px; font-size: 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
details.card { padding: 4px 14px; } details summary { min-height: 52px; display: flex; align-items: center; font-weight: 600; list-style: none; } details summary::-webkit-details-marker { display: none; }
.login { min-height: 100dvh; min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 24px 24px calc(var(--safe-b) + 30px); max-width: 480px; margin: 0 auto; }
.login .mark { width: 76px; height: 76px; border-radius: 20px; margin-bottom: 14px; }
.err { color: var(--warn); background: var(--warn-soft); border-radius: 12px; padding: 10px 14px; margin: 12px 0; font-size: 16px; }
.tag { font-size: 13px; padding: 2px 9px; border-radius: 999px; font-weight: 700; }
.tag.shea { background: var(--accent-soft); color: var(--accent-dark); } .tag.greg { background: var(--olive-soft); color: var(--olive); } .tag.other { background: var(--sand); color: var(--muted); }
.search { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: calc(var(--safe-t) + 8px) 0 8px; margin-top: -8px; }
.mini { font-size: 14px; color: var(--muted); }
.call { display: flex; gap: 10px; margin-top: 10px; }
.call .btn { flex: 1; }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }

/* item pages: lift Snap above the action bar, keep the bar buttons on one line */
.snap.raised { bottom: calc(var(--tab-h) + var(--safe-b) + 88px); }
.actionbar .btn { white-space: nowrap; padding: 0 10px; font-size: 17px; }
.actionbar { padding-right: 96px; }

/* builder budget */
.bar { height: 10px; border-radius: 999px; background: var(--sand); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--olive); border-radius: 999px; }
.bar.over > i { background: var(--accent); }
.bigmoney { font-size: 32px; font-weight: 700; letter-spacing: -.5px; margin-top: 2px; }
.cc .code { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 4px; }
.ccnums { display: flex; gap: 8px; margin: 8px 0 10px; }
.ccnums > div { flex: 1; min-width: 0; }
.ccnums span { display: block; font-size: 13px; color: var(--muted); }
.ccnums b { font-size: 16px; font-variant-numeric: tabular-nums; }
