/* =========================================================
   RONNIEVINO — Grand Cru Theme
   White · Ink · Deep Burgundy · Gold
   Cormorant Garamond + Inter
   ========================================================= */

:root {
  /* Palette */
  --burgundy:      #6B1530;
  --burgundy-dark: #4A0E20;
  --burgundy-lt:   #9B2350;
  --gold:          #B8943A;
  --gold-lt:       #D4B060;
  --ink:           #111111;
  --text:          #1C1C1C;
  --text-muted:    #777777;
  --text-light:    #AAAAAA;
  --bg:            #FFFFFF;
  --bg-off:        #F8F6F3;
  --bg-warm:       #F3EFE9;
  --border:        #E4E0DB;
  --border-lt:     #EDEBE8;
  --green:         #2D6A4F;
  --yellow:        #92622A;
  --red-status:    #8B1A2A;

  /* Type */
  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-sans:  'Inter', system-ui, sans-serif;

  /* Radii & shadows */
  --radius:    4px;
  --radius-lg: 8px;
  --shadow:    0 1px 4px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.06);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.08), 0 8px 32px rgba(0,0,0,0.10);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

a { color: var(--burgundy); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* ─── NAVBAR ─────────────────────────────────────────────── */
.navbar {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  height: 64px;
  gap: 0;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--burgundy);
  letter-spacing: 0.06em;
  text-decoration: none;
  flex-shrink: 0;
  text-transform: uppercase;
}
.nav-brand:hover { text-decoration: none; color: var(--burgundy-dark); }

.nav-links {
  display: flex;
  align-items: center;
  list-style: none;
  margin-left: auto;
  gap: 0;
}

.nav-links a {
  color: var(--text-muted);
  padding: 0.4rem 0.9rem;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 500;
  transition: color 0.15s;
  text-decoration: none;
  border-radius: 0;
}

.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-links a.active { color: var(--burgundy); }

.btn-admin, .btn-admin-sm {
  font-size: 0.72rem !important;
  padding: 0.35rem 0.9rem !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  color: var(--text-muted) !important;
  background: transparent !important;
  font-weight: 500 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
  margin-left: 0.5rem;
  transition: border-color 0.15s, color 0.15s !important;
}
.btn-admin:hover, .btn-admin-sm:hover {
  border-color: var(--burgundy) !important;
  color: var(--burgundy) !important;
  background: transparent !important;
  text-decoration: none !important;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.3rem;
  cursor: pointer;
  margin-left: auto;
}

