/* ============================================================
   WINE CELLAR — La Sommelière ECS51.2Z
   style.css
   ============================================================ */

/* ─── CSS CUSTOM PROPERTIES (THEMING TABLE) ─────────────────
   Change any value here to retheme the entire app.
   ──────────────────────────────────────────────────────────── */
:root {
  /* --- BACKGROUNDS --- */
  --color-bg-page:          #0a0a0a;   /* page background, near-black */
  --color-bg-panel:         #111111;   /* left/right panel background */
  --color-bg-panel-header:  #1a1a1a;   /* panel header bar */
  --color-bg-toolbar:       #141414;   /* top toolbar */
  --color-bg-cabinet:       #181818;   /* cabinet outer frame fill */
  --color-bg-zone:          #141414;   /* zone inner background */
  --color-bg-modal:         #1e1e1e;   /* modal dialog background */
  --color-bg-modal-overlay: rgba(0, 0, 0, 0.80);

  /* --- CABINET STRUCTURE --- */
  --color-cabinet-frame:    #333333;   /* cabinet border/frame */
  --color-shelf-wood:       #954520;   /* shelf bar */
  --color-shelf-wood-light: #b85528;   /* shelf highlight edge */
  --color-shelf-wood-dark:  #6b3016;   /* shelf shadow edge */
  --color-zone-separator:   #2a2a2a;   /* line between zones */

  /* --- BOTTLE CIRCLES --- */
  --color-slot-empty:       #252525;   /* empty slot circle fill */
  --color-slot-empty-border:#333333;   /* empty slot ring */
  --color-wine-red:         #7a0000;   /* red wine circle fill */
  --color-wine-red-inner:   #4a0000;   /* red wine inner circle */
  --color-wine-red-glow:    #cc2222;   /* red wine hover glow */
  --color-wine-white:       #ede8d0;   /* white wine circle fill */
  --color-wine-white-inner: #d5cfa8;   /* white wine inner */
  --color-wine-white-glow:  #fff8e7;   /* white wine hover glow */
  --color-wine-rose:        #b85070;   /* rosé circle fill */
  --color-wine-rose-inner:  #8a3050;
  --color-wine-rose-glow:   #e080a0;
  --color-wine-sparkling:   #c8a020;   /* sparkling gold fill */
  --color-wine-sparkling-inner: #9a7810;
  --color-wine-sparkling-glow:  #f0c840;
  --color-slot-selected:    #ffffff;   /* selection ring */
  --color-slot-move-target: #3a86ff;   /* move-mode highlight ring */
  --color-slot-drag-over:   #5a9fff;   /* drag-over highlight */

  /* --- ACCENT / UI BLUE --- */
  --color-accent:           #3a86ff;   /* primary buttons, links */
  --color-accent-hover:     #5a9fff;
  --color-accent-dark:      #1a5fbf;

  /* --- DANGER --- */
  --color-danger:           #cc3333;
  --color-danger-hover:     #ee4444;

  /* --- TEXT --- */
  --color-text-primary:     #e8e8e8;   /* main text */
  --color-text-secondary:   #888888;   /* muted text, labels */
  --color-text-muted:       #555555;   /* very muted */
  --color-text-inverse:     #111111;   /* text on light circles */

  /* --- BORDERS --- */
  --color-border:           #2a2a2a;
  --color-border-subtle:    #1e1e1e;

  /* --- BEVEL --- */
  /* Raised-panel bevel: bright top/left highlight + dark bottom/right shadow,
     plus an outer drop shadow to lift the panel off the page background.    */
  --bevel-panel: inset 0 2px 0 rgba(255,255,255,0.18),
                 inset 2px 0 0 rgba(255,255,255,0.07),
                 inset 0 -2px 0 rgba(0,0,0,0.70),
                 inset -2px 0 0 rgba(0,0,0,0.50),
                 4px 0 12px rgba(0,0,0,0.5);

  /* --- TYPE BADGE COLORS --- */
  --color-badge-red-bg:     #5a0000;
  --color-badge-red-text:   #ffaaaa;
  --color-badge-white-bg:   #3a3a20;
  --color-badge-white-text: #f5f0dc;
  --color-badge-rose-bg:    #4a2030;
  --color-badge-rose-text:  #e8a0b0;
  --color-badge-sparkling-bg:   #2a2a00;
  --color-badge-sparkling-text: #d4af37;

  /* --- SIZING --- */
  --bottle-size:        52px;    /* diameter of each bottle circle */
  --bottle-gap:          6px;    /* gap between circles in a row */
  --shelf-wood-height:  12px;    /* wooden bar thickness */
  --panel-left-width:  280px;
  --panel-right-width: 300px;
  --toolbar-height:     52px;
  --cabinet-padding:    24px;

  /* --- TYPOGRAPHY --- */
  --font-main: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg: 12px;
}

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-main);
  background: var(--color-bg-page);
  color: var(--color-text-primary);
  font-size: 14px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}

