/* ═══════════════════════════════════════════════════════════
   VinoVault — "Münchener Weinszene"
   Luxury dark theme · Glassmorphism · Editorial typography
   ═══════════════════════════════════════════════════════════ */

/* ── Design Tokens ───────────────────────────────────────── */
:root {
  /* Surfaces */
  --bg-dark: #0c0b10;
  --bg-elevated: #141318;
  --bg-card: rgba(24, 22, 30, 0.72);
  --bg-card-solid: #18161e;
  --bg-card-hover: #1f1d28;
  --bg-input: #100f16;
  --bg-glass: rgba(28, 26, 34, 0.55);

  /* Primary — deep wine */
  --accent: #8b2f3a;
  --accent-light: #b04a5a;
  --accent-hover: #9c3848;
  --accent-muted: rgba(139, 47, 58, 0.14);

  /* Secondary — champagne gold */
  --gold: #c9a96e;
  --gold-dim: #a08550;
  --gold-muted: rgba(201, 169, 110, 0.10);

  /* Text */
  --text: #ddd8cf;
  --text-secondary: #9e9890;
  --text-muted: #6b6560;
  --text-heading: #f0ebe2;

  /* Semantic */
  --success: #5a9e6f;
  --warning: #d4a24e;
  --danger: #c44f4f;

  /* Structure */
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.10);

  /* Radii */
  --radius: 6px;
  --radius-sm: 3px;
  --radius-lg: 10px;

  /* Shadows */
  --shadow: 0 1px 2px rgba(0,0,0,0.25), 0 4px 16px rgba(0,0,0,0.12);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.35), 0 0 1px rgba(255,255,255,0.04);
  --shadow-glow: 0 0 24px rgba(139,47,58,0.10);
  --blur: 20px;

  /* Typography */
  --font-display: 'Cormorant Garant', 'Georgia', serif;
  --font: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Motion */
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --ease-out: cubic-bezier(0, 0, 0.25, 1);
  --transition: 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
  --transition-slow: 0.4s cubic-bezier(0, 0, 0.25, 1);

  /* Layout */
  --max-width: 840px;
  --nav-height: 56px;

  /* Wine colors */
  --red: #8b1a2b;
  --white: #d4c95e;
  --rose: #d4899e;
  --orange: #c47a32;
  --sparkling: #d4c77a;
  --dessert: #b08d55;
  --fortified: #6b2f1a;
  --unknown: #666;
}


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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  font-weight: 300;
  background: var(--bg-dark);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Subtle grain texture */
  background-image:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(139,47,58,0.04) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(201,169,110,0.02) 0%, transparent 50%);
  background-attachment: fixed;
}

[x-cloak] { display: none !important; }

a {
  color: var(--accent-light);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover { color: var(--text-heading); }

img { max-width: 100%; display: block; }
ul, ol { list-style: none; }


/* ── Layout ──────────────────────────────────────────────── */
.main-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1.25rem;
  padding-top: calc(var(--nav-height) + 1.5rem);
  padding-bottom: env(safe-area-inset-bottom, 1.5rem);
  min-height: calc(100vh - var(--nav-height));
  min-height: calc(100dvh - var(--nav-height));
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 500;
  color: var(--text-heading);
  margin-bottom: 1.25rem;
  letter-spacing: 0.02em;
}


/* ── Navbar ──────────────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(12, 11, 16, 0.82);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 1.25rem;
}

.nav-brand {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.06em;
  transition: color var(--transition);
}

.nav-brand:hover { color: var(--text-heading); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-link {
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  transition: color var(--transition), background var(--transition);
}

.nav-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.nav-link--active {
  color: var(--gold);
  background: var(--gold-muted);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-left: 0.75rem;
  padding-left: 0.75rem;
  border-left: 1px solid var(--border);
}

.nav-user-name {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 300;
}

/* Hamburger */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  min-width: 44px;
  min-height: 44px;
}

.hamburger-line {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--text-secondary);
  border-radius: 1px;
  transition: transform var(--transition), opacity var(--transition);
}


/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  border: 1px solid var(--border);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.card:hover {
  border-color: var(--border-hover);
}

.card + .card { margin-top: 0.875rem; }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.875rem;
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--text-heading);
  letter-spacing: 0.015em;
}


/* ── Bottle Card ─────────────────────────────────────────── */
.bottle-card {
  display: flex;
  gap: 0;
  align-items: stretch;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.bottle-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-lg);
  color: var(--text);
}