/* ─── FLASH MESSAGES ─────────────────────────────────────── */
.flash-container { position: fixed; top: 74px; right: 1.5rem; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.flash { padding: 0.75rem 1.25rem; border-radius: var(--radius-lg); font-size: 0.88rem; display: flex; align-items: center; gap: 1rem; box-shadow: var(--shadow-md); max-width: 360px; border: 1px solid; }
.flash button { background: none; border: none; cursor: pointer; font-size: 1rem; opacity: 0.5; }
.flash-success { background: #f0faf4; color: #1a5c38; border-color: #a7d8b8; }
.flash-danger  { background: #fdf2f2; color: #8b1a1a; border-color: #e8b4b4; }
.flash-info    { background: #f0f4fd; color: #1a3a7c; border-color: #b4c8e8; }
.flash-warning { background: #fdf8f0; color: #7a4a10; border-color: #e8d0a0; }

/* ─── LAYOUT ─────────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 2rem; }

.page-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 2.5rem 0;
  margin-bottom: 0;
}
.page-header h1 {
  font-family: var(--font-serif);
  font-size: 2.4rem;
  font-weight: 400;
  color: var(--ink);
  letter-spacing: 0.01em;
}
.page-header p { color: var(--text-muted); margin-top: 0.25rem; font-size: 0.9rem; }

.section { padding: 3rem 0; }
.section-title {
  font-family: var(--font-serif);
  font-size: 1.7rem;
  font-weight: 400;
  color: var(--ink);
  margin-bottom: 0.35rem;
}
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
  margin-bottom: 2rem;
}
.section-header a { font-size: 0.75rem; color: var(--text-muted); letter-spacing: 0.08em; text-transform: uppercase; }
.section-header a:hover { color: var(--burgundy); }
.section-cta { margin-top: 2.5rem; text-align: center; }

/* ─── HERO ───────────────────────────────────────────────── */
.hero {
  display: grid;
  grid-template-columns: 1fr 360px;
  border-bottom: 1px solid var(--border);
}

.hero-inner {
  padding: 5rem 2rem 5rem 2rem;
  max-width: 620px;
  margin: 0 auto 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-eyebrow {
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 500;
  margin-bottom: 1.25rem;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(2.8rem, 5vw, 4rem);
  font-weight: 400;
  color: var(--ink);
  line-height: 1.1;
  letter-spacing: 0.01em;
  margin-bottom: 1rem;
}
.hero-title span { color: var(--burgundy); }

.hero-sub {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.7;
  margin-bottom: 2.25rem;
  max-width: 420px;
}

.hero-actions { display: flex; align-items: center; gap: 1.5rem; }
.hero-link { font-size: 0.78rem; color: var(--text-muted); letter-spacing: 0.08em; text-transform: uppercase; border-bottom: 1px solid var(--border); padding-bottom: 1px; }
.hero-link:hover { color: var(--burgundy); border-color: var(--burgundy); text-decoration: none; }

.hero-stats-panel {
  background: var(--burgundy);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 3rem 2rem;
}

.hero-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem 0;
  width: 100%;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.hero-stat:last-child { border-bottom: none; }

.stat-num {
  font-family: var(--font-serif);
  font-size: 2.6rem;
  color: #fff;
  line-height: 1;
  display: block;
}

.stat-label {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.55);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-top: 0.4rem;
  font-weight: 500;
}

/* ─── NAVBAR LOGO ────────────────────────────────────────── */
.nav-logo {
  display: flex;
  align-items: flex-end;
  height: 28px;
  gap: 0;
}
.nav-lab {
  height: 28px;
  width: auto;
  object-fit: contain;
  object-position: top center;
  display: block;
}
.nav-lab-black   { filter: none; }
.nav-lab-choc    { filter: sepia(1) hue-rotate(320deg) saturate(2.5) brightness(0.55); }
.nav-lab-yellow  { filter: sepia(1) hue-rotate(5deg) saturate(2.5) brightness(1.1); }

/* ─── LETTERHEAD CREST ───────────────────────────────────── */
.crest-banner {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  padding: 1.75rem 2rem;
}
.crest-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
}
.crest-labs {
  display: flex;
  align-items: flex-end;
  flex-shrink: 0;
}
.crest-lab {
  height: 90px;
  width: auto;
  object-fit: contain;
  object-position: top center;
  display: block;
}
.crest-divider {
  width: 1px;
  height: 90px;
  background: var(--border);
  flex-shrink: 0;
}
.crest-text { text-align: left; }
.crest-eyebrow {
  font-family: var(--font-sans);
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.3rem;
}
.crest-name {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
  margin-bottom: 0.25rem;
}
.crest-sub {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1rem;
  color: var(--text-muted);
}

/* ─── LAB BANNER (legacy — no longer used) ───────────────── */
.lab-banner {
  overflow: hidden;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg-off);
  height: 72px;
  display: flex;
  align-items: center;
}

.lab-track {
  display: flex;
  align-items: center;
  gap: 0;
  white-space: nowrap;
  animation: lab-scroll 22s linear infinite;
  will-change: transform;
}

@keyframes lab-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.lab-svg {
  height: 52px;
  width: auto;
  flex-shrink: 0;
  margin-right: 8px;
}

.lab-black     { color: #1a1a1a; }
.lab-yellow    { color: #C9963A; }
.lab-chocolate { color: #6B3520; }

/* ─── BUTTONS ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.5rem;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  border-radius: var(--radius);
}
.btn:hover { text-decoration: none; }

.btn-primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-primary:hover { background: #333; border-color: #333; }

.btn-outline { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { border-color: var(--ink); color: var(--ink); background: transparent; }

.btn-danger { background: #c0392b; color: white; border-color: #c0392b; }
.btn-danger:hover { background: #a53025; }

.btn-lg { padding: 0.8rem 2.25rem; font-size: 0.82rem; }
.btn-sm { padding: 0.3rem 0.85rem; font-size: 0.72rem; }
.btn-xs { padding: 0.18rem 0.55rem; font-size: 0.7rem; }
.btn-full { width: 100%; }
.btn-icon-del { background: none; border: none; color: #c0392b; cursor: pointer; font-size: 0.85rem; padding: 2px 6px; }

/* ─── WINE CARDS ─────────────────────────────────────────── */
.wine-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0;
  border: 1px solid var(--border);
}
.wine-grid-compact {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.wine-card {
  background: var(--bg);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  transition: background 0.15s;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
}
.wine-card:hover { background: var(--bg-off); text-decoration: none; }

.wine-card-img {
  position: relative;
  height: 200px;
  background: var(--bg-warm);
  border-bottom: 1px solid var(--border-lt);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.wine-card-img img { width: 100%; height: 100%; object-fit: cover; }

.wine-card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--border);
}
.placeholder-bottle { width: 44px; height: 88px; }
.detail-img-placeholder .placeholder-bottle { width: 72px; height: 144px; }

.wine-card-placeholder.red       { background: #f8f2f3; color: #d4b0b5; }
.wine-card-placeholder.white     { background: #f8f6ee; color: #d4c98a; }
.wine-card-placeholder.rosé      { background: #faf2f4; color: #e8b8c0; }
.wine-card-placeholder.sparkling { background: #f2f4f8; color: #b0bcda; }
.wine-card-placeholder.dessert   { background: #f8f4ee; color: #d4b870; }
.wine-card-placeholder.fortified { background: #f5f0ea; color: #c4a07a; }

.wine-card-body { padding: 1.1rem 1.2rem; flex: 1; display: flex; flex-direction: column; }
.wine-card-meta { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.5rem; }
.wine-card-vintage { font-size: 0.68rem; color: var(--gold); letter-spacing: 0.12em; text-transform: uppercase; font-weight: 600; }
.wine-card-type { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); padding: 0.15rem 0.5rem; border: 1px solid var(--border); border-radius: 2px; }
.wine-card-name { font-family: var(--font-serif); font-size: 1.15rem; font-weight: 400; margin-bottom: 0.2rem; line-height: 1.25; color: var(--ink); }
.wine-card-region { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 0; flex: 1; }
.wine-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 0.9rem; padding-top: 0.8rem; border-top: 1px solid var(--border-lt); }
.wine-card-arrow { color: var(--burgundy); font-size: 0.9rem; }

.rating-score { font-family: var(--font-serif); font-size: 1.4rem; color: var(--burgundy); font-weight: 400; }
.rating-label { font-size: 0.72rem; color: var(--text-muted); }
.rating-score-sm { background: var(--burgundy); color: white; font-size: 0.72rem; padding: 0.12rem 0.4rem; border-radius: 2px; font-weight: 600; }
.bottles-badge { background: var(--bg-off); border: 1px solid var(--border); font-size: 0.7rem; padding: 0.12rem 0.4rem; border-radius: 2px; color: var(--text-muted); }

/* ─── BADGES ─────────────────────────────────────────────── */
.badge {
  position: absolute;
  top: 10px; right: 10px;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.22rem 0.55rem;
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border: 1px solid;
}
.badge-green  { background: #f0faf4; color: #1a5c38; border-color: #a7d8b8; }
.badge-yellow { background: #fdf8f0; color: #7a4a10; border-color: #e8d0a0; }
.badge-red    { background: #fdf2f2; color: #8b1a1a; border-color: #e8b4b4; }

/* ─── COLLECTION LAYOUT ─────────────────────────────────── */
.collection-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 0;
  padding-top: 0;
  align-items: start;
  border-top: none;
}

.filters-sidebar {
  background: var(--bg-off);
  border-right: 1px solid var(--border);
  padding: 1.5rem;
  position: sticky;
  top: 64px;
  min-height: calc(100vh - 64px);
}

.filter-group { margin-bottom: 1.25rem; }
.filter-group label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.4rem;
}
.filter-group input, .filter-group select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
}
.filter-group input:focus, .filter-group select:focus {
  outline: none;
  border-color: var(--burgundy);
}
.filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.checkbox-label { display: flex !important; align-items: center; gap: 0.5rem; font-size: 0.83rem !important; text-transform: none !important; letter-spacing: 0 !important; color: var(--text-muted) !important; cursor: pointer; }
.checkbox-label input { width: auto !important; }

.collection-main { padding: 2rem; }

.empty-state { text-align: center; padding: 5rem 2rem; color: var(--text-muted); }
.empty-state p { font-size: 1rem; margin-bottom: 1rem; }

/* ─── WINE DETAIL ────────────────────────────────────────── */
.wine-detail { padding: 2.5rem 2rem; }
.detail-back { margin-bottom: 2rem; }
.detail-back a { color: var(--text-muted); font-size: 0.82rem; letter-spacing: 0.06em; text-transform: uppercase; }
.detail-back a:hover { color: var(--text); }

.detail-grid {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 3rem;
  align-items: start;
}

.detail-sidebar { position: sticky; top: 80px; }

.detail-img-wrap {
  border: 1px solid var(--border);
  background: var(--bg-warm);
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  overflow: hidden;
}
.detail-img { width: 100%; height: 100%; object-fit: cover; }
.detail-img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--border);
}

.detail-meta-card {
  border: 1px solid var(--border);
  background: var(--bg);
  margin-bottom: 1rem;
}
.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border-lt);
  font-size: 0.85rem;
}
.meta-row:last-child { border-bottom: none; }
.meta-row span { color: var(--text-muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; }
.meta-row strong { text-align: right; max-width: 60%; }

.window-banner {
  padding: 0.6rem 1rem;
  font-size: 0.82rem;
  font-weight: 500;
  margin-bottom: 1rem;
  border: 1px solid;
  border-radius: var(--radius);
}
.window-green  { background: #f0faf4; color: #1a5c38; border-color: #a7d8b8; }
.window-yellow { background: #fdf8f0; color: #7a4a10; border-color: #e8d0a0; }
.window-red    { background: #fdf2f2; color: #8b1a1a; border-color: #e8b4b4; }

.detail-value-card {
  background: var(--burgundy);
  color: white;
  padding: 1rem;
  margin-bottom: 1rem;
  border-radius: var(--radius);
}
.value-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.value-row:last-child { border-bottom: none; }
.value-row span { color: rgba(255,255,255,0.6); }
.value-total { margin-top: 0.25rem; font-weight: 600; }
.value-total span, .value-total strong { color: var(--gold-lt); font-size: 1rem; }

.detail-admin-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.detail-header { display: flex; align-items: flex-start; gap: 1.5rem; margin-bottom: 2rem; }
.detail-rating {
  background: var(--burgundy);
  color: white;
  padding: 0.75rem 1rem;
  text-align: center;
  flex-shrink: 0;
  min-width: 80px;
  border-radius: var(--radius);
}
.big-score { font-family: var(--font-serif); font-size: 2.4rem; display: block; line-height: 1; }
.big-score-label { font-size: 0.65rem; color: rgba(255,255,255,0.65); letter-spacing: 0.08em; text-transform: uppercase; }
.detail-name { font-family: var(--font-serif); font-size: 2.2rem; font-weight: 400; line-height: 1.15; color: var(--ink); }
.detail-producer { color: var(--text-muted); margin-top: 0.3rem; font-size: 0.95rem; }

.detail-section { margin-bottom: 2rem; padding-bottom: 2rem; border-bottom: 1px solid var(--border); }
.detail-section:last-child { border-bottom: none; }
.detail-section h3 { font-family: var(--font-serif); font-size: 1.3rem; font-weight: 400; color: var(--ink); margin-bottom: 0.85rem; }
.detail-section h4 { font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.75rem; font-weight: 500; }
.professional-notes { color: var(--text-muted); font-style: italic; line-height: 1.7; }

.admin-section { background: var(--bg-off); border: 1px solid var(--border); padding: 1rem; margin-top: 1rem; border-radius: var(--radius); }

/* ─── INLINE FORM ────────────────────────────────────────── */
.inline-form { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.inline-form input, .inline-form select {
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-family: var(--font-sans);
}

/* ─── LOG FORM ───────────────────────────────────────────── */
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.form-group { display: flex; flex-direction: column; gap: 0.3rem; }
.form-group label { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; }
.form-group input, .form-group select, .form-group textarea {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--burgundy);
}
.form-hint { font-size: 0.76rem; color: var(--text-muted); margin-top: 0.25rem; }

/* ─── LOG LIST & TIMELINE ────────────────────────────────── */
.log-list { display: flex; flex-direction: column; gap: 0; border: 1px solid var(--border); }
.log-entry {
  background: var(--bg);
  padding: 1rem 1.25rem;
  display: grid;
  grid-template-columns: 90px 1fr auto;
  gap: 1rem;
  align-items: start;
  border-bottom: 1px solid var(--border-lt);
}
.log-entry:last-child { border-bottom: none; }
.log-date { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; padding-top: 2px; letter-spacing: 0.04em; }
.log-occasion { font-weight: 600; font-size: 0.9rem; margin-bottom: 0.2rem; }
.log-food { font-size: 0.82rem; color: var(--text-muted); }
.log-rating { background: var(--burgundy); color: white; font-size: 0.75rem; font-weight: 600; padding: 0.2rem 0.5rem; border-radius: 2px; white-space: nowrap; }
.muted { color: var(--text-muted); font-style: italic; }

.log-timeline { max-width: 700px; margin: 0 auto; padding: 1rem 0; }
.timeline-year { font-family: var(--font-serif); font-size: 1.8rem; font-weight: 400; color: var(--ink); padding: 1.5rem 0 0.5rem; }
.timeline-entry { display: grid; grid-template-columns: 60px 20px 1fr; gap: 0 1rem; align-items: start; margin-bottom: 1rem; }
.timeline-date { text-align: right; font-size: 0.75rem; color: var(--text-muted); font-weight: 600; padding-top: 14px; }
.timeline-dot { width: 10px; height: 10px; background: var(--burgundy); border-radius: 50%; margin-top: 17px; justify-self: center; }
.timeline-card { background: var(--bg); border: 1px solid var(--border); padding: 1rem; }
.timeline-card-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.4rem; }
.timeline-wine-name { font-weight: 600; font-size: 0.92rem; }
.timeline-occasion { font-size: 0.8rem; font-weight: 600; color: var(--burgundy); margin-bottom: 0.2rem; }
.timeline-notes { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.2rem; }
.timeline-food { font-size: 0.8rem; color: var(--text-muted); }
.timeline-bottles { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.4rem; }

/* ─── CELLAR ─────────────────────────────────────────────── */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0; border: 1px solid var(--border); margin-bottom: 2.5rem; }
.stat-card {
  background: var(--bg);
  padding: 1.5rem;
  text-align: center;
  border-right: 1px solid var(--border);
}
.stat-card:last-child { border-right: none; }
.stat-card-accent { background: var(--burgundy); }
.stat-card-green  { background: #f0faf4; }
.stat-card-red    { background: #fdf2f2; }

.stat-card-num { display: block; font-family: var(--font-serif); font-size: 2rem; font-weight: 400; color: var(--burgundy); line-height: 1; }
.stat-card-accent .stat-card-num { color: #fff; }
.stat-card-green .stat-card-num  { color: var(--green); }
.stat-card-red .stat-card-num    { color: var(--red-status); }
.stat-card-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); margin-top: 0.4rem; font-weight: 500; }
.stat-card-accent .stat-card-label { color: rgba(255,255,255,0.55); }

.location-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1px; background: var(--border); margin-bottom: 2.5rem; border: 1px solid var(--border); }
.location-card { background: var(--bg); padding: 1.5rem; }
.location-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.75rem; }
.location-card-header h3 { font-family: var(--font-serif); font-size: 1.2rem; font-weight: 400; color: var(--ink); }
.capacity-bar { height: 3px; background: var(--border); margin: 0.75rem 0 0.4rem; }
.capacity-fill { height: 100%; background: var(--burgundy); transition: width 0.3s; }
.capacity-text { font-size: 0.75rem; color: var(--text-muted); }
.location-desc { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.5rem; }

/* ─── DATA TABLE ─────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); }
.data-table { width: 100%; border-collapse: collapse; background: var(--bg); font-size: 0.86rem; }
.data-table th {
  background: var(--bg-off);
  color: var(--text-muted);
  padding: 0.7rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.data-table td { padding: 0.65rem 1rem; border-bottom: 1px solid var(--border-lt); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-off); }
.action-cell { white-space: nowrap; display: flex; gap: 0.4rem; }

/* ─── STATS ──────────────────────────────────────────────── */
.stats-section { margin-bottom: 2.5rem; }
.stats-section h2 { font-family: var(--font-serif); font-size: 1.5rem; font-weight: 400; color: var(--ink); margin-bottom: 1.25rem; }
.charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1px; background: var(--border); margin-bottom: 2.5rem; border: 1px solid var(--border); }
.chart-card { background: var(--bg); padding: 1.75rem; }
.chart-card h3 { font-family: var(--font-serif); font-size: 1.15rem; font-weight: 400; color: var(--ink); margin-bottom: 1.25rem; }

.window-summary { display: flex; gap: 1px; background: var(--border); border: 1px solid var(--border); flex-wrap: wrap; }
.window-item { padding: 1.25rem 2rem; text-align: center; min-width: 120px; background: var(--bg); }
.window-item .window-num { display: block; font-family: var(--font-serif); font-size: 2rem; font-weight: 400; }

.top-rated-list { display: flex; flex-direction: column; gap: 0; border: 1px solid var(--border); }
.top-rated-item { display: flex; align-items: center; gap: 1rem; background: var(--bg); padding: 0.85rem 1.1rem; border-bottom: 1px solid var(--border-lt); text-decoration: none; color: var(--text); transition: background 0.15s; }
.top-rated-item:last-child { border-bottom: none; }
.top-rated-item:hover { background: var(--bg-off); text-decoration: none; }
.top-rated-rank { font-family: var(--font-serif); font-size: 1.2rem; color: var(--text-muted); width: 28px; text-align: center; font-weight: 400; }
.top-rated-info { flex: 1; }
.top-rated-info strong { display: block; font-size: 0.92rem; }
.top-rated-info span { font-size: 0.78rem; color: var(--text-muted); }
.top-rated-score { background: var(--burgundy); color: white; padding: 0.25rem 0.55rem; border-radius: 2px; font-weight: 700; font-size: 0.85rem; }

/* ─── ADMIN WINE FORM ────────────────────────────────────── */
.wine-form-wrap { padding: 2.5rem 2rem; max-width: 900px; }
.wine-form-wrap h1 { font-family: var(--font-serif); font-size: 2rem; font-weight: 400; color: var(--ink); margin-bottom: 2rem; }
.form-back { margin-bottom: 1.5rem; }
.form-back a { color: var(--text-muted); font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; }
.form-section { background: var(--bg); border: 1px solid var(--border); padding: 1.5rem; margin-bottom: 1.25rem; }
.form-section h2 { font-family: var(--font-serif); font-size: 1.2rem; font-weight: 400; color: var(--ink); margin-bottom: 1.25rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border); }
.advanced-options-section { padding: 0; overflow: hidden; border: 1px solid var(--border); margin-bottom: 1.25rem; background: var(--bg); }
.advanced-toggle { width: 100%; background: none; border: none; padding: 1.1rem 1.5rem; text-align: left; font-family: var(--font-serif); font-size: 1.2rem; font-weight: 400; color: var(--ink); cursor: pointer; display: flex; align-items: center; gap: 0.6rem; }
.advanced-toggle:hover { background: var(--bg-off); }
#advancedArrow { font-size: 0.8rem; color: var(--text-muted); }
.advanced-toggle-hint { font-family: var(--font-sans); font-size: 0.75rem; color: var(--text-light); font-weight: normal; margin-left: auto; }
.form-section-inner { padding: 0 1.5rem 1.25rem; border-top: 1px solid var(--border); }
.form-section-inner h3 { font-family: var(--font-serif); font-size: 1.05rem; font-weight: 400; color: var(--text-muted); margin: 1.25rem 0 0.85rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-span-2 { grid-column: span 2; }
.form-actions { display: flex; gap: 1rem; flex-wrap: wrap; padding-bottom: 3rem; }
.log-form .form-group { margin-bottom: 0.75rem; }
.log-form textarea { resize: vertical; }

/* ─── AUTH ───────────────────────────────────────────────── */
.auth-wrap { display: flex; justify-content: center; align-items: center; min-height: calc(100vh - 130px); padding: 2rem; background: var(--bg-off); }
.auth-card { background: var(--bg); border: 1px solid var(--border); padding: 2.5rem; width: 100%; max-width: 400px; }
.auth-card h1 { font-family: var(--font-serif); font-size: 1.8rem; font-weight: 400; color: var(--ink); margin-bottom: 0.5rem; }
.auth-card p { color: var(--text-muted); margin-bottom: 1.5rem; font-size: 0.9rem; }

/* ─── FOOTER ─────────────────────────────────────────────── */
.site-footer {
  background: var(--bg-off);
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  padding: 1.5rem 2rem;
  text-align: center;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: auto;
}

/* ─── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .collection-layout { grid-template-columns: 1fr; }
  .filters-sidebar { position: static; min-height: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .collection-main { padding: 1.5rem; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-sidebar { position: static; }
  .form-grid { grid-template-columns: 1fr; }
  .form-span-2 { grid-column: span 1; }
  .hero { grid-template-columns: 1fr; }
  .hero-stats-panel { flex-direction: row; padding: 2rem; }
  .hero-stat { border-bottom: none; border-right: 1px solid rgba(255,255,255,0.12); padding: 0 2rem; }
  .hero-stat:last-child { border-right: none; }
  .stat-cards { border: none; background: transparent; display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; border: 1px solid var(--border); }
}

@media (max-width: 640px) {
  .nav-links { display: none; position: absolute; top: 64px; left: 0; right: 0; background: var(--bg); border-bottom: 1px solid var(--border); flex-direction: column; padding: 0.75rem 0; gap: 0; box-shadow: var(--shadow); }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 0.75rem 2rem; border-radius: 0; }
  .nav-toggle { display: block; }
  .hero-inner { padding: 3rem 1.5rem; }
  .hero-title { font-size: 2.4rem; }
  .hero-stats-panel { flex-wrap: wrap; }
  .wine-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .timeline-entry { grid-template-columns: 48px 16px 1fr; }
  .log-entry { grid-template-columns: 70px 1fr; }
  .log-rating { grid-column: span 2; }
  .charts-grid { grid-template-columns: 1fr; }
  .lab-banner { height: 56px; }
  .lab-svg { height: 42px; }
  .container { padding: 0 1.25rem; }
}

/* ── Barcode Scanner ──────────────────────────────────────────────────────── */
.scanner-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}
.scanner-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.scanner-icon {
  font-size: 1.6rem;
  line-height: 1;
  color: var(--burgundy);
  flex-shrink: 0;
}
.scanner-header > div {
  flex: 1;
}
.scanner-header strong {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--ink);
  display: block;
}
.scanner-header p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}
.scanner-viewport {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}
/* html5-qrcode injects its own video element — let it fill the container */
.scanner-viewport video {
  width: 100%;
  display: block;
}
/* Targeting reticle overlay */
.scanner-reticle {
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.45);
  border: 2px solid rgba(255,255,255,0.15);
}
.scanner-reticle::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 260px; height: 100px;
  border: 2.5px solid var(--burgundy);
  border-radius: 4px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.45);
}
/* Hide html5-qrcode's own UI chrome */
#scannerReader > img,
#scannerReader > div[style*="text-align: center"] { display: none !important; }

.scanner-hint {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0.5rem 0 0.75rem;
}
.scanner-manual {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.scanner-manual input {
  flex: 1;
  min-width: 140px;
  max-width: 200px;
  font-size: 0.85rem;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg);
  color: var(--ink);
}
.scanner-status {
  margin-top: 0.75rem;
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-family: var(--font-sans);
  line-height: 1.4;
}
.scanner-status--loading {
  background: #f0f4ff;
  color: #3a5cc5;
  border: 1px solid #c0cef5;
}
.scanner-status--success {
  background: #edf7ed;
  color: #2a6a2a;
  border: 1px solid #b0d9b0;
}
.scanner-status--warn {
  background: #fdf6e3;
  color: #7a5a10;
  border: 1px solid #e8d898;
}
.scanner-status--error {
  background: #fdf0f0;
  color: #8a2020;
  border: 1px solid #e8b0b0;
}
