@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --primary: #8D6E63;
  --primary-dark: #A1887F;
  --primary-light: #BCAAA4;
  --secondary: #D7CCC8;
  --accent: #3E2723;
  --accent-light: #E0CB9A;
  --bg: #FAF7F2;
  --bg-card: #FFFFFF;
  --bg-warm: #F5F0E8;
  --text: #2C1810;
  --text-muted: #7A6E66;
  --text-light: #A89B93;
  --border: #E8E0D6;
  --border-light: #F0EBE3;
  --danger: #C0392B;
  --success: #27AE60;
  --shadow-sm: 0 1px 3px rgba(44, 24, 16, 0.06);
  --shadow-md: 0 4px 12px rgba(44, 24, 16, 0.08);
  --shadow-lg: 0 8px 30px rgba(44, 24, 16, 0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

::selection {
  background: var(--accent);
  color: var(--secondary);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ===== HEADER ===== */
.app-header {
  background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 60%, var(--primary-light) 100%);
  padding: 2rem 1.5rem 1.5rem;
  position: relative;
  overflow: hidden;
}

.app-header::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(201, 169, 110, 0.15) 0%, transparent 70%);
  border-radius: 50%;
}

.header-content {
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

.header-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.25rem;
}

.header-title {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 1.75rem;
  color: #fff;
  letter-spacing: 0.02em;
}

.header-subtitle {
  font-size: 0.85rem;
  color: var(--accent-light);
  font-weight: 300;
  margin-top: 0.25rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ===== TAB NAV ===== */
.tab-nav {
  display: flex;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  max-width: 800px;
  margin: 0 auto;
  position: sticky;
  top: 0;
  z-index: 10;
}

.tab-btn {
  flex: 1;
  padding: 0.85rem 1rem;
  border: none;
  background: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.tab-btn.active {
  color: var(--primary);
  font-weight: 600;
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20%;
  right: 20%;
  height: 3px;
  background: var(--primary);
  border-radius: 3px 3px 0 0;
}

.tab-btn:hover:not(.active) {
  color: var(--text);
  background: var(--bg-warm);
}

.tab-icon {
  font-size: 1rem;
}

/* ===== MAIN ===== */
.main-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 1rem;
  padding-bottom: 3rem;
}

/* ===== STATS BAR ===== */
.stats-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}

.stat-number {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-divider {
  width: 1px;
  height: 28px;
  background: var(--border);
}

/* ===== SEARCH & FILTERS ===== */
.search-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.search-input-wrap {
  flex: 1;
  position: relative;
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 0.7rem 2rem 0.7rem 2.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  background: var(--bg-card);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(114, 47, 55, 0.1);
}

.clear-search {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.2rem;
}

.filter-toggle {
  padding: 0.7rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}

.filter-toggle.active {
  border-color: var(--primary-light);
  color: var(--primary);
  background: rgba(114, 47, 55, 0.05);
}

.filters-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.filter-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-row select {
  flex: 1;
  min-width: 120px;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}

.filter-row select:focus {
  outline: none;
  border-color: var(--primary-light);
}

.clear-filters {
  margin-top: 0.5rem;
  border: none;
  background: none;
  color: var(--primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
}

/* ===== TASTING GRID ===== */
.tasting-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.tasting-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: var(--shadow-sm);
  animation: fadeInUp 0.4s ease both;
}

.tasting-card:nth-child(1) { animation-delay: 0s; }
.tasting-card:nth-child(2) { animation-delay: 0.05s; }
.tasting-card:nth-child(3) { animation-delay: 0.1s; }
.tasting-card:nth-child(4) { animation-delay: 0.15s; }
.tasting-card:nth-child(5) { animation-delay: 0.2s; }
.tasting-card:nth-child(6) { animation-delay: 0.25s; }
.tasting-card:nth-child(7) { animation-delay: 0.3s; }
.tasting-card:nth-child(8) { animation-delay: 0.35s; }
.tasting-card:nth-child(n+9) { animation-delay: 0.4s; }

.tasting-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card-image-area {
  position: relative;
  height: 160px;
  background: linear-gradient(135deg, var(--bg-warm) 0%, var(--border-light) 100%);
  overflow: hidden;
}

.card-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-photo-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  opacity: 0.3;
}

