/* ============================================
   DIGITAL ORGANOLEPTIC — Wine Tasting Evaluation
   Mobile-first dark theme with glassmorphism
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600&display=swap');

/* ── CSS Variables ── */
:root {
  --bg-primary: #0d0a1a;
  --bg-secondary: #1a1032;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.07);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  
  --wine-red: #8b1a2b;
  --wine-red-light: #c0392b;
  --wine-gold: #d4a843;
  --wine-gold-light: #f0d78c;
  --wine-purple: #6c3483;
  
  --accent: #c0392b;
  --accent-hover: #e74c3c;
  --accent-glow: rgba(192, 57, 43, 0.3);
  
  --text-primary: #f0ece4;
  --text-secondary: rgba(240, 236, 228, 0.6);
  --text-muted: rgba(240, 236, 228, 0.35);
  
  --success: #27ae60;
  --warning: #f39c12;
  --error: #e74c3c;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 0.15s ease;
  
  --slider-height: 6px;
  --slider-thumb: 44px;
}

/* ── Reset & Base ── */
*, *::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: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100dvh;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(ellipse at 20% 0%, rgba(139, 26, 43, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(108, 52, 131, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(212, 168, 67, 0.04) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ── Layout ── */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
  min-height: 100dvh;
}

.app-container.admin-wide {
  max-width: 900px;
}

/* ── Header / Navigation ── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 20px;
  margin-bottom: 8px;
}

.app-logo {
  display: flex;
  flex-direction: column;
  gap: 0;
  text-decoration: none;
  line-height: 1;
}

.app-brand {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  text-decoration: none;
}

.app-sub-brand {
  font-family: 'Outfit', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--wine-gold);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.app-sub-brand:hover {
  opacity: 0.75;
  text-decoration: underline;
}

/* Legacy icon kept for backward compat if any page still uses it */
.app-logo-icon {
  display: none;
}

.app-logo-text {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.app-logo-text span {
  color: var(--wine-gold);
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: var(--bg-card);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  font-size: 18px;
}

.btn-icon:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  font-size: 0.8rem;
  color: var(--text-secondary);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

/* ── Login Page ── */
.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80dvh;
  text-align: center;
  padding: 20px;
}

.login-hero-icon {
  width: 100px;
  height: 100px;
  background: linear-gradient(135deg, var(--wine-red), var(--wine-purple));
  border-radius: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  margin-bottom: 28px;
  box-shadow: 0 12px 40px rgba(139, 26, 43, 0.3);
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.login-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--text-primary), var(--wine-gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 36px;
  max-width: 300px;
}

.login-form {
  width: 100%;
  max-width: 340px;
}

.input-group {
  position: relative;
  margin-bottom: 16px;
}

.input-group input {
  width: 100%;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: var(--transition);
  backdrop-filter: blur(10px);
}

.input-group input::placeholder {
  color: var(--text-muted);
}

.input-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-group input.error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.2);
}

.input-error-msg {
  color: var(--error);
  font-size: 0.8rem;
  margin-top: 6px;
  text-align: left;
  display: none;
}

.input-error-msg.visible {
  display: block;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: var(--radius-md);
  border: none;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, var(--wine-red), var(--accent-hover));
  color: white;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 30px var(--accent-glow);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
}

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

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--glass-border);
}

.btn-outline:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.btn-small {
  padding: 10px 18px;
  font-size: 0.85rem;
}

.btn-success {
  background: linear-gradient(135deg, #1e8449, var(--success));
  color: white;
}

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  backdrop-filter: blur(12px);
  box-shadow: var(--glass-shadow);
  transition: var(--transition);
}

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

.card + .card {
  margin-top: 12px;
}

/* ── Page Title ── */
.page-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

/* ── Series / Wine Selection ── */
.series-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.series-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.series-badge.red {
  background: rgba(139, 26, 43, 0.3);
  color: #e88;
  border: 1px solid rgba(139, 26, 43, 0.5);
}

.series-badge.white {
  background: rgba(212, 168, 67, 0.15);
  color: var(--wine-gold-light);
  border: 1px solid rgba(212, 168, 67, 0.3);
}

.wine-list {
  list-style: none;
}

.wine-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  margin-bottom: 8px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  color: inherit;
}

.wine-item:hover, .wine-item:active {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--glass-border);
}

.wine-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wine-item-name {
  font-weight: 500;
  font-size: 0.95rem;
}

.wine-item-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.wine-item-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.wine-item-status.completed {
  color: var(--success);
}

.wine-item-status .check-icon {
  font-size: 16px;
}

.wine-item-arrow {
  color: var(--text-muted);
  font-size: 18px;
  transition: var(--transition);
}

.wine-item:hover .wine-item-arrow {
  color: var(--text-secondary);
  transform: translateX(3px);
}

/* ── Wine Tabs (inside series page) ── */
.wine-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 24px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 4px;
  border: 1px solid var(--glass-border);
}