.bottle-card__color-bar {
  width: 3px;
  flex-shrink: 0;
}

.bottle-card__body {
  flex: 1;
  min-width: 0;
  padding: 0.875rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.bottle-card__producer {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.01em;
}

.bottle-card__name {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 300;
}

.bottle-card__meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.bottle-card__vintage {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.04em;
}

/* Legacy bottle card classes */
.bottle-color-bar { width: 3px; border-radius: 0; flex-shrink: 0; }
.bottle-color-bar--red { background: var(--red); }
.bottle-color-bar--white { background: var(--white); }
.bottle-color-bar--rose { background: var(--rose); }
.bottle-color-bar--sparkling { background: var(--sparkling); }
.bottle-color-bar--dessert { background: var(--dessert); }
.bottle-color-bar--fortified { background: var(--fortified); }
.bottle-color-bar--orange { background: var(--orange); }

.bottle-info { flex: 1; min-width: 0; }
.bottle-name {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bottle-meta { font-size: 0.8125rem; color: var(--text-muted); margin-top: 0.125rem; }


/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.625rem;
  font-weight: 500;
  padding: 0.1875rem 0.5rem;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.badge--active {
  background: rgba(90, 158, 111, 0.12);
  color: var(--success);
}

.badge--opened {
  background: rgba(212, 162, 78, 0.12);
  color: var(--warning);
}

.badge--consumed {
  background: rgba(107, 101, 96, 0.12);
  color: var(--text-muted);
}

.badge--warning {
  background: rgba(212, 162, 78, 0.12);
  color: var(--warning);
}

.badge--danger {
  background: rgba(196, 79, 79, 0.12);
  color: var(--danger);
}

.badge--subtle {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  margin-right: 0.25rem;
  margin-bottom: 0.25rem;
}


/* ── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }

.form-group--compact { margin-bottom: 0; }

.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-bottom: 0.375rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-label--checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.form-input,
.form-select {
  width: 100%;
  padding: 0.625rem 0.875rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 300;
  letter-spacing: 0.01em;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: rgba(139, 47, 58, 0.5);
  box-shadow: 0 0 0 3px rgba(139, 47, 58, 0.08);
}

.form-input::placeholder { color: var(--text-muted); font-weight: 300; }

.form-input--error { border-color: var(--danger); }

.form-error {
  font-size: 0.75rem;
  color: var(--danger);
  margin-top: 0.25rem;
  font-weight: 400;
}

select.form-input,
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b6560' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.875rem center;
  padding-right: 2.25rem;
}

/* Form layout utilities */
.form-row {
  display: flex;
  gap: 0.875rem;
  flex-wrap: wrap;
}

.form-group--half { flex: 1 1 calc(50% - 0.4375rem); min-width: 140px; }
.form-group--third { flex: 1 1 calc(33.333% - 0.583rem); min-width: 120px; }
.form-group--quarter { flex: 1 1 calc(25% - 0.656rem); min-width: 100px; }

.form-textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

.form-fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  background: rgba(255, 255, 255, 0.01);
}

.form-legend {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 500;
  color: var(--text-heading);
  padding: 0 0.5rem;
  letter-spacing: 0.02em;
}

.form-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.required { color: var(--accent-light); font-weight: 400; }
.field-error { color: var(--danger); font-size: 0.8125rem; }

/* Grape variety rows */
.grape-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.grape-name { flex: 3; }
.grape-pct { flex: 1; min-width: 60px; }


/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  min-height: 40px;
}