/* ─── TOOLBAR ────────────────────────────────────────────────── */
.toolbar {
  height: var(--toolbar-height);
  background: var(--color-bg-toolbar);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  flex-shrink: 0;
  z-index: 10;
}

.toolbar__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.toolbar__icon { font-size: 20px; }

.toolbar__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.toolbar__subtitle {
  font-size: 11px;
  color: var(--color-text-secondary);
}

.toolbar__stats {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  justify-content: center;
  font-size: 12px;
  color: var(--color-text-secondary);
}

.stat-item span {
  color: var(--color-text-primary);
  font-weight: 600;
}

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

.toolbar__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ─── MAIN LAYOUT ────────────────────────────────────────────── */
.app-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ─── PANELS ─────────────────────────────────────────────────── */
.panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--color-border);
}

.panel--left {
  width: var(--panel-left-width);
  min-width: var(--panel-left-width);
  background: var(--color-bg-panel);
  box-shadow: var(--bevel-panel);
}

.panel--center {
  flex: 1;
  background: linear-gradient(rgba(10,10,10,0.65), rgba(10,10,10,0.65)), url('back.jpg') center/cover no-repeat;
  overflow-y: auto;
  overflow-x: auto;
  border-right: 1px solid var(--color-border);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px;
}

.panel--right {
  width: var(--panel-right-width);
  min-width: var(--panel-right-width);
  background: var(--color-bg-panel);
  border-right: none;
  box-shadow: var(--bevel-panel);
}

.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--color-bg-panel-header);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.panel__title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-secondary);
}

.panel__badge {
  background: var(--color-accent-dark);
  color: var(--color-text-primary);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 22px;
  text-align: center;
}

/* ─── IMPORT ACTIONS (left panel) ────────────────────────────── */
.import-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

/* ─── UNPLACED WINE LIST ─────────────────────────────────────── */
.wine-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  padding: 6px;
}

.wine-list--drag-over {
  background: rgba(58, 134, 255, 0.05);
  outline: 2px dashed var(--color-slot-drag-over);
  outline-offset: -4px;
  border-radius: var(--radius-md);
}

.wine-list__empty {
  padding: 20px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 13px;
}

.wine-list__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  cursor: grab;
  transition: background 0.15s;
  margin-bottom: 2px;
}

.wine-list__item:hover { background: rgba(255,255,255,0.05); }
.wine-list__item:active { cursor: grabbing; }
.wine-list__item--dragging { opacity: 0.4; }