.wine-tab {
  flex: 1;
  padding: 10px 8px;
  text-align: center;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.wine-tab.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 12px var(--accent-glow);
}

.wine-tab .tab-check {
  font-size: 12px;
  margin-left: 4px;
}

/* ── Evaluation Form ── */
.eval-section {
  margin-bottom: 28px;
  animation: fadeInUp 0.4s ease both;
}

.eval-section:nth-child(2) { animation-delay: 0.05s; }
.eval-section:nth-child(3) { animation-delay: 0.1s; }
.eval-section:nth-child(4) { animation-delay: 0.15s; }

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

.eval-section-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--wine-gold);
}

.eval-section-title .icon {
  font-size: 20px;
}

/* ── Slider Component ── */
.slider-group {
  margin-bottom: 22px;
  padding: 14px 16px 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  transition: var(--transition);
}

.slider-group:hover,
.slider-group.active {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--glass-border);
}

.slider-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.slider-label-text {
  font-size: 0.9rem;
  font-weight: 500;
}

.slider-value {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-hover);
  min-width: 36px;
  text-align: right;
  transition: var(--transition-fast);
}

.slider-wrapper {
  position: relative;
  padding: 8px 0 0;
}

/* Custom Range Input */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: var(--slider-height);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  position: relative;
  z-index: 2;
  background: transparent;
}

/* Track */
input[type="range"]::-webkit-slider-runnable-track {
  height: var(--slider-height);
  border-radius: 3px;
  background: linear-gradient(to right, 
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0.1) 100%
  );
}

input[type="range"]::-moz-range-track {
  height: var(--slider-height);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
}

/* Thumb */
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: var(--slider-thumb);
  height: var(--slider-thumb);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-hover), var(--wine-red));
  border: 3px solid var(--bg-primary);
  box-shadow: 0 2px 10px var(--accent-glow), 0 0 0 2px var(--accent);
  margin-top: calc((var(--slider-height) - var(--slider-thumb)) / 2);
  cursor: grab;
  transition: box-shadow var(--transition-fast);
}

input[type="range"]::-moz-range-thumb {
  width: var(--slider-thumb);
  height: var(--slider-thumb);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-hover), var(--wine-red));
  border: 3px solid var(--bg-primary);
  box-shadow: 0 2px 10px var(--accent-glow), 0 0 0 2px var(--accent);
  cursor: grab;
}

input[type="range"]:active::-webkit-slider-thumb {
  box-shadow: 0 2px 16px var(--accent-glow), 0 0 0 3px var(--accent-hover);
  cursor: grabbing;
}

input[type="range"]:active::-moz-range-thumb {
  box-shadow: 0 2px 16px var(--accent-glow), 0 0 0 3px var(--accent-hover);
  cursor: grabbing;
}

/* Slider filled track (via JS background) */
input[type="range"].filled {
  /* background is set via JS */
}

/* Step markers */
.slider-steps {
  display: flex;
  justify-content: space-between;
  position: relative;
  margin-top: 6px;
  padding: 0 2px;
}

.slider-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.slider-step-tick {
  width: 1px;
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
}

.slider-step-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Min/Max text labels */
.slider-extremes {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
}

.slider-extreme {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
  max-width: 45%;
}

.slider-extreme.max {
  text-align: right;
}

/* ── Score Summary ── */
.score-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(139, 26, 43, 0.15), rgba(108, 52, 131, 0.1));
  border: 1px solid rgba(139, 26, 43, 0.2);
  margin: 24px 0;
}

.score-summary-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.score-summary-value {
  font-family: 'Outfit', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--wine-gold);
}

.score-summary-max {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* ── Submit Area ── */
.submit-area {
  position: sticky;
  bottom: 0;
  padding: 16px 0;
  background: linear-gradient(to top, var(--bg-primary) 60%, transparent);
  z-index: 10;
}

/* ── Toast / Notification ── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  padding: 14px 24px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 1000;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 90vw;
  text-align: center;
  backdrop-filter: blur(12px);
}

.toast.visible {
  transform: translateX(-50%) translateY(0);
}

.toast.success {
  background: rgba(39, 174, 96, 0.9);
  color: white;
  border: 1px solid rgba(39, 174, 96, 0.5);
}

.toast.error {
  background: rgba(231, 76, 60, 0.9);
  color: white;
  border: 1px solid rgba(231, 76, 60, 0.5);
}

.toast.info {
  background: rgba(52, 152, 219, 0.9);
  color: white;
  border: 1px solid rgba(52, 152, 219, 0.5);
}

/* ── My Results ── */
.result-card {
  padding: 16px;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.result-wine-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.result-total {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--wine-gold);
}

.result-scores {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 16px;
}

.result-score-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.result-score-label {
  color: var(--text-secondary);
}

.result-score-value {
  font-weight: 600;
  color: var(--text-primary);
}

.result-notes {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(212, 168, 67, 0.06);
  border: 1px solid rgba(212, 168, 67, 0.22);
}
.result-notes-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--wine-gold, #d4a843);
  margin-bottom: 4px;
}
.result-notes-text {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* ── Admin Dashboard ── */
.admin-login {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60dvh;
  gap: 16px;
  text-align: center;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  padding: 16px;
  text-align: center;
}

.stat-value {
  font-family: 'Outfit', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--wine-gold);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Admin Table */
.admin-table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -16px;
  padding: 0 16px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  min-width: 600px;
}

