/* Wine Cellar — base layout & components (theme vars only) */

/*
 * ── Responsive Breakpoints ──
 * Used consistently throughout this file and all component styles.
 *
 *   --bp-mobile:   640px   (max-width: 640px  = mobile)
 *   --bp-tablet:   641px   (min-width: 641px  = tablet and up)
 *   --bp-desktop:  1024px  (min-width: 1024px = desktop and up)
 *   --bp-wide:     1440px  (min-width: 1440px = wide desktop)
 *
 * Usage in media queries (CSS cannot use custom properties in @media):
 *   @media (max-width: 640px)  { ... }   mobile
 *   @media (min-width: 641px)  { ... }   tablet+
 *   @media (min-width: 1024px) { ... }   desktop+
 *   @media (min-width: 1440px) { ... }   wide+
 */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  padding-top: 148px;
}

body.app-shell-unauth {
  padding-top: 0;
}

@media (min-width: 641px) {
  body {
    padding-top: 170px;
  }
}

h1,
h2,
h3,
h4 {
  margin: 0 0 0.5rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text);
}

h1 {
  font-size: 1.75rem;
}

h2 {
  font-size: 1.35rem;
}

h3 {
  font-size: 1.15rem;
}

h4 {
  font-size: 1rem;
}

p {
  margin: 0 0 0.75rem;
  color: var(--text-muted);
}

small {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent-hover);
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.container {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 1024px) {
  .container {
    padding: 0 1.5rem;
  }
}

.grid {
  display: grid;
  gap: 1rem;
}

.grid.cols-2 {
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .grid.cols-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.grid.cols-3 {
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .grid.cols-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .grid.cols-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

.grid.cols-4 {
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .grid.cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .grid.cols-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

.grid.cols-6 {
  grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 640px) {
  .grid.cols-6 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1024px) {
  .grid.cols-6 {
    grid-template-columns: repeat(6, 1fr);
  }
}

.flex {
  display: flex;
}

.flex-wrap {
  flex-wrap: wrap;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-sm {
  gap: 0.5rem;
}

.gap {
  gap: 0.75rem;
}

.gap-lg {
  gap: 1rem;
}

/* Nav */
.app-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  background: var(--nav-bg);
  border-bottom: none;
  box-shadow: var(--nav-shadow, 0 2px 12px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04));
}

body.app-shell-unauth .app-nav {
  position: fixed;
  background: transparent;
  box-shadow: none;
  border-bottom: none;
}

body.app-shell-unauth .nav-tab-bar,
body.app-shell-unauth .hamburger,
body.app-shell-unauth .mobile-nav-panel {
  display: none !important;
}

body.app-shell-unauth .nav-logo {
  display: none;
}

body.app-shell-unauth .nav-brand span {
  display: none;
}

.nav-top-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.45rem 1rem;
}

@media (min-width: 641px) {
  .nav-top-line {
    padding: 0.45rem 1.5rem;
  }
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.nav-brand:hover {
  opacity: 0.85;
}

.nav-brand span {
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--accent, var(--text));
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.nav-logo {
  display: block;
  height: 72px;
  max-width: 72px;
  width: auto;
  flex-shrink: 0;
  margin: 0;
  object-fit: contain;
  filter: var(--logo-filter, none);
  transition: transform 0.2s ease;
}

.nav-brand:hover .nav-logo {
  transform: scale(1.03);
}

@media (min-width: 641px) {
  .nav-logo {
    height: 84px;
    max-width: 84px;
    margin: 0;
  }
}

.nav-tab-bar {
  display: none;
  width: 100%;
  border-top: 1px solid var(--nav-divider, rgba(0, 0, 0, 0.08));
  padding: 0 1rem;
}

@media (min-width: 641px) {
  .nav-tab-bar {
    display: block;
    padding: 0 1.5rem;
  }
}

.nav-tabs {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
}

.nav-tabs-left,
.nav-tabs-right {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-tab {
  position: relative;
  padding: 0.6rem 0.85rem;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s ease;
}

a.nav-tab {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  box-sizing: border-box;
}

.nav-tab::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0.85rem;
  right: 0.85rem;
  height: 2.5px;
  border-radius: 2px 2px 0 0;
  background: transparent;
  transition: background 0.2s ease;
}

.nav-tab:hover {
  color: var(--text);
}

.nav-tab:hover::after {
  background: var(--accent-muted);
}

.nav-tab.active {
  color: var(--accent);
  font-weight: 600;
}

.nav-tab.active::after {
  background: var(--accent);
}

.nav-tabs-right .nav-tab {
  font-size: 0.8125rem;
  padding: 0.5rem 0.7rem;
  opacity: 0.8;
}

.nav-tabs-right .nav-tab::after {
  left: 0.7rem;
  right: 0.7rem;
}

.nav-tabs-right .nav-tab:hover {
  opacity: 1;
}

.nav-tabs-right .nav-tab.active {
  opacity: 1;
}

.nav-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  flex-shrink: 0;
}

.nav-secondary-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.nav-actions .select {
  padding: 0.3rem 0.5rem;
  font-size: 0.8125rem;
  border-radius: 6px;
  border-color: var(--nav-divider, var(--border));
  background: var(--nav-control-bg, var(--bg));
}

.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

@media (min-width: 641px) {
  .hamburger {
    display: none;
  }
}

.hamburger-line {
  display: block;
  height: 2px;
  width: 20px;
  background: var(--text);
  border-radius: 1px;
}

.mobile-nav-panel {
  display: none;
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  z-index: 99;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem 1rem 1rem;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--nav-border);
  box-shadow: var(--shadow-lg);
}

