/* ====== FONT FALLBACKS (size-adjust) ====== */
@font-face {
  font-family: 'Outfit Fallback';
  src: local('Arial');
  size-adjust: 103%;
  ascent-override: 95%;
  descent-override: 22%;
  line-gap-override: 0%;
}
@font-face {
  font-family: 'Fraunces Fallback';
  src: local('Georgia');
  size-adjust: 103%;
  ascent-override: 92%;
  descent-override: 22%;
}

:root {
  --cream: #F8F4ED;
  --cream-deep: #F1EBDF;
  --paper: #FFFFFF;
  --ink: #1C1816;
  --ink-soft: #3A332D;
  --muted: #8A8074;
  --muted-light: #B5AE9F;
  --line: #E6DED0;
  --line-soft: #EFE8DA;

  --rouge: #6B1F2E;
  --rouge-bg: #F1DCDE;
  --blanc: #5C7A6B;
  --blanc-bg: #DCE8DC;
  --rose: #C97B63;
  --rose-bg: #F6DED2;
  --champagne: #B89456;
  --champagne-bg: #F2E5C8;
  --doux: #9B6B3F;
  --doux-bg: #E9D8BE;

  --alert: #B8542E;
  --alert-bg: #F4DFD1;
  --warn: #C4983E;
  --warn-bg: #F5E8C8;
  --ok: #5E7C66;
  --ok-bg: #DCE8DC;

  --radius: 4px;
  --radius-lg: 8px;
  --shadow-sm: 0 1px 2px rgba(28, 24, 22, 0.04);
  --shadow-md: 0 4px 16px rgba(28, 24, 22, 0.06);
  --shadow-lg: 0 12px 40px rgba(28, 24, 22, 0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
}
html { height: 100%; }
body {
  font-family: 'Outfit', 'Outfit Fallback', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--cream);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

.serif { font-family: 'Fraunces', 'Fraunces Fallback', Georgia, 'Times New Roman', serif; font-optical-sizing: auto; }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}
button { cursor: pointer; background: none; border: none; }

/* ---------- LOGIN ---------- */
.login-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--cream);
  padding: 24px;
}
.login-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-md);
}
.login-card-subtitle {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 32px;
}
.login-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}
.login-tab {
  flex: 1;
  padding: 10px 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 120ms;
}
.login-tab.active {
  color: var(--ink);
  border-bottom-color: var(--ink);
}
.login-error {
  background: var(--alert-bg);
  color: var(--alert);
  border: 1px solid rgba(184, 84, 46, 0.2);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* ---------- LAYOUT ---------- */
.app {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  max-width: 100%;
}

.sidebar {
  background: var(--paper);
  border-right: 1px solid var(--line);
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 0;
}

.logo {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line-soft);
}
.logo-mark {
  font-family: 'Fraunces', 'Fraunces Fallback', Georgia, serif;
  font-style: italic;
  font-size: 30px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--rouge);
}
.logo-text {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.sidebar-backdrop { display: none; }

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-section {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-light);
  padding: 6px 12px;
  margin-top: 16px;
}
.nav-section:first-child { margin-top: 0; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-weight: 400;
  color: var(--ink-soft);
  text-align: left;
  width: 100%;
  transition: background 120ms ease;
}
.nav-item:hover { background: var(--cream); }
.nav-item.active {
  background: var(--ink);
  color: var(--cream);
  font-weight: 500;
}
.nav-item.active svg { color: var(--cream); }
.nav-item svg { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
.nav-item .count {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.nav-item.active .count { color: var(--muted-light); }

.sidebar-footer {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--line-soft);
  font-size: 11px;
  color: var(--muted);
  line-height: 1.6;
}

.main {
  min-width: 0;
  max-width: 100%;
  padding: 40px 48px 80px;
  overflow-x: hidden;
}

.main-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.main-header h1 {
  font-family: 'Fraunces', 'Fraunces Fallback', Georgia, serif;
  font-weight: 400;
  font-size: 36px;
  letter-spacing: -0.02em;
  line-height: 1.05;
}
.main-header .subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
}
.main-header .actions { display: flex; gap: 8px; }

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  transition: all 120ms ease;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn svg { width: 14px; height: 14px; }
.btn-primary {
  background: var(--ink);
  color: var(--cream);
}
.btn-primary:hover { background: var(--ink-soft); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--line);
}
.btn-secondary:hover { background: var(--cream); border-color: var(--muted-light); }
.btn-ghost {
  color: var(--muted);
  padding: 6px 10px;
}
.btn-ghost:hover { color: var(--ink); background: var(--cream-deep); }
.btn-danger {
  color: var(--alert);
  border: 1px solid var(--line);
  background: var(--paper);
}
.btn-danger:hover { background: var(--alert-bg); border-color: var(--alert); }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-icon {
  padding: 8px;
  width: 32px;
  height: 32px;
  justify-content: center;
}
.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--muted);
  transition: background 120ms, color 120ms;
}
.modal-close:hover { background: var(--cream-deep); color: var(--ink); }
.modal-close svg { width: 14px; height: 14px; }