.admin-table th {
  padding: 10px 8px;
  text-align: left;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
}

.admin-table td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
}

.admin-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.admin-table .wine-name-cell {
  font-weight: 500;
  min-width: 120px;
}

.admin-table .avg-value {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
}

.admin-table .highlight {
  color: var(--wine-gold);
  font-weight: 700;
}

/* Comparison bars */
.comparison-bar-container {
  margin-top: 4px;
}

.comparison-bar {
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.comparison-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s ease;
}

.comparison-bar-fill.red {
  background: linear-gradient(to right, var(--wine-red), var(--accent-hover));
}

.comparison-bar-fill.gold {
  background: linear-gradient(to right, var(--wine-gold), var(--wine-gold-light));
}

/* ── QR Code Section ── */
.qr-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 16px;
}

.qr-card {
  text-align: center;
  padding: 24px;
}

.qr-card canvas,
.qr-card img {
  max-width: 200px;
  margin: 12px auto;
  display: block;
  border-radius: 8px;
}

.qr-label {
  font-weight: 600;
  margin-bottom: 8px;
}

.qr-url {
  font-size: 0.72rem;
  color: var(--text-muted);
  word-break: break-all;
}

/* ── Loading / Spinner ── */
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 40px auto;
}

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

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 10, 26, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.empty-state-text {
  font-size: 0.95rem;
}

/* ── Bottom Navigation ── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(13, 10, 26, 0.95);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--glass-border);
  display: flex;
  justify-content: center;
  padding: 8px 0 env(safe-area-inset-bottom, 8px);
  z-index: 50;
}

.bottom-nav-inner {
  display: flex;
  gap: 4px;
  max-width: 480px;
  width: 100%;
  padding: 0 16px;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 500;
  transition: var(--transition);
}

.nav-item:hover,
.nav-item.active {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
  color: var(--accent-hover);
}

.nav-item .nav-icon {
  font-size: 22px;
}

/* Account for bottom nav */
body.has-nav {
  padding-bottom: 80px;
}

/* ── Responsive Tweaks ── */
@media (min-width: 600px) {
  .qr-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
  
  .admin-stats {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ── Utilities ── */
.text-center { text-align: center; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.hidden { display: none !important; }

/* Fade animations */
.fade-in {
  animation: fadeIn 0.3s ease both;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Scroll to hide navigation on keyboard open */
@media (max-height: 500px) {
  .bottom-nav {
    display: none;
  }
}
/* ── Admin Dashboard Layout ── */
.admin-wide {
  max-width: 1200px !important;
}

@media (max-width: 768px) {
  .admin-wide {
    padding: 10px;
  }
  
  /* Stack columns on mobile */
  .admin-wide .card > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
}

.admin-table-container {
  scrollbar-width: thin;
  scrollbar-color: var(--glass-border) transparent;
}

.admin-table-container::-webkit-scrollbar {
  width: 6px;
}

.admin-table-container::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 3px;
}

#series-results .card {
  border-left: 4px solid var(--accent);
}

#series-results .card:has(.white) {
  border-left-color: var(--wine-gold);
}

canvas {
  max-width: 100%;
  height: auto !important;
}

/* Chart.js canvas inside series accordion must fill its sized container */
.series-panel canvas {
  height: 100% !important;
  width: 100% !important;
}

/* ── Series Accordion ── */
.series-accordion {
  border-left: 4px solid var(--accent);
  padding: 0;
  overflow: hidden;
}
.series-accordion[open] {
  padding: 0;
}
.series-summary {
  list-style: none;
  cursor: pointer;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  user-select: none;
  transition: background 0.2s;
}
.series-summary::-webkit-details-marker { display: none; }
.series-summary:hover {
  background: rgba(212, 168, 67, 0.05);
}
.series-summary-main {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}
.series-summary-name {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text-primary);
}
.series-summary-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: rgba(255,255,255,0.05);
  padding: 3px 10px;
  border-radius: 10px;
}
.series-summary-chevron {
  font-size: 1.2rem;
  color: var(--wine-gold);
  transition: transform 0.25s ease;
  flex-shrink: 0;
}
.series-accordion[open] .series-summary-chevron {
  transform: rotate(180deg);
}
.series-body {
  padding: 0 22px 22px;
  border-top: 1px solid var(--glass-border);
  padding-top: 18px;
}
.series-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 14px;
}

/* ── Per-series Tabs ── */
.series-tabs {
  display: flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 18px;
}
.series-tab {
  flex: 1;
  padding: 10px 14px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s;
}
.series-tab:hover { color: var(--text-primary); }
.series-tab.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(212, 168, 67, 0.3);
}
.series-panel { display: none; }
.series-panel.active { display: block; }