.mobile-nav-panel.open {
  display: flex;
}

@media (min-width: 641px) {
  .mobile-nav-panel {
    display: none !important;
  }
}

.mobile-nav-panel .nav-tab {
  width: 100%;
  text-align: left;
}

.mobile-nav-divider {
  border: none;
  border-top: 1px solid var(--nav-border, var(--border));
  margin: 0.35rem 0;
}

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2.4rem 1rem 1rem;
}

.login-center {
  width: min(100%, 460px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
}

.landing-hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.4rem;
}

.landing-hero h1 {
  margin-bottom: 0.3rem;
}

.landing-hero-compact {
  padding: 0.7rem 0.9rem;
}

.landing-hero-compact h2 {
  margin: 0 0 0.2rem;
  font-size: 1rem;
}

.landing-hero-compact p {
  margin: 0;
  font-size: 0.82rem;
}

.landing-feature-list {
  margin: 0.25rem 0 0;
  padding-left: 1.15rem;
  color: var(--text-muted);
}

.landing-feature-list li {
  margin-bottom: 0.35rem;
}

.landing-auth {
  width: 100%;
}

.landing-auth h2 {
  margin-bottom: 0.35rem;
}

.login-logo {
  height: clamp(130px, 24vw, 220px);
  max-width: min(78vw, 300px);
  width: auto;
  object-fit: contain;
  opacity: 0.92;
}

.login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.login-form .input,
.login-submit {
  min-height: 44px;
}

.login-submit {
  width: 100%;
}

.login-inline-error {
  margin: 0;
  font-size: 0.85rem;
  color: var(--error);
  text-align: center;
}

.login-confirm-error {
  margin: -0.2rem 0 0.05rem;
  font-size: 0.8rem;
  color: var(--error);
  text-align: left;
}

.login-form .input.input-invalid {
  border-color: var(--error);
  box-shadow: 0 0 0 1px var(--error);
}

.login-forgot {
  margin-top: 0.15rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.2rem 0;
}

.login-show-passwords {
  align-self: flex-end;
  border: none;
  background: transparent;
  color: var(--text-muted);
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.82rem;
  padding: 0.1rem 0;
}

.login-shell .public-site-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  text-align: center;
}

.login-shell .public-site-links__link {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.login-shell .public-site-links__link:hover {
  color: var(--accent);
}

.login-shell .public-site-links__sep {
  color: var(--text-muted);
  user-select: none;
}

.app-footer {
  width: 100%;
  margin: 0;
  padding: 0.9rem 1rem calc(0.95rem + env(safe-area-inset-bottom, 0));
  text-align: center;
  font-size: 0.8125rem;
}

.app-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.app-footer__link {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.app-footer__link:hover {
  color: var(--accent);
}

.app-footer__sep {
  color: var(--text-muted);
  user-select: none;
}

.forgot-form {
  width: min(100%, 430px);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.forgot-form .input,
.forgot-form .btn {
  min-height: 44px;
}

@media (min-width: 860px) {
  .login-logo {
    height: clamp(180px, 22vw, 280px);
    max-width: min(30vw, 360px);
  }
}

body.app-shell-unauth .nav-top-line {
  justify-content: flex-end;
  padding-top: 0.65rem;
}

body.app-shell-unauth .nav-actions {
  gap: 0.35rem;
}

body.app-shell-unauth .nav-actions .select {
  min-height: 40px;
}

@media (max-width: 640px) {
  .login-logo {
    height: 150px;
  }

  body.app-shell-unauth .nav-top-line {
    padding: 0.5rem 0.6rem;
  }

  body.app-shell-unauth .nav-actions .select {
    min-height: 44px;
    max-width: none !important;
  }

  .landing-hero {
    order: 2;
  }

  .landing-auth {
    order: 1;
  }
}

/* Cards */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.125rem;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

/* Tables */
.data-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th,
.data-table td {
  padding: 0.65rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface);
  white-space: nowrap;
}

.data-table th.sortable {
  cursor: pointer;
  user-select: none;
}

.data-table th.sortable:hover {
  color: var(--accent);
}

.data-table tbody tr {
  transition: background 0.2s ease;
}

.data-table tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.02);
}

