/* Suivi de cave — styles. Mobile d'abord, iPhone et iPad. */
:root {
  --bg: #FAF7F5; --surface: #FFFFFF; --surface-2: #F3EDEC; --ink: #211A1E; --muted: #6E6066; --line: #E6DDDB; --line-strong: #CFC2C2;
  --accent: #7B1E3A; --accent-ink: #FFFFFF; --accent-soft: #F3E4E9; --danger: #B3261E; --ok: #2E7D4F; --warn: #B7791F;
  --shadow: 0 1px 2px rgba(40, 20, 30, .06), 0 4px 16px rgba(40, 20, 30, .06);
  --radius: 12px; --tab-h: 56px;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --c1: #A32848; --c2: #B57800; --c3: #D55181; --c4: #2A78D6; --c5: #EB6834; --c6: #4A3AA7;
  --t-rouge: #7B1E3A; --t-blanc: #C9A227; --t-rose: #E08AA0; --t-petillant: #3C8D9E; --t-liquoreux: #C97A1B; --t-orange: #E0731D; --t-mute: #5B3A8C; --t-spiritueux: #6B4A2B; --t-autre: #8A8A8A;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17121A; --surface: #211A25; --surface-2: #2A2230; --ink: #EEE6EA; --muted: #A697A0; --line: #342A3A; --line-strong: #4A3D50;
    --accent: #D2607F; --accent-ink: #17121A; --accent-soft: #3A2230; --danger: #F28B82; --ok: #6CC594; --warn: #E0B25A;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
    --t-rouge: #C9506F; --t-blanc: #E3C24A;
    --c1: #D2607F; --c2: #C98500; --c3: #D55181; --c4: #3987E5; --c5: #D95926; --c6: #9085E9;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 17px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif; -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#app { min-height: 100%; display: flex; flex-direction: column; }
#view { flex: 1; padding-bottom: calc(var(--tab-h) + var(--sab) + 12px); }
#netbar { position: sticky; top: 0; z-index: 30; background: var(--warn); color: #1a1408; font-size: 13px; font-weight: 600; text-align: center; padding: calc(var(--sat) + 4px) 12px 4px; }
#netbar.ok { background: var(--ok); color: #fff; }

/* Barre d'onglets */
#tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: repeat(5, 1fr); height: calc(var(--tab-h) + var(--sab)); padding-bottom: var(--sab); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px); border-top: 1px solid var(--line); }
#tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 11px; font-weight: 500; }
#tabbar a .ico { font-size: 22px; line-height: 1; }
#tabbar a.active { color: var(--accent); }
#tabbar a.tab-add .ico { font-size: 26px; font-weight: 300; }
body.has-detail #tabbar { display: none; }

/* En-têtes d'écran */
.screen { padding: calc(var(--sat) + 8px) 16px 16px; max-width: 760px; margin: 0 auto; }
.screen-head { display: flex; align-items: center; gap: 10px; min-height: 44px; margin-bottom: 8px; }
.screen-head h1 { font-size: 28px; font-weight: 700; margin: 0; letter-spacing: -.01em; flex: 1; }
.screen-head h1.small { font-size: 20px; }
.back { display: inline-flex; align-items: center; gap: 2px; color: var(--accent); font-weight: 500; padding: 8px 8px 8px 0; min-height: 44px; }
.sub { color: var(--muted); font-size: 14px; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-weight: 600; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--accent); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; font-size: 18px; }
.icon-btn .badge { position: absolute; top: -4px; right: -4px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; border-radius: 10px; min-width: 18px; height: 18px; line-height: 18px; text-align: center; padding: 0 4px; }
.icon-btn { position: relative; }