@media (max-width: 600px) {
  .series-summary { padding: 14px 16px; }
  .series-body { padding: 14px 16px 16px; }
  .series-summary-name { font-size: 1rem; }
  .series-tab { font-size: 0.78rem; padding: 8px 10px; }
}

/* ── AI Demo Panel ── */
.ai-demo-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.12), rgba(99, 102, 241, 0.08));
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 18px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.ai-demo-badge {
  background: linear-gradient(135deg, #a855f7, #6366f1);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  padding: 4px 10px;
  border-radius: 6px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(168, 85, 247, 0.4);
}
.ai-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.ai-card {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 18px;
  position: relative;
}
.ai-card-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--wine-gold);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ai-pill {
  font-size: 0.6rem;
  background: rgba(168, 85, 247, 0.2);
  color: #c4b5fd;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 1px;
  font-weight: 600;
  text-transform: uppercase;
}
.ai-narrative {
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--text-primary);
  margin: 0;
}
.ai-narrative strong { color: var(--wine-gold); }
.ai-narrative em { color: #c4b5fd; font-style: normal; font-weight: 600; }
.ai-bullets {
  margin: 0;
  padding-left: 18px;
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--text-secondary);
}
.ai-bullets li { margin-bottom: 6px; }
.ai-bullets strong { color: var(--wine-gold); }
.ai-bullets em { color: #c4b5fd; font-style: normal; font-weight: 600; }
.ai-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ai-chip {
  background: rgba(212, 168, 67, 0.1);
  border: 1px solid rgba(212, 168, 67, 0.25);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 500;
}
.ai-coming-soon {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.08), rgba(0, 0, 0, 0.25));
  border-color: rgba(168, 85, 247, 0.25);
}
.ai-rdk-report {
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.65;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 14px 16px;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  max-height: 320px;
  overflow-y: auto;
}

/* Technological Navigator card */
.ai-navigator-card {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(99, 102, 241, 0.06), rgba(0, 0, 0, 0.28)) !important;
  border: 1px solid rgba(16, 185, 129, 0.25) !important;
}
.ai-nav-match {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(16, 185, 129, 0.18);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.ai-nav-match-title {
  font-weight: 700;
  font-size: 1rem;
  color: #86efac;
  margin-bottom: 8px;
}
.ai-nav-match-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.ai-nav-k {
  display: inline-block;
  font-weight: 700;
  color: var(--text-muted);
  margin-right: 6px;
  letter-spacing: 0.3px;
}
.ai-nav-recipe-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #86efac;
  margin-bottom: 8px;
}
.ai-nav-recipe li { margin-bottom: 6px; line-height: 1.55; }

/* ── Style Objectivization card (benchmark match) ── */
.ai-style-card {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.08), rgba(99, 102, 241, 0.06), rgba(0, 0, 0, 0.28)) !important;
  border: 1px solid rgba(168, 85, 247, 0.28) !important;
}
.style-similarity-hi {
  color: #c4b5fd;
  font-family: 'Outfit', sans-serif;
  font-size: 1.2em;
}
.style-benchmark-card {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(168, 85, 247, 0.22);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 12px 0;
}
.style-benchmark-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.style-benchmark-badge {
  background: rgba(168, 85, 247, 0.18);
  color: #ddd6fe;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 5px;
  letter-spacing: 0.5px;
}
.style-benchmark-label {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
}
.style-benchmark-note {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.55;
}
.style-other {
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.style-other-title {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.style-other-row {
  display: grid;
  grid-template-columns: 90px 40px 1fr;
  align-items: center;
  gap: 10px;
  margin-bottom: 5px;
  font-size: 0.78rem;
}
.style-other-bar {
  display: block;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
}
.style-other-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, rgba(168, 85, 247, 0.6), rgba(99, 102, 241, 0.6));
}
.style-other-num {
  font-weight: 700;
  color: #c4b5fd;
  font-size: 0.78rem;
  text-align: right;
}
.style-other-label {
  color: var(--text-secondary);
}