.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: var(--text-heading);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); box-shadow: var(--shadow-glow); }

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--border-hover);
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.btn-danger {
  background: var(--danger);
  color: var(--text-heading);
}
.btn-danger:hover:not(:disabled) { background: #b34444; }

.btn-accent {
  background: var(--gold-muted);
  color: var(--gold);
  border: 1px solid rgba(201, 169, 110, 0.15);
}
.btn-accent:hover:not(:disabled) {
  background: rgba(201, 169, 110, 0.16);
  border-color: rgba(201, 169, 110, 0.25);
}

.btn-danger-subtle {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(196, 79, 79, 0.2);
}
.btn-danger-subtle:hover:not(:disabled) {
  background: rgba(196, 79, 79, 0.08);
  border-color: rgba(196, 79, 79, 0.3);
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.6875rem;
  min-height: 32px;
}

.btn-lg {
  padding: 0.875rem 2rem;
  font-size: 0.875rem;
  min-height: 48px;
}

.btn-block { width: 100%; }

.btn-icon {
  padding: 0.375rem;
  min-width: 32px;
  min-height: 32px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.btn-icon:hover:not(:disabled) { color: var(--text); border-color: var(--border-hover); }

.btn-capture {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: transparent;
  border: 3px solid var(--text-heading);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all var(--transition);
}
.btn-capture:hover { border-color: var(--gold); }
.btn-capture:active { transform: scale(0.94); }


/* ── Tables ──────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table { width: 100%; border-collapse: collapse; }

th {
  text-align: left;
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.8125rem;
  font-weight: 300;
  color: var(--text-secondary);
}

tr:hover td { background: rgba(255, 255, 255, 0.015); }


/* ── Modal ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}

.modal-card {
  background: var(--bg-card-solid);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1.75rem;
  width: 100%;
  max-width: 480px;
  border: 1px solid var(--border);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text-heading);
  margin-bottom: 1.25rem;
  letter-spacing: 0.02em;
}


/* ── Dialog (inline confirm modals) ──────────────────────── */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}

.dialog {
  background: var(--bg-card-solid);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1.75rem;
  width: 100%;
  max-width: 420px;
  border: 1px solid var(--border);
  max-height: 90vh;
  overflow-y: auto;
}

.dialog--wide { max-width: 560px; }

.dialog__title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text-heading);
  margin-bottom: 1.25rem;
  letter-spacing: 0.02em;
}

.dialog__message {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  line-height: 1.5;
  font-weight: 300;
}

.dialog__actions {
  display: flex;
  gap: 0.625rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
}


/* ── Toast ────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  font-weight: 400;
  z-index: 300;
  max-width: 360px;
  box-shadow: var(--shadow-lg);
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
}

.toast--success {
  background: rgba(90, 158, 111, 0.92);
  border-color: rgba(90, 158, 111, 0.3);
  color: #fff;
}

.toast--error {
  background: rgba(196, 79, 79, 0.92);
  border-color: rgba(196, 79, 79, 0.3);
  color: #fff;
}

.toast--warning {
  background: rgba(212, 162, 78, 0.92);
  border-color: rgba(212, 162, 78, 0.3);
  color: #1a1a2e;
}

/* Toast transitions */
.toast-enter { transition: all 0.3s var(--ease-out); }
.toast-enter-start { opacity: 0; transform: translateY(0.75rem); }
.toast-enter-end { opacity: 1; transform: translateY(0); }
.toast-leave { transition: all 0.2s var(--ease); }
.toast-leave-start { opacity: 1; }
.toast-leave-end { opacity: 0; transform: translateY(0.5rem); }


/* ── Spinner ─────────────────────────────────────────────── */
.loader-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 0;
  gap: 1rem;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--gold-dim);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner--sm { width: 14px; height: 14px; border-width: 1.5px; }
.spinner--lg { width: 40px; height: 40px; border-width: 2.5px; }

@keyframes spin { to { transform: rotate(360deg); } }


/* ── View transitions ────────────────────────────────────── */
.fade-enter { transition: opacity 0.2s var(--ease-out); }
.fade-enter-start { opacity: 0; }
.fade-enter-end { opacity: 1; }


/* ── Tabs ─────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.tab-btn {
  padding: 0.75rem 1.25rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}

.tab-btn:hover { color: var(--text); }

.tab-btn--active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}


/* ── Auth ─────────────────────────────────────────────────── */
.auth-wrap {
  max-width: 380px;
  margin: 4rem auto 0;
}

.auth-title {
  text-align: center;
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 500;
  color: var(--gold);
  margin-bottom: 0.25rem;
  letter-spacing: 0.06em;
}

.auth-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 300;
  margin-bottom: 2rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}


/* ── Stat Grid ───────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.875rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  text-align: center;
  transition: border-color var(--transition);
}

.stat-card:hover { border-color: var(--border-hover); }

.stat-value {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 600;
  color: var(--text-heading);
  line-height: 1.1;
}

.stat-label {
  font-size: 0.625rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.375rem;
  font-weight: 400;
}


/* ── View Header ─────────────────────────────────────────── */
.view-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.view-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 500;
  color: var(--text-heading);
  letter-spacing: 0.02em;
}