.card-rating-badge {
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  background: rgba(44, 24, 16, 0.8);
  backdrop-filter: blur(8px);
  color: var(--accent);
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.card-body {
  padding: 0.85rem;
}

.card-wine-name {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.4rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.35rem;
}

.card-tag {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  font-weight: 500;
}

.card-tag.vintage {
  background: rgba(114, 47, 55, 0.1);
  color: var(--primary);
}

.card-tag.grape {
  background: rgba(201, 169, 110, 0.2);
  color: var(--secondary);
}

.card-region {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.1rem;
}

.card-date {
  font-size: 0.72rem;
  color: var(--text-light);
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 0.85rem;
  border-top: 1px solid var(--border-light);
}

.card-action-btn {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.3rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease;
}

.card-action-btn:hover {
  background: var(--bg-warm);
}

.card-action-btn.danger {
  color: var(--danger);
  font-size: 0.75rem;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
}

.confirm-delete {
  display: flex;
  gap: 0.25rem;
}

.results-count {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.78rem;
  color: var(--text-light);
  letter-spacing: 0.03em;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
}

.empty-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  opacity: 0.4;
}

.empty-state h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.2rem;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.empty-state p {
  font-size: 0.88rem;
  color: var(--text-muted);
  max-width: 280px;
  margin: 0 auto;
}

/* ===== SKELETON ===== */
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.skeleton-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-light);
}

.skeleton-photo {
  height: 160px;
  background: linear-gradient(90deg, var(--bg-warm) 25%, var(--border-light) 50%, var(--bg-warm) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease infinite;
}

.skeleton-line {
  height: 12px;
  margin: 0.6rem 0.85rem;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--bg-warm) 25%, var(--border-light) 50%, var(--bg-warm) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease infinite;
}

.skeleton-line.wide { width: 80%; }
.skeleton-line.medium { width: 55%; }
.skeleton-line.short { width: 35%; margin-bottom: 0.85rem; }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== FORM ===== */
.form-container {
  animation: fadeInUp 0.3s ease;
}

.form-header {
  margin-bottom: 1.25rem;
}

.form-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
}

.form-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.tasting-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-section {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.section-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-group input,
.form-group textarea {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(114, 47, 55, 0.1);
  background: var(--bg-card);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-light);
}

/* ===== STAR RATING ===== */
.star-rating {
  display: flex;
  gap: 0.35rem;
}

.star-btn {
  border: none;
  background: none;
  font-size: 2rem;
  color: var(--border);
  cursor: pointer;
  transition: color 0.15s ease, transform 0.15s ease;
  padding: 0;
  line-height: 1;
}

.star-btn.filled {
  color: var(--accent);
}

.star-btn:hover {
  transform: scale(1.15);
  color: var(--accent);
}

/* ===== PHOTO UPLOAD ===== */
.photo-upload-area {
  min-height: 120px;
}

.upload-label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.upload-label:hover {
  border-color: var(--primary-light);
  background: rgba(114, 47, 55, 0.03);
}