/* ── Taster AI Profile Card (my-results page) ── */
.ai-taster-card {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.12), rgba(79, 70, 229, 0.08), rgba(0, 0, 0, 0.3));
  border: 1px solid rgba(168, 85, 247, 0.3);
  position: relative;
  overflow: hidden;
}
.ai-taster-card::before {
  content: '';
  position: absolute;
  top: -50%; right: -20%;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.2), transparent 70%);
  pointer-events: none;
}
.ai-taster-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  position: relative;
  flex-wrap: wrap;
}
.ai-taster-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--wine-gold);
  margin-left: 10px;
}
.ai-taster-note {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0 0 18px;
  position: relative;
}
.ai-taster-note em {
  color: #c4b5fd;
  font-style: normal;
  font-size: 0.78rem;
  display: block;
  margin-top: 6px;
  opacity: 0.9;
}
.ai-taster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  position: relative;
}
.ai-taster-metric {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 14px;
}
.ai-metric-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 8px;
}
.ai-metric-value {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--wine-gold);
  margin-bottom: 6px;
}
.ai-metric-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.ai-metric-sub strong { color: var(--wine-gold); }
.ai-roadmap {
  margin-top: 18px;
  position: relative;
}
.ai-roadmap summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: #c4b5fd;
  font-weight: 600;
  padding: 10px 14px;
  background: rgba(168, 85, 247, 0.1);
  border-radius: 10px;
  list-style: none;
  transition: background 0.2s;
}
.ai-roadmap summary:hover { background: rgba(168, 85, 247, 0.15); }
.ai-roadmap summary::-webkit-details-marker { display: none; }
.ai-roadmap[open] summary { margin-bottom: 10px; }
.ai-roadmap ul {
  margin: 0;
  padding-left: 20px;
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--text-secondary);
}
.ai-roadmap strong { color: var(--wine-gold); }

/* ── Aroma Picker (ЗГУ/РДК) ── */
.aroma-section { padding-bottom: 20px; }
.aroma-section[open] .aroma-summary { margin-bottom: 18px; }
.aroma-summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.aroma-summary::-webkit-details-marker { display: none; }
.aroma-summary::after {
  content: '▾';
  margin-left: auto;
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: transform 0.2s;
}
.aroma-section[open] .aroma-summary::after { transform: rotate(180deg); }
.aroma-hint {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  width: 100%;
  margin-top: 4px;
  letter-spacing: 0.3px;
}
.aroma-groups { display: flex; flex-direction: column; gap: 16px; }

/* ── Aroma Picker V2 (3-level drill-down) ── */
.aroma-picker-v2 { display: flex; flex-direction: column; gap: 12px; }