/* dark-mode striping handled in dark.css */

.data-table tbody tr:hover {
  background: var(--accent-muted);
}

.data-table tbody tr.clickable-row {
  cursor: pointer;
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
  color: var(--text);
}

.form-row {
  display: grid;
  gap: 0.75rem;
}

.bulk-price-point-meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

@media (min-width: 640px) {
  .form-row.cols-2 {
    grid-template-columns: 1fr 1fr;
  }

  .bulk-price-point-meta {
    grid-template-columns: repeat(3, minmax(160px, 1fr));
    align-items: end;
  }
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 0.5rem 0.65rem;
  font-size: 0.9375rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.textarea {
  min-height: 88px;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--accent);
}

.form-error {
  font-size: 0.75rem;
  color: var(--error);
  margin-top: 0.25rem;
}

a.btn {
  text-decoration: none;
  box-sizing: border-box;
}

.table-cell-link {
  color: inherit;
  text-decoration: none;
  font-weight: inherit;
}

.table-cell-link:hover {
  text-decoration: underline;
}

.kpi-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.kpi-card-link:focus-visible {
  outline: 2px solid var(--accent, #7f1d1d);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: var(--text-inverse);
  border-color: var(--accent);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-danger {
  background: var(--error-bg);
  color: var(--error);
  border-color: var(--error);
}

.btn-danger:hover:not(:disabled) {
  background: var(--error);
  color: var(--text-inverse);
}

.btn-icon {
  padding: 0.45rem;
  min-width: 40px;
  min-height: 40px;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.8125rem;
}

/* Pills */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
}

.pill-red {
  background: var(--error-bg);
  color: var(--error);
}

.pill-green {
  background: var(--success-bg);
  color: var(--success);
}

.pill-amber {
  background: var(--warning-bg);
  color: var(--warning);
}

.pill-blue {
  background: var(--info-bg);
  color: var(--info);
}

.pill-muted {
  background: var(--surface);
  color: var(--text-muted);
}

.pill-owner {
  background: #DBEAFE;
  color: #1E40AF;
  font-weight: 600;
}

/* Color dots */
.color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid var(--border-strong);
}

.color-dot.red {
  background: var(--wine-red);
}

.color-dot.white {
  background: var(--wine-white);
}

.color-dot.rose {
  background: var(--wine-rose);
}

.color-dot.orange {
  background: var(--wine-orange);
}

.color-dot.sparkling {
  background: var(--wine-sparkling);
}

/* KPI */
.kpi-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: var(--shadow);
  min-height: 100px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.kpi-card .kpi-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.kpi-card .kpi-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}

.kpi-card .kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--accent-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}

.kpi-card.accent .kpi-value {
  color: var(--accent);
}

.kpi-card.success .kpi-value {
  color: var(--success);
}

.kpi-card.warning .kpi-value {
  color: var(--warning);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}