/* Recherche */
.searchbar { position: sticky; top: 0; z-index: 20; background: var(--bg); padding: calc(var(--sat) + 8px) 16px 8px; }
.searchrow { display: flex; gap: 8px; align-items: center; }
.search { flex: 1; display: flex; align-items: center; gap: 8px; background: var(--surface-2); border-radius: 12px; padding: 0 12px; min-height: 44px; }
.search input { flex: 1; border: 0; background: transparent; min-height: 44px; font-size: 17px; outline: none; }
.search input::placeholder { color: var(--muted); }
.search .clear { border: 0; background: var(--line-strong); color: var(--surface); width: 20px; height: 20px; border-radius: 50%; font-size: 12px; line-height: 20px; padding: 0; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 8px 0 2px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 6px 12px; border-radius: 17px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 14px; font-weight: 500; white-space: nowrap; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip.filter { background: var(--accent-soft); border-color: transparent; color: var(--ink); }
.chip .x { opacity: .7; font-size: 13px; }
.resultcount { color: var(--muted); font-size: 13px; padding: 4px 16px 0; }

/* Cartes de la liste */
.list { display: flex; flex-direction: column; gap: 8px; padding: 8px 16px; max-width: 760px; margin: 0 auto; }
.card { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; background: var(--surface); border-radius: var(--radius); padding: 10px 12px; box-shadow: var(--shadow); cursor: pointer; }
.card .thumb, .thumb-ph { width: 56px; height: 72px; border-radius: 8px; object-fit: cover; background: var(--surface-2); }
.thumb-ph { display: flex; align-items: center; justify-content: center; font-size: 22px; opacity: .6; }
.card .body { min-width: 0; }
.card .title { font-weight: 600; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card .meta { color: var(--muted); font-size: 14px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: var(--surface-2); color: var(--ink); }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--t-autre); }
.pill.t-rouge .dot { background: var(--t-rouge); } .pill.t-blanc .dot { background: var(--t-blanc); } .pill.t-rose .dot { background: var(--t-rose); }
.pill.t-petillant .dot { background: var(--t-petillant); } .pill.t-liquoreux .dot { background: var(--t-liquoreux); } .pill.t-orange .dot { background: var(--t-orange); }
.pill.t-mute .dot { background: var(--t-mute); } .pill.t-spiritueux .dot { background: var(--t-spiritueux); }
.pill.ap-now { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.pill.ap-wait { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.pill.ap-past { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.pill.loc { color: var(--muted); font-weight: 500; }
.stockctl { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.stockctl .n { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 2ch; text-align: center; }
.stockctl .n.zero { color: var(--muted); }
.qbtn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface-2); font-size: 22px; font-weight: 500; line-height: 1; display: inline-flex; align-items: center; justify-content: center; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.qbtn:active { transform: scale(.94); background: var(--accent-soft); }
.qbtn:disabled { opacity: .35; }
.empty { text-align: center; color: var(--muted); padding: 48px 24px; }
.empty .big { font-size: 40px; margin-bottom: 8px; }

/* Fiche */
.hero { display: grid; grid-template-columns: 120px 1fr; gap: 16px; align-items: start; }
.hero img.main, .hero .thumb-ph.main { width: 120px; height: 160px; border-radius: 12px; object-fit: cover; background: var(--surface-2); font-size: 40px; }
.hero h1 { font-size: 22px; margin: 0 0 4px; line-height: 1.2; }
.hero .sub { font-size: 15px; }
.bigstock { display: flex; align-items: center; gap: 16px; justify-content: center; margin: 20px 0 8px; }
.bigstock .n { font-size: 44px; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 2ch; text-align: center; }
.bigstock .unit { font-size: 13px; color: var(--muted); text-align: center; margin-top: -6px; }
.bigstock .qbtn { width: 60px; height: 60px; font-size: 30px; }
.block { background: var(--surface); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); margin-top: 12px; }
.block h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 8px; font-weight: 600; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 15px; }
.kv .k { color: var(--muted); }
.kv .v { text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }
.gallery { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.gallery img { width: 84px; height: 112px; object-fit: cover; border-radius: 8px; background: var(--surface-2); flex: 0 0 auto; }
.gallery .addph { width: 84px; height: 112px; border-radius: 8px; border: 1px dashed var(--line-strong); display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 4px; color: var(--accent); font-size: 12px; font-weight: 600; flex: 0 0 auto; background: transparent; }
.mov { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 15px; align-items: center; }
.mov:first-of-type { border-top: 0; }
.mov .q { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 2.5ch; text-align: right; }
.mov .q.neg { color: var(--danger); } .mov .q.pos { color: var(--ok); }
.mov .d { color: var(--muted); font-size: 13px; }
.mov .note { color: var(--muted); font-size: 13px; grid-column: 2 / -1; }
.actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.actions .btn { flex: 1; }
.stars { color: var(--warn); letter-spacing: 1px; }

/* Formulaires */
.form { display: flex; flex-direction: column; gap: 14px; }
.fs { background: var(--surface); border-radius: var(--radius); padding: 4px 14px; box-shadow: var(--shadow); }
.fs legend, .fs h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; margin: 10px 0 0; padding: 0; }
.field { display: flex; flex-direction: column; gap: 4px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.field:last-child { border-bottom: 0; }
.field label { font-size: 13px; color: var(--muted); font-weight: 500; }
.field input, .field select, .field textarea { border: 0; background: transparent; min-height: 32px; font-size: 17px; width: 100%; outline: none; padding: 0; }
.field textarea { min-height: 72px; resize: vertical; }
.field select { -webkit-appearance: none; appearance: none; background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23999' stroke-width='1.6' fill='none'/%3E%3C/svg%3E") no-repeat right center; padding-right: 20px; }
.field.error label { color: var(--danger); }
.field .hint { font-size: 13px; color: var(--muted); }
.field .err { font-size: 13px; color: var(--danger); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row2 .field { border-bottom: 1px solid var(--line); }
.warnbox { background: color-mix(in srgb, var(--warn) 14%, transparent); border-left: 3px solid var(--warn); padding: 10px 12px; border-radius: 8px; font-size: 14px; }
.warnbox a { font-weight: 600; }
.errbox { background: color-mix(in srgb, var(--danger) 12%, transparent); border-left: 3px solid var(--danger); padding: 10px 12px; border-radius: 8px; font-size: 14px; color: var(--danger); }
.okbox { background: color-mix(in srgb, var(--ok) 14%, transparent); border-left: 3px solid var(--ok); padding: 10px 12px; border-radius: 8px; font-size: 14px; }
.savebar { position: sticky; bottom: calc(var(--tab-h) + var(--sab) + 8px); padding-top: 8px; background: linear-gradient(to top, var(--bg) 70%, transparent); }
body.has-detail .savebar { bottom: calc(var(--sab) + 8px); }
.segment { display: flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 3px; }
.segment button { flex: 1; border: 0; background: transparent; border-radius: 8px; min-height: 36px; font-size: 14px; font-weight: 500; color: var(--muted); }
.segment button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.ratingpick { display: flex; gap: 4px; font-size: 28px; }
.ratingpick button { border: 0; background: transparent; padding: 4px; color: var(--line-strong); }
.ratingpick button.on { color: var(--warn); }

/* Listes de menu */
.menu { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.menu a, .menu button.item, .menu div.item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--ink); width: 100%; text-align: left; background: transparent; border-left: 0; border-right: 0; border-top: 0; min-height: 52px; }
.menu > :last-child { border-bottom: 0; }
.menu .ico { font-size: 20px; width: 28px; text-align: center; }
.menu .lbl { flex: 1; font-weight: 500; }
.menu .lbl small { display: block; color: var(--muted); font-size: 13px; font-weight: 400; }
.menu .chev { color: var(--muted); }

/* Feuille montante */
#sheet-root { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.4); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg); width: 100%; max-width: 640px; max-height: 92vh; border-radius: 18px 18px 0 0; padding: 8px 16px calc(16px + var(--sab)); overflow-y: auto; animation: up .22s ease-out; }
@media (min-width: 900px) { #sheet-root { align-items: center; } .sheet { border-radius: 18px; max-height: 85vh; } }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 0 auto 10px; }
.sheet h2.title { font-size: 20px; margin: 4px 0 12px; }
@keyframes up { from { transform: translateY(30px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }
.facet { margin-bottom: 14px; }
.facet h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 6px; font-weight: 600; display: flex; justify-content: space-between; }
.facet h3 button { border: 0; background: none; color: var(--accent); font-size: 13px; text-transform: none; letter-spacing: 0; }
.facet .chips { flex-wrap: wrap; overflow: visible; }
.chip .n { opacity: .7; font-weight: 400; }

/* Toast */
#toast-root { position: fixed; left: 0; right: 0; bottom: calc(var(--tab-h) + var(--sab) + 12px); z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
body.has-detail #toast-root { bottom: calc(var(--sab) + 16px); }
.toast { pointer-events: auto; background: var(--ink); color: var(--bg); border-radius: 12px; padding: 12px 16px; display: flex; align-items: center; gap: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.25); font-size: 15px; max-width: 520px; width: 100%; }
.toast button { border: 0; background: transparent; color: var(--accent-soft); font-weight: 700; padding: 4px 6px; }
@media (prefers-color-scheme: dark) { .toast button { color: var(--accent); } }
.toast.err { background: var(--danger); color: #fff; }

/* Tableau de bord */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tile { background: var(--surface); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.tile .v { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.tile .l { font-size: 13px; color: var(--muted); }
.bars { display: grid; gap: 6px; }
.bar { display: grid; grid-template-columns: minmax(80px, 30%) 1fr auto; gap: 10px; align-items: center; font-size: 14px; }
.bar .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .track { height: 10px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--accent); border-radius: 5px; }
.bar .n { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 3ch; text-align: right; }

/* Plan de cave */
.place { margin-top: 12px; }
.place h2 { font-size: 18px; margin: 0 0 6px; display: flex; justify-content: space-between; align-items: baseline; }
.place h2 small { color: var(--muted); font-size: 14px; font-weight: 500; }
.zones { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.zone { background: var(--surface); border-radius: 10px; padding: 10px 12px; box-shadow: var(--shadow); text-align: left; border: 0; }
.zone .zn { font-weight: 600; font-size: 15px; }
.zone .zc { color: var(--muted); font-size: 13px; }

/* Import */
.steps { display: flex; gap: 6px; margin: 6px 0 14px; }
.steps span { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.steps span.on { background: var(--accent); }
.tbl { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.tbl table { border-collapse: collapse; font-size: 13px; min-width: 100%; }
.tbl th, .tbl td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.tbl th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; background: var(--surface-2); }
.maprow { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.maprow select { width: 100%; min-height: 40px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); padding: 0 8px; }
.maprow .src { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.maprow .src small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
.dropzone { border: 2px dashed var(--line-strong); border-radius: 14px; padding: 28px 16px; text-align: center; color: var(--muted); background: var(--surface); }
.dropzone input { display: none; }

/* Journal */
.logline { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.logline .t { color: var(--muted); font-size: 12px; }
.logline.conflict { border-left: 3px solid var(--warn); padding-left: 8px; }
.logline.error { border-left: 3px solid var(--danger); padding-left: 8px; }

/* Connexion */
.login { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 24px; max-width: 420px; margin: 0 auto; gap: 16px; }
.login .logo { width: 88px; height: 88px; border-radius: 22px; margin: 0 auto 8px; display: block; }
.login h1 { text-align: center; margin: 0; font-size: 26px; }
.login p { text-align: center; color: var(--muted); margin: 0; }

/* iPad / Mac : deux colonnes */
@media (min-width: 900px) {
  #view.cave-layout { display: grid; grid-template-columns: 400px 1fr; height: 100vh; padding-bottom: 0; }
  #view.cave-layout .pane-list { border-right: 1px solid var(--line); overflow-y: auto; height: 100vh; padding-bottom: calc(var(--tab-h) + 12px); }
  #view.cave-layout .pane-detail { overflow-y: auto; height: 100vh; padding-bottom: calc(var(--tab-h) + 12px); }
  #view.cave-layout .pane-detail .screen { max-width: 680px; }
  body.has-detail #tabbar { display: grid; }
  .pane-detail .back { display: none; }
  .pane-detail .savebar { bottom: calc(var(--tab-h) + 8px); }
  .placeholder { height: 100%; display: flex; align-items: center; justify-content: center; color: var(--muted); }
  .card.selected { outline: 2px solid var(--accent); }
  #tabbar { left: auto; right: auto; width: 400px; }
  .tiles { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 899px) {
  #view.cave-layout .pane-list { display: block; }
  #view.cave-layout .pane-detail { display: none; }
  body.has-detail #view.cave-layout .pane-list { display: none; }
  body.has-detail #view.cave-layout .pane-detail { display: block; }
}

/* Accueil et graphiques */
.tile { border: 0; text-align: left; font: inherit; color: inherit; }
button.tile { cursor: pointer; } button.tile:active { background: var(--accent-soft); }
.block.chart h2 { margin-bottom: 10px; }
.donut { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; }
.donut svg .seg { cursor: pointer; } .donut svg .seg:hover, .donut svg .seg:focus-visible { opacity: .8; outline: none; }
.donut-v { font-size: 26px; font-weight: 800; fill: var(--ink); font-variant-numeric: tabular-nums; }
.donut-l { font-size: 11px; fill: var(--muted); }
.legend { display: grid; gap: 2px; }
.legend.inline { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); margin-top: 8px; }
.legend-row { display: grid; grid-template-columns: 12px 1fr auto auto; gap: 8px; align-items: center; border: 0; background: transparent; padding: 4px 6px; border-radius: 6px; font-size: 14px; text-align: left; color: var(--ink); }
.legend-row:hover { background: var(--surface-2); }
.legend-row .sw { width: 12px; height: 12px; border-radius: 3px; }
.legend-row .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-row .val { font-weight: 600; font-variant-numeric: tabular-nums; }
.legend-row .pct { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; min-width: 4ch; text-align: right; }
.hbars { display: grid; gap: 4px; }
.hbar { display: grid; grid-template-columns: minmax(84px, 32%) 1fr auto; gap: 10px; align-items: center; border: 0; background: transparent; padding: 4px 6px; border-radius: 6px; font-size: 14px; text-align: left; color: var(--ink); min-height: 30px; }
.hbar:hover { background: var(--surface-2); }
.hbar .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar .track { height: 12px; background: var(--surface-2); border-radius: 0 4px 4px 0; overflow: hidden; }
.hbar .fill { display: block; height: 100%; border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar .val { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 3ch; text-align: right; }
.cols-wrap { overflow-x: auto; }
.cols { width: 100%; height: 140px; display: block; }
.cols .grid { stroke: var(--line); stroke-width: 1; }
.cols .tick { font-size: 11px; fill: var(--muted); }
.cols .cap { font-size: 11px; fill: var(--ink); font-weight: 600; }
.cols .col { cursor: pointer; } .cols .col:hover path, .cols .col:focus-visible path { opacity: 1; } .cols .col:focus-visible { outline: none; }
.segbar { display: flex; gap: 2px; height: 14px; border-radius: 4px; overflow: hidden; background: var(--surface-2); }
.segbar .seg { border: 0; padding: 0; height: 100%; cursor: pointer; min-width: 3px; }
.segbar .seg:first-child { border-radius: 4px 0 0 4px; } .segbar .seg:last-child { border-radius: 0 4px 4px 0; }
/* Photo depuis le web */
.webgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
@media (min-width: 600px) { .webgrid { grid-template-columns: repeat(4, 1fr); } }
.webthumb { border: 0; padding: 0; background: var(--surface-2); border-radius: 10px; overflow: hidden; aspect-ratio: 3 / 4; position: relative; cursor: pointer; }
.webthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.webthumb .src { position: absolute; left: 0; right: 0; bottom: 0; font-size: 10px; padding: 3px 6px; background: rgba(0,0,0,.55); color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.webthumb:disabled { opacity: .5; }
.webthumb:active { transform: scale(.97); }

.webpreview-img { background: var(--surface-2); border-radius: 12px; display: flex; align-items: center; justify-content: center; min-height: 200px; }
.webpreview-img img { max-width: 100%; max-height: 55vh; object-fit: contain; border-radius: 12px; display: block; }

/* Carte des vins */
.carte { max-width: 680px; font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif; }
.carte-head { text-align: center; padding: 18px 0 10px; border-bottom: 1px solid var(--line-strong); margin-bottom: 8px; }
.carte-eyebrow { font-size: 12px; letter-spacing: .22em; text-transform: uppercase; color: var(--accent); font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif; font-weight: 600; }
.carte-title { font-size: 34px; font-weight: 500; margin: 6px 0 4px; letter-spacing: -.005em; }
.carte-sub { color: var(--muted); font-size: 14px; font-style: italic; }
.carte-section { padding: 18px 0 6px; }
.carte-section h2 { display: flex; align-items: baseline; justify-content: center; gap: 12px; font-size: 22px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; margin: 0 0 12px; color: var(--ink); }
.carte-section h2::before, .carte-section h2::after { content: ""; flex: 1; height: 1px; background: var(--line-strong); }
.carte-section h2 small { font-size: 12px; color: var(--muted); font-style: italic; text-transform: none; letter-spacing: 0; }
.carte-region-block { margin: 14px 0 6px; }
.carte-region-title { font-size: 13px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin: 0 0 6px; font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif; }
.carte-region-title small { color: var(--muted); font-weight: 500; letter-spacing: .04em; text-transform: none; }
.carte-group { margin: 6px 0 10px; }
.carte-group h4 { font-size: 17px; font-weight: 700; margin: 0 0 2px; letter-spacing: .01em; }
.carte-line { display: flex; align-items: baseline; gap: 8px; padding: 4px 0 4px 14px; color: var(--ink); font-size: 16px; line-height: 1.35; }
.carte-line:hover { text-decoration: none; background: var(--surface-2); border-radius: 6px; }
.carte-name { display: flex; flex-direction: column; min-width: 0; }
.carte-cuvee { }
.carte-region { font-size: 13px; color: var(--muted); font-style: italic; }
.carte-size { font-size: 12px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, sans-serif; }
.carte-size.big { font-size: 13px; color: var(--accent); font-weight: 600; }
.carte-dots { flex: 1; border-bottom: 1px dotted var(--line-strong); transform: translateY(-5px); min-width: 16px; }
.carte-right { display: flex; align-items: baseline; gap: 10px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.carte-vintage { font-weight: 600; min-width: 3.2ch; text-align: right; }
.carte-price { color: var(--muted); font-size: 14px; }
.carte-qty { font-size: 12px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, sans-serif; background: var(--surface-2); border-radius: 8px; padding: 1px 6px; }
.carte-foot { text-align: center; color: var(--muted); font-style: italic; margin: 24px 0 8px; }
@media print {
  #tabbar, #netbar, #toast-root, #sheet-root, .no-print { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  #view { padding: 0; }
  .carte { max-width: none; }
  .carte-line { break-inside: avoid; padding-left: 8mm; }
  .carte-region-block { break-inside: avoid; }
  .carte-section { break-inside: avoid-page; }
  .carte-line:hover { background: none; }
  .carte-qty { border: 1px solid #999; background: none; }
}
