/* ==========================================================================
   CellarNote Design System — Calm Editorial Light Theme & Wine Accent Tokens
   ========================================================================== */
:root {
  /* Neutral Surfaces */
  --bg-canvas: #f5f5f7;
  --bg-surface: #ffffff;
  --bg-subtle: #f9f9fb;
  --bg-hover: #f0f0f4;
  --bg-translucent: rgba(255, 255, 255, 0.88);
  --bg-backdrop: rgba(24, 24, 27, 0.36);

  /* Neutral Borders (Hairline, Never Heavy) */
  --border-subtle: #eaeaf0;
  --border-default: #dcdce5;
  --border-strong: #c4c4d0;

  /* Typography Ink (WCAG AA+ on White & Subtle Grey) */
  --text-primary: #18181b;
  --text-secondary: #52525b;
  --text-muted: #6e6e78;
  --text-inverse: #ffffff;

  /* Primary Neutral Interactive Actions */
  --action-primary: #18181b;
  --action-primary-hover: #2d2d34;
  --focus-ring: rgba(122, 30, 52, 0.22);

  /* Restrained Wine-Type Accent Palette (Accents Only — Never Large Blocks) */
  /* Red: Deep Burgundy */
  --wine-red: #7a1e34;
  --wine-red-soft: #faf2f4;
  --wine-red-border: #e8cdd4;
  --wine-red-text: #6b192d;

  /* White: Pale Gold */
  --wine-white: #c8a84e;
  --wine-white-soft: #fbf8ee;
  --wine-white-border: #ebe0bc;
  --wine-white-text: #735a15;

  /* Rosé: Blush */
  --wine-rose: #d687a0;
  --wine-rose-soft: #fdf4f7;
  --wine-rose-border: #f1d4de;
  --wine-rose-text: #8c3652;

  /* Sparkling: Champagne */
  --wine-sparkling: #c9b58c;
  --wine-sparkling-soft: #faf7f0;
  --wine-sparkling-border: #e7dec8;
  --wine-sparkling-text: #635335;

  /* Dessert: Amber */
  --wine-amber: #c97d2e;
  --wine-amber-soft: #fcf5ec;
  --wine-amber-border: #eed5b6;
  --wine-amber-text: #824710;

  /* Fortified: Deeper Port / Vintage Garnet Red */
  --wine-fortified: #4f1022;
  --wine-fortified-soft: #f6edf0;
  --wine-fortified-border: #ddc0c9;
  --wine-fortified-text: #450d1d;

  /* Rating Star Highlight */
  --star-active: #b9892d;
  --star-inactive: #d4d4dc;

  /* Semantic Status Tokens */
  --status-success: #1f6a47;
  --status-success-soft: #eef8f2;
  --status-success-border: #c4e4d3;

  --status-warn: #854d12;
  --status-warn-soft: #fdf7ec;
  --status-warn-border: #efd8b4;

  --status-info: #285777;
  --status-info-soft: #f2f7fb;
  --status-info-border: #cde0ee;

  --status-danger: #a62626;
  --status-danger-soft: #fdf2f2;
  --status-danger-border: #f2c9c9;

  /* Spacing Scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  /* Radii */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-pill: 999px;

  /* Elevation */
  --shadow-xs: 0 1px 2px rgba(24, 24, 27, 0.04);
  --shadow-sm: 0 2px 8px rgba(24, 24, 27, 0.045), 0 1px 2px rgba(24, 24, 27, 0.03);
  --shadow-md: 0 10px 26px rgba(24, 24, 27, 0.08), 0 2px 6px rgba(24, 24, 27, 0.04);
  --shadow-lg: 0 22px 54px rgba(24, 24, 27, 0.14), 0 6px 16px rgba(24, 24, 27, 0.06);

  /* Typography (Full Latin-Ext, Hungarian ő/ű, French, German, Romanian, Greek & Cyrillic coverage) */
  --font-sans: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, "Noto Sans", Roboto, "Helvetica Neue", sans-serif;
  --font-serif: "Source Serif 4", "Cambria", "Noto Serif", "Liberation Serif", "Times New Roman", serif;
  --text-xs: 12px;
  --text-sm: 13.5px;
  --text-base: 15px;
  --text-lg: 18px;
  --text-xl: 22px;

  /* Motion */
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --dur-fast: 140ms;
  --dur-med: 220ms;
}

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

html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg-canvas);
  color-scheme: light;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  background: var(--bg-canvas);
  color: var(--text-primary);
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100dvh;
  padding-bottom: calc(88px + env(safe-area-inset-bottom));
}

body.modal-open {
  overflow: hidden;
}

h1, h2, h3 {
  margin: 0;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text-primary);
}

p {
  margin: 0;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: rgba(24, 24, 27, 0.06);
  padding: 1px 5px;
  border-radius: 4px;
}

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

.ui-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bg-translucent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  padding-top: env(safe-area-inset-top);
}

.header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

.brand-logo {
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  box-shadow: var(--shadow-xs);
}

.brand-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.brand-text h1 {
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  white-space: nowrap;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  max-width: 100%;
  min-width: 0;
}

.status-pill > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.status-dot.offline {
  background: var(--wine-amber);
}

.status-pill-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  padding: 2px 6px 2px 0;
  font-family: inherit;
  cursor: pointer;
  max-width: 100%;
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}

.status-pill-btn:hover {
  color: var(--text-primary);
}

.status-pill-btn:focus-visible {
  outline: 2px solid var(--wine-red);
  outline-offset: 2px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .hide-xs {
    display: none;
  }

  .header-inner {
    padding: 10px 14px;
    gap: 10px;
  }

  .brand {
    gap: 10px;
  }

  .brand-logo {
    width: 34px;
    height: 34px;
  }

  .brand-text h1 {
    font-size: 19px;
  }

  .header-actions {
    gap: 6px;
  }

  .header-actions .btn-icon-label {
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0;
    justify-content: center;
  }
}

.menu-wrap {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + var(--space-2));
  min-width: 224px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 6px;
  z-index: 40;
}

.dropdown-item {
  width: 100%;
  min-height: 44px;
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  text-align: left;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}

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