/* ---------- DASHBOARD ---------- */
.grid-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}
.stat {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
}
.stat-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}
.stat-value {
  font-family: 'Fraunces', 'Fraunces Fallback', Georgia, serif;
  font-size: 40px;
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.stat-unit {
  font-size: 14px;
  color: var(--muted);
  margin-left: 4px;
  font-family: 'Outfit', sans-serif;
}
.stat-sub {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.dash-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
}
.card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 18px;
}
.card-title {
  font-family: 'Fraunces', 'Fraunces Fallback', Georgia, serif;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.card-meta {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* Drinking window bars */
.window-list { display: flex; flex-direction: column; gap: 14px; }
.window-row {
  display: grid;
  grid-template-columns: 150px 1fr 60px;
  gap: 16px;
  align-items: center;
}
.window-label { font-size: 13px; color: var(--ink-soft); }
.window-label .range { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; }
.window-bar {
  height: 8px;
  background: var(--cream-deep);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.window-bar-fill {
  height: 100%;
  background: var(--ink);
  border-radius: 4px;
  transition: width 400ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.window-row.urgent .window-bar-fill { background: var(--alert); }
.window-row.soon .window-bar-fill { background: var(--warn); }
.window-row.comfortable .window-bar-fill { background: var(--ok); }
.window-count {
  font-family: 'Fraunces', 'Fraunces Fallback', Georgia, serif;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.window-row.urgent .window-count { color: var(--alert); }

/* Distribution */
.dist-grid { display: flex; flex-direction: column; gap: 8px; }
.dist-row {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 6px 0;
}
.dist-row .label { font-size: 13px; display: flex; align-items: center; gap: 8px; }
.dist-row .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dist-row .bar {
  height: 6px;
  background: var(--cream-deep);
  border-radius: 3px;
  overflow: hidden;
}
.dist-row .bar-fill { height: 100%; border-radius: 3px; }
.dist-row .count {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 30px;
  text-align: right;
}

/* Alerts */
.alerts-list { display: flex; flex-direction: column; gap: 10px; }
.alert-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--alert-bg);
  border: 1px solid rgba(184, 84, 46, 0.2);
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 120ms ease;
}
.alert-row.warn { background: var(--warn-bg); border-color: rgba(196, 152, 62, 0.2); }
.alert-row:hover { transform: translateX(2px); }
.alert-row svg { width: 16px; height: 16px; color: var(--alert); flex-shrink: 0; }
.alert-row.warn svg { color: var(--warn); }
.alert-text { flex: 1; font-size: 13px; }
.alert-text strong { font-weight: 600; }
.alert-meta { font-size: 11px; color: var(--muted); }

/* ---------- CAVE (LIST) ---------- */
.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.search {
  flex: 1;
  min-width: 220px;
  position: relative;
}
.search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--muted);
  pointer-events: none;
}
.search input {
  width: 100%;
  padding: 10px 14px 10px 36px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 120ms ease;
}
.search input:focus { border-color: var(--ink); }

.filter-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.chip {
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  transition: all 120ms ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; }
.chip:hover { border-color: var(--muted); }
.chip.active {
  background: var(--ink);
  color: var(--cream);
  border-color: var(--ink);
}

.active-filters {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--muted);
}
.clear-filters {
  color: var(--alert);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.wines-grid { display: flex; flex-direction: column; gap: 1px; background: var(--line-soft); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.wine-row {
  display: grid;
  grid-template-columns: 4px minmax(0, 1fr) auto;
  column-gap: 16px;
  row-gap: 6px;
  background: var(--paper);
  padding: 16px 20px;
  align-items: center;
  cursor: pointer;
  transition: background 120ms ease;
}
.wine-row:hover { background: var(--cream); }
.wine-row.header { display: none; }
.wine-row .color-bar {
  width: 4px;
  height: 36px;
  border-radius: 2px;
}
.wine-main { min-width: 0; }
.wine-name {
  font-family: 'Fraunces', 'Fraunces Fallback', Georgia, serif;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.wine-cuvee {
  font-family: 'Fraunces', 'Fraunces Fallback', Georgia, serif;
  font-style: italic;
  font-weight: 400;
  color: var(--muted);
  margin-left: 4px;
}
.wine-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.wine-meta .sep { color: var(--muted-light); }

.wine-row > .wine-vintage,
.wine-row > .wine-format,
.wine-row > .wine-casier,
.wine-row > .wine-apogee { display: none; }

.wine-row-mobile-extra {
  grid-column: 2 / -1;
  display: flex;
  gap: 10px 14px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}
.wine-row-mobile-extra .wine-vintage-inline {
  font-family: 'Fraunces', 'Fraunces Fallback', Georgia, serif;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}
.wine-row-mobile-extra .mono-inline {
  font-family: 'Fraunces', 'Fraunces Fallback', Georgia, serif;
  letter-spacing: 0.04em;
}

.wine-stock {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
}
.stock-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: all 120ms ease;
  flex-shrink: 0;
}
.stock-btn:hover { background: var(--ink); border-color: var(--ink); color: var(--cream); }
.stock-btn svg { width: 10px; height: 10px; }
.stock-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.stock-btn:disabled:hover { background: transparent; color: var(--muted); border-color: var(--line); }
.stock-val {
  font-family: 'Fraunces', 'Fraunces Fallback', Georgia, serif;
  font-size: 20px;
  font-weight: 500;
  min-width: 28px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.stock-val.empty { color: var(--muted-light); }

.wine-vintage {
  font-family: 'Fraunces', 'Fraunces Fallback', Georgia, serif;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}
.wine-format { font-size: 12px; color: var(--muted); }
.wine-casier {
  font-family: 'Fraunces', 'Fraunces Fallback', Georgia, serif;
  font-size: 14px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-align: center;
}
.wine-apogee { font-size: 11px; text-align: right; }

@media (min-width: 1100px) {
  .wine-row {
    grid-template-columns: 4px minmax(0, 1fr) 70px 90px 110px 70px 120px;
    column-gap: 20px;
    row-gap: 0;
    padding: 16px 22px;
  }
  .wine-row.header {
    display: grid;
    background: var(--cream-deep);
    padding: 10px 22px;
    cursor: default;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
  }
  .wine-row.header:hover { background: var(--cream-deep); }
  .wine-row > .wine-vintage,
  .wine-row > .wine-format,
  .wine-row > .wine-casier,
  .wine-row > .wine-apogee { display: block; }
  .wine-row-mobile-extra { display: none; }
  .wine-name { -webkit-line-clamp: 1; }
}
.apogee-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: var(--ok-bg);
  color: var(--ok);
}
.apogee-badge.urgent { background: var(--alert-bg); color: var(--alert); }
.apogee-badge.soon { background: var(--warn-bg); color: var(--warn); }
.apogee-badge.young { background: var(--cream-deep); color: var(--muted); }
.apogee-badge .dot { width: 4px; height: 4px; border-radius: 50%; background: currentColor; }

.tag-pill {
  display: inline-block;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 500;
  border-radius: 999px;
  background: var(--cream-deep);
  color: var(--muted);
  letter-spacing: 0.04em;
}

.empty-state {
  text-align: center;
  padding: 80px 24px;
  background: var(--paper);
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
}
.empty-state .icon {
  font-family: 'Fraunces', 'Fraunces Fallback', Georgia, serif;
  font-style: italic;
  font-size: 48px;
  color: var(--muted-light);
  margin-bottom: 8px;
}
.empty-state h3 {
  font-family: 'Fraunces', 'Fraunces Fallback', Georgia, serif;
  font-weight: 500;
  font-size: 20px;
  margin-bottom: 6px;
}
.empty-state p { color: var(--muted); margin-bottom: 20px; }

/* ---------- DETAIL / FORM MODAL ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28, 24, 22, 0.5);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadein 180ms ease;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideup { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal {
  background: var(--paper);
  border-radius: var(--radius-lg);
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideup 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.modal-wide { max-width: 860px; }

.modal-header {
  padding: 24px 28px 20px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  background: var(--paper);
  z-index: 1;
}
.modal-title {
  font-family: 'Fraunces', 'Fraunces Fallback', Georgia, serif;
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.15;
}
.modal-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.modal-body { padding: 24px 28px; }
.modal-footer {
  padding: 16px 28px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  position: sticky;
  bottom: 0;
  background: var(--paper);
}

/* Form fields */
.form-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, 1fr);
}
.form-grid .full { grid-column: 1 / -1; }
.form-section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-soft);
  margin-top: 12px;
  margin-bottom: 4px;
  grid-column: 1 / -1;
}
.form-section-title:first-child { margin-top: 0; }
.field label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.field label .optional {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted-light);
  font-style: italic;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 9px 12px;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  transition: all 120ms ease;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--ink);
  background: var(--paper);
}
.field textarea { resize: vertical; min-height: 80px; font-family: inherit; }
.field-inline { display: flex; gap: 8px; align-items: center; }
.field-inline input { flex: 1; }