.view-subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 300;
  margin-top: 0.125rem;
}


/* ── Alerts ──────────────────────────────────────────────── */
.alert {
  padding: 0.875rem 1.125rem;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  font-weight: 400;
  margin-bottom: 1.25rem;
  border: 1px solid transparent;
  line-height: 1.5;
}

.alert--error {
  background: rgba(196, 79, 79, 0.08);
  border-color: rgba(196, 79, 79, 0.2);
  color: var(--danger);
}

.alert--warning {
  background: rgba(212, 162, 78, 0.08);
  border-color: rgba(212, 162, 78, 0.2);
  color: var(--warning);
}

.alert--info {
  background: rgba(201, 169, 110, 0.06);
  border-color: rgba(201, 169, 110, 0.15);
  color: var(--gold);
}


/* ── Bottle Grid ─────────────────────────────────────────── */
.bottle-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}


/* ── Filter Bar ──────────────────────────────────────────── */
.filter-bar {
  background: var(--bg-card);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.filter-bar__row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.filter-bar__row .form-group--compact {
  flex: 1;
  min-width: 100px;
}

.filter-bar__row .form-input,
.filter-bar__row .form-select {
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
}

.filter-bar__toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  padding: 0.5rem;
  transition: color var(--transition);
}
.filter-bar__toggle:hover { color: var(--text); }

.filter-bar__actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.filter-btn--active {
  border-color: var(--gold) !important;
  color: var(--gold) !important;
}

.filter-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  margin-left: 2px;
}


/* ── Pagination ──────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1.25rem 0;
}

.pagination__info {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  font-weight: 300;
}

.pagination__btn {
  min-width: 44px;
  min-height: 44px;
}


/* ── Breadcrumb ──────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  letter-spacing: 0.02em;
}

.breadcrumb a,
.breadcrumb__link {
  color: var(--text-muted);
  transition: color var(--transition);
}

.breadcrumb a:hover,
.breadcrumb__link:hover { color: var(--text); }

.breadcrumb__sep { color: var(--text-muted); opacity: 0.4; }
.breadcrumb__current { color: var(--text-secondary); }


/* ── Detail View ─────────────────────────────────────────── */
.detail-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.detail-header__color {
  width: 4px;
  min-height: 56px;
  border-radius: 2px;
  flex-shrink: 0;
  opacity: 0.85;
}

.detail-header__name {
  font-family: var(--font-display);
  font-size: 1.625rem;
  font-weight: 600;
  color: var(--text-heading);
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.detail-header__producer {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  font-weight: 300;
}

.detail-header .badge {
  margin-left: auto;
  flex-shrink: 0;
  margin-top: 0.375rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
}

.detail-grid__item {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

.detail-grid__item:nth-child(2n) { border-right: none; }

.detail-grid__item--wide {
  grid-column: 1 / -1;
  border-right: none;
}

.detail-grid__item dt {
  font-size: 0.625rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.125rem;
}

.detail-grid__item dd {
  font-size: 0.9375rem;
  color: var(--text);
  font-weight: 300;
}

.detail-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.75rem;
}


/* ── Impressions ─────────────────────────────────────────── */
.impressions-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.impression-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.125rem;
  margin-bottom: 0.75rem;
  transition: border-color var(--transition);
}

.impression-card:hover { border-color: var(--border-hover); }

.impression-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.impression-card__emoji { font-size: 1.25rem; }

.impression-card__date {
  font-size: 0.6875rem;
  color: var(--text-muted);
  font-weight: 300;
  letter-spacing: 0.02em;
}

.impression-card__notes {
  font-size: 0.875rem;
  color: var(--text);
  line-height: 1.6;
  font-weight: 300;
  font-style: italic;
}

.impression-card__meta {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.625rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 300;
}


/* ── Scan View ───────────────────────────────────────────── */
.view-scan { }

.scan-capture {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.scan-capture__section {
  background: var(--bg-card);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.scan-actions {
  display: flex;
  gap: 0.75rem;
  flex-direction: column;
  align-items: stretch;
}

.scan-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5rem 1rem;
  gap: 1.25rem;
}

.scan-loading__text {
  font-family: var(--font-display);
  font-size: 1.125rem;
  color: var(--text-secondary);
  font-weight: 400;
  letter-spacing: 0.03em;
}

.scan-confirm { }

.scan-confidence {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding: 0.875rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-wrap: wrap;
}

.scan-warnings {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-bottom: 1.25rem;
}

.scan-done {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5rem 1rem;
  gap: 1rem;
  text-align: center;
}

.scan-done__text {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--text-heading);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.success-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(90, 158, 111, 0.10);
  color: var(--success);
  font-size: 2rem;
  border: 2px solid rgba(90, 158, 111, 0.2);
  animation: successPulse 0.5s var(--ease-out);
}