.wine-list__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.wine-list__dot--red       { background: var(--color-wine-red); }
.wine-list__dot--white     { background: var(--color-wine-white); border: 1px solid #666; }
.wine-list__dot--rose      { background: var(--color-wine-rose); }
.wine-list__dot--sparkling { background: var(--color-wine-sparkling); }

.wine-list__info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.wine-list__name {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wine-list__meta {
  font-size: 10px;
  color: var(--color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wine-list__type-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 3px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Delete (×) button on unplaced list items */
.wine-list__delete {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  font-size: 15px;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0;
  transition: color 0.15s, opacity 0.15s;
}
.wine-list__item:hover .wine-list__delete { opacity: 1; }
.wine-list__delete:hover { color: var(--color-danger); }
.wine-list__type-tag--red       { background: var(--color-badge-red-bg);       color: var(--color-badge-red-text); }
.wine-list__type-tag--white     { background: var(--color-badge-white-bg);     color: var(--color-badge-white-text); }
.wine-list__type-tag--rose      { background: var(--color-badge-rose-bg);      color: var(--color-badge-rose-text); }
.wine-list__type-tag--sparkling { background: var(--color-badge-sparkling-bg); color: var(--color-badge-sparkling-text); }

/* ─── CABINET ────────────────────────────────────────────────── */
.cabinet {
  display: flex;
  flex-direction: row;
  gap: 24px;
  align-items: flex-start;
}

.cabinet-unit {
  background: var(--color-bg-cabinet);
  border: 2px solid var(--color-cabinet-frame);
  border-radius: var(--radius-lg);
  padding: var(--cabinet-padding);
  min-width: 480px;
  flex-shrink: 0;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.06),
    0 8px 40px rgba(0,0,0,0.7),
    inset 0 2px 0 rgba(255,255,255,0.18),
    inset 0 -2px 0 rgba(0,0,0,0.75),
    inset 2px 0 0 rgba(255,255,255,0.09),
    inset -2px 0 0 rgba(0,0,0,0.60);
}

/* ─── ZONES ──────────────────────────────────────────────────── */
.zone {
  padding: 10px;
  border-radius: var(--radius-md);
}

.zone--upper { background: rgba(100, 160, 255, 0.03); }
.zone--lower { background: rgba(180,  40,  40, 0.03); }

.zone__label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 0 4px;
}

.zone__name {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-secondary);
}

.zone__temp {
  font-size: 10px;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
}

/* ─── ZONE SEPARATOR ─────────────────────────────────────────── */
.zone-separator {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
  padding: 0 4px;
}

.zone-separator__line {
  flex: 1;
  height: 1px;
  background: var(--color-zone-separator);
}

.zone-separator__panel {
  background: var(--color-bg-panel-header);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
}

.zone-separator__label {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--color-text-muted);
  letter-spacing: 0.08em;
}

/* ─── SHELVES ────────────────────────────────────────────────── */
.zone__shelves { display: flex; flex-direction: column; }

.shelf { position: relative; }

.shelf__track {
  height: var(--shelf-wood-height);
  background: linear-gradient(
    to bottom,
    var(--color-shelf-wood-light)  0%,
    var(--color-shelf-wood)       50%,
    var(--color-shelf-wood-dark) 100%
  );
  border-radius: 3px;
  margin-bottom: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5), 0 1px 0 rgba(255,255,255,0.08) inset;
}

.shelf__row {
  display: flex;
  flex-direction: row;
  gap: var(--bottle-gap);
  margin-left: 0;
  margin-bottom: 4px;
}

.shelf__row--offset {
  margin-left: calc((var(--bottle-size) + var(--bottle-gap)) / 2);
}

/* Shelves sit snug against each other (honeycomb overlap) */
.shelf + .shelf { margin-top: 0; }

/* ─── BOTTLE SLOTS ───────────────────────────────────────────── */
.slot {
  width:  var(--bottle-size);
  height: var(--bottle-size);
  flex-shrink: 0;
  position: relative;
  cursor: pointer;
}

.slot__circle {
  width:  100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s, box-shadow 0.12s;
  position: relative;
  overflow: hidden;
  border: 2px solid transparent;
}

/* Empty slot */
.slot__circle--empty {
  background: var(--color-slot-empty);
  border-color: var(--color-slot-empty-border);
  cursor: default;
}

/* Drop target highlight on empty slot */
.slot--drag-over .slot__circle--empty {
  border-color: var(--color-slot-drag-over);
  background: rgba(58, 134, 255, 0.15);
  box-shadow: 0 0 0 2px rgba(58, 134, 255, 0.3);
}

/* Red wine */
.slot__circle--red {
  background: radial-gradient(circle at 35% 35%, var(--color-wine-red-glow) 0%, var(--color-wine-red) 45%, var(--color-wine-red-inner) 100%);
  border-color: rgba(255,255,255,0.08);
  box-shadow: 0 0 8px rgba(139, 0, 0, 0.4), inset 0 1px 2px rgba(255,255,255,0.1);
}

