:root {
  --ink: #1d1418; --wine: #5e1a2b; --deep: #2a0f17; --gold: #c9a45c; --gold-soft: #f3e7cc; --ivory: #fbf8f2;
  --line: #e6dccb; --muted: #645a5e; --young: #3d5a80; --ready: #2f6b4f; --peak: #8a6a2c; --past: #a3322a; --unknown: #8c8589;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink);
}
* { box-sizing: border-box; }
html, body { overflow-x: hidden; }
body { margin: 0; background: linear-gradient(180deg, var(--ivory), #fff 60%); -webkit-text-size-adjust: 100%; }
h1, h2, h3, .brand strong, .stat strong { font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; }
.skip-link { position: absolute; left: -999px; }
.skip-link:focus { left: 12px; top: 12px; background: #fff; padding: 8px; z-index: 10; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 18px; padding-top: max(12px, env(safe-area-inset-top)); background: var(--deep); color: #fff; flex-wrap: wrap; border-bottom: 1px solid rgba(201,164,92,.45); }
.brand { display: flex; gap: 10px; align-items: center; color: inherit; text-decoration: none; min-width: 0; }
.brand strong { font-size: 19px; letter-spacing: .02em; }
.brand small { display: block; opacity: .78; font-size: 12px; }
.logo-mark { flex: 0 0 36px; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--gold); color: var(--gold); display: grid; place-items: center; font: 600 13px/1 Georgia, serif; letter-spacing: .06em; }
.pill { background: rgba(201,164,92,.16); color: var(--gold-soft); padding: 6px 12px; border-radius: 999px; font-size: 13px; }
main { max-width: 1100px; margin: 0 auto; padding: 18px; padding-bottom: max(18px, env(safe-area-inset-bottom)); }
.hero { padding: 10px 0 6px; }
.hero h1 { font-size: clamp(28px, 5.6vw, 46px); margin: 8px 0; line-height: 1.12; font-weight: 600; }
.hero em { color: var(--wine); font-style: italic; }
.hero p { max-width: 760px; color: var(--muted); line-height: 1.55; }
.eyebrow { font-size: 12px; letter-spacing: .14em; font-weight: 700; color: var(--peak); }
.welcome, .panel { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 16px; margin-top: 10px; }
.welcome h2 { margin-top: 0; }
.tabs { position: sticky; top: 0; z-index: 5; display: flex; gap: 6px; overflow-x: auto; padding: 8px 0; background: linear-gradient(var(--ivory), rgba(251,248,242,.95)); -webkit-overflow-scrolling: touch; scrollbar-width: none; max-width: 100%; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: 0 0 auto; min-height: 44px; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-weight: 600; font-size: 15px; cursor: pointer; }
.tabs button[aria-selected=true] { background: var(--wine); color: var(--gold-soft); border-color: var(--wine); }
.panel-head { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; justify-content: space-between; }
.panel-head h2 { margin: 0; font-size: 24px; font-weight: 600; }
.panel h3 { margin: 20px 0 8px; font-size: 19px; }
.fine { color: var(--muted); font-size: 14px; line-height: 1.5; margin: 6px 0; }
.status { min-height: 1.2em; margin: 6px 2px; font-size: 14px; color: var(--ready); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.button { min-height: 44px; border: 0; border-radius: 12px; padding: 10px 14px; font-weight: 700; font-size: 15px; background: var(--wine); color: #fff; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.button-gold { background: var(--gold); color: var(--deep); }
.button-soft { background: var(--gold-soft); color: var(--ink); }
.button-danger { background: #fff; color: var(--past); border: 1px solid #e7c3bf; }
.button-small { min-height: 40px; padding: 6px 12px; font-size: 14px; }
.file-button { cursor: pointer; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 10px; }
.stat { border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: linear-gradient(180deg, #fff, var(--ivory)); min-width: 0; }
.stat span { display: block; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.stat strong { display: block; font-size: 24px; margin-top: 4px; overflow-wrap: anywhere; }
.stat small { color: var(--muted); }
.gain-up { color: var(--ready); } .gain-down { color: var(--past); }
.status-bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: 110px 1fr 44px; gap: 8px; align-items: center; font-size: 14px; }
.bar .track { height: 12px; border-radius: 999px; background: #f1ebe0; overflow: hidden; }
.bar .fill { height: 100%; border-radius: 999px; }
.bar b { text-align: right; }
.s-young { background: var(--young); } .s-ready { background: var(--ready); } .s-peak { background: var(--peak); } .s-past { background: var(--past); } .s-unknown { background: var(--unknown); }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.badge.soon { background: var(--gold-soft); color: var(--deep); }
.next-list, .log { padding-left: 20px; margin: 0; line-height: 1.6; }
.next-list li, .log li { margin-bottom: 6px; overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 14px; background: #fff; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.filters label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); flex: 1 1 140px; min-width: 0; }
.filters label.grow { flex: 1 1 100%; }
input, select, textarea { font: inherit; font-size: 16px; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); width: 100%; max-width: 100%; min-width: 0; }
textarea { min-height: 80px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.card { border: 1px solid var(--line); border-left: 5px solid var(--wine); border-radius: 14px; padding: 12px 14px; background: #fff; min-width: 0; }
.card.c-white { border-left-color: #d8c27a; } .card.c-rose { border-left-color: #e3a0a8; } .card.c-sparkling { border-left-color: #e8d9a8; }
.card.c-dessert { border-left-color: #d29a3a; } .card.c-fortified { border-left-color: #6b2a1a; } .card.c-orange { border-left-color: #d9823b; }
.card h4 { margin: 0 0 2px; font-size: 17px; font-family: "Iowan Old Style", Palatino, Georgia, serif; overflow-wrap: anywhere; }
.card .meta { color: var(--muted); font-size: 14px; margin: 2px 0; overflow-wrap: anywhere; }
.card .row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.card .qty { font-weight: 700; margin-right: auto; }
.empty { color: var(--muted); font-style: italic; }
.location { margin-bottom: 16px; }
.location h3 { display: flex; justify-content: space-between; gap: 8px; }
.bins { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.bin { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: var(--ivory); min-width: 0; }
.bin strong { display: block; font-size: 15px; }
.bin ul { list-style: none; padding: 0; margin: 6px 0 0; font-size: 13px; line-height: 1.45; }
.bin li { overflow-wrap: anywhere; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--wine); }
.dot.c-white { background: #d8c27a; } .dot.c-rose { background: #e3a0a8; } .dot.c-sparkling { background: #e8d9a8; } .dot.c-dessert { background: #d29a3a; } .dot.c-fortified { background: #6b2a1a; } .dot.c-orange { background: #d9823b; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 14px; }
.form-grid label, .settings label { display: grid; gap: 4px; font-size: 14px; font-weight: 600; min-width: 0; }
.form-grid .wide { grid-column: 1 / -1; }
.form-errors { color: var(--past); font-weight: 600; min-height: 1em; margin: 0; }
.settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 14px; }
footer { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: center; padding: 22px 18px 30px; color: var(--muted); font-size: 14px; }
footer a { color: var(--wine); }
.footer-logo { width: 72px; height: 54px; object-fit: contain; }
@media (max-width: 480px) {
  main { padding: 12px; }
  .bar { grid-template-columns: 92px 1fr 36px; }
  .cards { grid-template-columns: 1fr; }
  .pill { font-size: 12px; }
}
@media print {
  .topbar, .tabs, .filters, footer, .actions, .status, #welcome { display: none !important; }
  .panel { border: 0; }
}

.buy { margin: 28px 0 8px; padding: 22px 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--deep, #2a0f17); color: #f4efe6; text-align: center; }
.buy-kicker { letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); font-size: 0.75rem; font-weight: 700; margin: 0; }
.buy-price { font-size: 2rem; font-weight: 600; margin: 0.35rem 0; color: var(--gold-soft, #e8d9a8); font-family: "Iowan Old Style", Palatino, Georgia, serif; }
.buy-copy { color: #d8d9e3; margin: 0.35rem auto 0; max-width: 640px; }
.buy-row { display: flex; flex-wrap: wrap; gap: 0.55rem; justify-content: center; margin: 0.9rem 0; }
.button-primary { background: var(--gold); color: var(--deep, #2a0f17); }
.buy-shopify { background: transparent; color: var(--gold-soft, #e8d9a8); border: 1px solid var(--gold); }
.buy-note { color: #b9bbcb; font-size: 0.88rem; }
.buy-note a { color: var(--gold-soft, #e8d9a8); }
@media print { .buy { display: none !important; } }