/* Tier 1 — Category cards grid */
.aroma-categories {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.aroma-cat-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 16px 14px;
  min-height: 96px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  color: var(--text-primary);
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  text-align: left;
}
.aroma-cat-card:hover, .aroma-cat-card:active { transform: translateY(-2px); background: rgba(255,255,255,0.07); }
.aroma-cat-icon { font-size: 1.8rem; line-height: 1; }
.aroma-cat-label {
  font-family: 'Outfit', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: var(--text-primary);
}
.aroma-cat-count {
  position: absolute; top: 10px; right: 10px;
  min-width: 22px; height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: rgba(255,255,255,0.1);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center; justify-content: center;
  transition: all 0.2s;
}
.aroma-cat-count.has {
  background: var(--wine-gold);
  color: #0d0a1a;
}
/* Accent colors per category */
.aroma-cat-card.accent-gold   { border-color: rgba(212,168,67,0.35); background: linear-gradient(180deg, rgba(212,168,67,0.10), rgba(212,168,67,0.03)); }
.aroma-cat-card.accent-green  { border-color: rgba(39,174,96,0.35); background: linear-gradient(180deg, rgba(39,174,96,0.10), rgba(39,174,96,0.03)); }
.aroma-cat-card.accent-amber  { border-color: rgba(243,156,18,0.35); background: linear-gradient(180deg, rgba(243,156,18,0.10), rgba(243,156,18,0.03)); }
.aroma-cat-card.accent-purple { border-color: rgba(155,89,182,0.40); background: linear-gradient(180deg, rgba(155,89,182,0.12), rgba(155,89,182,0.03)); }
.aroma-cat-card.accent-red    { grid-column: 1 / -1; border-color: rgba(231,76,60,0.45); background: linear-gradient(180deg, rgba(231,76,60,0.14), rgba(231,76,60,0.04)); }
.aroma-cat-card.accent-red .aroma-cat-label { color: #f5a7a0; }

/* Tier 2 — Category panel */
.aroma-cat-panel {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.02);
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.aroma-cat-panel.accent-gold   { border-left: 3px solid var(--wine-gold); }
.aroma-cat-panel.accent-green  { border-left: 3px solid #27ae60; }
.aroma-cat-panel.accent-amber  { border-left: 3px solid #f39c12; }
.aroma-cat-panel.accent-purple { border-left: 3px solid #9b59b6; }
.aroma-cat-panel.accent-red    { border-left: 3px solid #e74c3c; }

.aroma-cat-panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.aroma-back-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
}
.aroma-back-btn:hover { background: rgba(255,255,255,0.1); color: var(--text-primary); }
.aroma-cat-panel-title { display: flex; align-items: center; gap: 8px; font-family: 'Outfit', sans-serif; font-size: 0.95rem; }
.aroma-cat-panel-title strong { color: var(--text-primary); }
.aroma-prompt {
  width: 100%;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
}

.aroma-subgroup-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.aroma-sg-chip {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  -webkit-tap-highlight-color: transparent;
}
.aroma-sg-chip:hover { background: rgba(255,255,255,0.08); }
.aroma-sg-chip.active {
  background: rgba(212,168,67,0.18);
  border-color: var(--wine-gold);
  color: var(--text-primary);
}
.aroma-sg-count {
  display: inline-flex;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: rgba(255,255,255,0.08);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  align-items: center; justify-content: center;
}
.aroma-sg-count.has { background: var(--wine-gold); color: #0d0a1a; }

/* Tier 3 — Descriptor rows with 5-segment intensity */
.aroma-descriptors { display: flex; flex-direction: column; gap: 10px; }
.aroma-sg-block {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0,0,0,0.15);
  border: 1px solid rgba(255,255,255,0.04);
}
.aroma-sg-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--wine-gold);
  margin-bottom: 10px;
  letter-spacing: 0.3px;
}
.aroma-desc-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  padding: 10px 8px;
  border-radius: 8px;
  transition: background 0.15s;
}
.aroma-desc-row:hover { background: rgba(255,255,255,0.03); }
.aroma-desc-row.active { background: rgba(212,168,67,0.06); }
.aroma-desc-row.is-defect.active { background: rgba(231,76,60,0.1); }
.aroma-desc-row.is-rancio.active { background: rgba(155,89,182,0.1); }
.aroma-desc-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text-primary);
}
.aroma-flag {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.aroma-flag-defect { background: rgba(231,76,60,0.2); color: #f5a7a0; }
.aroma-flag-rancio { background: rgba(155,89,182,0.2); color: #d4a0f0; }

.aroma-desc-slider {
  display: flex;
  align-items: center;
  gap: 10px;
}
.aroma-seg-bar {
  display: flex;
  flex: 1;
  gap: 3px;
  padding: 3px;
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.06);
  /* Allow native vertical scroll; we'll preventDefault only after detecting horizontal drag */
  touch-action: pan-y;
  cursor: ew-resize;
  user-select: none;
  -webkit-user-select: none;
}
.aroma-seg-bar:focus-visible {
  outline: 2px solid rgba(212,168,67,0.6);
  outline-offset: 2px;
}
.aroma-seg {
  flex: 1;
  height: 26px;
  min-height: 26px;
  border: none;
  background: rgba(255,255,255,0.04);
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.12s, transform 0.08s;
  -webkit-tap-highlight-color: transparent;
  /* The bar handles pointer events; segments are visual only during drag. */
  pointer-events: none;
}
.aroma-seg:hover { background: rgba(255,255,255,0.1); }
.aroma-seg:active { transform: scale(0.95); }
.aroma-seg.filled { background: var(--wine-gold); }
.aroma-desc-row.i4 .aroma-seg.filled { background: #e4b951; }
.aroma-desc-row.i5 .aroma-seg.filled { background: #f0d78c; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15); }
.aroma-desc-row.is-defect .aroma-seg.filled { background: #e74c3c; }
.aroma-desc-row.is-rancio .aroma-seg.filled { background: #9b59b6; }
.aroma-desc-value {
  min-width: 24px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--wine-gold);
  text-align: center;
}
.aroma-desc-row:not(.active) .aroma-desc-value { color: var(--text-muted); }

/* Summary chips strip */
.aroma-summary-chips {
  padding: 12px;
  border-radius: 10px;
  background: rgba(212,168,67,0.05);
  border: 1px dashed rgba(212,168,67,0.25);
}
.aroma-summary-chips:empty { display: none; }
.aroma-summary-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--wine-gold);
  margin-bottom: 8px;
}
.aroma-summary-list { display: flex; flex-wrap: wrap; gap: 6px; }
.aroma-sum-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(212,168,67,0.12);
  border: 1px solid rgba(212,168,67,0.3);
  color: var(--text-primary);
  font-size: 0.8rem;
}
.aroma-sum-chip strong {
  font-family: 'Outfit', sans-serif;
  color: var(--wine-gold);
  font-size: 0.85rem;
}
.aroma-sum-chip.is-defect {
  background: rgba(231,76,60,0.15);
  border-color: rgba(231,76,60,0.4);
}
.aroma-sum-chip.is-defect strong { color: #f5a7a0; }
.aroma-sum-chip.aroma-sum-legacy {
  opacity: 0.7;
  border-style: dashed;
}

/* Responsive tweaks */
@media (max-width: 380px) {
  .aroma-categories { grid-template-columns: 1fr; }
  .aroma-cat-card.accent-red { grid-column: auto; }
  .aroma-seg { height: 30px; }
}

/* Autosave indicator */
.aroma-save-indicator {
  position: sticky;
  bottom: 8px;
  margin-left: auto;
  align-self: flex-end;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 5;
  width: max-content;
}
.aroma-save-indicator.is-saving {
  opacity: 1;
  background: rgba(212,168,67,0.15);
  color: var(--wine-gold);
  border: 1px solid rgba(212,168,67,0.3);
}
.aroma-save-indicator.is-saved {
  opacity: 1;
  background: rgba(39,174,96,0.15);
  color: #4edc8f;
  border: 1px solid rgba(39,174,96,0.3);
}
.aroma-save-indicator.is-error {
  opacity: 1;
  background: rgba(231,76,60,0.15);
  color: #f5a7a0;
  border: 1px solid rgba(231,76,60,0.4);
}


/* ── PWA Banners (install + update) ── */
.pwa-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(20, 14, 38, 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(212, 168, 67, 0.3);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  color: var(--text-primary, #fff);
  font-family: 'Inter', system-ui, sans-serif;
  transform: translateY(140%);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(.2,.8,.2,1), opacity 0.3s;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}
body.has-nav .pwa-banner { bottom: 76px; }
.pwa-banner.visible { transform: translateY(0); opacity: 1; }
.pwa-banner .pwa-icon {
  font-size: 1.75rem;
  line-height: 1;
  flex: 0 0 auto;
}
.pwa-banner .pwa-text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pwa-banner .pwa-text strong {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--wine-gold, #d4a843);
  letter-spacing: 0.01em;
}
.pwa-banner .pwa-text small {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.3;
}
.pwa-banner .pwa-actions {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}
.pwa-btn {
  appearance: none;
  border: 0;
  padding: 8px 12px;
  border-radius: 10px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s;
}
.pwa-btn:active { transform: scale(0.96); }
.pwa-btn-primary {
  background: linear-gradient(135deg, var(--wine-gold, #d4a843), #b88a2e);
  color: #1a1032;
}
.pwa-btn-primary:hover { filter: brightness(1.08); }
.pwa-btn-ghost {
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
}
.pwa-btn-ghost:hover { color: #fff; }

@media (max-width: 420px) {
  .pwa-banner { flex-wrap: wrap; padding: 10px 12px; gap: 10px; }
  .pwa-banner .pwa-text { flex-basis: 100%; order: 1; }
  .pwa-banner .pwa-icon { order: 0; }
  .pwa-banner .pwa-actions { order: 2; width: 100%; justify-content: flex-end; }
}

/* ── Ambient light warning (OIV threshold hint) ── */
.light-warning {
  padding: 10px 12px;
  margin-bottom: 12px;
  border-radius: 10px;
  background: rgba(255, 193, 7, 0.12);
  border: 1px solid rgba(255, 193, 7, 0.32);
  color: #f0d78c;
  font-size: 0.85rem;
  line-height: 1.4;
}
.light-warning.hidden { display: none; }

/* ── Notes section (inside .eval-section.card for consistent look) ── */
.notes-input {
  width: 100%;
  min-height: 96px;
  padding: 12px 14px;
  margin-top: 4px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary, #fff);
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
  resize: vertical;
  transition: border-color 0.2s, background 0.2s;
}
.notes-input:focus {
  outline: none;
  border-color: rgba(212, 168, 67, 0.45);
  background: rgba(255, 255, 255, 0.06);
}

.notes-hint {
  margin: 10px 0 0;
  font-size: 0.78rem;
  color: var(--text-secondary, rgba(255, 255, 255, 0.6));
  line-height: 1.4;
}
.notes-hint-muted {
  color: rgba(255, 255, 255, 0.45);
  font-style: italic;
}

.voice-btn {
  margin-top: 12px;
}
.voice-btn.recording {
  background: rgba(192, 57, 43, 0.22);
  border-color: rgba(192, 57, 43, 0.55);
  color: #ffb4a2;
  animation: voicePulse 1.4s ease-in-out infinite;
}
.voice-btn.transcribing {
  opacity: 0.7;
  cursor: wait;
}
@keyframes voicePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(192, 57, 43, 0.55); }
  50%      { box-shadow: 0 0 0 10px rgba(192, 57, 43, 0); }
}

/* ============================================
   SERIES LOCK — elegant locked-evaluation state
   ============================================ */
.card.series-locked {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(212, 168, 67, 0.28);
  background: linear-gradient(135deg, rgba(28, 18, 45, 0.85), rgba(13, 10, 26, 0.92));
  box-shadow:
    inset 0 0 0 1px rgba(212, 168, 67, 0.08),
    0 8px 30px rgba(0, 0, 0, 0.35);
  transition: all 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.card.series-locked .series-card-body {
  filter: blur(2.5px) saturate(0.55) brightness(0.55);
  opacity: 0.45;
  pointer-events: none;
  transition: filter 0.5s ease, opacity 0.5s ease;
}

.card.series-locked .wine-item-status,
.card.series-locked .check-icon {
  visibility: hidden;
}

.series-lock-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 24px;
  gap: 14px;
  background: radial-gradient(
    ellipse at center,
    rgba(212, 168, 67, 0.08) 0%,
    rgba(13, 10, 26, 0.55) 70%
  );
  backdrop-filter: blur(1.5px);
  -webkit-backdrop-filter: blur(1.5px);
  animation: lockFadeIn 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.series-lock-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--wine-gold, #d4a843);
  background: radial-gradient(circle at center,
    rgba(212, 168, 67, 0.18) 0%,
    rgba(212, 168, 67, 0.04) 60%,
    transparent 100%);
  border: 1px solid rgba(212, 168, 67, 0.45);
  box-shadow:
    0 0 0 6px rgba(212, 168, 67, 0.06),
    0 0 30px rgba(212, 168, 67, 0.18) inset;
  animation: lockPulse 3.2s ease-in-out infinite;
}

.series-lock-icon svg {
  width: 32px;
  height: 32px;
  filter: drop-shadow(0 0 6px rgba(212, 168, 67, 0.45));
}

.series-lock-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.6px;
  color: var(--wine-gold, #d4a843);
  text-transform: uppercase;
  text-shadow: 0 0 18px rgba(212, 168, 67, 0.35);
}

.series-lock-sub {
  font-size: 0.82rem;
  font-weight: 400;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.72);
  max-width: 320px;
  letter-spacing: 0.2px;
}

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

@keyframes lockPulse {
  0%, 100% {
    box-shadow:
      0 0 0 6px rgba(212, 168, 67, 0.06),
      0 0 30px rgba(212, 168, 67, 0.18) inset;
    transform: scale(1);
  }
  50% {
    box-shadow:
      0 0 0 10px rgba(212, 168, 67, 0.04),
      0 0 50px rgba(212, 168, 67, 0.28) inset;
    transform: scale(1.04);
  }
}

/* Admin lock button — engaged state */
.btn.is-locked {
  color: var(--wine-gold, #d4a843) !important;
  border-color: rgba(212, 168, 67, 0.5) !important;
  background: rgba(212, 168, 67, 0.08) !important;
  box-shadow: 0 0 18px rgba(212, 168, 67, 0.18);
}

/* Admin hide button — engaged state (cool dim violet) */
.btn.is-hidden-series {
  color: #b6a4ff !important;
  border-color: rgba(120, 100, 220, 0.45) !important;
  background: rgba(120, 100, 220, 0.08) !important;
  box-shadow: 0 0 18px rgba(120, 100, 220, 0.18);
}

/* Admin: dim hidden series in dashboard so admin sees they're invisible to tasters */
.series-accordion.series-admin-hidden {
  opacity: 0.62;
  border-left: 3px solid rgba(120, 100, 220, 0.45);
}

.series-summary-flag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  padding: 2px 8px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

/* Banner shown when arriving (e.g. via QR) at a locked/hidden series */
.series-access-banner {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  margin-bottom: 18px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(212, 168, 67, 0.10), rgba(212, 168, 67, 0.02));
  border: 1px solid rgba(212, 168, 67, 0.32);
  box-shadow: 0 0 24px rgba(212, 168, 67, 0.08);
  animation: lockFadeIn 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.sab-icon {
  font-size: 1.6rem;
  line-height: 1.1;
  flex: 0 0 auto;
}
.sab-body { flex: 1; min-width: 0; }
.sab-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--wine-gold, #d4a843);
  margin-bottom: 4px;
  letter-spacing: 0.2px;
}
.sab-sub {
  font-size: 0.82rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.72);
}

@media (max-width: 480px) {
  .series-lock-icon { width: 54px; height: 54px; }
  .series-lock-icon svg { width: 26px; height: 26px; }
  .series-lock-title { font-size: 0.95rem; }
  .series-lock-sub { font-size: 0.78rem; }
}



/* ============================================
   REVEALED RESULTS — taster sees group comparison
   ============================================ */
.card.series-revealed {
  border: 1px solid rgba(212, 168, 67, 0.32);
  box-shadow: 0 0 28px rgba(212, 168, 67, 0.08);
}

.revealed-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  padding: 3px 10px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #0a0a0a;
  background: linear-gradient(135deg, #eab308, #ca8a04);
  border-radius: 999px;
}

.group-compare {
  margin-top: 10px;
  padding: 12px;
  border-radius: 10px;
  background: rgba(212, 168, 67, 0.05);
  border: 1px solid rgba(212, 168, 67, 0.18);
}
.group-compare-row {
  display: grid;
  grid-template-columns: 110px 1fr 44px;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.gc-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.72);
  letter-spacing: 0.3px;
}
.gc-bar {
  position: relative;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
}
.gc-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.gc-fill.gc-mine {
  background: linear-gradient(90deg, #eab308, #facc15);
}
.gc-fill.gc-group {
  background: linear-gradient(90deg, rgba(120, 100, 220, 0.9), rgba(99, 102, 241, 0.9));
}
.gc-val {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--wine-gold, #d4a843);
  text-align: right;
}
.gc-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(212, 168, 67, 0.18);
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.7);
}
.gc-inline {
  font-size: 0.7rem;
  color: rgba(180, 170, 230, 0.8);
  font-weight: 500;
  margin-left: 2px;
}

@media (max-width: 480px) {
  .group-compare-row { grid-template-columns: 90px 1fr 40px; gap: 8px; }
  .gc-footer { font-size: 0.68rem; gap: 8px; }
}