@keyframes successPulse {
  0% { transform: scale(0.85); opacity: 0; }
  60% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}


/* ── Camera Component ────────────────────────────────────── */
.camera-component {
  min-height: 120px;
}

.camera-preview-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.camera-live {
  position: relative;
  width: 100%;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
}

.camera-video {
  width: 100%;
  display: block;
  border-radius: var(--radius);
}

.camera-controls {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
}

.capture-ring {
  display: block;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--text-heading);
  transition: transform var(--transition);
}

.btn-capture:hover .capture-ring { transform: scale(0.9); }

.camera-mode-switch {
  padding-top: 0.5rem;
}

.camera-file-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 2rem;
}

.file-upload-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  background: var(--bg-input);
  border: 1px dashed var(--border-hover);
  border-radius: var(--radius);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  transition: all var(--transition);
}

.file-upload-label:hover {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(139, 47, 58, 0.06);
}

.camera-error { margin-bottom: 0.5rem; }

.camera-captured {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.captured-thumb {
  max-width: 100%;
  max-height: 240px;
  object-fit: contain;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.icon-camera::before { content: ''; }
.icon-upload::before { content: ''; }


/* ── Empty State ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  opacity: 0.3;
}

.empty-state__text {
  font-size: 0.875rem;
  margin-bottom: 1rem;
  font-weight: 300;
}


/* ── Utility ─────────────────────────────────────────────── */
.sr-only,
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.8125rem; }

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}


/* ── Dashboard: Bar Charts ───────────────────────────────── */
.bar-list {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.bar-label {
  width: 5.5rem;
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: right;
  font-weight: 300;
  letter-spacing: 0.02em;
}

.bar-track {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 3px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s var(--ease-out);
  min-width: 2px;
}

.bar-fill--red { background: var(--red); }
.bar-fill--white { background: var(--white); }
.bar-fill--rose { background: var(--rose); }
.bar-fill--orange { background: var(--orange); }
.bar-fill--sparkling { background: var(--sparkling); }
.bar-fill--dessert { background: var(--dessert); }
.bar-fill--fortified { background: var(--fortified); }
.bar-fill--unknown { background: var(--text-muted); }
.bar-fill--vintage { background: var(--gold-dim); }

.bar-count {
  width: 2.5rem;
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: right;
}


/* ── Dashboard: Ranked List ──────────────────────────────── */
.ranked-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  counter-reset: rank;
}

.ranked-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  counter-increment: rank;
}

.ranked-item:last-child { border-bottom: none; }

.ranked-item::before {
  content: counter(rank) ".";
  width: 1.75rem;
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
}

.ranked-name { flex: 1; font-size: 0.8125rem; font-weight: 300; }
.ranked-count { flex-shrink: 0; }


/* ── Dashboard: Alerts ───────────────────────────────────── */
.alert-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.alert-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.alert-item:last-child { border-bottom: none; }

.alert-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.alert-name {
  font-weight: 400;
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* ── Dashboard: Activity ─────────────────────────────────── */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--border);
}

.activity-item:last-child { border-bottom: none; }

.activity-icon {
  width: 1.625rem;
  height: 1.625rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.6875rem;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
}

.activity-icon--created { background: rgba(90, 158, 111, 0.10); color: var(--success); }
.activity-icon--opened { background: rgba(212, 162, 78, 0.10); color: var(--warning); }
.activity-icon--consumed { background: rgba(139, 47, 58, 0.10); color: var(--accent-light); }

.activity-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.activity-text { font-size: 0.8125rem; font-weight: 300; }
.activity-time { font-size: 0.6875rem; }


/* ── Storage ─────────────────────────────────────────────── */
.cellar-card .card-header { margin-bottom: 0.375rem; }

.cellar-name-btn {
  background: none;
  border: none;
  color: var(--text-heading);
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  padding: 0;
  letter-spacing: 0.01em;
  transition: color var(--transition);
}

.cellar-name-btn:hover { color: var(--gold); }

