/* ==========================================================================
   Wine Cellar: design system
   All colours live as CSS variables on :root. Mobile first.
   ========================================================================== */

/* ---------- Fonts (self hosted, work offline) ---------- */
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("../fonts/plus-jakarta-sans-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("../fonts/plus-jakarta-sans-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Design tokens ---------- */
:root {
  color-scheme: light;

  --bg: #eef0f2;
  --surface: #ffffff;
  --surface-2: #f3f4f6;
  --border: #e3e6ea;
  --border-input: #8a9099; /* form fields need 3:1 against their surroundings */

  --text: #1b1d21;
  --text-muted: #5b6068;

  --wine: #7a2437;
  --wine-light: #8f2c42;
  --on-wine: #ffffff;

  --gold: #7a2437; /* accent: labels, focus ring, links */
  --gold-dim: #c9a3ac;

  --ok: #4f7d5b;
  --warn: #b7791f;
  --urgent: #b03a3a;

  --type-red: #8e2a3b;
  --type-white: #cdb86a;
  --type-rose: #e0a3a1;
  --type-sparkling: #d9c58a;

  --header-top: #f7f8fa;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  --dark: #1b1d21;

  --radius: 18px;
  --radius-sm: 12px;
  --radius-pill: 999px;

  --font-title: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-ui: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --gutter: 16px;
  --max-width: 640px;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p {
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

/* Visible focus for keyboard users, everywhere */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.app {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gutter) calc(6rem + env(safe-area-inset-bottom));
}

/* Small uppercase label used for eyebrows and metadata */
.label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}

.meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

/* ---------- Search ---------- */
.search {
  position: relative;
  margin-top: 1.25rem;
}

.search__icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.input {
  width: 100%;
  min-height: 48px;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border-input);
  border-radius: var(--radius);
  color: var(--text);
}

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

.input:focus-visible {
  outline: none;
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px rgba(122, 36, 55, 0.25);
}

.search .input {
  padding-left: 2.6rem;
}

/* ---------- Filter chips + sort ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
}

.chips {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1 1 100%;
  margin: 0 calc(var(--gutter) * -1);
  padding: 0.125rem var(--gutter);
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 36px;
  padding: 0.35rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 0.875rem;
  white-space: nowrap;
}

@media (hover: hover) {
  .chip:hover {
    border-color: var(--gold-dim);
  }
}

.chip__count {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.chip[aria-pressed="true"] {
  background: var(--wine);
  border-color: var(--wine-light);
  color: var(--on-wine);
}

.chip[aria-pressed="true"] .chip__count {
  color: var(--on-wine);
  opacity: 0.8;
}

.sort {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.select {
  min-height: 36px;
  padding: 0.3rem 2rem 0.3rem 0.75rem;
  background: var(--surface)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238d968f' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")
    no-repeat right 0.7rem center;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  appearance: none;
}

/* ---------- Wine card ---------- */

.wine-name {
  font-family: var(--font-title);
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.type-dot {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  margin-top: 0.45rem;
  border-radius: 50%;
  background: var(--type-red);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.04);
}

.type-dot--white { background: var(--type-white); }
.type-dot--rose { background: var(--type-rose); }
.type-dot--sparkling { background: var(--type-sparkling); }