@media (min-width: 640px) {
  .modal-overlay {
    align-items: center;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s ease;
}

.modal-content > form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

@media (min-width: 640px) {
  .modal-content.modal-wide {
    max-width: 720px;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(12px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.modal-body {
  padding: 1rem 1.25rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  padding: 0.75rem 1.25rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
}

/* Toast */
#toast-container {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: min(100vw - 1.25rem, 560px);
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  line-height: 1.45;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  animation: toastIn 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.toast-message {
  flex: 1;
  font-weight: 600;
  word-break: break-word;
}

.toast-close {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: inherit;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  opacity: 0.95;
  padding: 0.2rem 0.42rem;
  min-width: 1.7rem;
  min-height: 1.7rem;
}

.toast-persistent {
  font-size: 0.98rem;
  padding: 1rem 1.05rem;
  border-width: 2px;
}

@keyframes toastIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast-success {
  border-color: var(--success);
  border-left: 5px solid var(--success);
  background: linear-gradient(0deg, var(--success-bg), var(--success-bg)), var(--bg-elevated);
}

.toast-warning {
  border-color: var(--warning);
  border-left: 5px solid var(--warning);
  background: linear-gradient(0deg, var(--warning-bg), var(--warning-bg)), var(--bg-elevated);
}

.toast-error {
  border-color: var(--error);
  border-left: 5px solid var(--error);
  background: linear-gradient(0deg, var(--error-bg), var(--error-bg)), var(--bg-elevated);
}

/* Drinking window bar */
.drinking-window-bar {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: var(--surface);
  overflow: hidden;
  margin-top: 0.35rem;
}

.drinking-window-bar .segment {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--warning), var(--success));
  opacity: 0.85;
}

.drinking-window-bar .marker {
  position: absolute;
  top: -3px;
  width: 3px;
  height: 16px;
  background: var(--accent);
  border-radius: 1px;
  transform: translateX(-50%);
  z-index: 2;
  box-shadow: 0 0 0 2px var(--bg);
}

/* Drinking window detail widget */
.dw-detail {
  padding: 0.5rem 0;
}
.dw-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.dw-bar {
  position: relative;
  height: 28px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: visible;
}
.dw-segment {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 6px;
}
.dw-seg-window {
  background: linear-gradient(90deg, #fbbf24, #22c55e, #fbbf24);
  opacity: 0.35;
}
.dw-seg-peak {
  background: var(--success);
  opacity: 0.55;
  border-radius: 4px;
}
.dw-now {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 3px;
  background: var(--accent);
  border-radius: 2px;
  transform: translateX(-50%);
  z-index: 3;
  box-shadow: 0 0 0 2px var(--bg);
}
.dw-now-label {
  position: absolute;
  top: -22px;
  transform: translateX(-50%);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
  z-index: 4;
}
.dw-labels {
  position: relative;
  height: 1.4rem;
  margin-top: 0.25rem;
}
.dw-label-start,
.dw-label-end,
.dw-label-peak {
  position: absolute;
  transform: translateX(-50%);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}
.dw-label-peak {
  color: var(--success, #16a34a);
  font-size: 0.7rem;
  font-weight: 700;
  opacity: 0.85;
}
.dw-meta {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.dw-meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.dw-meta-key {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.dw-meta-val {
  font-size: 1rem;
  font-weight: 600;
}

.dw-adjuster {
  margin-top: 0.75rem;
  margin-bottom: 1.15rem;
  padding: 0.85rem 0.95rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.dw-adjuster h3 {
  margin-bottom: 0.35rem;
}

.dw-adjuster > p {
  margin-bottom: 0.85rem;
}

.dw-preview-toggle {
  border-radius: var(--radius-sm);
}

.dw-toggle-pill {
  cursor: pointer;
  transition: box-shadow 0.2s ease;
}

.dw-toggle-pill:hover {
  box-shadow: 0 0 0 1px var(--accent);
}

.dw-adjuster-track {
  position: relative;
  height: 44px;
  margin: 1.7rem 0 1.7rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg-elevated);
}

.dw-adjuster-edge-labels,
.dw-adjuster-peak-labels {
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: none;
}

.dw-adjuster-edge-labels {
  top: -1.1rem;
}

.dw-adjuster-peak-labels {
  bottom: -1.2rem;
}

.dw-adjuster-label {
  position: absolute;
  transform: translateX(-50%);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--surface);
  padding: 0 0.2rem;
  border-radius: 4px;
  white-space: nowrap;
}

.dw-adjuster-label.peak-start,
.dw-adjuster-label.peak-end {
  color: var(--success);
}

.dw-main-window {
  position: absolute;
  top: 6px;
  bottom: 6px;
  min-width: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--warning), var(--success), var(--warning));
  opacity: 0.8;
  cursor: grab;
}

.dw-main-handle {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg);
  cursor: ew-resize;
}

.dw-main-handle.left {
  left: -6px;
}

.dw-main-handle.right {
  right: -6px;
}

.dw-peak-window {
  position: absolute;
  top: 4px;
  bottom: 4px;
  min-width: 10px;
  border-radius: 999px;
  background: var(--success);
  opacity: 0.9;
}

.dw-peak-handle {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 10px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg);
  cursor: ew-resize;
}

.dw-peak-handle.left {
  left: -5px;
}

.dw-peak-handle.right {
  right: -5px;
}

.dw-main-handle.dragging,
.dw-peak-handle.dragging {
  cursor: grabbing;
}

.dw-adjuster-now-marker {
  position: absolute;
  top: 2px;
  bottom: 2px;
  width: 2px;
  background: var(--accent);
  transform: translateX(-50%);
  opacity: 0.9;
}

.dw-adjuster-now-label {
  position: absolute;
  top: -1.65rem;
  transform: translateX(-50%);
  font-size: 0.7rem;
  color: var(--accent);
  font-weight: 700;
  background: var(--surface);
  padding: 0 0.2rem;
  border-radius: 4px;
  z-index: 3;
}

.dw-adjuster-actions {
  margin-top: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.dw-adjuster-status {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.dw-adjuster-reset-btn {
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
}

.vintage-window-manual {
  border-left: 4px solid var(--warning);
}

.dw-manual-badge {
  font-weight: 700;
  letter-spacing: 0.01em;
}

/* Charts */
.chart-card {
  position: relative;
  min-height: 260px;
}

.chart-card canvas {
  max-height: 280px;
}

.chart-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.chart-tab {
  padding: 0.35rem 0.65rem;
  font-size: 0.8125rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.chart-tab:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.chart-tab.active {
  border-color: var(--accent);
  background: var(--accent-muted);
  color: var(--accent);
  font-weight: 600;
}

/* Summary bar */
.summary-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.65rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--text-muted);
}

.summary-bar strong {
  color: var(--text);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 2.5rem 1.5rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
}

.empty-state .empty-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  opacity: 0.5;
}

.empty-state p {
  margin-bottom: 1rem;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

/* Skeleton */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface) 25%,
    var(--border) 50%,
    var(--surface) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@media (prefers-reduced-motion: reduce) {
  .skeleton {
    animation: none;
    background: var(--surface);
  }
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.skeleton-text {
  height: 0.9em;
  margin-bottom: 0.5rem;
}

.skeleton-title {
  height: 1.5rem;
  width: 60%;
  margin-bottom: 0.75rem;
}

.skeleton-kpi {
  height: 100px;
  border-radius: var(--radius-md);
}

/* Spinner */
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation: none;
    border-top-color: var(--border);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Page layout */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.wine-detail-layout {
  display: grid;
  gap: 1.25rem;
}

.wine-detail-layout > div > .card + .card {
  margin-top: 0.45rem;
}

@media (min-width: 1024px) {
  .wine-detail-layout {
    grid-template-columns: 1fr 280px;
    align-items: start;
  }
}

.sidebar-panel {
  position: sticky;
  top: 225px;
}

.wine-header-band {
  height: 6px;
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
}

.vintage-rating-editor {
  display: flex;
  align-items: end;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.vintage-rating-editor label {
  margin: 0;
  min-width: 120px;
}

.vintage-rating-input {
  width: 110px;
}

.dw-meta-val-rating {
  display: block;
}

.dw-rating-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.tag-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.tag-cloud-chip {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.tag-cloud-chip.is-active {
  background: var(--accent-muted);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.tag-cloud-create {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.5rem;
  align-items: center;
}

.tag-cloud-create input[type="color"] {
  width: 3rem;
  min-width: 3rem;
  padding: 0.1rem;
}

@media (max-width: 640px) {
  .tag-cloud-create {
    grid-template-columns: 1fr;
  }
}

.filter-panel {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

@media (min-width: 640px) {
  .filter-panel {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .filter-panel {
    grid-template-columns: repeat(4, 1fr);
  }
}

.inv-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.65rem 0.85rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
}

.inv-filter-bar .input,
.inv-filter-bar .select {
  flex: 1;
  min-width: 0;
  max-width: 100%;
}

.inv-filter-bar .input[type="search"] {
  flex: 2;
  min-width: 10rem;
}

.inv-filter-bar .select {
  min-width: 7rem;
  max-width: 12rem;
}

.inv-filter-bar .inventory-tag-multiselect {
  min-width: 11rem;
  max-width: 14rem;
  height: 2.7rem;
}

@media (max-width: 640px) {
  .inv-filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .inv-filter-bar .input,
  .inv-filter-bar .select {
    max-width: 100%;
  }
}

.inventory-export-bar {
  display: flex;
  justify-content: flex-end;
  margin-top: 1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 640px) {
  .inventory-export-bar {
    justify-content: stretch;
  }
  .inventory-export-bar .btn {
    width: 100%;
  }
}

.color-filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.color-filter-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.color-filter-btn:hover {
  transform: scale(1.06);
}

.color-filter-btn.active {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
}

.inventory-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .inventory-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .inventory-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.wine-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.wine-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.wine-card-band {
  height: 8px;
  width: 100%;
}

.wine-card-body {
  padding: 1rem;
}

.table-actions {
  display: flex;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.data-table tbody tr:hover .table-actions,
.wine-card:hover .table-actions {
  opacity: 1;
}

@media (max-width: 640px) {
  .table-actions {
    opacity: 1;
  }
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.text-muted {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-right {
  text-align: right;
}

.mt-1 {
  margin-top: 0.5rem;
}

.mb-1 {
  margin-bottom: 0.5rem;
}

.py-1 {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.quick-actions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

.admin-user-create-form {
  display: grid;
  gap: 0.6rem;
}

.admin-tag-create-form {
  display: grid;
  gap: 0.6rem;
  margin-bottom: 0.8rem;
}

.admin-tag-color-wrap {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr);
  gap: 0.5rem;
  align-items: center;
}

.admin-preferences-grid {
  display: grid;
  gap: 0.75rem;
}

.admin-branding-layout {
  display: grid;
  grid-template-columns: minmax(140px, 220px) 1fr;
  gap: 1rem;
  align-items: start;
}

.admin-branding-preview {
  width: 100%;
  max-width: 220px;
  max-height: 140px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--bg-elevated) 70%, #fff 30%);
  padding: 0.5rem;
}

.admin-branding-controls {
  display: grid;
  gap: 0.6rem;
}

@media (max-width: 720px) {
  .admin-branding-layout {
    grid-template-columns: 1fr;
  }
}

.admin-submenu-card {
  padding: 0.55rem 0.65rem;
}

.admin-submenu {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.admin-submenu-link {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  padding: 0.45rem 0.8rem;
  font-size: 0.9rem;
  cursor: pointer;
  min-width: 165px;
}

.admin-submenu-link:hover {
  background: var(--surface);
}

.admin-submenu-link.active {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--bg-elevated));
}

.admin-cellar-zones-wrap {
  display: grid;
  gap: 0.75rem;
}

.admin-cellar-meta-grid {
  display: grid;
  gap: 0.75rem;
}

.admin-cellar-zone-row {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  padding: 0.75rem;
}

.admin-cellar-zone-row h3 {
  margin: 0 0 0.6rem;
  font-size: 0.95rem;
}

.admin-cellar-zone-grid {
  display: grid;
  gap: 0.6rem;
}

.admin-cellar3d-topview {
  position: relative;
  min-height: 220px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}

.admin-cellar3d-wall {
  position: absolute;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
}

.admin-cellar3d-wall-1 {
  left: 10%;
  top: 1rem;
  width: 80%;
  height: 2.5rem;
}

.admin-cellar3d-wall-2 {
  right: 1rem;
  top: 12%;
  width: 2.5rem;
  height: 76%;
}

.admin-cellar3d-wall-3 {
  left: 10%;
  bottom: 1rem;
  width: 80%;
  height: 2.5rem;
}

.admin-cellar3d-wall-4 {
  left: 1rem;
  top: 12%;
  width: 2.5rem;
  height: 76%;
}

.admin-cellar3d-wall-label {
  position: absolute;
  font-size: 0.75rem;
  color: var(--text-muted);
  top: -1.25rem;
  left: 0.1rem;
}

.admin-cellar3d-offset-legend {
  margin: 0;
  font-size: 0.82rem;
  max-width: 52rem;
}

.admin-cellar3d-room-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--text-muted);
  font-size: 0.82rem;
}

.admin-cellar3d-zone-slot {
  position: absolute;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.08rem;
  pointer-events: none;
}

.admin-cellar3d-zone-pill {
  position: relative;
  transform: none;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 18%, var(--bg-elevated));
  color: var(--text);
  font-size: 0.72rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05rem;
  line-height: 1.1;
  text-align: center;
  max-width: min(9rem, 92%);
}

.admin-cellar3d-zone-pill-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.admin-cellar3d-zone-pill-pct {
  font-size: 0.62rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.admin-cellar3d-zones-wrap {
  display: grid;
  gap: 0.75rem;
}

.admin-cellar3d-zone-row {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  padding: 0.75rem;
}

.admin-cellar3d-zone-row h3 {
  margin: 0 0 0.6rem;
  font-size: 0.95rem;
}

.admin-cellar3d-zone-grid {
  display: grid;
  gap: 0.6rem;
}

.cellar-map-zones {
  display: block;
}

.cellar-zone-card > h3 {
  margin: 0 0 0.25rem;
}

.cellar-zone-card {
  width: fit-content;
}

.cellar-zone-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.cellar-rack-grid {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.cellar-rack-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  padding: 0.55rem;
  width: 156px;
  height: 182px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: visible;
}

.cellar-rack-card h4 {
  margin: 0;
  font-size: 0.85rem;
}

.cellar-rack-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}

.cellar-rack-line {
  display: grid;
  gap: 0.5rem;
  width: 100%;
}

.cellar-rack-line:last-child {
  margin-bottom: 0;
}

.cellar-rack-line-label {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.cellar-rack-dots {
  display: grid;
  justify-content: center;
  gap: 0.45rem;
}

.cellar-rack-dots-standard {
  grid-template-columns: repeat(4, 16px);
  row-gap: 0.45rem;
}

.cellar-rack-dots-magnum {
  grid-template-columns: repeat(3, 32px);
  row-gap: 0.5rem;
  column-gap: 0.5rem;
}

.cellar-rack-dots-double-magnum {
  grid-template-columns: repeat(2, 64px);
  row-gap: 0.5rem;
  column-gap: 0.5rem;
}

.cellar-dot {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
}

.cellar-dot.is-filled {
  border-color: var(--accent);
  background: var(--accent);
}

.cellar-dot-magnum.is-filled:not(.cellar-dot-red):not(.cellar-dot-white):not(.cellar-dot-sparkling),
.cellar-dot-double-magnum.is-filled:not(.cellar-dot-red):not(.cellar-dot-white):not(.cellar-dot-sparkling) {
  border-color: var(--success);
  background: var(--success);
}

.cellar-dot.is-filled.cellar-dot-red {
  border-color: #6f2333;
  background: #6f2333;
}

.cellar-dot.is-filled.cellar-dot-white {
  border-color: #d4b530;
  background: #d4b530;
}

.cellar-dot.is-filled.cellar-dot-sparkling {
  border-color: #2d6fd4;
  background: #2d6fd4;
}

.cellar-dot-magnum {
  width: 32px;
  height: 32px;
}

.cellar-dot-double-magnum {
  width: 64px;
  height: 64px;
}

.cellar-rack-visual {
  flex: 1;
  display: flex;
  align-items: center;
}

.cellar-rack-tooltip {
  position: fixed;
  left: 0;
  top: 0;
  transform: translateY(4px);
  width: min(320px, 72vw);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.22);
  padding: 0.6rem 0.7rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease, visibility 140ms ease;
  z-index: 30;
}

.cellar-rack-tooltip.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.cellar-rack-tooltip-title {
  font-weight: 700;
  font-size: 0.82rem;
  margin-bottom: 0.4rem;
}

.cellar-rack-tooltip-list {
  margin: 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.2rem;
  font-size: 0.78rem;
  line-height: 1.3;
  max-height: 210px;
  overflow-y: auto;
}

.cellar-3d-canvas-host {
  width: 100%;
  min-height: 560px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #11151c;
  overflow: hidden;
}

.cellar-3d-canvas-host canvas {
  display: block;
  width: 100%;
  height: 560px;
}

@media (min-width: 760px) {
  .admin-preferences-grid {
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    align-items: end;
  }

  .admin-cellar-meta-grid {
    grid-template-columns: repeat(3, minmax(200px, 1fr));
    align-items: end;
  }

  .admin-cellar-zone-grid {
    grid-template-columns: minmax(220px, 1.4fr) repeat(2, minmax(170px, 1fr));
    align-items: end;
  }

  .admin-cellar3d-zone-grid {
    grid-template-columns: repeat(2, minmax(200px, 1fr));
    align-items: end;
  }
}

@media (min-width: 760px) {
  .admin-user-create-form {
    grid-template-columns: minmax(220px, 1fr) 180px auto;
    align-items: end;
  }

  .admin-tag-create-form {
    grid-template-columns: minmax(220px, 1fr) 90px auto;
    align-items: end;
  }

}

.activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.activity-list li {
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.activity-list li:last-child {
  border-bottom: none;
}

.accordion-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  overflow: hidden;
}

.accordion-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  background: var(--surface);
  border: none;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.accordion-panel {
  padding: 0.75rem 0.85rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  display: none;
}

.accordion-item.open .accordion-panel {
  display: block;
}

.tasting-card {
  border-left: 3px solid var(--accent);
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  background: var(--bg-elevated);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  border: 1px solid var(--border);
  border-left-width: 3px;
}

.rating-slider-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.rating-slider-wrap output {
  min-width: 2rem;
  font-weight: 600;
  color: var(--accent);
}

/* Language switcher */
.lang-switcher {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}
.lang-btn {
  background: none;
  border: 2px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1.25rem;
  padding: 0.15rem 0.3rem;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 200ms, border-color 200ms;
}
.lang-btn:hover {
  opacity: 1;
}
.lang-btn.active {
  opacity: 1;
  border-color: var(--accent);
}

/* ── Temperature page ────────────────────────────────── */
.temp-top-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
@media (min-width: 640px) {
  .temp-top-row {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 1024px) {
  .temp-top-row {
    grid-template-columns: repeat(4, 1fr);
  }
}
.temp-current-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.temp-big {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
}
.temp-value {
  font-size: 4rem;
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
}
.temp-unit {
  font-size: 1.5rem;
  color: var(--text-muted);
}
.temp-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.temp-ideal {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  background: var(--surface);
  color: var(--text-muted);
}
.temp-no-data {
  color: var(--text-muted);
  font-style: italic;
}
.temp-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 1rem;
}
.temp-stat-item {
  display: flex;
  flex-direction: column;
}
.temp-stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.temp-stat-value {
  font-size: 1.1rem;
  font-weight: 600;
}
.temp-period-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.temp-slider-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.25rem;
}

.temp-slider-label {
  font-weight: 600;
  font-size: 1rem;
  min-width: 5rem;
  text-align: center;
}

.temp-period-slider {
  flex: 1;
  accent-color: var(--primary, #7F1D1D);
  height: 6px;
  cursor: pointer;
}

.temp-slider-ticks {
  display: flex;
  justify-content: space-between;
  padding: 0 0.25rem;
  margin-bottom: 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.temp-charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.temp-job-status-card {
  margin-top: 0.75rem;
}

.temp-job-status-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

.temp-job-status-error {
  margin-top: 0.75rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

@media (max-width: 900px) {
  .temp-charts-row {
    grid-template-columns: 1fr;
  }
}

/* Price Changes */
.pc-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.pc-sort-btn {
  all: unset;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-weight: 600;
  color: inherit;
}
.pc-sort-btn:hover {
  text-decoration: underline;
}
.pc-wine-name {
  font-weight: 500;
}
.pc-row:hover {
  background: var(--accent-muted);
}
.pc-row.pc-big-up .pc-change-cell,
.pc-row.pc-big-up .pc-pct-cell {
  color: #15803d;
  font-weight: 700;
}
.pc-row.pc-up .pc-change-cell,
.pc-row.pc-up .pc-pct-cell {
  color: #16a34a;
  font-weight: 600;
}
.pc-row.pc-down .pc-change-cell,
.pc-row.pc-down .pc-pct-cell {
  color: #dc2626;
  font-weight: 600;
}
.pc-row.pc-big-down .pc-change-cell,
.pc-row.pc-big-down .pc-pct-cell {
  color: #991b1b;
  font-weight: 700;
}
.pc-row.pc-flat .pc-change-cell,
.pc-row.pc-flat .pc-pct-cell {
  color: var(--text-muted);
}
.pc-row.pc-big-up {
  border-left: 3px solid #15803d;
}
.pc-row.pc-up {
  border-left: 3px solid #16a34a;
}
.pc-row.pc-down {
  border-left: 3px solid #dc2626;
}
.pc-row.pc-big-down {
  border-left: 3px solid #991b1b;
}
.pc-row.pc-flat {
  border-left: 3px solid transparent;
}

/* ── Drinking Window Editor ── */
.dw-ed-page-header { margin-bottom: 1.5rem; }
.dw-ed-page-header h1 { margin-bottom: 0.25rem; }
.dw-ed-section-header { margin-bottom: 0.75rem; }
.dw-ed-section-header h2 { margin: 0; font-size: 1.1rem; }
.dw-ed-section-header p { margin: 0.15rem 0 0; font-size: 0.85rem; }

.dw-ed-table th,
.dw-ed-table td { padding: 0.3rem 0.5rem; vertical-align: middle; }
.dw-ed-input-wide { width: 100%; min-width: 10rem; }
.dw-ed-input-num { width: 5rem; text-align: right; }
.dw-ed-act-col { width: 2.5rem; text-align: center; }

.dw-ed-row-actions {
  display: flex; gap: 0.5rem; align-items: center;
  padding: 0.5rem 0.5rem 0.25rem; flex-wrap: wrap;
}

.dw-ed-chip-list {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  padding: 0.5rem;
}
.dw-ed-chip {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.2rem 0.6rem; border-radius: 1rem;
  background: var(--accent-soft, rgba(99, 102, 241, 0.12));
  font-size: 0.85rem; font-weight: 500;
}
.dw-ed-chip-x {
  background: none; border: none; cursor: pointer;
  font-size: 0.75rem; line-height: 1; padding: 0;
  color: var(--text-muted); opacity: 0.7;
}
.dw-ed-chip-x:hover { opacity: 1; color: var(--danger, #dc2626); }

.dw-ed-footer {
  display: flex; gap: 1rem; margin-top: 1.5rem;
  padding: 1rem 0; border-top: 1px solid var(--border);
  position: sticky; bottom: 0; background: var(--bg);
  z-index: 5;
}
