/* AIWine for Wineries — app styles. Warm bone, claret, aged brass; app-soft radii. */
:root {
  --bg: #F4EFE5; --sheet: #FAF6EE; --sheet-2: #FFFCF6; --recess: #EDE6D8;
  --ink: #1B1410; --ink-soft: #4A3D34; --muted: #8B7E6E; --faint: #B6A992;
  --line: #D8CFBE; --line-soft: #E6DECF;
  --claret: #5C1B27; --claret-deep: #3A0E18; --brass: #A98654; --brass-soft: #C9A878;
  --green: #3F6B4B;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Manrope', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
button { font-family: var(--sans); cursor: pointer; }

#app { max-width: 520px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; position: relative; }

.screen { display: none; padding: calc(16px + var(--safe-top)) 18px calc(96px + var(--safe-bottom)); }
.screen.on { display: block; }
@media (prefers-reduced-motion: no-preference) {
  .screen { animation: wfade 0.28s var(--ease); }
}
@keyframes wfade { from { transform: translateY(6px); } }

.eyebrow { font-family: var(--mono); font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--brass); font-weight: 500; }
.h-serif { font-family: var(--serif); font-weight: 500; letter-spacing: -0.01em; line-height: 1.08; }
.h-serif em { font-style: italic; color: var(--claret); }

.demo-pill { position: fixed; top: calc(8px + var(--safe-top)); right: 10px; z-index: 60; font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.16em; color: var(--brass); background: rgba(250,246,238,0.92); border: 1px solid rgba(169,134,84,0.45); border-radius: 999px; padding: 4px 10px; backdrop-filter: blur(8px); }