.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.radio-pill {
  padding: 7px 14px;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 120ms ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.radio-pill input { display: none; }
.radio-pill .dot { width: 6px; height: 6px; border-radius: 50%; }
.radio-pill:hover { border-color: var(--muted); }
.radio-pill.checked {
  background: var(--ink);
  color: var(--cream);
  border-color: var(--ink);
}

/* Detail view */
.detail-hero {
  padding: 24px 28px 24px;
  background: var(--cream);
  border-bottom: 1px solid var(--line-soft);
}
.detail-type-bar { height: 3px; border-radius: 2px; margin-bottom: 16px; width: 48px; }
.detail-origin {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.detail-name {
  font-family: 'Fraunces', 'Fraunces Fallback', Georgia, serif;
  font-weight: 500;
  font-size: 30px;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 4px;
}
.detail-cuvee {
  font-family: 'Fraunces', 'Fraunces Fallback', Georgia, serif;
  font-style: italic;
  font-weight: 400;
  color: var(--muted);
  font-size: 20px;
}
.detail-vintage {
  font-family: 'Fraunces', 'Fraunces Fallback', Georgia, serif;
  font-size: 42px;
  font-weight: 400;
  letter-spacing: -0.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  margin-top: 8px;
}
.detail-props {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  padding: 20px 28px;
  background: var(--paper);
  border-bottom: 1px solid var(--line-soft);
}
.prop-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.prop-value { font-size: 15px; color: var(--ink); }
.prop-value.mono { font-variant-numeric: tabular-nums; font-family: 'Fraunces', 'Fraunces Fallback', Georgia, serif; }

.detail-stock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
  background: var(--paper);
  border-bottom: 1px solid var(--line-soft);
  gap: 20px;
}
.stock-big {
  display: flex;
  align-items: center;
  gap: 12px;
}
.stock-big .stock-btn { width: 36px; height: 36px; }
.stock-big .stock-btn svg { width: 14px; height: 14px; }
.stock-big-value {
  font-family: 'Fraunces', 'Fraunces Fallback', Georgia, serif;
  font-size: 44px;
  font-weight: 500;
  letter-spacing: -0.02em;
  min-width: 60px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.detail-block {
  padding: 20px 28px;
  border-bottom: 1px solid var(--line-soft);
}
.detail-block:last-child { border-bottom: none; }
.detail-block h4 {
  font-family: 'Fraunces', 'Fraunces Fallback', Georgia, serif;
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 12px;
}
.comment-box {
  background: var(--cream);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 14px;
  font-style: italic;
  font-family: 'Fraunces', 'Fraunces Fallback', Georgia, serif;
  color: var(--ink-soft);
  line-height: 1.6;
}
.tasting-event {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line-soft);
  font-size: 13px;
}
.tasting-event:last-child { border: none; }
.tasting-event .date {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  min-width: 90px;
}
.tasting-event .action { color: var(--ink); }

.tags-display { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-display {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--cream-deep);
  font-size: 12px;
  color: var(--ink-soft);
}

/* ---------- IMPORT ---------- */
.import-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.import-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
}
.import-card h3 {
  font-family: 'Fraunces', 'Fraunces Fallback', Georgia, serif;
  font-size: 20px;
  font-weight: 500;
  margin-bottom: 6px;
}
.import-card p {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 16px;
}
.import-card textarea {
  width: 100%;
  min-height: 200px;
  padding: 12px;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: 'SF Mono', 'Menlo', 'Monaco', monospace;
  font-size: 12px;
  line-height: 1.6;
  outline: none;
}
.import-card textarea:focus { border-color: var(--ink); background: var(--paper); }