/* Primary Navigation Tabs */
.nav-tabs {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 35;
  background: var(--bg-translucent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-subtle);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 4px var(--space-2) calc(4px + env(safe-area-inset-bottom));
}

.nav-btn {
  position: relative;
  min-height: 52px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}

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

.nav-btn.active {
  color: var(--wine-red);
}

.nav-svg {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
}

@media (min-width: 768px) {
  body {
    padding-bottom: var(--space-8);
  }

  .header-inner {
    padding: 14px var(--space-6);
  }

  .status-pill {
    max-width: 440px;
  }

  .nav-tabs {
    position: static;
    max-width: 1120px;
    margin: var(--space-5) auto 0;
    padding: 5px;
    gap: 4px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xs);
    width: calc(100% - 48px);
  }

  .nav-btn {
    min-height: 44px;
    flex-direction: row;
    gap: var(--space-2);
    font-size: 14px;
    border-radius: var(--radius-sm);
  }

  .nav-btn.active {
    background: var(--wine-red-soft);
    color: var(--wine-red-text);
  }
}

/* ==========================================================================
   Main Container & Banners
   ========================================================================== */
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: var(--space-5) var(--space-4);
}

@media (min-width: 768px) {
  .container {
    padding: var(--space-6);
  }
}

.banner {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-5);
  font-size: var(--text-sm);
  line-height: 1.5;
  border: 1px solid transparent;
}

.banner-warn {
  background: var(--status-warn-soft);
  border-color: var(--status-warn-border);
  color: var(--status-warn);
}

.banner-info {
  background: var(--status-info-soft);
  border-color: var(--status-info-border);
  color: var(--status-info);
}

/* ==========================================================================
   Stats Strip
   ========================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.stat-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-value {
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

@media (min-width: 640px) {
  .stats-grid {
    gap: var(--space-4);
    margin-bottom: var(--space-5);
  }

  .stat-card {
    padding: var(--space-4) var(--space-5);
    gap: 6px;
  }

  .stat-label {
    font-size: 11.5px;
    letter-spacing: 0.04em;
  }

  .stat-value {
    font-size: 26px;
  }
}

/* ==========================================================================
   Toolbar, Inputs & Wine-Type Filter Chips
   ========================================================================== */
input[type="text"],
input[type="search"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  min-height: 44px;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  font-size: var(--text-base);
  font-family: inherit;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--border-strong);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--wine-red);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

button:focus-visible {
  outline: 2px solid var(--wine-red);
  outline-offset: 2px;
}

textarea {
  resize: vertical;
  min-height: 84px;
  line-height: 1.5;
}