.badge {
  max-width: 100%;
  padding: 0.15rem 0.5rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.badge--sample {
  border-color: var(--gold-dim);
  color: var(--gold);
}

/* Status pill: solid colour, text colour chosen for contrast */
.pill {
  flex-shrink: 0;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.pill--ok { background: var(--ok); color: var(--bg); }
.pill--warn { background: var(--warn); color: var(--bg); }
.pill--urgent { background: var(--urgent); color: var(--text); }

/* Ripeness bar: fill width comes from --progress (0% to 100%) */
.ripeness {
  margin-top: 0.875rem;
}

.ripeness__bar {
  height: 6px;
  background: var(--surface-2);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.ripeness__fill {
  display: block;
  width: var(--progress, 0%);
  height: 100%;
  border-radius: inherit;
  background: var(--ok);
}

.ripeness--warn .ripeness__fill { background: var(--warn); }
.ripeness--urgent .ripeness__fill { background: var(--urgent); }

/* Quantity stepper */

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.6rem 1.1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 500;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

@media (hover: hover) {
  .btn:hover {
    border-color: var(--gold-dim);
  }
}

.btn:active {
  transform: scale(0.97);
}

.btn--primary {
  background: var(--wine);
  border-color: var(--wine-light);
  color: var(--on-wine);
}

@media (hover: hover) {
  .btn--primary:hover {
    background: var(--wine-light);
    border-color: var(--wine-light);
    color: var(--on-wine);
  }
}

.btn--ghost {
  background: none;
  border-color: transparent;
  color: var(--text-muted);
}

@media (hover: hover) {
  .btn--ghost:hover {
    color: var(--text);
    border-color: var(--border);
  }
}

@media (hover: hover) {
  .btn--danger:hover {
    color: var(--text);
    background: var(--urgent);
    border-color: var(--urgent);
  }
}

.btn--icon {
  width: 44px;
  padding: 0;
  border-radius: 50%;
}

.btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Floating add button */
/* Floating buttons: Scan + Add wine */

/* ---------- Empty state ---------- */
.empty {
  margin-top: 2rem;
  padding: 2.5rem 1.5rem;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
}

.empty__title {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-style: italic;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.empty .btn {
  margin-top: 1rem;
}

/* ---------- Out of stock, flat lists, history ---------- */
.pill--none {
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

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

/* ---------- Header actions ---------- */

.btn--small {
  min-height: 40px;
  padding: 0.4rem 0.75rem;
  font-size: 0.8125rem;
}

.btn--small svg {
  width: 16px;
  height: 16px;
}

/* ---------- Clickable cards ---------- */

.wine-name__btn {
  min-height: 24px; /* minimum tap target size */
  padding: 0;
  background: none;
  border: 0;
  font: inherit;
  text-align: left;
  color: inherit;
  overflow-wrap: anywhere;
}

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

/* ---------- Modal (bottom sheet on phones, centred card on larger screens) ---------- */
body:has(.modal[open]) {
  overflow: hidden;
}

.modal {
  width: 100%;
  max-width: var(--max-width);
  max-height: 92dvh;
  margin: auto auto 0;
  padding: 0;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.modal[open] {
  display: flex;
  flex-direction: column;
  animation: sheet-in 0.25s ease-out;
}

.modal::backdrop {
  background: rgba(8, 10, 10, 0.7);
  backdrop-filter: blur(3px);
}

@keyframes sheet-in {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

@media (min-width: 680px) {
  .modal {
    margin: auto;
    max-height: 88vh;
    border-bottom: 1px solid var(--border);
    border-radius: 18px;
  }
}

.sheet {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: inherit;
  margin: 0;
}

.sheet__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem var(--gutter) 1rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--header-top) 0%, var(--surface) 100%);
}

.sheet__title {
  margin-top: 0.2rem;
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.sheet__head .meta {
  margin-top: 0.25rem;
}

/* Small "Vivino ↗" pill after the wine's details (only when the page was found) */
.vivino-link {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  min-height: 24px;
  padding: 0 0.45rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--wine);
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  vertical-align: 1px;
}

.vivino-link svg {
  width: 12px;
  height: 12px;
}

@media (hover: hover) {
  .vivino-link:hover { border-color: var(--gold-dim); }
}

.sheet__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem var(--gutter) 1.25rem;
}

.sheet__foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.875rem var(--gutter) calc(0.875rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.sheet__body > p + .field {
  margin-top: 1rem;
}

.btn--danger-solid {
  background: var(--urgent);
  border-color: var(--urgent);
  color: var(--text);
}

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

.field {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

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

.field__label {
  display: block;
  margin-bottom: 0.35rem;
  padding: 0;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
}

.field__hint {
  margin-top: 0.3rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.field__error {
  margin-top: 0.3rem;
  font-size: 0.8125rem;
  color: #e38d8d;
}

.input[aria-invalid="true"] {
  border-color: var(--urgent);
}

.textarea {
  min-height: 5.5rem;
  resize: vertical;
  line-height: 1.45;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.375rem;
}

.segmented__option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented__option > span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  cursor: pointer;
}

.segmented__option .type-dot {
  margin: 0;
}

.segmented__option input:checked + span {
  background: var(--wine);
  border-color: var(--wine-light);
  color: var(--on-wine);
}

.segmented__option input:checked + span .type-dot {
  box-shadow: 0 0 0 2px #ffffff; /* keeps the red dot visible on the burgundy button */
}

.segmented__option input:focus-visible + span {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 44px;
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch__track {
  position: relative;
  width: 44px;
  height: 26px;
  background: var(--surface-2);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-pill);
  transition: background-color 0.15s ease;
}

.switch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.switch input:checked + .switch__track {
  background: var(--wine);
  border-color: var(--wine-light);
}

.switch input:checked + .switch__track::after {
  transform: translateX(18px);
  background: var(--on-wine);
}

.switch input:focus-visible + .switch__track {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.more summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  font-size: 0.875rem;
  color: var(--gold);
  cursor: pointer;
}

.more .form-grid {
  margin-top: 0.75rem;
}

/* ---------- Detail screen ---------- */
.detail__sample {
  display: inline-block;
  margin-bottom: 0.75rem;
}

.detail-block {
  padding-bottom: 1.1rem;
  margin-bottom: 1.1rem;
  border-bottom: 1px solid var(--border);
}

.detail-status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.detail-block .ripeness {
  margin-top: 0.75rem;
}

.detail__window {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.detail__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.detail__sources {
  margin-top: 0.9rem;
  overflow-wrap: anywhere;
}

.detail__sources a {
  color: var(--gold);
}

.spinner--small {
  width: 14px;
  height: 14px;
  margin: 0;
  border-width: 2px;
}

.detail__text {
  margin-top: 0.4rem;
}

.detail__subhead {
  margin-top: 1rem;
}

.flavours {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
}

.flavour {
  padding: 0.25rem 0.7rem;
  background: rgba(122, 36, 55, 0.1);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius-pill);
  font-size: 0.8125rem;
  color: var(--text);
  overflow-wrap: anywhere;
}

.detail__notes {
  margin: 0.5rem 0 0;
  padding-left: 0.9rem;
  border-left: 2px solid var(--wine-light);
  font-family: var(--font-title);
  font-style: italic;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.875rem 1rem;
  margin: 0;
}

.fact dt {
  font-size: 0.625rem;
  color: var(--text-muted);
}

.fact dd {
  margin: 0.15rem 0 0;
  overflow-wrap: anywhere;
}

/* ---------- Empty state art ---------- */
.empty__art {
  display: block;
  width: 44px;
  height: 66px;
  margin: 0 auto 1rem;
  color: var(--gold-dim);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(5.5rem + env(safe-area-inset-bottom));
  z-index: 10;
  width: min(calc(100% - 2 * var(--gutter)), 480px);
  transform: translate(-50%, 1rem);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}

.toast__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.9rem 0.75rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  font-size: 0.9rem;
}

.toast__action {
  min-height: 36px;
  padding: 0.3rem 0.6rem;
  background: none;
  border: 0;
  font-weight: 600;
  color: var(--gold);
}

/* ---------- Sync status ---------- */
.sync {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 28px;
  margin-top: 0.3rem;
  padding: 0;
  background: none;
  border: 0;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.sync__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
}

.sync--synced .sync__dot { background: var(--ok); }
.sync--syncing .sync__dot,
.sync--connecting .sync__dot { background: var(--gold); animation: pulse 1.2s ease-in-out infinite; }
.sync--offline .sync__dot,
.sync--no-storage .sync__dot,
.sync--no-pin .sync__dot,
.sync--error .sync__dot { background: var(--warn); }

@keyframes pulse {
  50% { opacity: 0.3; }
}

/* ---------- PIN lock screen ---------- */
.lock {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: calc(1.5rem + env(safe-area-inset-top)) var(--gutter) calc(1.5rem + env(safe-area-inset-bottom));
  overflow-y: auto;
  background:
    radial-gradient(90% 60% at 50% 0%, rgba(111, 31, 44, 0.35), transparent 70%),
    linear-gradient(180deg, var(--header-top) 0%, var(--bg) 100%);
}

.lock[hidden] {
  display: none;
}

body.is-locked {
  overflow: hidden;
}

.lock__card {
  width: 100%;
  max-width: 360px;
  text-align: center;
  animation: card-in 0.5s ease-out both;
}

.lock__card .empty__art {
  margin-bottom: 1.25rem;
  color: var(--gold);
}

.lock__title {
  margin-top: 0.4rem;
  font-family: var(--font-title);
  font-size: 2rem;
  font-weight: 500;
}

.lock__tagline {
  margin-top: 0.25rem;
  font-family: var(--font-title);
  font-style: italic;
  color: var(--gold);
}

.lock__text {
  margin-top: 0.5rem;
  color: var(--text-muted);
}

.lock__text em {
  font-family: var(--font-title);
  color: var(--gold);
}

.lock__form {
  margin-top: 1.5rem;
}

.lock__input {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  letter-spacing: 0.4em;
  text-align: center;
}

.lock__error {
  min-height: 1.3rem;
}

.lock__button {
  width: 100%;
  margin-top: 0.75rem;
}

.lock__hint {
  margin-top: 1.25rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* ---------- Welcome tour ---------- */
.welcome__body {
  padding-top: 2rem;
  text-align: center;
}

.welcome__art {
  display: grid;
  place-items: center;
  height: 88px;
  margin-bottom: 1rem;
  color: var(--gold);
}

.welcome__art .empty__art {
  margin: 0;
  color: var(--gold);
}

.welcome__icon {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border: 1px solid var(--gold-dim);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 30%, rgba(162, 58, 74, 0.35), transparent 70%);
}

.welcome__icon svg {
  width: 34px;
  height: 34px;
}

.welcome__title {
  margin-top: 0.4rem;
  font-family: var(--font-title);
  font-size: 1.6rem;
  font-weight: 500;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.welcome__text {
  max-width: 34ch;
  margin: 0.75rem auto 0;
  color: var(--text-muted);
}

.welcome__dots {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 1.5rem;
}

.welcome__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border-input);
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.welcome__dot.is-active {
  background: var(--gold);
  transform: scale(1.3);
}

.welcome .sheet__body {
  animation: card-in 0.35s ease-out both;
}

/* ---------- Footer ---------- */
.footer {
  margin-top: 3rem;
  padding: 1.25rem 0 0.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer__name {
  color: var(--gold);
}

.footer__tagline {
  margin-top: 0.2rem;
  font-family: var(--font-title);
  font-style: italic;
  color: var(--text-muted);
}

.footer .meta {
  margin-top: 0.2rem;
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem;
}

.footer__storage {
  overflow-wrap: anywhere;
}

.env-banner {
  margin-bottom: 1rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--warn);
  border-radius: var(--radius-sm);
  background: rgba(183, 121, 31, 0.12);
  color: var(--text);
  font-size: 0.875rem;
}

.backup-group {
  margin-top: 1.25rem;
}

.backup-group .label {
  margin-bottom: 0.5rem;
}

.backup {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.backup__main {
  flex: 1;
  min-width: 10rem;
}

.backup__title {
  font-weight: 500;
}

.backup__confirm {
  flex: 1 1 100%;
  padding: 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius-sm);
}

.backup__confirm .sheet__actions {
  margin-top: 0.6rem;
  justify-content: flex-end;
}

.footer__tour {
  margin-top: 0.5rem;
  color: var(--text-muted);
}

/* ---------- Photo recognition ---------- */
.ai-model {
  margin-top: 0.35rem;
  color: var(--gold);
}

.scan-status {
  padding: 2rem 0;
  text-align: center;
}

.scan-status p + p {
  margin-top: 0.4rem;
}

.spinner {
  display: inline-block;
  width: 36px;
  height: 36px;
  margin-bottom: 1rem;
  border: 3px solid var(--surface-2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  /* Keep a slow, visible hint that work is happening */
  .spinner { animation: pulse 1.6s ease-in-out infinite !important; animation-duration: 1.6s !important; }
}

.proposal {
  margin-bottom: 0.875rem;
  padding: 0.875rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: opacity 0.15s ease;
}

.proposal--skipped {
  opacity: 0.5;
}

.proposal__head {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.proposal__title {
  flex: 1;
  min-width: 0;
}

.proposal__title .wine-name {
  font-size: 1.05rem;
}

.proposal__note,
.proposal__match {
  margin-top: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.proposal__match {
  color: var(--gold);
}

.proposal__quick {
  margin-top: 0.75rem;
}

.proposal .more {
  margin-top: 0.25rem;
}

.badge--high { border-color: var(--ok); color: var(--text); }
.badge--medium { border-color: var(--warn); color: var(--warn); }
.badge--low { border-color: var(--urgent); color: #e38d8d; }

.input--compact {
  min-height: 44px;
  padding: 0.5rem 0.75rem;
}

.select--full {
  width: 100%;
  min-height: 44px;
  font-size: 1rem;
}

.switch--small {
  min-height: 32px;
  margin-top: 0.1rem;
}

.sheet__foot--spread {
  align-items: center;
  justify-content: space-between;
}

.sheet__actions {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}

/* ---------- Friendly motion ---------- */
@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes glow {
  0% { box-shadow: 0 0 0 0 rgba(122, 36, 55, 0.45), var(--shadow); }
  100% { box-shadow: 0 0 0 14px rgba(122, 36, 55, 0), var(--shadow); }
}

.wine-card--new {
  animation: card-in 0.45s ease-out both, glow 1.2s ease-out 0.3s;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Larger screens ---------- */
@media (min-width: 560px) {
  

  .chips {
    flex: 1 1 auto;
    margin: 0;
    padding: 0.125rem 0;
  }
}

/* ==========================================================================
   Pages: overview, cellar and history with the bottom menu
   ========================================================================== */


/* Shared parts that need a small tweak on light backgrounds */
.label { letter-spacing: 0.06em; font-weight: 700; }
.pill { letter-spacing: 0; text-transform: none; font-weight: 700; font-size: 0.6875rem; }
.pill--ok,
.pill--urgent,
.btn--danger-solid { color: #ffffff; }
.pill--warn { color: var(--text); }
.badge--low { color: var(--urgent); }
.sheet__title,
.wine-name,
.empty__title { font-weight: 700; font-style: normal; }
.footer__tagline { font-style: normal; }
.modal::backdrop { background: rgba(27, 29, 33, 0.45); }
.modal { box-shadow: 0 -10px 40px rgba(27, 29, 33, 0.2); }
.toast__inner { box-shadow: 0 10px 30px rgba(27, 29, 33, 0.2); }

.empty { background: var(--surface); border-style: solid; }

.app {
  padding-bottom: calc(7rem + env(safe-area-inset-bottom));
}

.toast {
  bottom: calc(6.5rem + env(safe-area-inset-bottom));
}

.dash {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.dash-card {
  background: var(--surface);
  border-radius: var(--radius);
}

.dash-muted {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Page title */
.dash-head {
  padding-top: calc(1.75rem + env(safe-area-inset-top));
}

.dash-head__eyebrow,
.dash-head__sub {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.dash-head__title {
  margin-top: 0.25rem;
  font-size: 1.625rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.dash-head__sub {
  margin-top: 0.1rem;
}

.dash-head .sync {
  margin-top: 0.15rem;
  font-size: 0.75rem;
}

/* Three small numbers */
.dash-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.625rem;
}

.dash-tile {
  padding: 0.75rem 0.875rem;
  border-radius: 16px;
  min-width: 0;
}

.dash-tile__label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.dash-tile__value {
  margin-top: 0.1rem;
  font-size: 1.25rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-tile__value--word {
  font-size: 0.9375rem;
  line-height: 1.9rem;
}

/* Card with a title */
.dash-section {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  padding: 1rem 1.125rem;
}

.dash-section__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.dash-section__title {
  font-size: 0.9375rem;
  font-weight: 700;
}

.dash-section__count {
  font-weight: 500;
  color: var(--text-muted);
}

.dash-link {
  min-height: 44px;
  margin: -0.75rem -0.5rem;
  padding: 0 0.5rem;
  background: none;
  border: 0;
  color: var(--wine);
  font-size: 0.8125rem;
  font-weight: 700;
}

/* Ripeness: one bar in three parts */
.dash-ripeness {
  display: flex;
  gap: 2px;
  height: 14px;
  border-radius: 7px;
  overflow: hidden;
}

.dash-ripeness__part { width: var(--size); }
.dash-ripeness__part--now { background: var(--urgent); }
.dash-ripeness__part--soon { background: #d59a3a; }
.dash-ripeness__part--wait { background: #5e8c69; }

.dash-ripeness__legend {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: #3f434a;
}

/* Bottles per country */
.dash-bars {
  display: grid;
  grid-template-columns: minmax(0, 6rem) minmax(0, 1fr) 1.75rem;
  gap: 0.5rem 0.625rem;
  align-items: center;
  font-size: 0.8125rem;
}

.dash-bars__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-bars__track { display: block; }

.dash-bars__fill {
  display: block;
  width: var(--size);
  min-width: 10px;
  height: 10px;
  border-radius: 5px;
  background: var(--wine);
}

.dash-bars__fill--rest { background: #9aa0a8; }
.dash-bars__count { text-align: right; }

/* Rows inside a card (ready to drink, history) */
.dash-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.dash-list li + li .dash-row {
  border-top: 1px solid var(--border);
}

/* History row: the row itself plus a small bin button on the right */
.dash-hist {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.dash-hist + .dash-hist { border-top: 1px solid var(--border); }
.dash-list .dash-hist + .dash-hist .dash-row { border-top: 0; }
.dash-hist .dash-row { flex: 1; min-width: 0; }

.dash-hist__remove {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-right: -0.5rem;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 50%;
  color: #8a9099;
}

.dash-hist__remove svg { width: 18px; height: 18px; }

@media (hover: hover) {
  .dash-hist__remove:hover { background: #f4e6e9; color: var(--urgent); }
}

.remove-history__hint { margin-top: 0.6rem; font-size: 0.875rem; }
.remove-history__hint strong { color: var(--text); }

.dash-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-height: 56px;
  padding: 0.5rem 0;
  background: none;
  border: 0;
  color: var(--text);
  text-align: left;
}

.dash-row__main { min-width: 0; }

.dash-row__title,
.dash-row__meta {
  display: block;
  overflow-wrap: anywhere;
}

.dash-row__title {
  font-size: 0.9375rem;
  font-weight: 700;
}

.dash-row__meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.dash-row__date {
  flex-shrink: 0;
  white-space: nowrap;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--wine);
}

@media (hover: hover) {
  button.dash-row:hover .dash-row__title { color: var(--wine); }
}

/* Cellar: segmented control, chips and wine cards */
.dash .search { margin-top: 0; }
.dash .search .input { border-radius: 14px; }

.dash-seg {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border-radius: 14px;
}

.dash-seg__item {
  min-height: 40px;
  background: none;
  border: 0;
  border-radius: 10px;
  color: #3f434a;
  font-size: 0.8125rem;
  font-weight: 500;
}

.dash-seg__item[aria-selected="true"] {
  background: var(--dark);
  color: #ffffff;
  font-weight: 700;
}

.dash .toolbar { margin-top: 0; }

.chip {
  background: var(--surface);
  border-color: #d5d9de;
  color: var(--text);
  font-weight: 600;
}

.chip[aria-pressed="true"] {
  background: var(--wine);
  border-color: var(--wine);
  color: #ffffff;
}

.chip[aria-pressed="true"] .chip__count { color: #ffffff; opacity: 0.8; }

.dash-group {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.dash-group + .dash-group { margin-top: 1rem; }

.dash-group__title {
  margin-bottom: -0.125rem;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-muted);
}

.dash-wine {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  padding: 0.875rem 1rem;
  background: var(--surface);
  border-radius: var(--radius);
  cursor: pointer;
}

.dash-wine--empty { opacity: 0.6; }

.dash-wine__top {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
}

.dash-wine__top .type-dot {
  margin-top: 0.4rem;
  box-shadow: none;
}

.dash-wine__title {
  flex: 1;
  min-width: 0;
}

.dash-wine__name {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
}

.dash-wine__meta {
  margin-top: 0.1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.dash-sample {
  color: var(--wine);
  font-weight: 600;
}

.dash-wine__bar {
  height: 6px;
  border-radius: 3px;
  background: var(--bg);
  overflow: hidden;
}

.dash-wine__bar.ripeness--ok .ripeness__fill { background: #5e8c69; }
.dash-wine__bar.ripeness--warn .ripeness__fill { background: #d59a3a; }
.dash-wine__bar.ripeness--urgent .ripeness__fill { background: var(--urgent); }

.dash-wine__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.dash-qty {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 2px;
  background: var(--bg);
  border-radius: 999px;
}

.dash-qty__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: var(--surface);
  border: 0;
  border-radius: 50%;
  color: var(--text);
}

.dash-qty__btn svg { width: 16px; height: 16px; }
.dash-qty__btn:disabled { opacity: 0.35; cursor: not-allowed; }

.dash-qty__value {
  min-width: 1.5rem;
  text-align: center;
  font-weight: 700;
}

.dash-wine__price {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Buttons of the dashboard pages */
.dash-btn {
  min-height: 44px;
  padding: 0 0.875rem;
  border: 0;
  border-radius: 12px;
  font-size: 0.8125rem;
  font-weight: 700;
}

.dash-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.dash-btn--dark { background: var(--dark); color: #ffffff; }
.dash-btn--wine { background: var(--wine); color: #ffffff; }
.dash-btn--light { background: var(--surface); color: var(--text); border: 1px solid #d5d9de; }

.dash-btn--block {
  width: 100%;
  min-height: 52px;
  border-radius: 14px;
  font-size: 1rem;
}

/* History page: one card per month */
.dash-month {
  padding: 0.5rem 1.125rem 0.25rem;
}

.dash-month + .dash-month { margin-top: 0.875rem; }

.dash-month__title {
  margin: 0.5rem 0 0.125rem;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-muted);
}

/* Bottom navigation + round add button */
.dash-nav {
  position: fixed;
  left: 50%;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)); /* Overzicht, Kelder, plus, Historie */
  align-items: center;
  width: min(calc(100% - 2 * var(--gutter)), calc(var(--max-width) - 2 * var(--gutter)));
  height: 60px;
  transform: translateX(-50%);
  background: var(--dark);
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(27, 29, 33, 0.25);
}

.dash-nav__item {
  min-height: 48px;
  background: none;
  border: 0;
  color: #b6bbc3;
  font-size: 0.75rem;
  font-weight: 500;
}

.dash-nav__item[aria-current="page"] {
  color: #ffffff;
  font-weight: 700;
}

.dash-nav__item:focus-visible { outline-color: #ffffff; outline-offset: -4px; }

/* The raised plus in the middle of the menu */
.dash-nav__plus-slot {
  display: flex;
  justify-content: center;
}

.dash-nav__plus {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  margin-top: -30px;
  padding: 0;
  background: var(--wine);
  border: 4px solid var(--bg);
  border-radius: 50%;
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(27, 29, 33, 0.25);
}

.dash-nav__plus svg { width: 26px; height: 26px; }
.dash-nav__plus:focus-visible { outline-color: var(--wine); outline-offset: 2px; }

/* "Wijn toevoegen" choice sheet */
.modal--add-choice { background: var(--bg); }

.add-choice__head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem var(--gutter) 0.25rem;
}

.add-choice__grip {
  position: absolute;
  top: 0.625rem;
  left: 50%;
  width: 40px;
  height: 4px;
  margin-left: -20px;
  border-radius: 2px;
  background: #c4c9cf;
}

.add-choice__title {
  font-size: 1.25rem;
  font-weight: 800;
}

.add-choice__list {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  padding: 0.5rem var(--gutter) calc(1.25rem + env(safe-area-inset-bottom));
}

.add-choice__item {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  min-height: 72px;
  padding: 0.75rem 0.875rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--text);
  text-align: left;
}

@media (hover: hover) {
  .add-choice__item:hover { border-color: var(--gold-dim); }
}

.add-choice__icon {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: #f4e6e9;
  color: var(--wine);
}

.add-choice__icon--primary {
  background: var(--wine);
  color: #ffffff;
}

.add-choice__icon svg { width: 22px; height: 22px; }

.add-choice__name,
.add-choice__text { display: block; }
.add-choice__name { font-size: 1rem; font-weight: 700; }
.add-choice__text { font-size: 0.8125rem; color: var(--text-muted); }

/* Sales demo: a password instead of the household PIN */
.lock__password {
  font-size: 1.125rem;
  text-align: center;
}

/* Sales demo: AI actions left today */
.add-choice__ai {
  margin: 0.25rem var(--gutter) 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.add-choice__ai--blocked {
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  background: #f8ecd9;
  color: var(--text);
}

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

.detail__ai {
  margin-top: 0.25rem;
}