/* Mobile nav toggle */
.mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.mobile-toggle {
  padding: 8px;
  border-radius: var(--radius);
}
.mobile-toggle svg { width: 20px; height: 20px; }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--cream);
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  max-width: calc(100vw - 40px);
  text-align: center;
  animation: slideup 200ms ease;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 900px) {
  .grid-stats { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .detail-props { grid-template-columns: repeat(2, 1fr); }
  .import-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .app { grid-template-columns: 1fr; }
  .mobile-header { display: flex; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(28, 24, 22, 0.5);
    z-index: 55;
  }
  .sidebar-backdrop.open { display: block; }
  .main { padding: 20px 16px 80px; }
  .main-header { flex-direction: column; align-items: flex-start; gap: 16px; }
  .main-header h1 { font-size: 28px; }
  .form-grid { grid-template-columns: 1fr; }
  .wine-row {
    padding: 14px 16px;
    column-gap: 12px;
  }
  .wine-meta { font-size: 11px; }
  .wine-row-mobile-extra { font-size: 11px; }
  .detail-props { grid-template-columns: 1fr 1fr; }
  .grid-stats { grid-template-columns: repeat(2, 1fr); }
  .modal { max-height: 95vh; max-height: 95dvh; }
  .modal-header, .modal-body, .modal-footer { padding-left: 20px; padding-right: 20px; }
  .toolbar { gap: 10px; }
  .search { min-width: 0; }
}

/* Color dots */
.dot-rouge { background: var(--rouge); }
.dot-blanc { background: var(--blanc); }
.dot-rose { background: var(--rose); }
.dot-champagne { background: var(--champagne); }
.dot-doux { background: var(--doux); }

.bar-rouge { background: var(--rouge); }
.bar-blanc { background: var(--blanc); }
.bar-rose { background: var(--rose); }
.bar-champagne { background: var(--champagne); }
.bar-doux { background: var(--doux); }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 5px; border: 2px solid var(--cream); }
::-webkit-scrollbar-thumb:hover { background: var(--muted-light); }

.hide-mobile { }
@media (max-width: 720px) { .hide-mobile { display: none !important; } }