.slot__circle--red:hover {
  transform: scale(1.06);
  box-shadow: 0 0 14px rgba(204, 34, 34, 0.6), inset 0 1px 2px rgba(255,255,255,0.15);
}

/* White wine */
.slot__circle--white {
  background: radial-gradient(circle at 35% 35%, var(--color-wine-white-glow) 0%, var(--color-wine-white) 50%, var(--color-wine-white-inner) 100%);
  border-color: rgba(0,0,0,0.15);
  box-shadow: 0 0 8px rgba(237, 232, 208, 0.25), inset 0 1px 2px rgba(255,255,255,0.5);
}

.slot__circle--white:hover {
  transform: scale(1.06);
  box-shadow: 0 0 14px rgba(255, 248, 231, 0.4), inset 0 1px 2px rgba(255,255,255,0.6);
}

/* Rosé wine */
.slot__circle--rose {
  background: radial-gradient(circle at 35% 35%, var(--color-wine-rose-glow) 0%, var(--color-wine-rose) 50%, var(--color-wine-rose-inner) 100%);
  border-color: rgba(255,255,255,0.08);
  box-shadow: 0 0 8px rgba(184, 80, 112, 0.35), inset 0 1px 2px rgba(255,255,255,0.15);
}

.slot__circle--rose:hover {
  transform: scale(1.06);
  box-shadow: 0 0 14px rgba(224, 128, 160, 0.5), inset 0 1px 2px rgba(255,255,255,0.2);
}

/* Sparkling wine */
.slot__circle--sparkling {
  background: radial-gradient(circle at 35% 35%, var(--color-wine-sparkling-glow) 0%, var(--color-wine-sparkling) 50%, var(--color-wine-sparkling-inner) 100%);
  border-color: rgba(255,255,255,0.12);
  box-shadow: 0 0 8px rgba(200, 160, 32, 0.35), inset 0 1px 2px rgba(255,255,255,0.2);
}

.slot__circle--sparkling:hover {
  transform: scale(1.06);
  box-shadow: 0 0 14px rgba(240, 200, 64, 0.5), inset 0 1px 2px rgba(255,255,255,0.3);
}

/* Selected state */
.slot__circle--selected {
  border-color: var(--color-slot-selected) !important;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.3), 0 0 16px rgba(255,255,255,0.15) !important;
}

/* White wine selected: use a warm amber ring for contrast against the pale circle */
.slot__circle--white.slot__circle--selected {
  border-color: #b8860b !important;
  box-shadow: 0 0 0 2px rgba(184,134,11,0.45), 0 0 16px rgba(184,134,11,0.25) !important;
}

/* Move target state */
.slot__circle--move-target {
  border-color: var(--color-slot-move-target) !important;
  animation: pulse-blue 1.2s ease-in-out infinite;
}

@keyframes pulse-blue {
  0%, 100% { box-shadow: 0 0 0 2px rgba(58,134,255,0.3); }
  50%       { box-shadow: 0 0 0 4px rgba(58,134,255,0.6); }
}

/* Dragging from cabinet */
.slot--dragging { opacity: 0.35; }

/* Drop on occupied slot */
.slot--drag-over .slot__circle:not(.slot__circle--empty) {
  border-color: var(--color-slot-drag-over) !important;
  box-shadow: 0 0 0 2px rgba(90, 159, 255, 0.4) !important;
}

/* Bottle label (abbreviation) */
.slot__label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: rgba(255,255,255,0.6);
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
  pointer-events: none;
  user-select: none;
  text-align: center;
  line-height: 1;
}

.slot__circle--white .slot__label { color: rgba(0,0,0,0.75); text-shadow: none; }

/* ─── DETAIL PANEL ───────────────────────────────────────────── */
.detail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 10px;
  color: var(--color-text-muted);
  font-size: 13px;
}

.detail-empty__icon { font-size: 36px; opacity: 0.3; }

.detail-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
}

.detail__header {
  padding: 10px 14px 8px;
  background: var(--color-bg-panel-header);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.detail__type-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 3px;
}

