:root {
  color-scheme: dark;
  --bg: #0d0f10;
  --card: #171a1d;
  --card-2: #202428;
  --line: rgba(255,255,255,.09);
  --text: #f6f3ee;
  --muted: #a7a7a1;
  --accent: #d7b26d;
  --danger: #ff7b7b;
  --radius: 22px;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at top, #1a1713 0, var(--bg) 32rem); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, system-ui, sans-serif; }
button, input, select { font: inherit; }
button { color: inherit; }
#app { max-width: 760px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 18px) 18px calc(100px + env(safe-area-inset-bottom)); }
.topbar, .sheet-header, .list-header, .button-row, .lookup-panel, .wine-card-main, .wine-card-footer { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.topbar h1, .sheet-header h2 { margin: 2px 0 0; font-size: 29px; letter-spacing: -.03em; }
.eyebrow { text-transform: uppercase; letter-spacing: .13em; font-size: 11px; color: var(--accent); font-weight: 700; }
.icon-button { width: 42px; height: 42px; border: 1px solid var(--line); background: rgba(255,255,255,.045); border-radius: 50%; font-size: 24px; }
.summary-card { display:grid; grid-template-columns: repeat(3,1fr); gap: 1px; margin: 24px 0 16px; background: var(--line); border:1px solid var(--line); border-radius: var(--radius); overflow:hidden; }
.summary-card div { background: rgba(23,26,29,.9); padding: 18px 12px; text-align:center; }
.summary-card span { display:block; font-weight:700; font-size:18px; }
.summary-card small { color:var(--muted); font-size:11px; }
.sync-bar { display:flex; align-items:center; justify-content:space-between; gap:12px; margin:0 0 16px; padding:12px 13px; background:rgba(23,26,29,.75); border:1px solid var(--line); border-radius:16px; }
.sync-copy { min-width:0; display:grid; gap:3px; }
.sync-copy strong { font-size:13px; }
.sync-copy small { color:var(--muted); font-size:11px; line-height:1.35; }
.sync-button { flex:0 0 auto; padding:10px 12px; font-size:12px; }
.sync-button:disabled { opacity:.55; cursor:wait; }
.controls { display:grid; gap:10px; }
.search-box { display:flex; gap:10px; align-items:center; background:var(--card); border:1px solid var(--line); border-radius:16px; padding:0 14px; }
.search-box input { flex:1; border:0; background:transparent; color:var(--text); padding:14px 0; outline:none; }
.filter-row { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; overflow:auto; }
select, input { width:100%; color:var(--text); background:#15181b; border:1px solid var(--line); border-radius:14px; padding:12px 13px; outline:none; }
select:focus, input:focus { border-color:rgba(215,178,109,.65); box-shadow:0 0 0 3px rgba(215,178,109,.12); }
.list-header { margin:24px 2px 10px; }
.list-header h2 { margin:0; font-size:18px; }
.list-header span { color:var(--muted); font-size:13px; }
.wine-list { display:grid; gap:10px; }
.wine-card { border:1px solid var(--line); background:linear-gradient(145deg, rgba(31,35,39,.95), rgba(19,21,23,.96)); border-radius:20px; overflow:hidden; }
.wine-card-main { padding:14px; align-items:flex-start; }
.wine-thumb { width:70px; height:96px; flex:0 0 auto; border-radius:13px; background:#0b0c0d; object-fit:contain; border:1px solid var(--line); }
.wine-thumb.placeholder { display:grid; place-items:center; font-size:36px; }
.wine-info { flex:1; min-width:0; }
.wine-info h3 { margin:2px 0 5px; font-size:16px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.wine-meta { color:var(--muted); font-size:12px; }
.badge { display:inline-flex; margin-top:8px; padding:5px 8px; border-radius:999px; background:rgba(215,178,109,.13); color:#ecd29f; font-size:11px; font-weight:600; }
.card-stock-actions { display:grid; justify-items:end; gap:7px; flex:0 0 auto; }
.quantity-control { display:flex; align-items:center; gap:7px; }
.quantity-control button { width:31px; height:31px; border-radius:10px; border:1px solid var(--line); background:var(--card-2); }
.quantity-control button:disabled { opacity:.28; cursor:not-allowed; }
.remove-wine-button { border:0; background:transparent; color:var(--danger); font-size:11px; font-weight:700; padding:2px 3px; cursor:pointer; }
.quantity-control strong { min-width:18px; text-align:center; }
.wine-card-footer { border-top:1px solid var(--line); padding:11px 14px; }
.wine-card-footer small { color:var(--muted); }
.wine-card-footer strong { font-size:14px; }
.empty-state { text-align:center; color:var(--muted); padding:52px 22px; }
.empty-state h3 { color:var(--text); margin-bottom:6px; }
.empty-state p { max-width:360px; margin:0 auto; line-height:1.45; }
.bottle-placeholder { font-size:44px; }
.hidden { display:none !important; }
.fab { position:fixed; right:22px; bottom:calc(22px + env(safe-area-inset-bottom)); width:62px; height:62px; border:0; border-radius:50%; color:#15120c; background:var(--accent); box-shadow:0 15px 38px rgba(0,0,0,.45); font-size:32px; z-index:10; }
dialog.sheet { width:min(100%,760px); max-width:760px; max-height:91vh; margin:auto auto 0; border:1px solid var(--line); border-bottom:0; border-radius:26px 26px 0 0; padding:18px; background:#101214; color:var(--text); box-shadow:0 -18px 60px rgba(0,0,0,.55); }
dialog::backdrop { background:rgba(0,0,0,.7); backdrop-filter:blur(7px); }
.sheet-handle { width:44px; height:5px; background:#444; border-radius:999px; margin:0 auto 14px; }
.sheet-header { margin-bottom:18px; }
.form-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-top:12px; }
.two-col { display:grid; grid-template-columns:2fr 1fr; gap:10px; }
label { display:grid; gap:7px; font-size:12px; color:#c8c7c2; font-weight:600; }
.full { grid-column:1/-1; }
details { margin-top:16px; }
summary { cursor:pointer; font-weight:700; }
.lookup-panel { margin-top:14px; background:rgba(215,178,109,.08); border:1px solid rgba(215,178,109,.2); padding:13px; border-radius:16px; }
.lookup-panel div { display:grid; gap:4px; }
.lookup-panel small { color:var(--muted); font-weight:400; line-height:1.35; }
.lookup-results { display:grid; gap:8px; margin-top:10px; }
.lookup-result { width:100%; text-align:left; border:1px solid var(--line); background:var(--card); border-radius:14px; padding:11px; }
.lookup-result strong, .lookup-result span { display:block; }
.lookup-result span { color:var(--muted); margin-top:3px; font-size:12px; }
.status-message { margin-top:10px; color:var(--muted); font-size:12px; line-height:1.4; }
.sheet-actions { position:sticky; bottom:-18px; display:flex; justify-content:flex-end; gap:9px; background:linear-gradient(transparent,#101214 24%); padding:28px 0 calc(10px + env(safe-area-inset-bottom)); margin-top:12px; }
.primary, .secondary, .ghost, .file-button { border-radius:14px; padding:12px 16px; border:1px solid transparent; font-weight:700; text-align:center; }
.primary { background:var(--accent); color:#17120a; }
.primary.small { padding:9px 12px; font-size:12px; }
.secondary, .ghost, .file-button { background:var(--card-2); border-color:var(--line); }
.danger { color:var(--danger); margin-right:auto; }
.settings-section { padding:16px 0; border-top:1px solid var(--line); }
.settings-section h3 { margin:0 0 7px; }
.settings-section p { color:var(--muted); font-size:13px; line-height:1.45; margin:0 0 13px; }
.settings-section code { color:#e7d2aa; }
.trusted-sites { display:flex; flex-wrap:wrap; gap:6px; margin-top:10px; font-size:11px; color:var(--muted); }
.trusted-sites strong { background:var(--card-2); border-radius:999px; padding:5px 8px; color:#d9d7d1; }
.detail-hero { display:grid; grid-template-columns:110px 1fr; gap:18px; align-items:start; }
.detail-image { width:110px; height:150px; object-fit:contain; background:#08090a; border:1px solid var(--line); border-radius:18px; }
.detail-facts { display:grid; grid-template-columns:repeat(2,1fr); gap:9px; margin:18px 0; }
.fact { background:var(--card); border:1px solid var(--line); border-radius:15px; padding:12px; }
.fact small { display:block; color:var(--muted); margin-bottom:3px; }
.detail-actions { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.toast { position:fixed; left:50%; bottom:calc(98px + env(safe-area-inset-bottom)); transform:translate(-50%, 20px); background:#f4efe5; color:#171411; padding:10px 14px; border-radius:999px; box-shadow:0 8px 30px rgba(0,0,0,.4); font-size:13px; opacity:0; pointer-events:none; transition:.25s; z-index:50; white-space:nowrap; max-width:90vw; overflow:hidden; text-overflow:ellipsis; }
.toast.show { opacity:1; transform:translate(-50%,0); }
@media (max-width:560px) {
  .filter-row { grid-template-columns:150px 125px 135px; }
  .form-grid { grid-template-columns:1fr; }
  .full { grid-column:auto; }
  .two-col { grid-template-columns:1.7fr .8fr; }
}