.position-form-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}


/* ── Admin ───────────────────────────────────────────────── */
.invite-form-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}

.invite-form-row .form-group {
  flex: 1;
  margin-bottom: 0;
}

.invite-form-action { flex: 0; }

.generated-code-box {
  background: rgba(90, 158, 111, 0.05);
  border: 1px solid rgba(90, 158, 111, 0.15);
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
}

.code-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.code-value {
  flex: 1;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--success);
  word-break: break-all;
  font-family: 'SF Mono', 'Fira Code', monospace;
  letter-spacing: 0.04em;
}

.row-revoked td { opacity: 0.4; }


/* ── Focus States ────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid rgba(201, 169, 110, 0.4);
  outline-offset: 2px;
}

.btn:focus-visible {
  outline: 2px solid rgba(201, 169, 110, 0.4);
  outline-offset: 2px;
}


/* ── Print ───────────────────────────────────────────────── */
@media print {
  .navbar, .toast, .nav-toggle, .detail-actions, .btn,
  .filter-bar, .pagination, .dialog-overlay, .modal-overlay { display: none !important; }
  body { background: #fff; color: #111; }
  .card { background: #fff; border: 1px solid #ccc; box-shadow: none; }
  .main-content { padding-top: 0; }
}


/* ── Responsive (mobile-first breakpoint) ────────────────── */
@media (max-width: 640px) {
  /* Nav */
  .nav-toggle { display: flex; }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    flex-direction: column;
    background: rgba(12, 11, 16, 0.95);
    backdrop-filter: blur(var(--blur));
    -webkit-backdrop-filter: blur(var(--blur));
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 1.25rem;
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
    gap: 0;
  }

  .nav-links--open { display: flex; }

  .nav-link {
    padding: 0.875rem 0.5rem;
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .nav-user {
    margin-left: 0;
    padding-left: 0;
    border-left: none;
    border-top: 1px solid var(--border);
    padding-top: 0.875rem;
    margin-top: 0.375rem;
    width: 100%;
    justify-content: space-between;
    min-height: 44px;
  }

  /* Layout */
  .main-content { padding: 1.25rem 1rem; padding-top: calc(var(--nav-height) + 1.25rem); }

  /* Stats */
  .stat-grid { grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
  .stat-value { font-size: 1.75rem; }
  .stat-card { padding: 1rem 0.5rem; }

  /* Bottle grid */
  .bottle-grid { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }

  .bottle-card__body { padding: 0.75rem 0.75rem; }
  .bottle-card__producer { font-size: 0.9375rem; }

  /* Detail */
  .detail-header { flex-wrap: wrap; gap: 0.75rem; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-grid__item { border-right: none; }
  .detail-actions { flex-direction: column; gap: 0.375rem; }
  .detail-actions .btn { width: 100%; min-height: 44px; }

  /* Filter */
  .filter-bar { padding: 0.75rem; }
  .filter-bar__row { flex-direction: column; gap: 0.5rem; }
  .filter-bar__row .form-group--compact { min-width: 100%; }

  /* Forms */
  .form-row { flex-direction: column; gap: 0; }
  .form-group--half,
  .form-group--third,
  .form-group--quarter { flex: 1 1 100%; min-width: 100%; }

  /* Scan */
  .scan-actions .btn { min-height: 48px; }

  /* Camera */
  .btn-capture { width: 64px; height: 64px; }
  .capture-ring { width: 42px; height: 42px; }

  /* Toast */
  .toast { left: 1rem; right: 1rem; max-width: none; }

  /* Modal / Dialog */
  .modal-card { margin: 0.5rem; padding: 1.25rem; }
  .dialog { margin: 0.5rem; padding: 1.25rem; }

  /* Auth */
  .auth-wrap { margin-top: 2rem; }
  .auth-title { font-size: 2rem; }

  /* Admin */
  .invite-form-row { flex-direction: column; }

  /* Storage */
  .position-form-grid { grid-template-columns: repeat(2, 1fr); }

  /* View header */
  .view-header { flex-direction: column; gap: 0.5rem; align-items: flex-start; }
  .view-title { font-size: 1.5rem; }
}

/* Large screens: 3-col bottle grid */
@media (min-width: 641px) {
  .bottle-grid { grid-template-columns: repeat(3, 1fr); }

  .scan-actions {
    flex-direction: row;
    justify-content: center;
  }
}