.upload-placeholder {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.photo-preview-wrap {
  position: relative;
  display: inline-block;
}

.photo-preview {
  max-width: 100%;
  max-height: 200px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

.remove-photo-btn {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== FORM ACTIONS ===== */
.form-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.btn-primary {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-primary:active {
  transform: scale(0.98);
}

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

.btn-secondary {
  padding: 0.75rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

/* ===== DETAIL VIEW ===== */
.detail-container {
  animation: fadeInUp 0.3s ease;
}

.detail-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.back-btn {
  border: none;
  background: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--primary);
  cursor: pointer;
  padding: 0.4rem 0;
  transition: opacity 0.2s ease;
}

.back-btn:hover {
  opacity: 0.7;
}

.edit-btn {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
}

.edit-btn:hover {
  border-color: var(--primary-light);
  color: var(--primary);
}

.detail-photo-wrap {
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-md);
  max-height: 350px;
}

.detail-photo {
  width: 100%;
  max-height: 350px;
  object-fit: cover;
  display: block;
}

.detail-header {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

.detail-wine-name {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.6rem;
  line-height: 1.25;
}

.detail-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.detail-tag {
  font-size: 0.78rem;
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
  background: rgba(114, 47, 55, 0.08);
  color: var(--primary);
  font-weight: 500;
}

.detail-date {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.detail-stars {
  display: flex;
  gap: 0.2rem;
}

.detail-star {
  font-size: 1.5rem;
  color: var(--border);
}

.detail-star.filled {
  color: var(--accent);
}

.detail-notes {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.note-section {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
}

.note-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.note-text {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text);
}

.no-notes {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 640px) {
  .main-content {
    padding: 0.75rem;
    padding-bottom: 2rem;
  }

  .header-title {
    font-size: 1.4rem;
  }

  .tasting-grid {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-group.full-width {
    grid-column: 1;
  }

  .stats-bar {
    gap: 0.6rem;
    padding: 0.75rem 0.5rem;
  }

  .stat-number {
    font-size: 1.1rem;
  }

  .filter-row {
    flex-direction: column;
  }

  .filter-row select {
    min-width: 100%;
  }

  .form-actions {
    flex-direction: column-reverse;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
    text-align: center;
  }

  .detail-wine-name {
    font-size: 1.3rem;
  }
}

@media (min-width: 641px) and (max-width: 900px) {
  .tasting-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}


<!-- WALKTHROUGH_SCRIPT:
[
  {"step": 1, "narration": "Welcome to Cellar Notes — your personal wine journal. Here you can log tastings and browse your wine experiences.", "view": "user", "highlight_selector": ".app-header", "wait_for": "tap_to_continue"},
  {"step": 2, "narration": "The Journal tab shows all your past tastings as beautiful cards with photos, ratings, and key details.", "view": "user", "highlight_selector": ".tab-btn:first-child", "wait_for": "tap_to_continue"},
  {"step": 3, "narration": "Use the search bar to find wines by name, region, grape, or tasting notes. Tap Filters for advanced filtering by region, grape, and rating.", "view": "user", "highlight_selector": ".search-bar", "wait_for": "tap_to_continue"},
  {"step": 4, "narration": "Tap 'Log Tasting' to record a new wine experience. Fill in the wine name, vintage, region, grape, and your tasting notes.", "view": "user", "highlight_selector": ".tab-btn:nth-child(2)", "wait_for": "tap_to_continue"},
  {"step": 5, "narration": "Rate the wine from 1 to 5 stars, and upload a photo of the label to remember it later.", "view": "user", "highlight_selector": ".star-rating", "wait_for": "tap_to_continue"},
  {"step": 6, "narration": "Tap any card to see the full tasting detail with all your notes beautifully laid out. You can edit or delete tastings anytime.", "view": "user", "highlight_selector": ".tasting-card", "wait_for": "tap_to_continue"}
]
-->

.auth-gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, var(--bg) 0%, var(--bg-warm) 100%);
}

.auth-gate-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.auth-gate-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

.auth-gate-card h1 {
  font-family: 'Playfair Display', serif;
  font-size: 1.7rem;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.auth-gate-card p {
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

.auth-gate-btn {
  width: 100%;
}

.header-userbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.9rem;
  flex-wrap: wrap;
}

.header-user {
  font-size: 0.85rem;
  color: #fff;
  opacity: 0.95;
}

.header-logout {
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.45rem 0.8rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.header-logout:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.35);
}

@media (max-width: 640px) {
  .auth-gate-card {
    padding: 1.5rem;
  }
}

.photo-upload-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.upload-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--primary-light);
  border-radius: var(--radius-sm);
  background: rgba(114, 47, 55, 0.04);
  color: var(--primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.upload-action-btn:hover {
  background: rgba(114, 47, 55, 0.08);
}

.upload-action-btn.secondary {
  border-color: var(--border);
  color: var(--text-muted);
  background: var(--bg-card);
}

.upload-action-btn.secondary:hover {
  border-color: var(--primary-light);
  color: var(--primary);
}

.upload-placeholder-wrap {
  min-height: 120px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: var(--bg);
}

.chart-controls-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  margin-bottom: 0.9rem;
  box-shadow: var(--shadow-sm);
}

.chart-controls-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.chart-toggle-btn {
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chart-toggle-btn.active {
  border-color: var(--primary-light);
  color: var(--primary);
  background: rgba(114, 47, 55, 0.05);
}

.chart-select {
  flex: 1;
  min-width: 140px;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}

.chart-select:focus {
  outline: none;
  border-color: var(--primary-light);
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}

.chart-card-wide {
  grid-column: 1 / -1;
}

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

.chart-card-header h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.05rem;
  color: var(--text);
}

.chart-card-header span {
  font-size: 0.75rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chart-canvas-wrap {
  position: relative;
  min-height: 240px;
}

.chart-canvas-wrap canvas {
  width: 100% !important;
  height: 240px !important;
}

.chart-card-wide .chart-canvas-wrap canvas {
  height: 280px !important;
}

.chart-empty {
  min-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 1rem;
  background: linear-gradient(135deg, var(--bg) 0%, var(--bg-warm) 100%);
  border-radius: var(--radius-sm);
}

@media (max-width: 640px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }

  .chart-card-wide {
    grid-column: auto;
  }

  .chart-select {
    min-width: 100%;
  }
}

.ai-sommelier-card {
  margin-top: 1.25rem;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
}

.ai-sommelier-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.ai-suggestions {
  margin-top: 1rem;
}

.ai-suggestions-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.ai-suggestion-card {
  padding: 0.9rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.ai-suggestion-title {
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.ai-suggestion-meta {
  font-size: 0.9rem;
  opacity: 0.8;
  margin-bottom: 0.5rem;
}

.share-status {
  font-size: 0.72rem;
  color: var(--success);
  font-weight: 600;
  margin-left: auto;
  align-self: center;
  white-space: nowrap;
}

.card-actions {
  flex-wrap: wrap;
}

.card-action-btn[title='Share'] {
  color: var(--primary);
}

@media (max-width: 640px) {
  .share-status {
    width: 100%;
    margin-left: 0;
    padding-top: 0.15rem;
  }
}

.export-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.9rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

.export-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.export-btn {
  padding: 0.7rem 1rem;
  border: 1px solid var(--primary-light);
  border-radius: var(--radius-sm);
  background: rgba(114, 47, 55, 0.06);
  color: var(--primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.export-btn:hover:not(:disabled) {
  background: rgba(114, 47, 55, 0.1);
}

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

.export-view-label,
.export-status {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.export-status {
  color: var(--success);
  font-weight: 600;
}

.pdf-report {
  position: absolute;
  left: 0;
  top: 0;
  width: 794px;
  min-height: 1123px;
  opacity: 0;
  pointer-events: none;
  background: #fff;
  color: #1f1a17;
  padding: 32px;
  font-family: 'DM Sans', sans-serif;
}

.pdf-report-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid #e8e0d6;
}

.pdf-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #722F37;
  margin-bottom: 6px;
}

.pdf-report-header h1 {
  font-family: 'Playfair Display', serif;
  font-size: 26px;
  margin-bottom: 8px;
  color: #2C1810;
}

.pdf-report-header p {
  font-size: 13px;
  line-height: 1.55;
  color: #5f534c;
  max-width: 520px;
}

.pdf-report-meta {
  min-width: 120px;
  text-align: right;
  font-size: 12px;
  color: #7a6e66;
  line-height: 1.6;
}

.pdf-report-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.pdf-tasting-block {
  border: 1px solid #eee4d8;
  border-radius: 14px;
  padding: 18px;
  break-inside: avoid;
  page-break-inside: avoid;
}

.pdf-tasting-top {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.pdf-tasting-top h2 {
  font-family: 'Playfair Display', serif;
  font-size: 19px;
  color: #2C1810;
  margin-bottom: 6px;
}

.pdf-subtitle {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: #7a6e66;
}

.pdf-subtitle span::after {
  content: '•';
  margin-left: 8px;
  color: #c9a96e;
}

.pdf-subtitle span:last-child::after {
  content: '';
  margin-left: 0;
}

.pdf-rating {
  font-size: 14px;
  color: #c9a96e;
  white-space: nowrap;
}

.pdf-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.pdf-detail-item {
  background: #faf7f2;
  border: 1px solid #f0ebe3;
  border-radius: 10px;
  padding: 10px 12px;
}

.pdf-detail-label,
.pdf-note-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #722F37;
  font-weight: 700;
  margin-bottom: 4px;
}

.pdf-detail-value,
.pdf-note-text {
  font-size: 12px;
  line-height: 1.55;
  color: #2C1810;
  white-space: pre-wrap;
}

.pdf-notes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.pdf-note-full {
  grid-column: 1 / -1;
}

.pdf-empty {
  padding: 24px;
  text-align: center;
  color: #7a6e66;
  border: 1px dashed #e8e0d6;
  border-radius: 12px;
}

@media (max-width: 640px) {
  .export-actions {
    align-items: stretch;
  }

  .export-btn,
  .export-view-label,
  .export-status {
    width: 100%;
  }
}