/* ---------- cards ---------- */
.card { background: var(--sheet); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.card + .card { margin-top: 12px; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.kpi { background: var(--sheet); border: 1px solid var(--line); border-radius: 16px; padding: 14px 15px 12px; }
.kpi .n { font-family: var(--serif); font-size: 30px; font-weight: 500; line-height: 1; margin: 6px 0 3px; }
.kpi .d { font-family: var(--mono); font-size: 9px; letter-spacing: 0.08em; color: var(--green); }
.kpi .d.flat { color: var(--muted); }

.sec-h { display: flex; align-items: baseline; justify-content: space-between; margin: 20px 0 10px; }
.sec-h h2 { font-family: var(--serif); font-size: 21px; font-weight: 600; margin: 0; }
.sec-h .all { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.14em; color: var(--brass); background: none; border: none; text-transform: uppercase; }

/* ---------- activity feed ---------- */
.feed-row { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); align-items: flex-start; }
.feed-row:last-child { border-bottom: none; }
.feed-dot { width: 32px; height: 32px; border-radius: 50%; background: var(--sheet-2); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; flex: none; color: var(--ink-soft); }
.feed-tx { flex: 1; font-size: 13.5px; min-width: 0; }
.feed-tx b { font-weight: 700; }
.feed-when { font-family: var(--mono); font-size: 9px; color: var(--faint); white-space: nowrap; padding-top: 4px; letter-spacing: 0.06em; }

/* ---------- wine rows ---------- */
.wine-row { display: flex; gap: 13px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.wine-row:last-child { border-bottom: none; }
.bottle { width: 38px; height: 54px; border-radius: 7px 7px 9px 9px; flex: none; position: relative; overflow: hidden; }
.bottle::after { content: ''; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18); }
.bottle .lbl { position: absolute; left: 5px; right: 5px; top: 18px; bottom: 14px; background: rgba(244,239,229,0.92); border-radius: 3px; }
.wine-info { flex: 1; min-width: 0; }
.wine-name { font-family: var(--serif); font-size: 17px; font-weight: 600; line-height: 1.15; }
.wine-meta { font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-top: 3px; }
.wine-stats { text-align: right; flex: none; }
.wine-price { font-family: var(--serif); font-size: 17px; font-weight: 600; }
.stock-tag { font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.12em; padding: 3px 8px; border-radius: 999px; border: 1px solid; margin-top: 4px; display: inline-block; }
.stock-in { color: var(--green); border-color: rgba(63,107,75,0.4); background: rgba(63,107,75,0.07); }
.stock-low { color: var(--brass); border-color: rgba(169,134,84,0.45); background: rgba(169,134,84,0.08); }
.stock-out { color: var(--muted); border-color: var(--line); background: var(--recess); }

/* ---------- bars & charts ---------- */
.hbar { display: grid; grid-template-columns: 92px 1fr 38px; gap: 10px; align-items: center; padding: 5px 0; font-size: 12.5px; }
.hbar .tr { height: 12px; background: var(--recess); border-radius: 3px; overflow: hidden; }
.hbar .tr i { display: block; height: 100%; background: var(--claret); border-radius: 3px; }
.hbar .nn { font-family: var(--mono); font-size: 10px; color: var(--ink-soft); text-align: right; }
.spark { display: flex; align-items: flex-end; gap: 4px; height: 56px; margin-top: 10px; }
.spark i { flex: 1; background: var(--brass-soft); border-radius: 2px 2px 0 0; min-height: 3px; }
.spark i.hot { background: var(--claret); }
.spark-lbl { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 8.5px; color: var(--faint); margin-top: 5px; letter-spacing: 0.06em; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 20px; border-radius: 12px; font-size: 14px; font-weight: 700; border: 1px solid transparent; transition: transform 0.12s; width: 100%; }
.btn:active { transform: scale(0.97); }
.btn-claret { background: var(--claret); color: #F4EFE5; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-sm { width: auto; padding: 8px 14px; font-size: 12.5px; border-radius: 9px; }

/* ---------- alert strip ---------- */
.alert { display: flex; gap: 11px; align-items: flex-start; background: rgba(169,134,84,0.09); border: 1px solid rgba(169,134,84,0.35); border-radius: 13px; padding: 12px 14px; font-size: 13px; color: var(--ink-soft); }
.alert .t { font-weight: 700; color: var(--ink); display: block; margin-bottom: 1px; }

/* ---------- sheet (bottom drawer) ---------- */
.scrim { position: fixed; inset: 0; background: rgba(27,20,16,0.45); backdrop-filter: blur(3px); z-index: 80; animation: wfadein 0.2s; }
@keyframes wfadein { from { opacity: 0; } }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-width: 520px; margin: 0 auto; background: var(--sheet-2); border-radius: 22px 22px 0 0; z-index: 85; padding: 10px 20px calc(22px + var(--safe-bottom)); animation: wrise 0.32s var(--ease); max-height: 86vh; overflow-y: auto; }
@keyframes wrise { from { transform: translateY(40px); } }
.sheet .grab { width: 38px; height: 4px; border-radius: 2px; background: var(--line); margin: 4px auto 14px; }
.sheet h3 { font-family: var(--serif); font-size: 22px; font-weight: 600; margin: 0 0 4px; }
.field { margin-top: 14px; }
.field .lab { font-family: var(--mono); font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); display: block; margin-bottom: 6px; }
.field input, .field select, .field textarea { width: 100%; font-family: var(--sans); font-size: 15px; color: var(--ink); background: var(--sheet); border: 1px solid var(--line); border-radius: 11px; padding: 12px 13px; outline: none; }
.field input:focus, .field textarea:focus { border-color: var(--brass); }
.seg3 { display: flex; gap: 6px; }
.seg3 button { flex: 1; padding: 10px 6px; border-radius: 10px; border: 1px solid var(--line); background: var(--sheet); font-size: 12.5px; font-weight: 600; color: var(--muted); }
.seg3 button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ---------- upload zone ---------- */
.dropzone { border: 1.5px dashed var(--line); border-radius: 16px; padding: 26px 18px; text-align: center; color: var(--muted); font-size: 13px; background: var(--sheet); }
.dropzone .big { font-family: var(--serif); font-size: 19px; color: var(--ink-soft); display: block; margin: 8px 0 2px; font-weight: 600; }
.prog { height: 6px; border-radius: 3px; background: var(--recess); overflow: hidden; margin-top: 14px; }
.prog i { display: block; height: 100%; width: 0; background: var(--claret); border-radius: 3px; transition: width 0.5s var(--ease); }

/* ---------- tab bar ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; max-width: 520px; margin: 0 auto; display: flex; background: rgba(244,239,229,0.88); backdrop-filter: blur(16px) saturate(160%); border-top: 1px solid var(--line); padding: 8px 6px calc(8px + var(--safe-bottom)); z-index: 50; }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; background: none; border: none; color: var(--muted); padding: 5px 0; transition: color 0.15s; }
.tab.on { color: var(--claret); }
.tab .tx { font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.12em; text-transform: uppercase; }

.toast { position: fixed; bottom: calc(92px + var(--safe-bottom)); left: 50%; transform: translateX(-50%) translateY(16px); background: var(--ink); color: var(--bg); padding: 11px 20px; border-radius: 999px; font-size: 13px; font-weight: 600; opacity: 0; pointer-events: none; transition: all 0.3s var(--ease); z-index: 90; white-space: nowrap; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast::before { content: '✓ '; color: var(--brass-soft); }

.kv-list { font-size: 14px; }
.kv-list .row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.kv-list .row:last-child { border-bottom: none; }
.kv-list .k { color: var(--muted); font-size: 13px; }
.kv-list .v { font-weight: 600; text-align: right; }