.detail__type-badge--red       { background: var(--color-badge-red-bg);       color: var(--color-badge-red-text); }
.detail__type-badge--white     { background: var(--color-badge-white-bg);     color: var(--color-badge-white-text); }
.detail__type-badge--rose      { background: var(--color-badge-rose-bg);      color: var(--color-badge-rose-text); }
.detail__type-badge--sparkling { background: var(--color-badge-sparkling-bg); color: var(--color-badge-sparkling-text); }

/* Row that holds the type badge + country flag side by side */
.detail__badge-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 6px;
}

/* Country flag emoji — slightly larger than the badge text so it reads clearly */
.detail__flag {
  font-size: 18px;
  line-height: 1;
  user-select: none;
}

.detail__name {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-primary);
  line-height: 1.3;
  margin-bottom: 2px;
}

.detail__position {
  font-size: 11px;
  color: var(--color-text-secondary);
  font-family: var(--font-mono);
}

.detail__fields {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex: 1;
}

.detail__field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Two fields side-by-side (e.g. Price + Alcohol) */
.detail__field-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.detail__label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-muted);
  font-weight: 600;
}

.detail__value {
  font-size: 13px;
  color: var(--color-text-primary);
  min-height: 16px;
}

.detail__value:empty::after {
  content: '—';
  color: var(--color-text-muted);
}

/* Clickable Vinmonopolet link in detail panel */
.detail__url-link {
  color: var(--color-accent);
  text-decoration: none;
  font-size: 12px;
}
.detail__url-link:hover { text-decoration: underline; }

/* Art.nr row with inline Fetch button */
.detail__field-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.detail__field-row .detail__value,
.detail__field-row .detail__input {
  flex: 1;
}

.detail__fetch-status {
  font-size: 10px;
  color: var(--color-text-secondary);
  min-height: 14px;
  display: block;
}

.detail__fetch-status.success { color: #4caf50; }
.detail__fetch-status.error   { color: var(--color-text-muted); }

/* Extra-small button variant */
.btn--xs {
  padding: 3px 8px;
  font-size: 11px;
  flex-shrink: 0;
}

/* Edit mode: inputs replace spans */
.detail__input {
  background: var(--color-bg-page);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
  font-family: var(--font-main);
  font-size: 13px;
  padding: 5px 8px;
  width: 100%;
  transition: border-color 0.15s;
}

.detail__input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px rgba(58,134,255,0.2);
}

textarea.detail__input {
  resize: vertical;
  min-height: 44px;
}

/* Notes field: preserve line breaks from stored \n\n */
.detail__value[data-field="notes"] {
  white-space: pre-wrap;
  line-height: 1.6;
}

.detail__actions,
.detail__edit-actions {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}

.move-hint {
  padding: 10px 14px;
  background: rgba(58, 134, 255, 0.1);
  border-top: 1px solid rgba(58, 134, 255, 0.2);
  border-bottom: 1px solid rgba(58, 134, 255, 0.2);
}

.move-hint p {
  font-size: 11px;
  color: var(--color-accent);
  line-height: 1.5;
}

/* ─── BUTTONS ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
  white-space: nowrap;
  user-select: none;
}

.btn--full { width: 100%; }

.btn--primary {
  background: var(--color-accent);
  color: #ffffff;
  border-color: var(--color-accent);
}
.btn--primary:hover { background: var(--color-accent-hover); border-color: var(--color-accent-hover); }

.btn--secondary {
  background: transparent;
  color: var(--color-text-secondary);
  border-color: var(--color-border);
}
.btn--secondary:hover { background: rgba(255,255,255,0.06); color: var(--color-text-primary); border-color: #444; }

.btn--outline {
  background: transparent;
  color: var(--color-text-secondary);
  border-color: var(--color-border);
}
.btn--outline:hover { color: var(--color-text-primary); border-color: #555; background: rgba(255,255,255,0.04); }

.btn--danger {
  background: transparent;
  color: var(--color-danger);
  border-color: rgba(204, 51, 51, 0.35);
}
.btn--danger:hover { background: rgba(204, 51, 51, 0.12); border-color: var(--color-danger); }

/* ─── MODALS ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-bg-modal-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(2px);
}

.modal-overlay[hidden] { display: none; }

.modal {
  background: var(--color-bg-modal);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  width: 480px;
  max-width: 95vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,0.7);
}

.modal--wide  { width: 850px; }
.modal--narrow { width: 360px; }

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.modal__header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.modal__close {
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.15s;
}
.modal__close:hover { color: var(--color-text-primary); }

.modal__body {
  padding: 18px;
  overflow-y: auto;
  flex: 1;
}

.modal__meta {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-bottom: 14px;
}

.modal__footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 14px 18px;
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}

/* ─── PREVIEW TABLE (PDF import) ─────────────────────────────── */
.table-scroll { overflow-x: auto; }

.preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.preview-table th {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.preview-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--color-border-subtle);
  color: var(--color-text-primary);
  vertical-align: middle;
}

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

.preview-table td select {
  background: var(--color-bg-page);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 3px 6px;
  font-size: 11px;
  font-family: var(--font-main);
}

.preview-table td input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: var(--color-accent);
}

/* ─── FORM ELEMENTS ──────────────────────────────────────────── */
.form-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

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

.form-row--fetch { margin-bottom: 4px; }

.form-row__inline {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.form-row__inline input { flex: 1; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

label {
  font-size: 11px;
  color: var(--color-text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#btn-import-json-label {
  text-transform: none;
  letter-spacing: normal;
}

.required { color: var(--color-danger); }

input[type="text"],
input[type="number"],
select,
textarea {
  background: var(--color-bg-page);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
  font-family: var(--font-main);
  font-size: 13px;
  padding: 7px 10px;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px rgba(58,134,255,0.15);
}

select { cursor: pointer; }

.fetch-status {
  font-size: 11px;
  color: var(--color-text-secondary);
  min-height: 16px;
  display: block;
  margin-top: 3px;
}

.fetch-status.success { color: #4caf50; }
.fetch-status.error   { color: var(--color-text-secondary); }

.form-divider {
  height: 1px;
  background: var(--color-border);
  margin: 14px 0;
}

/* ─── SCROLLBAR STYLING ──────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #444; }

/* ─── DELETE BUTTON (detail panel) ──────────────────────────── */
.btn--delete {
  color: var(--color-text-muted);
  border-color: var(--color-border);
}
.btn--delete:hover {
  color: var(--color-danger);
  border-color: rgba(204, 51, 51, 0.4);
  background: rgba(204, 51, 51, 0.06);
}

/* ─── DRINK LOG TABLE ────────────────────────────────────────── */
#modal-drink-log .table-scroll {
  max-height: calc(8 * 41px);  /* ~41px per row; shows 8 before scrolling */
  overflow-y: auto;
}


.drink-log__date {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-text-secondary);
  white-space: nowrap;
}

.drink-log__artnr {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-text-secondary);
}

.drink-log__rating {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-accent);
  text-align: center;
}

/* ─── RATING WHEEL ───────────────────────────────────────────── */
.rating-wheel-section {
  padding: 6px 14px 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rating-wheel-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.rating-wheel {
  cursor: pointer;
  overflow: visible;
  user-select: none;
}

.rating-track {
  fill: none;
  stroke: rgba(255,255,255,0.08);
  stroke-width: 4;
}

.rating-fill {
  fill: none;
  stroke: url(#rating-gradient);
  stroke-width: 4;
  stroke-linecap: round;
  /* Start at top (−90°): counter-clockwise via dashoffset */
  transform-origin: 60px 60px;
  transform: rotate(-90deg);
  transition: none;
}

.rating-handle {
  fill: none;
  stroke: #f4a261;
  stroke-width: 2.5;
  cursor: grab;
  transition: r 0.1s;
}
.rating-handle:hover,
.rating-wheel--dragging .rating-handle { r: 8; cursor: grabbing; }

.rating-label {
  fill: var(--color-text-primary);
  font-family: var(--font-main);
  font-size: 22px;
  font-weight: 600;
  text-anchor: middle;
  dominant-baseline: middle;
}

.rating-sublabel {
  fill: var(--color-text-secondary);
  font-family: var(--font-main);
  font-size: 11px;
  text-anchor: middle;
  dominant-baseline: middle;
}

.rating-hint {
  font-size: 11px;
  color: var(--color-text-muted);
  margin: 0;
  text-align: center;
}

/* ─── UTILITY ────────────────────────────────────────────────── */
[hidden] { display: none !important; }

/* ─── STATISTICS MODAL ───────────────────────────────────────── */
.modal--stats {
  width: 560px;
}

.stats-section {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--color-border);
}

.stats-section--last {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.stats-section__title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-secondary);
  margin-bottom: 12px;
}

