  :root{
    --wine: #6b1f2a;
    --wine-dark: #4a1620;
    --wine-light: #8a2e3c;
    --cream: #faf6f1;
    --paper: #ffffff;
    --gold: #b8905a;
    --ink: #2b2320;
    --muted: #7a6f68;
    --border: #e6ddd3;
    --green: #3f7a4f;
    --amber: #b0791f;
    --orange: #c1541f;
    --red: #a33a3a;
    --sidebar-muted: #d3b9ab;    /* brand subtitle + nav group labels — one tone instead of two close-but-different ones */
    --hover-tint: #fbf3ee;       /* row/card hover-and-active background, used consistently everywhere something is tappable */
    --block-gap: 24px;           /* consistent vertical rhythm between major page blocks (cards row, sections, page subtitle) */
  }
  * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
  html, body { margin:0; height:100%; overscroll-behavior-y: none; }
  body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif; background: var(--cream); color: var(--ink); }
  #root { min-height: 100vh; }
  .app { display:flex; min-height:100vh; }
  .sidebar { width:220px; height:100vh; position:sticky; top:0; align-self:flex-start; background: var(--wine-dark); color:#f2e9e2; flex-shrink:0; padding:24px 0 16px; padding-top: calc(24px + env(safe-area-inset-top)); display:flex; flex-direction:column; }
  .brand { padding: 0 20px 20px 20px; border-bottom:1px solid rgba(255,255,255,0.12); margin-bottom:16px; }
  .brand h1 { font-size:20px; margin:0 0 2px 0; letter-spacing:0.5px; }
  .brand p { margin:0; font-size:12px; color: var(--sidebar-muted); }
  .sidebar-main { flex:1; min-height:0; overflow-y:auto; }
  .sidebar-footer { flex-shrink:0; border-top:1px solid rgba(255,255,255,0.12); padding-top:10px; }
  .nav-item { width:100%; min-height:44px; display:flex; align-items:center; gap:10px; padding:10px 20px; cursor:pointer; font:inherit; font-size:14px; text-align:left; color:#e9dcd3; background:transparent; border:0; border-left:3px solid transparent; }
  .nav-item:hover { background: rgba(255,255,255,0.06); }
  .nav-item.active { background: rgba(255,255,255,0.1); border-left-color: var(--gold); color:#fff; font-weight:600; }
  .nav-item:focus-visible { outline:2px solid var(--gold); outline-offset:-3px; }
  .nav-icon { width:20px; flex:0 0 20px; display:inline-flex; justify-content:center; font-weight:700; }
  .nav-badge-dot { display:inline-block; width:7px; height:7px; border-radius:50%; background:var(--gold); margin-left:5px; vertical-align:middle; }
  .sidebar-account-wrap { position:relative; }
  .sidebar-popover { position:absolute; z-index:1100; left:calc(100% + 10px); bottom:0; width:220px; padding:8px; border-radius:12px; background:var(--paper); border:1px solid var(--border); box-shadow:0 12px 30px rgba(43,35,32,0.22); }
  .sidebar-popover button { display:block; width:100%; border:0; background:transparent; color:var(--ink); text-align:left; padding:10px 12px; border-radius:8px; font:inherit; font-size:13px; cursor:pointer; }
  .sidebar-popover button:hover, .sidebar-popover button:focus-visible { background:var(--hover-tint); outline:none; }
  .mobile-topbar, .mobile-bottom-nav, .mobile-more-overlay { display:none; }
  .main { flex:1; padding: 28px 36px; max-width: 1100px; padding-bottom: 100px; }
  .page-tabs { display:inline-flex; flex-wrap:wrap; gap:4px; padding:4px; margin-bottom:20px; background:#f1e6da; border-radius:10px; }
  .page-tabs button { border:0; background:transparent; color:var(--muted); padding:8px 13px; border-radius:7px; font:inherit; font-size:12.5px; font-weight:600; cursor:pointer; }
  .page-tabs button.active { background:var(--paper); color:var(--wine-dark); box-shadow:0 1px 4px rgba(43,35,32,0.12); }
  .page-tabs button:focus-visible { outline:2px solid var(--wine); outline-offset:1px; }
  h2.page-title { margin:0 0 4px 0; font-size:24px; }
  .page-sub { color: var(--muted); margin:0 0 var(--block-gap) 0; font-size:14px; }
  .cards { display:grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap:14px; margin-bottom: var(--block-gap); }
  .card { background: var(--paper); border:1px solid var(--border); border-radius:14px; padding:16px 18px; }
  .card .label { font-size:12px; color:var(--muted); text-transform:uppercase; letter-spacing:0.4px; margin-bottom:6px; }
  .card .value { font-size:26px; font-weight:700; color: var(--wine-dark); }
  .card .sub { font-size:12px; color: var(--muted); margin-top:4px; }
  .card-icon { width:34px; height:34px; border-radius:10px; display:flex; align-items:center; justify-content:center; font-size:16px; margin-bottom:10px; }
  .quick-actions { display:grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap:12px; margin-bottom: var(--block-gap); }
  .quick-action { background: var(--paper); border:1px solid var(--border); border-radius:14px; padding:16px; display:flex; align-items:center; gap:12px; cursor:pointer; transition: transform 0.12s ease, box-shadow 0.12s ease; }
  .quick-action:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(43,35,32,0.1); border-color:#ddcdbf; }
  .quick-action .qa-icon { width:38px; height:38px; border-radius:10px; background: var(--wine); color:#fff; display:flex; align-items:center; justify-content:center; font-size:17px; flex-shrink:0; }
  .quick-action .qa-label { font-weight:700; font-size:13.5px; }
  .quick-action .qa-sub { font-size:11.5px; color: var(--muted); margin-top:1px; }
  .section { background: var(--paper); border:1px solid var(--border); border-radius:14px; padding:20px; margin-bottom: var(--block-gap); }
  .section h3 { margin-top:0; font-size:16px; display:flex; align-items:center; gap:8px; }
  .alert-section { width:min(100%, var(--alert-panel-width, 100%)); transition:width .15s ease; }
  /* Tile grid — the modern card-based layout used for My Cellar, Tasting
     Journal, In the Store, and Wish List, in place of dense rows/tables. */
  .tile-grid { display:grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap:16px; margin-bottom: var(--block-gap); }
  .tile { background: var(--paper); border:1px solid var(--border); border-radius:16px; overflow:hidden; display:flex; flex-direction:column; box-shadow: 0 1px 2px rgba(43,35,32,0.05); transition: transform 0.12s ease, box-shadow 0.12s ease; }
  .tile.clickable { cursor:pointer; }
  .tile.clickable:hover { transform: translateY(-3px); box-shadow: 0 10px 20px rgba(43,35,32,0.12); border-color:#ddcdbf; }
  .tile-photo { width:100%; aspect-ratio: 1 / 1; object-fit:cover; display:block; background: var(--cream); }
  .tile-photo.placeholder { display:flex; align-items:center; justify-content:center; font-size:38px; background: var(--wine-dark); }
  .tile-body { padding:14px; display:flex; flex-direction:column; gap:4px; flex:1; }
  .tile-title { font-weight:700; font-size:14.5px; line-height:1.3; }
  .tile-sub { color:var(--muted); font-size:12px; }
  .tile-meta { display:flex; flex-wrap:wrap; gap:5px 10px; font-size:12px; color:var(--muted); margin-top:2px; }
  .tile-text { font-size:12.5px; color:var(--ink); margin-top:4px; display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; line-height:1.4; }
  .tile-footer { margin-top:auto; padding-top:10px; display:flex; justify-content:space-between; align-items:center; gap:8px; }
  .tile-actions { padding:0 14px 14px 14px; display:flex; gap:8px; }
  .tile-actions .btn { flex:1; text-align:center; }
  .btn { background: var(--wine); color:#fff; border:none; padding:9px 16px; border-radius:6px; font-size:13px; cursor:pointer; font-weight:600; }
  .btn:hover { background: var(--wine-light); }
  .btn:disabled { opacity:0.5; cursor:default; }
  .btn.secondary { background:transparent; color: var(--wine); border:1px solid var(--wine); }
  .btn.secondary:hover { background: rgba(107,31,42,0.06); }
  .btn.danger-secondary { background:transparent; color:var(--red); border:1px solid var(--red); }
  .btn.danger-secondary:hover { background:#f7e3e3; }
  .btn.small { padding:5px 10px; font-size:12px; }
  .toolbar { display:flex; justify-content:space-between; align-items:center; margin-bottom:16px; gap:10px; flex-wrap:wrap; }
  .search { padding:8px 12px; border:1px solid var(--border); border-radius:6px; font-size:13px; width:220px; }
  select.filter { padding:8px 10px; border:1px solid var(--border); border-radius:6px; font-size:13px; background:#fff; }
  table { width:100%; border-collapse: collapse; font-size:13px; }
  th { text-align:left; color:var(--muted); font-weight:600; font-size:11px; text-transform:uppercase; letter-spacing:0.3px; padding:8px 10px; border-bottom:1px solid var(--border); }
  td { padding:10px; border-bottom:1px solid var(--border); vertical-align:middle; }
  tr:hover td { background: var(--hover-tint); }
  .bottle-thumb { width:36px; height:36px; border-radius:8px; object-fit:cover; background:#eee; display:block; }
  .bottle-thumb.placeholder { display:flex; align-items:center; justify-content:center; font-size:16px; background: var(--wine-dark); }
  .pill { display:inline-block; padding:3px 9px; border-radius:20px; font-size:11px; font-weight:600; }
  .pill.green { background:#e5f2e8; color: var(--green); }
  .pill.amber { background:#faeed9; color: var(--amber); }
  .pill.orange { background:#fbe3d5; color: var(--orange); }
  .pill.red { background:#f7e3e3; color: var(--red); }
  .pill.muted { background:#eee; color: var(--muted); }
  .tag { display:inline-block; padding:3px 9px; border-radius:20px; font-size:11px; background:#f1e6da; color:#7a5a30; margin:2px 3px 2px 0; cursor:pointer; border:1px solid transparent; }
  .tag.selected { background: var(--wine); color:#fff; }
  .modal-overlay { position:fixed; inset:0; background:rgba(30,15,15,0.45); display:flex; align-items:flex-start; justify-content:center; padding:40px 20px; overflow-y:auto; z-index:50; }
  .modal { background:#fff; border-radius:16px; width:100%; max-width:680px; padding:26px; }
  .modal h3 { margin-top:0; }
  .form-grid { display:grid; grid-template-columns: 1fr 1fr; gap:12px; }
  .form-grid.full { grid-template-columns: 1fr; }
  .form-section-label { font-size:12px; font-weight:600; text-transform:uppercase; letter-spacing:0.4px; color:var(--gold); margin:18px 0 8px 0; }
  .form-section-label:first-of-type { margin-top:12px; }
  details > .form-section-label { margin-bottom:0; }
  .field { display:flex; flex-direction:column; gap:4px; margin-bottom:10px; }
  .field label { font-size:12px; color:var(--muted); font-weight:600; }
  .field input, .field select, .field textarea { padding:8px 10px; border:1px solid var(--border); border-radius:6px; font-size:13px; font-family:inherit; }
  .field textarea { resize:vertical; min-height:60px; }
  .modal-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:16px; }
  .modal-actions.stacked { flex-direction:column; align-items:flex-end; }
  .modal-actions-row { display:flex; gap:8px; }
  .empty { color: var(--muted); font-size:13px; padding:30px 0; text-align:center; }
  .read-only .main .btn:not(.readonly-allowed) { pointer-events:none; opacity:.45; }
  .readonly-banner { background:#fff4d6; border-bottom:1px solid #e4c66b; color:#604a12; padding:10px 24px; font-size:13px; }
  .photo-preview { width:100%; height:140px; object-fit:cover; border-radius:8px; border:1px solid var(--border); background:#f4efe9; }
  .photo-scan-box { border:2px dashed var(--wine); border-radius:10px; padding:22px 16px; text-align:center; cursor:pointer; background:#fdf8f5; }
  .photo-scan-box:hover { background:#fbf0ea; }
  .photo-scan-box:active { background:#f7e6dc; }
  .photo-scan-icon { font-size:30px; line-height:1; margin-bottom:6px; }
  .photo-scan-text { font-weight:700; color:var(--wine); font-size:14px; }
  .bottle-detail-header { display:flex; gap:18px; align-items:flex-start; }
  .bottle-detail-header img { width:100px; height:100px; object-fit:cover; border-radius:10px; background:#eee; }
  .kv { display:grid; grid-template-columns: 130px 1fr; gap:6px 10px; font-size:13px; margin-top:10px; }
  .kv div.k { color: var(--muted); }
  .stars { color: var(--gold); font-size:13px; }
  .flavor-bar-row { display:flex; align-items:center; gap:10px; margin-bottom:8px; font-size:13px; }
  .flavor-bar-row .fname { width:130px; flex-shrink:0; }
  .flavor-bar-track { flex:1; height:10px; background:#f0e6da; border-radius:6px; overflow:hidden; }
  .flavor-bar-fill { height:100%; background: var(--wine); }
  .flavor-bar-count { width:26px; text-align:right; color:var(--muted); font-size:12px; }
  .close-x { position:absolute; top:16px; right:20px; cursor:pointer; color:var(--muted); font-size:18px; background:none; border:none; }
  .hint { font-size:12px; color:var(--muted); margin-top:2px; }
  .banner { background:#fdf1ea; border:1px solid #f0d9c4; color:#7a4a1f; padding:10px 14px; border-radius:8px; font-size:12px; margin-bottom:18px; }
  .ocr-status { font-size:12px; color: var(--wine); margin-top:6px; display:flex; align-items:center; gap:6px; }
  .spinner { width:12px; height:12px; border:2px solid var(--border); border-top-color: var(--wine); border-radius:50%; animation: spin 0.7s linear infinite; }
  @keyframes spin { to { transform: rotate(360deg); } }
  .receipt-table th, .receipt-table td { font-size:12px; }
  .receipt-table input { width:100%; padding:5px 7px; font-size:12px; border:1px solid var(--border); border-radius:5px; }
  .install-banner { position:fixed; left:0; right:0; bottom:0; background: var(--wine-dark); color:#fff; padding:12px 18px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); font-size:12px; display:flex; justify-content:space-between; align-items:center; gap:12px; z-index:60; }
  .install-banner button { background:none; border:1px solid rgba(255,255,255,0.5); color:#fff; padding:6px 12px; border-radius:6px; font-size:12px; }
  .toast { position:fixed; top:16px; right:16px; background: var(--wine-dark); color:#fff; padding:10px 16px; border-radius:8px; font-size:13px; z-index:100; box-shadow: 0 4px 14px rgba(0,0,0,0.25); }

  /* ---------- My Somm (pairing) ---------- */
  .somm-home { max-width:560px; }
  .somm-home h2 { margin-bottom:2px; }
  .somm-choice-cards { display:grid; grid-template-columns: 1fr 1fr; gap:16px; margin-top:20px; }
  .somm-choice-card { background: var(--paper); border:1px solid var(--border); border-radius:16px; padding:24px 20px; cursor:pointer; transition: transform 0.12s ease, box-shadow 0.12s ease; }
  .somm-choice-card:hover { transform: translateY(-3px); box-shadow: 0 10px 20px rgba(43,35,32,0.12); border-color:#ddcdbf; }
  .somm-choice-card.disabled { opacity:0.55; cursor:default; }
  .somm-choice-card.disabled:hover { transform:none; box-shadow:none; }
  .somm-choice-title { font-weight:700; font-size:15px; margin-bottom:6px; }
  .somm-choice-sub { font-size:12.5px; color: var(--muted); line-height:1.4; }
  .somm-flow { max-width:640px; }
  .somm-back { font-size:12.5px; color: var(--wine); cursor:pointer; margin-bottom:16px; display:inline-block; }
  .somm-question { display:block; font-weight:700; font-size:15px; margin-bottom:8px; }
  .somm-dish-input { width:100%; padding:12px 14px; border:1px solid var(--border); border-radius:10px; font-size:14px; font-family:inherit; resize:vertical; }
  .somm-clarify { background:#fdf8f5; border:1px solid #f0d9c4; border-radius:10px; padding:12px 14px; margin-top:12px; }
  .somm-clarify-question { font-size:13px; font-weight:600; margin-bottom:6px; }
  .somm-clarify-input { width:100%; padding:8px 10px; border:1px solid var(--border); border-radius:6px; font-size:13px; }
  .somm-error { color: var(--red); font-size:12.5px; margin-top:8px; }
  .somm-dish-entry .btn { margin-top:14px; }
  .somm-results-heading { font-weight:700; font-size:15px; margin-bottom:14px; }
  .somm-card { display:flex; gap:14px; background: var(--paper); border:1px solid var(--border); border-radius:14px; padding:16px; margin-bottom:14px; }
  .somm-card-photo { width:56px; height:56px; border-radius:8px; object-fit:cover; background: var(--cream); flex-shrink:0; }
  .somm-card-body { flex:1; min-width:0; }
  .somm-card-title { font-weight:700; font-size:14.5px; }
  .somm-card-sub { font-size:12px; color: var(--muted); margin-top:1px; }
  .somm-card-score-row { display:flex; align-items:baseline; gap:10px; margin-top:8px; }
  .somm-score { font-size:20px; font-weight:700; color: var(--wine-dark); }
  .somm-confidence { font-size:11.5px; font-weight:600; padding:2px 8px; border-radius:20px; }
  .somm-confidence-high { background:#e5f2e8; color: var(--green); }
  .somm-confidence-medium { background:#faeed9; color: var(--amber); }
  .somm-confidence-low { background:#f7e3e3; color: var(--red); }
  .somm-explanation { font-size:13px; margin-top:8px; line-height:1.45; }
  .somm-card-meta { font-size:11.5px; color: var(--muted); margin-top:8px; display:flex; gap:6px; }
  .somm-why-toggle { font-size:12px; color: var(--wine); cursor:pointer; margin-top:10px; font-weight:600; }
  .somm-why-detail { font-size:12px; color: var(--muted); margin-top:8px; background: var(--cream); border-radius:8px; padding:10px 12px; display:flex; flex-direction:column; gap:3px; }
  .somm-no-match { max-width:640px; }
  .somm-build { font-size:12.5px; color: var(--ink); margin-top:8px; display:flex; flex-direction:column; gap:3px; line-height:1.4; }
  .somm-build strong { color: var(--wine-dark); font-weight:600; }
  .somm-loading { font-size:14px; color: var(--muted); padding:20px 0; }
  .somm-bottle-list { display:flex; flex-direction:column; gap:2px; max-height:420px; overflow-y:auto; border:1px solid var(--border); border-radius:10px; }
  .somm-bottle-row { display:flex; align-items:center; gap:12px; padding:10px 12px; cursor:pointer; border-bottom:1px solid var(--border); }
  .somm-bottle-row:last-child { border-bottom:none; }
  .somm-bottle-row:hover { background: var(--hover-tint); }
  .somm-bottle-thumb { width:36px; height:36px; border-radius:8px; object-fit:cover; background: var(--cream); flex-shrink:0; }
  .somm-bottle-thumb.placeholder { display:flex; align-items:center; justify-content:center; font-size:16px; background: var(--wine-dark); }
  .somm-bottle-row-title { font-weight:600; font-size:13px; }
  .somm-bottle-row-sub { font-size:11.5px; color: var(--muted); margin-top:1px; }
  .somm-log-row { margin-top:12px; display:flex; align-items:center; gap:10px; }
  .somm-logged { font-size:12.5px; color: var(--green); margin-top:12px; font-weight:600; }
  .somm-error-inline { font-size:11.5px; color: var(--red); }
  .somm-rated-summary { font-size:12.5px; color: var(--muted); margin-top:8px; }
  .somm-rate-form { margin-top:10px; background: var(--cream); border-radius:10px; padding:12px 14px; display:flex; flex-direction:column; gap:10px; }
  .somm-rate-row { display:flex; align-items:center; justify-content:space-between; gap:10px; }
  .somm-rate-label { font-size:12.5px; font-weight:600; color: var(--ink); }
  .somm-stars { font-size:20px; letter-spacing:2px; cursor:pointer; color:#d8cbc0; }
  .somm-star { cursor:pointer; }
  .somm-star.filled { color: var(--gold); }
  .somm-toggle-group { display:flex; gap:6px; }
  .somm-toggle-btn { font-size:12px; padding:4px 12px; border-radius:20px; border:1px solid var(--border); cursor:pointer; background: var(--paper); }
  .somm-toggle-btn.active { background: var(--wine-dark); color:#fff; border-color: var(--wine-dark); }
  .somm-select { font-size:12.5px; padding:6px 8px; border-radius:6px; border:1px solid var(--border); font-family:inherit; }
  .somm-prefs { margin-top:28px; }
  .somm-prefs-body { margin-top:10px; background: var(--paper); border:1px solid var(--border); border-radius:12px; padding:14px 16px; }
  .somm-recipe { margin-top:12px; background: var(--cream); border-radius:10px; padding:14px 16px; }
  .somm-recipe-title { font-weight:700; font-size:14.5px; }
  .somm-recipe-meta { font-size:11.5px; color: var(--muted); margin-top:2px; }
  .somm-recipe-section-label { font-weight:700; font-size:12px; text-transform:uppercase; letter-spacing:0.5px; color: var(--wine-dark); margin-top:12px; margin-bottom:4px; }
  .somm-recipe-ingredients { font-size:12.5px; margin:0; padding-left:18px; line-height:1.6; }
  .somm-recipe-steps { font-size:12.5px; margin:0; padding-left:18px; line-height:1.55; }
  .somm-recipe-steps li { margin-bottom:6px; }
  .somm-recipe-notes { font-size:12.5px; margin-top:10px; line-height:1.45; }
  .somm-recipe-notes strong { color: var(--wine-dark); }

  .slot-wrap { display:flex; align-items:flex-end; gap:18px; margin: 10px 0 28px 0; flex-wrap:wrap; }
  .slot-cabinet { background: var(--wine-dark); border-radius:16px; padding:16px; display:flex; gap:8px; box-shadow: 0 6px 20px rgba(0,0,0,0.28); border:3px solid var(--gold); }
  .slot-reel { width:56px; height:74px; background:#fff; border-radius:8px; overflow:hidden; position:relative; box-shadow: inset 0 2px 8px rgba(0,0,0,0.4); }
  .slot-reel-strip { display:flex; flex-direction:column; }
  .slot-reel-symbol { height:74px; display:flex; align-items:center; justify-content:center; font-size:34px; }
  .slot-reel-strip.spinning { animation: slot-roll 0.4s linear infinite; }
  @keyframes slot-roll { from { transform: translateY(0); } to { transform: translateY(-74px); } }
  .slot-lever { display:flex; flex-direction:column; align-items:center; padding-bottom:8px; }
  .slot-lever-rail { width:12px; height:96px; background: linear-gradient(180deg, #3a3530, #1c1916); border-radius:7px; position:relative; }
  .slot-lever-handle { position:absolute; left:50%; bottom:0; width:12px; height:70px; background: linear-gradient(180deg, var(--gold), #8a6a37); border-radius:7px; transform-origin: bottom center; transform: translateX(-50%) rotate(0deg); cursor:pointer; transition: transform 0.18s ease-out; }
  .slot-lever-handle .slot-lever-knob { position:absolute; top:-15px; left:50%; transform:translateX(-50%); width:28px; height:28px; border-radius:50%; background: radial-gradient(circle at 35% 30%, #e34a4a, #a11d1d); box-shadow: 0 3px 8px rgba(0,0,0,0.4); }
  .slot-lever-handle.pulled { transform: translateX(-50%) rotate(38deg); }
  .slot-lever-label { font-size:11px; color: var(--muted); margin-top:8px; text-align:center; max-width:70px; }
  .slot-direction { font-size:12.5px; font-style:italic; color: var(--muted); margin-top:6px; }

  .chat-fab { position:fixed; bottom:20px; right:20px; width:56px; height:56px; border-radius:50%; background: var(--wine-dark); color:#fff; display:flex; align-items:center; justify-content:center; font-size:22px; box-shadow:0 4px 14px rgba(0,0,0,0.28); cursor:pointer; z-index:1000; border:2px solid rgba(255,255,255,0.15); }
  .chat-fab:hover { filter:brightness(1.1); }
  .chat-panel { position:fixed; bottom:90px; right:20px; width:360px; max-width:calc(100vw - 40px); height:480px; max-height:calc(100vh - 140px); background:var(--paper); border-radius:14px; box-shadow:0 10px 40px rgba(0,0,0,0.3); display:flex; flex-direction:column; overflow:hidden; z-index:1000; border:1px solid var(--border); }
  .chat-panel-header { background:var(--wine-dark); color:#fff; padding:12px 16px; display:flex; align-items:center; justify-content:space-between; flex-shrink:0; }
  .chat-panel-header h4 { margin:0; font-size:14px; }
  .chat-panel-close { cursor:pointer; opacity:0.85; font-size:18px; }
  .chat-context-banner { background:#f3e6da; color:var(--wine-dark); font-size:12px; padding:6px 14px; border-bottom:1px solid var(--border); font-weight:600; flex-shrink:0; }
  .chat-messages { flex:1; overflow-y:auto; padding:14px; display:flex; flex-direction:column; gap:10px; background:var(--cream); }
  .chat-msg { max-width:85%; padding:8px 12px; border-radius:12px; font-size:13.5px; line-height:1.45; white-space:pre-wrap; }
  .chat-msg.user { align-self:flex-end; background:var(--wine-dark); color:#fff; border-bottom-right-radius:2px; }
  .chat-msg.assistant { align-self:flex-start; background:#fff; border:1px solid var(--border); border-bottom-left-radius:2px; }
  .chat-msg.system { align-self:center; font-size:12px; color:var(--red); }
  .chat-input-row { display:flex; gap:8px; padding:10px; border-top:1px solid var(--border); background:var(--paper); flex-shrink:0; }
  .chat-input-row textarea { flex:1; resize:none; border:1px solid var(--border); border-radius:8px; padding:8px 10px; font-family:inherit; font-size:13.5px; }
  .chat-empty-hint { color:var(--muted); font-size:13px; padding:8px; text-align:center; }

  @media (max-width: 760px) {
    .app { flex-direction:column; }
    .sidebar { display:none; }
    .mobile-topbar { position:sticky; top:0; z-index:900; width:100%; min-height:52px; display:flex; align-items:center; padding:calc(10px + env(safe-area-inset-top)) 16px 10px; color:#fff; background:var(--wine-dark); box-shadow:0 2px 8px rgba(43,35,32,.16); }
    .mobile-topbar strong { font-size:15px; letter-spacing:.2px; }
    .main { width:100%; max-width:none; padding:18px 16px calc(98px + env(safe-area-inset-bottom)); }
    .mobile-bottom-nav { position:fixed; z-index:1000; left:0; right:0; bottom:0; height:calc(64px + env(safe-area-inset-bottom)); display:grid; grid-template-columns:repeat(5, minmax(0, 1fr)); align-items:start; padding-bottom:env(safe-area-inset-bottom); background:rgba(255,255,255,.97); border-top:1px solid var(--border); box-shadow:0 -4px 16px rgba(43,35,32,.10); backdrop-filter:blur(14px); }
    .mobile-bottom-nav .nav-item { position:relative; min-width:0; min-height:64px; height:64px; padding:6px 2px 5px; gap:2px; flex-direction:column; justify-content:center; color:var(--muted); border:0; background:transparent; font-size:10.5px; text-align:center; }
    .mobile-bottom-nav .nav-item:hover { background:transparent; }
    .mobile-bottom-nav .nav-item.active { color:var(--wine-dark); background:transparent; border:0; font-weight:700; }
    .mobile-bottom-nav .nav-icon { width:32px; height:26px; flex:0 0 26px; border-radius:13px; align-items:center; font-size:17px; }
    .mobile-bottom-nav .nav-item.active .nav-icon { background:#f1e6da; }
    .mobile-bottom-nav .nav-badge-dot { position:absolute; margin-left:22px; margin-top:3px; }
    .mobile-more-overlay { position:fixed; z-index:1200; inset:0; display:flex; align-items:flex-end; justify-content:center; padding-top:20vh; background:rgba(30,15,15,.45); }
    .mobile-more-sheet { width:100%; max-height:80dvh; overflow:hidden; display:flex; flex-direction:column; background:var(--paper); border-radius:20px 20px 0 0; padding-bottom:env(safe-area-inset-bottom); box-shadow:0 -12px 40px rgba(30,15,15,.24); }
    .mobile-more-header { min-height:56px; padding:12px 16px; display:flex; justify-content:space-between; align-items:center; border-bottom:1px solid var(--border); }
    .icon-button { min-width:44px; min-height:44px; border:0; border-radius:50%; background:var(--cream); color:var(--ink); font-size:16px; cursor:pointer; }
    .mobile-more-content { overflow-y:auto; padding:10px 14px 20px; }
    .mobile-more-content > button { width:100%; min-height:46px; display:flex; align-items:center; justify-content:space-between; padding:10px 12px; border:0; border-radius:9px; background:transparent; color:var(--ink); font:inherit; font-size:14px; text-align:left; cursor:pointer; }
    .mobile-more-content > button:active { background:var(--hover-tint); }
    .mobile-more-content > button > span:not(.nav-badge-dot) { min-width:22px; padding:2px 7px; border-radius:12px; background:#f1e6da; color:var(--wine-dark); text-align:center; font-size:11px; }
    .more-section-label { padding:16px 12px 5px; color:var(--gold); font-size:11px; font-weight:700; letter-spacing:.5px; text-transform:uppercase; }
    .more-workspace { display:flex; align-items:center; gap:12px; justify-content:space-between; padding:8px 12px 12px; border-bottom:1px solid var(--border); }
    .more-workspace > div { display:flex; flex-direction:column; gap:2px; }
    .more-workspace span { color:var(--muted); font-size:11.5px; }
    .destructive-text { color:var(--red) !important; margin-top:8px; border-top:1px solid var(--border) !important; border-radius:0 !important; }
    .page-tabs { width:100%; display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); margin-bottom:18px; }
    .page-tabs button { min-height:40px; padding:7px 8px; }
    .form-grid { grid-template-columns: 1fr; }
    .tile-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap:12px; }
    .alert-section { width:100%; }
    .chat-panel { right:10px; left:10px; width:auto; max-width:none; bottom:calc(136px + env(safe-area-inset-bottom)); height:min(65vh, 500px); }
    .chat-fab { bottom:calc(76px + env(safe-area-inset-bottom)); right:16px; width:50px; height:50px; }
    .install-banner { bottom:calc(64px + env(safe-area-inset-bottom)); }
  }