.toolbar {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

@media (min-width: 720px) {
  .toolbar {
    flex-direction: row;
    align-items: center;
  }
}

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

.search-ico {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-wrap input {
  padding-left: 38px;
  box-shadow: var(--shadow-xs);
}

.toolbar-selects {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

@media (min-width: 720px) {
  .toolbar-selects {
    display: flex;
    flex-shrink: 0;
  }

  .toolbar-selects select {
    width: auto;
    min-width: 165px;
    box-shadow: var(--shadow-xs);
  }
}

/* Wine-Type Filter Chips */
.pill-strip {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding: 2px 2px 8px;
  margin-bottom: var(--space-4);
  scrollbar-width: none;
}

.pill-strip::-webkit-scrollbar {
  display: none;
}

.pill {
  min-height: 40px;
  white-space: nowrap;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: var(--radius-pill);
  padding: 0 15px;
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  box-shadow: var(--shadow-xs);
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

@media (max-width: 767px) {
  .pill {
    min-height: 44px;
  }
}

.pill:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.pill.active {
  background: var(--action-primary);
  border-color: var(--action-primary);
  color: var(--text-inverse);
  font-weight: 600;
}

.type-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-Red { background: var(--wine-red); }
.dot-White { background: var(--wine-white); }
.dot-Rosé { background: var(--wine-rose); }
.dot-Sparkling { background: var(--wine-sparkling); }
.dot-Dessert { background: var(--wine-amber); }
.dot-Fortified { background: var(--wine-fortified); }

/* Restrained Wine-Type Active Filter Chip States */
.pill[data-type="Red"].active {
  background: var(--wine-red-soft);
  border-color: var(--wine-red);
  color: var(--wine-red-text);
}

.pill[data-type="White"].active {
  background: var(--wine-white-soft);
  border-color: var(--wine-white);
  color: var(--wine-white-text);
}

.pill[data-type="Rosé"].active {
  background: var(--wine-rose-soft);
  border-color: var(--wine-rose);
  color: var(--wine-rose-text);
}

.pill[data-type="Sparkling"].active {
  background: var(--wine-sparkling-soft);
  border-color: var(--wine-sparkling);
  color: var(--wine-sparkling-text);
}

.pill[data-type="Dessert"].active {
  background: var(--wine-amber-soft);
  border-color: var(--wine-amber);
  color: var(--wine-amber-text);
}

.pill[data-type="Fortified"].active {
  background: var(--wine-fortified-soft);
  border-color: var(--wine-fortified);
  color: var(--wine-fortified-text);
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0 18px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), opacity var(--dur-fast) var(--ease);
}

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

.btn-primary {
  background: var(--action-primary);
  color: var(--text-inverse);
  box-shadow: var(--shadow-xs);
}

.btn-primary:hover:not(:disabled) {
  background: var(--action-primary-hover);
}

.btn-secondary,
.btn-ghost {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-default);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover:not(:disabled),
.btn-ghost:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.btn-accent-subtle,
.btn-gold {
  background: var(--wine-red-soft);
  color: var(--wine-red-text);
  border-color: var(--wine-red-border);
}

.btn-accent-subtle:hover:not(:disabled),
.btn-gold:hover:not(:disabled) {
  background: #f5e5e9;
  border-color: #d9b2bd;
}

.btn-danger {
  background: var(--status-danger-soft);
  color: var(--status-danger);
  border-color: var(--status-danger-border);
}

.btn-danger:hover:not(:disabled) {
  background: #fbe4e4;
  border-color: #e9b1b1;
}

.btn-sm {
  min-height: 38px;
  padding: 0 13px;
  font-size: 13px;
}

@media (max-width: 767px) {
  .btn-sm {
    min-height: 44px;
  }
}

.btn-close {
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
  border-radius: 50%;
}

/* ==========================================================================
   Wine Grid, Cards & Badges
   ========================================================================== */
.wine-grid,
.skeleton-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

@media (min-width: 640px) {
  .wine-grid,
  .skeleton-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1000px) {
  .wine-grid,
  .skeleton-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.skeleton-card {
  height: 210px;
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, #ffffff 25%, #f0f0f4 50%, #ffffff 75%);
  background-size: 200% 100%;
  border: 1px solid var(--border-subtle);
  animation: shimmer 1.4s infinite linear;
}

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

.wine-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-top: 3px solid var(--wine-red);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}

.wine-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-default);
}

.wine-card.consumed {
  background: var(--bg-subtle);
  opacity: 0.88;
}

.wine-card[data-wine-type="Red"] { border-top-color: var(--wine-red); }
.wine-card[data-wine-type="White"] { border-top-color: var(--wine-white); }
.wine-card[data-wine-type="Rosé"] { border-top-color: var(--wine-rose); }
.wine-card[data-wine-type="Sparkling"] { border-top-color: var(--wine-sparkling); }
.wine-card[data-wine-type="Dessert"] { border-top-color: var(--wine-amber); }
.wine-card[data-wine-type="Fortified"] { border-top-color: var(--wine-fortified); }

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.card-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.card-badges-spaced {
  margin-bottom: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.badge-type-Red {
  background: var(--wine-red-soft);
  color: var(--wine-red-text);
  border-color: var(--wine-red-border);
}

.badge-type-White {
  background: var(--wine-white-soft);
  color: var(--wine-white-text);
  border-color: var(--wine-white-border);
}

.badge-type-Rosé {
  background: var(--wine-rose-soft);
  color: var(--wine-rose-text);
  border-color: var(--wine-rose-border);
}

.badge-type-Sparkling {
  background: var(--wine-sparkling-soft);
  color: var(--wine-sparkling-text);
  border-color: var(--wine-sparkling-border);
}

.badge-type-Dessert {
  background: var(--wine-amber-soft);
  color: var(--wine-amber-text);
  border-color: var(--wine-amber-border);
}

.badge-type-Fortified {
  background: var(--wine-fortified-soft);
  color: var(--wine-fortified-text);
  border-color: var(--wine-fortified-border);
}

.badge-vintage {
  background: var(--bg-subtle);
  color: var(--text-primary);
  border-color: var(--border-default);
  font-variant-numeric: tabular-nums;
}

.badge-archived {
  background: #f0f0f4;
  color: var(--text-secondary);
  border-color: var(--border-default);
}

.rating-display {
  font-size: 13.5px;
  color: var(--star-active);
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.03em;
}

.rating-display .muted {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
}

.card-title {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.card-producer {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-top: 2px;
}

.card-meta {
  font-size: 13px;
  color: var(--text-muted);
}

.card-pairings {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pairing-tag {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: var(--radius-xs);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.card-footer {
  margin-top: auto;
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.price-tag {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Quantity Stepper */
.stepper {
  display: inline-flex;
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.stepper-btn {
  min-width: 44px;
  min-height: 44px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 500;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background var(--dur-fast) var(--ease);
}

.stepper-btn:hover:not(:disabled) {
  background: var(--bg-hover);
}

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

.stepper-val {
  min-width: 34px;
  text-align: center;
  font-size: 14px;
  font-weight: 650;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Empty State
   ========================================================================== */
.empty-state {
  text-align: center;
  padding: 56px var(--space-5);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

.empty-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto var(--space-4);
  border-radius: 50%;
  background: var(--wine-red-soft);
  border: 1px solid var(--wine-red-border);
  color: var(--wine-red);
  display: grid;
  place-items: center;
}

.empty-icon svg {
  width: 26px;
  height: 26px;
}

.empty-state h2 {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
}

.empty-state p {
  color: var(--text-secondary);
  margin: var(--space-2) auto var(--space-6);
  max-width: 440px;
  font-size: var(--text-sm);
}

.empty-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-3);
}

/* ==========================================================================
   Add & Scan Panels, Forms & Match Banners
   ========================================================================== */
.segmented-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 5px;
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow-xs);
}

.seg-btn {
  min-height: 44px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

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

.seg-btn.active {
  background: var(--action-primary);
  color: var(--text-inverse);
}

.panel-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}

@media (min-width: 640px) {
  .panel-card {
    padding: var(--space-6);
  }
}

.panel-head {
  margin-bottom: var(--space-5);
}

.panel-head h2 {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  margin-bottom: 6px;
}

.panel-head p {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  max-width: 660px;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: var(--space-8) var(--space-5);
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}

.dropzone:hover {
  border-color: var(--wine-red);
  background: var(--wine-red-soft);
}

.dropzone-ico {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-xs);
}

.dropzone-ico svg {
  width: 20px;
  height: 20px;
}

.dropzone-title {
  font-weight: 600;
  font-size: var(--text-base);
  color: var(--text-primary);
}

.dropzone-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.preview-wrap {
  margin-top: var(--space-4);
  text-align: center;
}

.preview-wrap img {
  max-width: 100%;
  max-height: 260px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-xs);
  object-fit: contain;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

.panel-actions-footer {
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--space-4);
  margin-top: var(--space-2);
}

.divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-6) 0 var(--space-5);
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

@media (min-width: 640px) {
  .form-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-full {
  grid-column: 1 / -1;
}

.field-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Duplicate Match Banners */
.match-banner {
  background: var(--wine-white-soft);
  border: 1px solid var(--wine-white-border);
  border-left: 3px solid var(--wine-white);
  border-radius: var(--radius-sm);
  padding: var(--space-4);
  margin-bottom: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.match-banner-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.match-banner-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--wine-white-text);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.match-summary {
  font-size: 14px;
  color: var(--text-primary);
}

.match-summary .muted {
  display: block;
  font-size: 12.5px;
  margin-top: 2px;
  color: var(--text-secondary);
}

.match-choices {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.match-choice-btn {
  min-height: 44px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.match-choice-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.match-choice-btn.active {
  background: var(--wine-red);
  border-color: var(--wine-red);
  color: var(--text-inverse);
}

/* Invoice Checklist */
.invoice-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.inline-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.invoice-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.invoice-item {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.invoice-item-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.invoice-check {
  width: 22px;
  height: 22px;
  accent-color: var(--wine-red);
  cursor: pointer;
  flex-shrink: 0;
}

.invoice-match-bar {
  background: var(--wine-white-soft);
  border: 1px solid var(--wine-white-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

@media (min-width: 640px) {
  .invoice-match-bar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.invoice-match-info {
  font-size: 12.5px;
  color: var(--wine-white-text);
}

.invoice-match-select {
  min-height: 40px;
  font-size: 13px;
  width: auto;
  min-width: 220px;
}

.invoice-item-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}

@media (min-width: 640px) {
  .invoice-item-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ==========================================================================
   Sommelier
   ========================================================================== */
.sommelier-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: 2px;
}

.chip {
  min-height: 40px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: var(--radius-pill);
  padding: 0 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

@media (max-width: 767px) {
  .chip {
    min-height: 44px;
  }
}

.chip:hover {
  background: var(--wine-red-soft);
  border-color: var(--wine-red-border);
  color: var(--wine-red-text);
}

.sommelier-results {
  margin-top: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.sommelier-overview {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--wine-red);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  box-shadow: var(--shadow-xs);
}

.sommelier-overview h3 {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--wine-red-text);
  margin-bottom: 6px;
}

.sommelier-overview p {
  color: var(--text-secondary);
  font-size: var(--text-base);
}

.rec-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.rec-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}

.score-pill {
  background: var(--status-success-soft);
  color: var(--status-success);
  border: 1px solid var(--status-success-border);
  border-radius: var(--radius-pill);
  padding: 4px 11px;
  font-size: 12.5px;
  font-weight: 650;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.rec-headline {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 15.5px;
}

.rec-tips {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}

@media (min-width: 640px) {
  .rec-tips {
    grid-template-columns: 1fr 1fr;
  }
}

.tip-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 13.5px;
  color: var(--text-secondary);
}

.tip-box strong {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 3px;
}

/* ==========================================================================
   Bottle Detail Modal / Bottom Sheet
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--bg-backdrop);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

@media (min-width: 680px) {
  .modal-backdrop {
    align-items: center;
    padding: var(--space-6);
  }
}

.modal-sheet {
  width: 100%;
  max-width: 700px;
  max-height: 92dvh;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 22px 22px 0 0;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@media (min-width: 680px) {
  .modal-sheet {
    border-radius: var(--radius-lg);
    max-height: 88dvh;
  }
}

.modal-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  background: var(--bg-surface);
}

.modal-title-group {
  min-width: 0;
}

.modal-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: var(--space-2);
}

.modal-header h2 {
  font-family: var(--font-serif);
  font-size: 22px;
  letter-spacing: -0.01em;
}

.modal-producer {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 2px;
}

.modal-body {
  padding: var(--space-5) var(--space-6);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  padding-bottom: calc(28px + env(safe-area-inset-bottom));
}

@media (max-width: 639px) {
  .modal-header,
  .modal-body {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }
}

.detail-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px var(--space-4);
}

.detail-bar-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.detail-bar-rating {
  margin-top: 3px;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}

@media (min-width: 540px) {
  .meta-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.meta-cell {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
}

.meta-cell .k {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.meta-cell .v {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.section-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.section-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.section-block h3 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

.notes-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}

@media (min-width: 540px) {
  .notes-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.note-tile {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  font-size: 13.5px;
  color: var(--text-secondary);
}

.note-tile strong {
  display: block;
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

/* Star Picker & Tasting History */
.tasting-form {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.tasting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.tasting-date-wrap {
  min-width: 156px;
}

.star-picker {
  display: inline-flex;
  gap: 2px;
}

.star-btn {
  min-width: 44px;
  min-height: 44px;
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  font-size: 26px;
  color: var(--star-inactive);
  cursor: pointer;
  line-height: 1;
  padding: 0;
  transition: color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.star-btn:hover {
  transform: scale(1.08);
}

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

.tasting-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.tasting-item {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-3);
}

.tasting-meta {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.tasting-notes-text {
  font-size: 14px;
  color: var(--text-secondary);
  white-space: pre-wrap;
  line-height: 1.55;
}

/* Data Tables (Reusable Tokenized Styling) */
table.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
  font-size: var(--text-sm);
}

table.data-table th,
table.data-table td {
  padding: 10px 13px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}

table.data-table th {
  background: var(--bg-subtle);
  font-size: 11.5px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

table.data-table tr:last-child td {
  border-bottom: none;
}

/* Multi-Vintage Card Selector & Modal Vertical Comparison */
.vintage-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.vintage-bar-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.vintage-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.vintage-pill {
  min-height: 36px;
  padding: 0 11px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-default);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

@media (max-width: 767px) {
  .vintage-pill {
    min-height: 44px;
    padding: 0 13px;
  }
}

.vintage-pill:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.vintage-pill.active {
  background: var(--action-primary);
  border-color: var(--action-primary);
  color: var(--text-inverse);
}

.vintage-pill.is-archived {
  border-style: dashed;
  color: var(--text-muted);
}

.vintage-pill.is-archived.active {
  border-style: solid;
  color: var(--text-inverse);
}

.vintage-pill-sub {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.78;
}

.modal-vintage-strip {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-vintage-strip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.modal-vintage-strip-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.compare-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  -webkit-overflow-scrolling: touch;
}

.compare-table {
  width: 100%;
  min-width: 440px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.compare-table th,
.compare-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
  vertical-align: top;
  min-width: 150px;
}

.compare-table th:last-child,
.compare-table td:last-child {
  border-right: none;
}

.compare-table tr:last-child td,
.compare-table tr:last-child th {
  border-bottom: none;
}

.compare-table .compare-attr-col {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 118px;
  width: 118px;
  background: var(--bg-subtle);
  font-size: 11.5px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.compare-table thead th {
  background: var(--bg-subtle);
  vertical-align: middle;
}

.compare-table .is-active-col {
  background: var(--wine-red-soft);
}

.compare-col-btn {
  width: 100%;
  min-height: 40px;
  background: transparent;
  border: none;
  padding: 0;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.compare-col-vintage {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.compare-best {
  color: var(--wine-red-text);
  font-weight: 650;
}

/* Label Photo Thumbnails & Modal Photo Panel */
.card-heading-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.card-heading-text {
  min-width: 0;
  flex: 1;
}

.card-thumb {
  width: 54px;
  height: 72px;
  border-radius: var(--radius-xs);
  object-fit: cover;
  border: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  box-shadow: var(--shadow-xs);
  flex-shrink: 0;
}

.modal-photo-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px var(--space-4);
}

.modal-photo-preview {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-width: 0;
}

.modal-photo-img {
  width: 76px;
  height: 102px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  box-shadow: var(--shadow-xs);
  flex-shrink: 0;
}

.modal-photo-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.modal-photo-title {
  font-size: 13px;
  font-weight: 650;
  color: var(--text-primary);
}

.modal-photo-sub {
  font-size: 12.5px;
  color: var(--text-muted);
}

.muted-sm {
  font-size: 12px;
  color: var(--text-muted);
}

/* ==========================================================================
   Toasts
   ========================================================================== */
.toast-root {
  position: fixed;
  right: var(--space-4);
  left: var(--space-4);
  bottom: calc(74px + env(safe-area-inset-bottom));
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  pointer-events: none;
}

@media (min-width: 768px) {
  .toast-root {
    left: auto;
    bottom: var(--space-5);
    align-items: flex-end;
  }
}

.toast {
  background: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-inverse);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  font-size: 13.5px;
  font-weight: 500;
  max-width: 420px;
  pointer-events: auto;
}

.toast.error {
  background: var(--status-danger-soft);
  border-color: var(--status-danger-border);
  color: var(--status-danger);
}

.toast.success {
  background: var(--bg-surface);
  border-color: var(--status-success-border);
  border-left: 3px solid var(--status-success);
  color: var(--text-primary);
}

/* ==========================================================================
   AI Settings Modal
   ========================================================================== */
.modal-sheet-sm {
  max-width: 620px;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.settings-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.provider-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}

@media (min-width: 480px) {
  .provider-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.provider-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 82px;
  padding: 14px var(--space-4);
  background: var(--bg-subtle);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

.provider-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-surface);
}

.provider-card.active {
  border-color: var(--wine-red);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.provider-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.provider-card-name {
  font-size: 14.5px;
  font-weight: 650;
  color: var(--text-primary);
}

.provider-card-sub {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

.key-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.key-badge.ready {
  background: var(--status-success-soft);
  color: var(--status-success);
  border: 1px solid var(--status-success-border);
}

.key-badge.missing {
  background: var(--status-warn-soft);
  color: var(--status-warn);
  border: 1px solid var(--status-warn-border);
}

.model-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.settings-hint {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.45;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 14px var(--space-4);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.toggle-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.toggle-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.toggle-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.45;
}

.toggle-switch {
  position: relative;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
  appearance: none;
  -webkit-appearance: none;
  background: var(--border-strong);
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}

.toggle-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-surface);
  box-shadow: var(--shadow-xs);
  transition: transform var(--dur-fast) var(--ease);
}

.toggle-switch:checked {
  background: var(--wine-red);
}

.toggle-switch:checked::after {
  transform: translateX(20px);
}

.toggle-switch:focus-visible {
  outline: 2px solid var(--wine-red);
  outline-offset: 2px;
}

.settings-subpanel {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.settings-grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}

@media (min-width: 480px) {
  .settings-grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.settings-test-box {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  line-height: 1.45;
}

.settings-test-box.success {
  background: var(--status-success-soft);
  border: 1px solid var(--status-success-border);
  color: var(--status-success);
}

.settings-test-box.error {
  background: var(--status-danger-soft);
  border: 1px solid var(--status-danger-border);
  color: var(--status-danger);
}

.settings-note {
  font-size: 12.5px;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  line-height: 1.5;
}

.banner-inline-btn {
  margin-left: 8px;
  vertical-align: middle;
}

/* ==========================================================================
   On-Device Visual Recognition Card
   ========================================================================== */
.visual-match-card {
  margin-top: var(--space-4);
  background: var(--bg-surface);
  border: 1px solid var(--status-success-border);
  border-left: 3px solid var(--status-success);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.visual-match-card.is-possible {
  border-color: var(--wine-white-border);
  border-left-color: var(--wine-white);
}

.visual-match-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.visual-match-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--status-success);
}

.visual-match-card.is-possible .visual-match-eyebrow {
  color: var(--wine-white-text);
}

.visual-match-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge-match-strong {
  background: var(--status-success-soft);
  border-color: var(--status-success-border);
  color: var(--status-success);
}

.badge-match-possible {
  background: var(--wine-white-soft);
  border-color: var(--wine-white-border);
  color: var(--wine-white-text);
}

.visual-match-body {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
}

.visual-match-thumb {
  width: 64px;
  height: 84px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  flex-shrink: 0;
}

.visual-match-info {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.visual-match-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.25;
}

.visual-match-producer {
  font-size: 13.5px;
  color: var(--text-secondary);
}

.visual-match-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.visual-match-candidates {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: var(--space-2);
  border-top: 1px solid var(--border-subtle);
}

.visual-match-candidates-label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.visual-match-note {
  font-size: 12.5px;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  line-height: 1.45;
}

.visual-match-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.visual-match-qty-group {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.visual-hash-status {
  margin-top: var(--space-3);
  font-size: 12.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.visual-hash-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--status-success);
  flex-shrink: 0;
}

/* ==========================================================================
   Cellar Card Summary, Camera Capture, Currency Picker & Invoice Validation
   ========================================================================== */
.card-summary {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.scan-source-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.source-tab {
  min-height: 44px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.source-tab:hover {
  background: var(--bg-subtle);
}

.source-tab.active {
  background: var(--text-primary);
  border-color: var(--text-primary);
  color: #ffffff;
}

.dropzone-btn {
  width: 100%;
  font-family: inherit;
  text-align: center;
}

.camera-viewfinder {
  margin-bottom: var(--space-4);
  background: var(--bg-subtle);
  border: 1.5px dashed var(--accent-border, var(--border-default));
  border-radius: var(--radius-md);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.camera-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  max-height: 54dvh;
  background: #141416;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

@media (min-width: 680px) {
  .camera-stage {
    aspect-ratio: 4 / 3;
    max-height: 400px;
  }
}

.camera-stage video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.camera-guide {
  position: absolute;
  inset: 12%;
  pointer-events: none;
}

.camera-corner {
  position: absolute;
  width: 24px;
  height: 24px;
  border-color: rgba(255, 255, 255, 0.84);
  border-style: solid;
  border-width: 0;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
}

.camera-corner.tl {
  top: 0;
  left: 0;
  border-top-width: 2.5px;
  border-left-width: 2.5px;
  border-top-left-radius: 6px;
}

.camera-corner.tr {
  top: 0;
  right: 0;
  border-top-width: 2.5px;
  border-right-width: 2.5px;
  border-top-right-radius: 6px;
}

.camera-corner.bl {
  bottom: 0;
  left: 0;
  border-bottom-width: 2.5px;
  border-left-width: 2.5px;
  border-bottom-left-radius: 6px;
}

.camera-corner.br {
  bottom: 0;
  right: 0;
  border-bottom-width: 2.5px;
  border-right-width: 2.5px;
  border-bottom-right-radius: 6px;
}

.camera-status-pill {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  background: rgba(20, 20, 22, 0.8);
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  white-space: nowrap;
}

.camera-fallback {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.camera-fallback-msg {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

.camera-fallback-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.camera-fallback-actions .btn {
  flex: 1 1 140px;
}

.camera-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

.camera-shutter-btn {
  flex: 1 1 auto;
  min-height: 50px;
  font-size: 15px;
  font-weight: 600;
}

.camera-shutter-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid currentColor;
  background: rgba(255, 255, 255, 0.9);
  flex-shrink: 0;
}

.camera-ctrl-btn {
  min-height: 50px;
  padding-left: 12px;
  padding-right: 12px;
  flex-shrink: 0;
}

.camera-ctrl-btn[aria-pressed='true'] {
  background: var(--accent-subtle, #f6e7ec);
  border-color: var(--accent);
  color: var(--accent);
}

.camera-inline-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.camera-alt-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: 6px 4px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
}

.camera-alt-link:hover {
  color: var(--text-primary);
}

.currency-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-2);
}

.currency-btn {
  min-height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
  padding: 6px 4px;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.currency-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.currency-btn.active {
  background: var(--action-primary);
  border-color: var(--action-primary);
  color: var(--text-inverse);
}

.currency-btn-sym {
  font-size: 14px;
  font-weight: 700;
}

.currency-btn-code {
  font-size: 11px;
  opacity: 0.8;
}

.fx-rate-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: 10px 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--text-secondary);
}

.fx-rate-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fx-rate-sub {
  font-size: 11.5px;
  color: var(--text-muted);
}

.invoice-validate-card {
  margin-top: var(--space-4);
  background: var(--bg-surface);
  border: 1px solid var(--status-info-border);
  border-left: 3px solid var(--status-info);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.invoice-validate-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.invoice-validate-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--status-info);
}

.invoice-validate-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2);
}

@media (min-width: 600px) {
  .invoice-validate-meta {
    grid-template-columns: repeat(4, 1fr);
  }
}

.invoice-pii-box {
  background: var(--status-warn-soft);
  border: 1px solid var(--status-warn-border);
  color: var(--status-warn);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.45;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.invoice-pii-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.invoice-pii-tag {
  background: rgba(133, 77, 18, 0.12);
  color: var(--status-warn);
  border-radius: var(--radius-pill);
  padding: 2px 9px;
  font-size: 11.5px;
  font-weight: 600;
}

.invoice-validate-textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  min-height: 160px;
  line-height: 1.45;
}

.invoice-validate-img {
  max-width: 100%;
  max-height: 260px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
}

.provider-card.is-disabled,
.provider-card:disabled {
  opacity: 0.52;
  cursor: not-allowed;
  background: var(--bg-subtle);
}

/* ==========================================================================
   Drinking Readiness Indicators & Timeline
   ========================================================================== */
.readiness-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid transparent;
  line-height: 1.45;
  white-space: nowrap;
}

.readiness-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: currentColor;
}

.readiness-peak {
  background: var(--status-success-soft);
  border-color: var(--status-success-border);
  color: var(--status-success);
}

.readiness-early {
  background: #edf6f4;
  border-color: #c2dfd9;
  color: #1f5d52;
}

.readiness-hold {
  background: var(--status-info-soft);
  border-color: var(--status-info-border);
  color: var(--status-info);
}

.readiness-soon {
  background: var(--status-warn-soft);
  border-color: var(--status-warn-border);
  color: var(--status-warn);
}

.readiness-past {
  background: var(--status-danger-soft);
  border-color: var(--status-danger-border);
  color: var(--status-danger);
}

.card-readiness-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.readiness-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.readiness-box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.readiness-box-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.readiness-track-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.readiness-track {
  position: relative;
  height: 7px;
  border-radius: var(--radius-pill);
  background: var(--border-subtle);
  overflow: visible;
}

.readiness-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--status-success);
}

.readiness-fill.state-early { background: #2c7a6b; }
.readiness-fill.state-hold { background: var(--status-info); }
.readiness-fill.state-soon { background: var(--wine-amber); }
.readiness-fill.state-past { background: var(--status-danger); }

.readiness-marker {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--action-primary);
  border: 2px solid var(--bg-surface);
  box-shadow: var(--shadow-xs);
  transform: translate(-50%, -50%);
}

.readiness-years {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   My Cellar Controls Row & Editable Table View
   ========================================================================== */
.cellar-controls-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.cellar-controls-row .pill-strip {
  margin-bottom: 0;
}

@media (min-width: 768px) {
  .cellar-controls-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
  }
}

.view-switch {
  display: inline-flex;
  align-self: flex-start;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
  box-shadow: var(--shadow-xs);
  flex-shrink: 0;
}

.view-switch-btn {
  min-height: 36px;
  padding: 0 13px;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

@media (max-width: 767px) {
  .view-switch-btn {
    min-height: 44px;
  }
}

.view-switch-btn.active {
  background: var(--action-primary);
  color: var(--text-inverse);
}

.cellar-table-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.table-toolbar {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.table-toolbar-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  font-size: 13px;
  color: var(--text-secondary);
}

.table-toolbar-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.table-reset-confirm {
  padding: var(--space-4);
  background: var(--status-danger-soft);
  border-bottom: 1px solid var(--status-danger-border);
  color: var(--status-danger);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  font-size: 13.5px;
}

.cellar-table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.cellar-edit-table {
  width: 100%;
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.cellar-edit-table th,
.cellar-edit-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  text-align: left;
}

.cellar-edit-table thead th {
  background: var(--bg-subtle);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  white-space: nowrap;
}

.cellar-edit-table tbody tr:last-child td {
  border-bottom: none;
}

.cellar-edit-table tbody tr.is-dirty {
  background: var(--wine-white-soft);
}

.cellar-edit-table tbody tr.is-marked-delete {
  background: var(--status-danger-soft);
  opacity: 0.72;
}

.cellar-edit-table tbody tr.is-marked-delete input,
.cellar-edit-table tbody tr.is-marked-delete select {
  text-decoration: line-through;
}

.tbl-input,
.tbl-select {
  min-height: 38px !important;
  padding: 6px 9px !important;
  font-size: 13px !important;
  border-radius: var(--radius-xs) !important;
}

@media (max-width: 767px) {
  .tbl-input,
  .tbl-select {
    min-height: 44px !important;
  }
}

.tbl-col-name { min-width: 185px; }
.tbl-col-producer { min-width: 155px; }
.tbl-col-vintage { width: 88px; min-width: 84px; }
.tbl-col-type { width: 118px; min-width: 112px; }
.tbl-col-qty { width: 132px; min-width: 128px; }
.tbl-col-price { width: 162px; min-width: 156px; }
.tbl-col-window { width: 145px; min-width: 140px; }
.tbl-col-region { min-width: 145px; }
.tbl-col-actions { width: 148px; min-width: 144px; white-space: nowrap; }

.tbl-qty-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tbl-qty-btn {
  min-width: 34px;
  min-height: 36px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xs);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  line-height: 1;
}

@media (max-width: 767px) {
  .tbl-qty-btn {
    min-width: 40px;
    min-height: 44px;
  }
}

.tbl-qty-btn:hover:not(:disabled) {
  background: var(--bg-hover);
}

.tbl-qty-input {
  width: 54px !important;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.tbl-price-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tbl-price-input {
  width: 82px !important;
  font-variant-numeric: tabular-nums;
}

.tbl-cur-select {
  width: 68px !important;
  padding-left: 6px !important;
  padding-right: 4px !important;
}

.tbl-window-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tbl-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ==========================================================================
   Critic Score Pills & Acronyms Glossary Modal
   ========================================================================== */
.critic-scores-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.critic-pill-group {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  overflow: hidden;
}

.critic-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  font-size: 11.5px;
  font-weight: 600;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  line-height: 1.45;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}

.critic-pill:hover {
  border-color: var(--wine-red-border);
  background: var(--wine-red-soft);
}

.critic-pill-group .critic-pill {
  border: none;
  border-radius: 0;
  background: transparent;
}

.critic-pill-lg {
  min-height: 36px;
  padding: 4px 11px;
  font-size: 12.5px;
}

@media (max-width: 767px) {
  .critic-pill-lg {
    min-height: 44px;
  }
}

.critic-pill-code {
  color: var(--wine-red-text);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.critic-source-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  min-height: 36px;
  padding: 0 8px 0 4px;
  border-left: 1px solid var(--border-subtle);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 12px;
}

@media (max-width: 767px) {
  .critic-source-link {
    min-width: 38px;
    min-height: 44px;
  }
}

.critic-source-link:hover {
  color: var(--wine-red-text);
  background: var(--wine-red-soft);
}

.critic-scores-panel {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.critic-scores-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.critic-scores-label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.link-btn {
  background: transparent;
  border: none;
  padding: 4px 2px;
  color: var(--wine-red-text);
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.glossary-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.glossary-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: 11px 13px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}

.glossary-item.is-highlighted {
  background: var(--wine-red-soft);
  border-color: var(--wine-red);
}

.glossary-code {
  min-width: 46px;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  color: var(--wine-red-text);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

.glossary-item.is-highlighted .glossary-code {
  background: var(--wine-red);
  border-color: var(--wine-red);
  color: var(--text-inverse);
}

.glossary-info {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.glossary-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}

.glossary-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.glossary-notes {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* ==========================================================================
   Local PDF Privacy Shield & Canvas Crop / Blackout Studio
   ========================================================================== */
.invoice-privacy-shield {
  background: var(--status-success-soft);
  border: 1px solid var(--status-success-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text-primary);
  font-size: 13px;
}

.invoice-privacy-shield-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}

.invoice-privacy-shield-head strong {
  color: var(--status-success);
}

.invoice-shield-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.invoice-shield-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  border: 1px solid var(--status-success-border);
  color: var(--status-success);
  font-size: 11.5px;
  font-weight: 600;
}

.invoice-text-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.crop-studio {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.crop-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.crop-tool-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.crop-hint {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.crop-canvas-wrap {
  width: 100%;
  overflow: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  background: #e9e9ef;
  display: flex;
  justify-content: center;
  padding: 8px;
}

.crop-canvas {
  max-width: 100%;
  height: auto;
  display: block;
  touch-action: none;
  cursor: crosshair;
  box-shadow: var(--shadow-xs);
  background: #ffffff;
}

.invoice-override-box {
  background: var(--status-warn-soft);
  border: 1px solid var(--status-warn-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.invoice-override-box p {
  margin: 0;
  line-height: 1.45;
}

.override-check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 44px;
  padding-top: 4px;
  cursor: pointer;
  font-weight: 500;
}

.override-check-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--wine-red);
  flex-shrink: 0;
}

/* ==========================================================================
   Cellar Drinking Window Alert Strip & Insights Dashboard
   ========================================================================== */
.readiness-alert-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  padding: 12px 16px;
  background: var(--status-warn-soft);
  border: 1px solid var(--status-warn-border);
  border-radius: var(--radius-md);
  font-size: 13.5px;
  color: var(--text-primary);
}

.readiness-alert-copy {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.readiness-alert-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.insights-root {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.insights-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.insights-header h2 {
  margin: 0 0 4px;
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
}

.insights-header p {
  margin: 0;
  font-size: 14px;
}

.insights-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}

@media (min-width: 768px) {
  .insights-kpi-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.35;
}

.insights-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.insights-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.insights-panel-head h3 {
  margin: 0 0 2px;
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.insights-panel-head p {
  margin: 0;
  font-size: 13px;
}

.insights-bucket-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.insights-bucket-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

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

.insights-bucket-btn.active {
  background: var(--wine-red-soft);
  border-color: var(--wine-red-border);
  color: var(--wine-red-text);
}

.insights-bucket-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.insights-alert-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.insights-alert-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding: 12px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.insights-alert-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.insights-alert-badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.insights-alert-title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.insights-alert-sub {
  font-size: 12.5px;
  color: var(--text-muted);
}

.insights-alert-side {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.insights-alert-price {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.insights-grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

@media (min-width: 820px) {
  .insights-grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.insights-type-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}

@media (min-width: 520px) {
  .insights-type-layout {
    flex-direction: row;
    align-items: center;
  }
}

.insights-donut-wrap {
  position: relative;
  width: 128px;
  height: 128px;
  flex-shrink: 0;
}

.insights-donut-svg {
  display: block;
}

.insights-donut-centre {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.insights-donut-centre strong {
  font-family: var(--font-serif);
  font-size: 22px;
  line-height: 1.1;
  color: var(--text-primary);
}

.insights-donut-centre span {
  font-size: 11px;
  color: var(--text-muted);
}

.insights-type-bars {
  width: 100%;
  min-width: 0;
  flex: 1;
}

.insights-bar-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.insights-bar-row {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 6px 8px;
  margin: -6px -8px;
  border-radius: var(--radius-xs);
  border: none;
  background: transparent;
  text-align: left;
  font-family: inherit;
  color: inherit;
}

.insights-bar-row.is-clickable {
  cursor: pointer;
  min-height: 44px;
  justify-content: center;
  transition: background var(--dur-fast) var(--ease);
}

.insights-bar-row.is-clickable:hover {
  background: var(--bg-hover);
}

.insights-bar-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}

.insights-bar-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.insights-bar-meta {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.insights-bar-track {
  width: 100%;
  height: 7px;
  border-radius: var(--radius-pill);
  background: var(--bg-hover);
  overflow: hidden;
}

.insights-bar-fill {
  display: block;
  height: 100%;
  border-radius: var(--radius-pill);
}

.insights-rank-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.insights-rank-row {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 10px 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}

.insights-rank-row:hover {
  background: var(--bg-surface);
  border-color: var(--border-strong);
}

.insights-rank-info {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.insights-rank-info strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.insights-rank-info span {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.insights-rank-val {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
  text-align: right;
}

.insights-rank-val strong {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.insights-rank-val span {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* ==========================================================================
   Close-Match Prompt & Duplicate Consolidation Modal
   ========================================================================== */
.match-banner-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.match-banner-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.invoice-match-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.invoice-item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.invoice-item-footer .card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.modal-duplicate-banner {
  background: var(--wine-white-soft);
  border: 1px solid var(--wine-white-border);
  border-left: 3px solid var(--wine-white);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.modal-duplicate-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.modal-duplicate-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--wine-white-text);
}

.modal-duplicate-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.modal-duplicate-info {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13.5px;
  color: var(--text-primary);
}

.modal-duplicate-info span {
  font-size: 12.5px;
  color: var(--text-secondary);
}

.consolidate-compare-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}

@media (min-width: 560px) {
  .consolidate-compare-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.consolidate-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.consolidate-card.is-keep {
  background: var(--bg-surface);
  border-color: var(--wine-red);
  box-shadow: 0 0 0 1px rgba(122, 30, 52, 0.14);
}

.consolidate-card-eyebrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.consolidate-card.is-keep .consolidate-card-eyebrow {
  color: var(--wine-red);
}

.consolidate-card-head {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.consolidate-thumb {
  width: 52px;
  height: 70px;
  object-fit: cover;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
  background: var(--bg-surface);
}

.consolidate-card-titles {
  min-width: 0;
  flex: 1;
}

.consolidate-card-name {
  font-family: var(--font-serif);
  font-size: 16.5px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.25;
}

.consolidate-card-producer {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.consolidate-meta-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.consolidate-qty-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.consolidate-qty-label {
  font-size: 12px;
  font-weight: 650;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.consolidate-preserve-note {
  font-size: 12.5px;
  color: var(--text-secondary);
  background: var(--status-success-soft);
  border: 1px solid var(--status-success-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  line-height: 1.45;
}

.consolidate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border-subtle);
}

.consolidate-actions .btn {
  flex: 1 1 180px;
  min-height: 44px;
}

[hidden] {
  display: none !important;
}


/* ---------- PWA Access, Invite Gate & Cloud Sync ---------- */
.pwa-sync-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pwa-sync-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.pwa-sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.pwa-sync-badge.synced {
  color: var(--status-ready-text, #166534);
  border-color: rgba(22, 101, 52, 0.22);
  background: rgba(22, 101, 52, 0.08);
}

.pwa-sync-badge.syncing {
  color: var(--accent, #7c2d3c);
  border-color: rgba(124, 45, 60, 0.22);
  background: rgba(124, 45, 60, 0.07);
}

.pwa-sync-badge.error {
  color: var(--danger, #b91c1c);
  border-color: rgba(185, 28, 28, 0.22);
  background: rgba(185, 28, 28, 0.08);
}

.pwa-quota-bar {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--border-subtle);
  overflow: hidden;
}

.pwa-quota-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent, #7c2d3c);
  transition: width 0.25s ease;
}

.pwa-sync-meta {
  font-size: 12.5px;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.pwa-sync-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}