.stats-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.stats-kpi {
  background: var(--color-bg-panel-header);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.stats-kpi__value {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text-primary);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.stats-kpi__label {
  font-size: 11px;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stats-type-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stats-type-row {
  display: grid;
  grid-template-columns: 20px 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--color-bg-panel-header);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

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

.stats-type-dot--red       { background: var(--color-wine-red); }
.stats-type-dot--white     { background: var(--color-wine-white); border: 1px solid #666; }
.stats-type-dot--rose      { background: var(--color-wine-rose); }
.stats-type-dot--sparkling { background: var(--color-wine-sparkling); }

.stats-type-name {
  font-size: 13px;
  color: var(--color-text-primary);
}

.stats-type-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-primary);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.stats-type-value {
  font-size: 12px;
  color: var(--color-text-secondary);
  font-variant-numeric: tabular-nums;
  text-align: right;
  min-width: 90px;
}

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

.stats-highlight {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 10px 12px;
  background: var(--color-bg-panel-header);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.stats-highlight__label {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.stats-highlight__name {
  font-size: 13px;
  color: var(--color-text-primary);
  flex: 1;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-highlight__detail {
  font-size: 12px;
  color: var(--color-accent);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.stats-empty {
  font-size: 12px;
  color: var(--color-text-muted);
  font-style: italic;
}

/* ─── SETTINGS MODAL ─────────────────────────────────────────── */
.modal--settings {
  width: 520px;
}

.settings-cabinet-block {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 12px;
}

.settings-cabinet-block:last-child {
  margin-bottom: 0;
}

.settings-cabinet-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.settings-cab-label {
  flex: 1;
  font-weight: 600;
}

.settings-zone-section {
  margin-top: 10px;
}

.settings-zone-section + .settings-zone-section {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--color-border-subtle);
}

.settings-zone-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.settings-zone-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

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

.settings-field-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.settings-field-row input {
  flex: 1;
  min-width: 0;
}

.settings-bottles-hint {
  font-size: 11px;
  color: var(--color-text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.settings-unit {
  font-size: 12px;
  color: var(--color-text-secondary);
  flex-shrink: 0;
}

.btn--ghost {
  background: transparent;
  color: var(--color-text-muted);
  border-color: var(--color-border);
  border-style: dashed;
  width: 100%;
  margin-top: 4px;
}

.btn--ghost:hover {
  color: var(--color-text-secondary);
  background: rgba(255,255,255,0.03);
  border-color: #444;
}

/* ─── SEARCH BAR (Unplaced List) ─────────────────────────────── */
.search-bar {
  padding: 6px 12px 8px;
  border-bottom: 1px solid var(--color-border);
}

.search-bar__input {
  width: 100%;
  box-sizing: border-box;
  background: var(--color-bg-page);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
  font-family: var(--font-main);
  font-size: 12px;
  padding: 5px 8px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

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

.search-bar__input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px rgba(58, 134, 255, 0.15);
}

/* ─── BULK ENRICH PROGRESS BANNER ───────────────────────────── */
.enrich-banner {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  background: rgba(58, 134, 255, 0.08);
  border-bottom: 1px solid rgba(58, 134, 255, 0.18);
  flex-shrink: 0;
}

.enrich-banner__spinner {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 1.5px solid rgba(58, 134, 255, 0.3);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: enrich-spin 0.8s linear infinite;
  flex-shrink: 0;
}

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

.enrich-banner__text {
  font-size: 11px;
  color: var(--color-accent);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Auto-enrich checkbox in PDF modal footer */
.enrich-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--color-text-secondary);
  cursor: pointer;
  margin-right: auto;
}

.enrich-checkbox-label input[type="checkbox"] {
  accent-color: var(--color-accent);
  cursor: pointer;
}

/* ─── ZONE MISMATCH TOAST ─────────────────────────────────────── */
.zone-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #5a3a00;
  color: #ffd080;
  border: 1px solid #a06010;
  border-radius: var(--radius-md);
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  z-index: 9999;
  opacity: 1;
  transition: opacity 0.4s ease;
}

.zone-toast--hidden {
  opacity: 0;
}

/* ─── CONTEXT MENU ───────────────────────────────────────────── */
.ctx-menu {
  position: fixed;
  z-index: 10000;
  background: var(--color-bg-modal);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 16px rgba(0,0,0,0.6);
  min-width: 140px;
  padding: 4px 0;
  outline: none;
}

.ctx-menu__item {
  display: block;
  width: 100%;
  padding: 7px 14px;
  background: none;
  border: none;
  color: var(--color-text-primary);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.ctx-menu__item:hover {
  background: var(--color-bg-panel-header);
  color: var(--color-accent);
}

/* ─── VMP SEARCH MODAL ───────────────────────────────────────── */
.modal--vmp-search {
  width: 560px;
}

.vmp-search-bar {
  margin-bottom: 10px;
}

.vmp-search-bar input {
  width: 100%;
  box-sizing: border-box;
  background: var(--color-bg-panel);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: 0.95rem;
  padding: 8px 12px;
}

.vmp-search-bar input:focus {
  outline: none;
  border-color: var(--color-accent);
}

.vmp-search-status {
  font-size: 0.82rem;
  color: var(--color-text-dim);
  min-height: 1.2em;
  margin-bottom: 6px;
}

.vmp-results-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 380px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.vmp-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
}

.vmp-result-item:hover {
  background: var(--color-bg-panel-header);
  border-color: var(--color-border);
}

.vmp-result-thumb {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 3px;
}

.vmp-result-thumb-placeholder {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  background: var(--color-bg-panel);
  border-radius: 3px;
}

.vmp-result-info {
  flex: 1;
  min-width: 0;
}

.vmp-result-name {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vmp-result-meta {
  font-size: 0.76rem;
  color: var(--color-text-dim);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vmp-result-artnr {
  font-size: 0.76rem;
  color: var(--color-text-dim);
  font-family: monospace;
  flex-shrink: 0;
}

/* ── Table / List View ──────────────────────────────────────── */
.modal--table-view {
  width: 1000px;
  max-height: 90vh;
}

.modal__count {
  font-size: 13px;
  font-weight: normal;
  color: var(--color-text-secondary);
  margin-left: 8px;
}

.table-view-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.table-view-controls .search-bar__input {
  flex: 1;
  width: auto;
  font-size: 13px;
  padding: 6px 10px;
}

.type-filter-select {
  background: var(--color-bg-page);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
  padding: 6px 10px;
  font-size: 13px;
  font-family: var(--font-main);
  outline: none;
  cursor: pointer;
}

.type-filter-select:focus {
  border-color: var(--color-accent);
}

.table-view__scroll {
  max-height: calc(90vh - 130px);
  overflow-y: auto;
}

.table-view__table .tv-num {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 12px;
}

.table-view__table .tv-name {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-view__row {
  cursor: pointer;
  transition: background 0.1s;
}

.table-view__row:hover td {
  background: rgba(255,255,255,0.04);
}

.tv-status {
  font-size: 11px;
  font-family: var(--font-mono);
}

.tv-status--placed   { color: var(--color-accent); }
.tv-status--unplaced { color: var(--color-text-secondary); }

/* Sort indicators */
.sortable { cursor: pointer; user-select: none; }
.sortable::after { content: ''; margin-left: 4px; }
.sort-asc::after  { content: '↑'; color: var(--color-accent); }
.sort-desc::after { content: '↓'; color: var(--color-accent); }

.wine-type-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
  flex-shrink: 0;
}

.table-view__table td:nth-child(2) {
  white-space: nowrap;
}

.wine-type-dot--red       { background: var(--color-wine-red); }
.wine-type-dot--white     { background: var(--color-wine-white); border: 1px solid #555; }
.wine-type-dot--rose      { background: var(--color-wine-rose); }
.wine-type-dot--sparkling { background: var(--color-wine-sparkling); }