/* Engenho design system v1 — warm paper, aged amber and cane green.
   Values come from design/Design system · Foundations and · Components, and the page layouts
   from the Cachaçapp redesign guide. */

:root {
  --paper: #F5EFE6;
  --surface: #FFFCF7;
  --sunken: #EFE6D8;
  --line: #E2D7C6;
  --line-strong: #C9BBA6;
  --ink: #231F1A;
  --ink-2: #5E554A;
  --primary: #9A4F16;
  --primary-hover: #7F4012;
  --primary-faded: #C9894E;   /* older bars in the price history */
  --on-primary: #FFFFFF;
  --primary-soft: #F6E3CF;
  --on-primary-soft: #7F4012;
  --cane: #3E6A2C;
  --cane-soft: #E3EDD9;
  --danger: #A12C1E;
  --danger-soft: #F8E1DC;
  --dark-band: #231F1A;       /* summary band and toasts */
  --dark-band-ink: #F1EADF;
  --dark-band-muted: #B5AA9A;
  --dark-band-line: #3A3329;
  --toast-action: #E39A55;
  --wood: #7A4F28;
  --on-wood: #FFFFFF;
  --backdrop: rgba(21, 19, 15, .45);
  --shadow-raised: 0 1px 2px rgba(35, 31, 26, .06), 0 4px 12px rgba(35, 31, 26, .06);
  --shadow-overlay: 0 12px 40px rgba(35, 31, 26, .20);
  --shadow-fab: 0 8px 24px rgba(154, 79, 22, .35);
  --shadow-segment: 0 1px 3px rgba(35, 31, 26, .12);
  --shadow-footer: 0 -8px 24px rgba(35, 31, 26, .06);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%235E554A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");

  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: Inter, system-ui, sans-serif;

  --r-tag: 6px;
  --r-chip: 8px;
  --r-control: 12px;
  --r-card: 16px;
  --r-sheet: 24px;
  --nav-h: 74px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #15130F;
    --surface: #1E1B16;
    --sunken: #28241E;
    --line: #3A3329;
    --line-strong: #52483C;
    --ink: #F1EADF;
    --ink-2: #B5AA9A;
    --primary: #E39A55;
    --primary-hover: #ECB07A;
    --primary-faded: #8A5B30;
    --on-primary: #1E1208;
    --primary-soft: #3D2B1B;
    --on-primary-soft: #F2C290;
    --cane: #9CC67E;
    --cane-soft: #24321D;
    --danger: #F08A78;
    --danger-soft: #42221C;
    --dark-band: #2A251E;
    --dark-band-ink: #F1EADF;
    --dark-band-muted: #B5AA9A;
    --dark-band-line: #4A4136;
    --wood: #8A5C30;
    --backdrop: rgba(0, 0, 0, .6);
    --shadow-raised: 0 1px 2px rgba(0, 0, 0, .35), 0 4px 12px rgba(0, 0, 0, .25);
    --shadow-overlay: 0 12px 40px rgba(0, 0, 0, .55);
    --shadow-fab: 0 8px 24px rgba(0, 0, 0, .45);
    --shadow-segment: 0 1px 3px rgba(0, 0, 0, .4);
    --shadow-footer: 0 -8px 24px rgba(0, 0, 0, .3);
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23B5AA9A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    color-scheme: dark;
  }
}

/* --- base ------------------------------------------------------------------ */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/24px var(--font-body);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }
a { color: var(--primary); }
a:hover { color: var(--primary-hover); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
button { font: inherit; color: inherit; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; }

.title { font: 800 34px/38px var(--font-display); letter-spacing: -.01em; text-wrap: balance; }
.display { font: 800 44px/46px var(--font-display); letter-spacing: -.02em; text-wrap: balance; overflow-wrap: anywhere; }
.heading { font: 700 20px/26px var(--font-display); }
.subheading { font: 700 17px/22px var(--font-display); }
.eyebrow {
  font: 600 12px/16px var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--primary);
}
.eyebrow-lg { font-size: 13px; letter-spacing: .1em; }
.eyebrow-muted { color: var(--ink-2); }
.app-eyebrow {
  font: 600 12px/16px var(--font-body); letter-spacing: .1em; text-transform: uppercase; color: var(--primary);
}
.overline { font: 600 12px/16px var(--font-body); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.meta { font-size: 13px; line-height: 18px; color: var(--ink-2); }
.meta-lg { font-size: 14px; line-height: 20px; }
.muted { color: var(--ink-2); }
.label { display: block; font: 600 14px/20px var(--font-body); color: var(--ink); }
.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.in-adega { color: var(--cane); font-weight: 600; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.align-start { align-self: flex-start; }
.align-center { align-self: center; }
.push-right { margin-left: auto; }

/* --- layout and navigation ------------------------------------------------- */

.page {
  max-width: 720px;
  margin: 0 auto;
  padding-top: 28px;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  padding-bottom: calc(var(--nav-h) + 112px + env(safe-area-inset-bottom));
}
.no-nav .page { padding-bottom: 48px; }

.page-header { display: flex; flex-direction: column; gap: 2px; margin-bottom: 16px; }
.page-header .meta { font-size: 14px; line-height: 20px; max-width: 60ch; margin-top: 2px; }

.app-nav {
  position: fixed; z-index: 20; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-around;
  padding: 8px max(4px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left));
  background: var(--surface); border-top: 1px solid var(--line);
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 64px; padding: 6px 0;
  color: var(--ink-2); text-decoration: none; font: 500 12px/1 var(--font-body); border-radius: 12px;
}
.nav-item:hover { color: var(--ink); }
.nav-icon { display: flex; align-items: center; justify-content: center; width: 56px; height: 30px; border-radius: 999px; }
.nav-item[aria-current="page"] { color: var(--primary); font-weight: 600; }
.nav-item[aria-current="page"] .nav-icon { background: var(--primary-soft); }

@media (min-width: 900px) {
  .has-nav { padding-left: 96px; }
  .app-nav {
    top: 0; right: auto; width: 96px; flex-direction: column; justify-content: flex-start; gap: 12px;
    padding: 32px 0 24px; border-top: 0; border-right: 1px solid var(--line);
  }
  .page { padding-top: 40px; padding-bottom: 120px; }
}

/* --- buttons ---------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 20px; border: 1px solid transparent; border-radius: var(--r-control);
  font: 600 16px/1 var(--font-body); text-decoration: none; white-space: nowrap; cursor: pointer;
}
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); color: var(--on-primary); }
.btn-secondary { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-secondary:hover { border-color: var(--line-strong); color: var(--ink); }
.btn-tonal { background: var(--primary-soft); color: var(--on-primary-soft); }
.btn-tonal:hover { border-color: var(--primary); color: var(--on-primary-soft); }
.btn-text { background: transparent; color: var(--primary); padding: 0 12px; }
.btn-text:hover { background: var(--primary-soft); color: var(--primary); }
.btn-danger { background: var(--surface); border-color: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); }
.btn-compact { height: 44px; padding: 0 14px; font-size: 15px; }
.btn-tall { height: 52px; font-size: 17px; }
.btn-chip { height: 36px; padding: 0 8px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-grow { flex: 1; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-icon {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 44px; height: 44px; padding: 0; border: 0; border-radius: var(--r-control);
  background: transparent; color: var(--ink-2); cursor: pointer;
}
.btn-icon:hover { background: var(--sunken); color: var(--ink); }
.btn-outline { border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.btn-square { width: 52px; height: 52px; border-radius: 14px; }
.btn-sunk { background: var(--sunken); color: var(--ink); }

.fab {
  position: fixed; z-index: 25;
  right: max(16px, env(safe-area-inset-right));
  bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 8px; height: 56px; padding: 0 22px 0 18px;
  border: 0; border-radius: 18px; background: var(--primary); color: var(--on-primary);
  font: 600 16px/1 var(--font-body); box-shadow: var(--shadow-fab); cursor: pointer;
}
.fab:hover { background: var(--primary-hover); }
@media (min-width: 900px) { .fab { right: 32px; bottom: 32px; } }

/* --- inputs ------------------------------------------------------------------ */

:where(input:not([type="checkbox"], [type="radio"], [type="range"], [type="hidden"]), select, textarea) {
  width: 100%; height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--r-control);
  background: var(--sunken); color: var(--ink); font: 500 16px/1.25 var(--font-body);
}
:where(textarea) {
  height: auto; min-height: 112px; padding: 12px 14px; line-height: 24px; font-weight: 400; resize: vertical;
  background: var(--paper);
}
:where(select) {
  appearance: none; padding-right: 40px; cursor: pointer;
  background-image: var(--chevron); background-repeat: no-repeat; background-position: right 12px center;
}
:where(input, select, textarea)::placeholder { color: var(--ink-2); opacity: .85; font-weight: 400; }
:where(input:not([type="checkbox"], [type="radio"], [type="range"]), select):focus,
:where(textarea):focus {
  outline: none; background-color: var(--surface); border: 2px solid var(--primary); padding-left: 13px;
}
:where(textarea):focus { padding: 11px 13px; }
input[type="checkbox"] { accent-color: var(--primary); }

.input-tall { height: 52px; }

.affix {
  display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--r-control); background: var(--sunken); color: var(--ink-2);
}
.affix:focus-within { background: var(--surface); border: 2px solid var(--primary); padding: 0 13px; }
.affix input, .affix input:focus {
  flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; border-radius: 0; background: transparent; outline: none;
  color: var(--ink);
}
.affix .icon { flex: none; }
.affix-text { font-weight: 600; }
.affix-pill { border-radius: 999px; border-color: transparent; padding: 0 16px; }
.affix-pill:focus-within { padding: 0 15px; }
.affix-compact { height: 44px; }
.affix-action { padding-right: 4px; }
.affix-action:focus-within { padding-right: 3px; }
.affix.input-tall { height: 52px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-error { font-size: 13px; line-height: 18px; color: var(--danger); }
.has-error > :where(input, select), .has-error .affix {
  background: var(--danger-soft); border: 2px solid var(--danger);
}
.has-error .affix { padding: 0 13px; }

.form { display: flex; flex-direction: column; gap: 20px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 16px; }
.row-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.narrow { max-width: 440px; }
.check-row { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; cursor: pointer; }
.check-row input { width: 20px; height: 20px; margin: 0; }

.banner { padding: 12px 16px; border-radius: var(--r-control); margin-bottom: 16px; font-size: 14px; line-height: 20px; }
.banner-error { background: var(--danger-soft); color: var(--danger); }

/* --- cards, tiles, lists, empty states ------------------------------------------ */

.card {
  background: var(--surface); border: 0; border-radius: var(--r-card);
  box-shadow: var(--shadow-raised); padding: 16px;
}
.card-list { display: flex; flex-direction: column; gap: 16px; }
.card-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; color: inherit; text-decoration: none; }
.card-head { display: flex; align-items: center; gap: 14px; }
.name-link { color: var(--ink); text-decoration: none; }
.name-link:hover { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }

.tasting { display: flex; flex-direction: column; gap: 12px; }
.notes { font-size: 15px; line-height: 22px; white-space: pre-wrap; overflow-wrap: anywhere; }

.tiles { display: grid; gap: 8px; margin-bottom: 16px; }
.tiles-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tiles-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tile {
  display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 12px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
}
.tile-value { font: 800 24px/28px var(--font-display); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tile-amber { color: var(--primary); }
.tile-sm { font-size: 20px; line-height: 24px; font-weight: 700; }
.tile-label { font-size: 12px; line-height: 16px; color: var(--ink-2); overflow-wrap: anywhere; }
.tile-sunk { background: var(--paper); border-color: transparent; border-radius: var(--r-control); }

.empty {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 20px 16px;
  border: 1px dashed var(--line-strong); border-radius: var(--r-card); text-align: center;
}
.empty strong { font: 700 16px/20px var(--font-display); }
.empty span { font-size: 14px; line-height: 20px; color: var(--ink-2); }
.empty .btn { margin-top: 6px; }
.empty-page { margin-top: 15vh; gap: 12px; }

/* --- search and filters ------------------------------------------------------------ */

.search-form { margin-bottom: 12px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink);
  font: 500 14px/1 var(--font-body); text-decoration: none; cursor: pointer; white-space: nowrap; list-style: none;
}
.chip-btn::-webkit-details-marker { display: none; }
.chip-btn:hover { border-color: var(--line-strong); color: var(--ink); }
.chip-btn[aria-current="true"] { background: var(--primary-soft); border-color: var(--primary); color: var(--on-primary-soft); font-weight: 600; }
.menu:first-child > .chip-btn { font-weight: 600; }

/* --- score -------------------------------------------------------------------- */

.score-ring {
  flex: none; display: grid; place-items: center; width: var(--size); height: var(--size); border-radius: 50%;
  background: conic-gradient(var(--primary) 0 var(--pct), var(--sunken) var(--pct) 100%);
}
.score-ring span {
  display: grid; place-items: center; width: calc(var(--size) * .8); height: calc(var(--size) * .8);
  border-radius: 50%; background: var(--surface);
  font: 700 calc(var(--size) * .33)/1 var(--font-display); font-variant-numeric: tabular-nums;
}
.score-ring-big { background: conic-gradient(var(--primary) 0 var(--pct), var(--line) var(--pct) 100%); }
.score-ring-big span { width: calc(var(--size) - 16px); height: calc(var(--size) - 16px); background: var(--paper);
  color: var(--primary); font-weight: 800; font-size: calc(var(--size) * .32); }

.score-field { gap: 10px; }
.score-display { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.score-readout { display: flex; flex-direction: column; align-items: center; }
.score-big { font: 800 56px/1 var(--font-display); letter-spacing: -.02em; color: var(--primary); font-variant-numeric: tabular-nums; }
.score-word { font-size: 14px; line-height: 20px; font-weight: 600; color: var(--ink-2); }
.score-range { width: 100%; height: 32px; margin: 0; accent-color: var(--primary); }
.score-scale { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.has-error .score-big { color: var(--danger); }

/* --- chips and badges ------------------------------------------------------------ */

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; font-size: 13px; line-height: 1; }
.chip-wood { border-radius: var(--r-chip); background: var(--sunken); }
.chip-aroma { border-radius: 999px; border: 1px solid var(--line); background: var(--surface); }
.i-ring { color: var(--wood); }
.dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--slice)); }

.badge {
  display: inline-flex; align-items: center; gap: 4px; flex: none; height: 24px; padding: 0 8px; border-radius: var(--r-tag);
  font: 600 12px/1 var(--font-body); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.badge-cane { background: var(--cane-soft); color: var(--cane); }
.badge-neutral { background: var(--sunken); color: var(--ink-2); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }

/* --- kebab menu ------------------------------------------------------------------- */

.menu { position: relative; flex: none; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 10; min-width: 180px; padding: 6px;
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow-overlay);
}
.menu-left { left: 0; right: auto; }
.menu-wide { width: 270px; }
.menu-scroll { max-height: 300px; overflow-y: auto; min-width: 220px; }
.menu-panel a, .menu-panel button {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 0 10px; border: 0; border-radius: 10px;
  background: transparent; color: var(--ink); font: 500 15px/20px var(--font-body); text-decoration: none; text-align: left; cursor: pointer;
}
.menu-panel a:hover, .menu-panel button:hover { background: var(--sunken); color: var(--ink); }
.menu-panel a[aria-current="true"] { font-weight: 600; color: var(--primary); }
.menu-panel .menu-danger { color: var(--danger); }
.menu-panel .icon { flex: none; }
.menu-panel small, .menu-note small { display: block; font-size: 13px; line-height: 18px; color: var(--ink-2); font-weight: 400; }
.menu-panel button span { padding-block: 8px; }
.menu-divider { height: 1px; margin: 4px 6px; border: 0; background: var(--line); }
.menu-note { display: flex; align-items: flex-start; gap: 12px; padding: 10px; color: var(--ink-2); font: 500 15px/20px var(--font-body); }
.menu-note .icon { margin-top: 1px; }

/* --- the tasting form (full-screen sheet / edit page) ------------------------------- */

.tasting-form { display: flex; flex-direction: column; min-height: 100%; background: var(--surface); }
.form-bar {
  position: sticky; top: 0; z-index: 6; display: flex; align-items: center; gap: 8px; height: 60px; padding: 0 8px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.form-bar-title { flex: 1; font: 700 19px/24px var(--font-display); }
.form-bar .meta { padding-right: 8px; }
.form-body { flex: 1; display: flex; flex-direction: column; gap: 28px; padding: 20px 16px 32px; }
.form-footer {
  position: sticky; bottom: 0; z-index: 6; display: flex; gap: 10px;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--line); box-shadow: var(--shadow-footer);
}
.page-form { max-width: 680px; padding-top: 16px; }
.fullform { border-radius: var(--r-card); overflow: clip; box-shadow: var(--shadow-raised); }
@media (max-width: 639px) {
  .page-form { padding: 0; }
  .fullform { border-radius: 0; box-shadow: none; }
}

/* --- cachaça picker -------------------------------------------------------------- */

.picker-anchor { position: relative; }
.picker-anchor.is-open .affix { border-radius: var(--r-control) var(--r-control) 0 0; }
.picker-list {
  position: absolute; left: 0; right: 0; top: calc(100% - 2px); z-index: 15; margin: 0; padding: 0; list-style: none;
  max-height: 288px; overflow-y: auto; background: var(--surface);
  border: 2px solid var(--primary); border-top: 1px solid var(--line); border-radius: 0 0 var(--r-control) var(--r-control);
  box-shadow: var(--shadow-overlay);
}
.picker-option {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 12px 14px;
  border-top: 1px solid var(--line); cursor: pointer;
}
.picker-option:first-child { border-top: 0; }
.picker-option[aria-selected="true"] { background: var(--primary-soft); }
.picker-option strong { font-weight: 600; }
.picker-brand { color: var(--ink-2); }
.picker-meta { flex: none; font-size: 12px; color: var(--ink-2); }
.picker-meta.in-adega { color: var(--cane); }
.picker-create { justify-content: flex-start; gap: 8px; color: var(--primary); font-weight: 600; }
.picker-chosen {
  display: flex; align-items: center; gap: 12px; padding: 12px 8px 12px 14px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--paper);
}
.chosen-name { font: 700 19px/24px var(--font-display); }
.picker-status { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; line-height: 18px; color: var(--ink-2); }
.picker-new {
  display: flex; flex-direction: column; gap: 12px; padding: 14px;
  border: 1px dashed var(--line-strong); border-radius: var(--r-control);
}
.picker-new-title { font: 700 15px/20px var(--font-display); }

/* --- wood picker ---------------------------------------------------------------------- */

.chips-selected { display: flex; flex-wrap: wrap; gap: 8px; }
.chips-selected:empty { display: none; }
.wood-selected {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 8px 0 10px; border: 0;
  border-radius: var(--r-chip); background: var(--wood); color: var(--on-wood); font: 600 14px/1 var(--font-body); cursor: pointer;
}
.wood-options { display: flex; flex-wrap: wrap; gap: 8px; }
.wood-option { position: relative; cursor: pointer; }
.wood-option input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.wood-option span {
  display: inline-flex; align-items: center; height: 36px; padding: 0 12px; border: 1px solid var(--line);
  border-radius: var(--r-chip); background: var(--surface); font: 500 14px/1 var(--font-body);
}
.wood-option:hover span { border-color: var(--line-strong); }
.wood-option input:checked + span { background: var(--wood); border-color: var(--wood); color: var(--on-wood); font-weight: 600; }
.wood-option input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }

/* --- aroma wheel ------------------------------------------------------------------ */

.aroma-field { gap: 12px; }
.wheel { display: block; width: 100%; max-width: 320px; margin: 0 auto; overflow: visible; }
.wheel-slice { cursor: pointer; outline: none; transition: transform .15s ease-out; }
.wheel-slice path { fill: var(--slice); stroke: var(--surface); stroke-width: 1.5; }
.wheel-slice text {
  fill: #FFFFFF; font: 600 10px var(--font-body); text-anchor: middle; dominant-baseline: central; pointer-events: none;
}
.wheel-slice:hover path, .wheel-slice:focus-visible path { stroke: var(--ink); stroke-width: 2; }
.wheel-slice.active { transform: translate(var(--dx), var(--dy)); }
.wheel-slice.active path { stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: round; }
.wheel-slice.active text { font-weight: 700; font-size: 11px; }
.wheel-badge circle { fill: var(--surface); stroke: var(--slice); stroke-width: 2.5; }
.wheel-badge text { fill: var(--ink); font-size: 10px; font-weight: 700; }
.wheel-hub { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; }
.wheel-hub-label { fill: var(--ink); font: 700 12px var(--font-display); text-anchor: middle; dominant-baseline: central; }
.wheel-hub-sub { fill: var(--ink-2); font: 400 8.5px var(--font-body); text-anchor: middle; dominant-baseline: central; }

.aroma-panel { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 14px; background: var(--paper); }
.aroma-panel legend {
  float: left; width: 100%; display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
  font: 700 15px/20px var(--font-display);
}
.aroma-panel legend .dot { width: 10px; height: 10px; }
.aroma-options { clear: both; display: flex; flex-wrap: wrap; gap: 8px; }
.pill { position: relative; cursor: pointer; }
.pill input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.pill > span {
  display: inline-flex; align-items: center; height: 36px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); font: 500 14px/1 var(--font-body);
}
.pill:hover > span { border-color: var(--line-strong); }
.pill input:checked + span { background: var(--slice); border-color: var(--slice); color: #FFFFFF; font-weight: 600; }
.pill input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }

.aroma-chosen { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.aroma-selected { display: contents; }
.aroma-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 6px 0 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 500 14px/1 var(--font-body); cursor: pointer;
}
.aroma-chip svg { color: var(--ink-2); }
.aroma-chip:hover { border-color: var(--line-strong); }

/* --- sheets (dialogs) -------------------------------------------------------------- */

dialog.sheet {
  width: 100%; max-width: 640px; max-height: min(92vh, 960px); margin: auto auto 0; overflow-y: auto;
  padding: 10px max(16px, env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  border: 0; border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-overlay);
}
dialog.sheet[open] { display: flex; flex-direction: column; gap: 16px; }
dialog.sheet::backdrop { background: var(--backdrop); }
.sheet-small { max-width: 460px; }
@media (min-width: 640px) {
  dialog.sheet { margin: auto; padding: 24px; border-radius: var(--r-sheet); max-height: min(88vh, 960px); }
}
.sheet-handle { flex: none; align-self: center; width: 40px; height: 4px; border-radius: 999px; background: var(--line); }
@media (min-width: 640px) { .sheet-handle { display: none; } }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sheet-title { font: 800 26px/30px var(--font-display); overflow-wrap: anywhere; }

/* The tasting sheet fills the phone screen; the form inside scrolls between its bars. */
dialog.sheet-full { padding: 0; gap: 0; }
dialog.sheet-full[open] { display: block; }
@media (max-width: 639px) {
  dialog.sheet-full { width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; border-radius: 0; }
}
@media (min-width: 640px) {
  dialog.sheet-full { padding: 0; height: min(92vh, 980px); overflow-y: auto; }
}

/* --- ficha ------------------------------------------------------------------------ */

.top-bar { display: flex; align-items: center; justify-content: space-between; margin: -16px -8px 4px; }
.ficha-head { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.status-band {
  display: flex; align-items: center; gap: 12px; margin-bottom: 20px; padding: 12px 12px 12px 16px;
  border-radius: 14px; background: var(--sunken); color: var(--ink-2);
}
.status-band p { flex: 1; font-size: 15px; line-height: 20px; color: var(--ink); }
.status-band strong { font-weight: 600; }
.section-card { display: flex; flex-direction: column; gap: 14px; margin-bottom: 20px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.quote { font-size: 17px; line-height: 26px; white-space: pre-wrap; overflow-wrap: anywhere; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.profile-bar { display: flex; gap: 2px; height: 12px; border-radius: 999px; overflow: hidden; }
.profile-bar span { background: var(--c); }
.plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.plain-list li { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }
.price-bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.price-bars li { display: flex; flex-direction: column; gap: 6px; }
.price-bar-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; font-size: 14px; font-variant-numeric: tabular-nums; }
.price-bar-head strong { font-weight: 600; }
.bar-track { height: 10px; border-radius: 999px; background: var(--sunken); }
.bar-fill { height: 10px; border-radius: 999px; background: var(--primary); }
.bar-old { background: var(--primary-faded); }

/* --- adega ------------------------------------------------------------------------- */

.segmented { display: flex; padding: 4px; border-radius: var(--r-control); background: var(--sunken); margin-bottom: 16px; }
.segmented a {
  flex: 1; display: flex; align-items: center; justify-content: center; height: 40px; border-radius: 9px;
  color: var(--ink-2); font: 600 15px/1 var(--font-body); text-decoration: none; font-variant-numeric: tabular-nums;
}
.segmented a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-segment); }

.summary-band {
  display: flex; align-items: stretch; margin-bottom: 16px; padding: 16px; border-radius: var(--r-card);
  background: var(--dark-band); color: var(--dark-band-ink);
}
.summary-band > div:not(.band-divider) { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.summary-band > div:first-child { flex: 1; }
.band-value { font: 800 30px/34px var(--font-display); font-variant-numeric: tabular-nums; }
.band-label { font-size: 13px; line-height: 18px; color: var(--dark-band-muted); }
.band-divider { width: 1px; margin: 0 16px; background: var(--dark-band-line); }

.list-card {
  list-style: none; margin: 0 0 16px; padding: 0; border-radius: var(--r-card);
  background: var(--surface); box-shadow: var(--shadow-raised);
}
.list-row { display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row-main {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; padding: 14px 12px 14px 16px;
  border: 0; background: transparent; text-align: left; cursor: pointer; border-radius: var(--r-card); color: var(--ink); text-decoration: none;
}
.list-row-main > .icon { color: var(--ink-2); flex: none; }
.qty-badge {
  flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-control);
  background: var(--cane-soft); color: var(--cane); font: 800 18px/1 var(--font-display);
}
.row-name { font: 700 18px/22px var(--font-display); }
.chip-action {
  flex: none; display: inline-flex; align-items: center; height: 32px; margin-right: 12px; padding: 0 12px;
  border-radius: var(--r-chip); background: var(--primary-soft); color: var(--on-primary-soft);
  font: 600 13px/1 var(--font-body); text-decoration: none;
}
.chip-action:hover { color: var(--on-primary-soft); outline: 1px solid var(--primary); }

.group-fold { margin-bottom: 16px; }
.group-fold > summary {
  display: flex; align-items: center; justify-content: space-between; min-height: 44px; list-style: none; cursor: pointer;
  font: 600 14px/20px var(--font-body); color: var(--ink-2);
}
.group-fold > summary::-webkit-details-marker { display: none; }
.group-fold[open] > summary .icon { transform: rotate(180deg); }
.fold-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.out-row {
  display: flex; align-items: center; gap: 14px; padding: 12px 12px 12px 16px;
  border: 1px dashed var(--line-strong); border-radius: var(--r-card);
}

.bottle-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r-card); }
.bottle-item { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-bottom: 1px solid var(--line); }
.bottle-item:last-child { border-bottom: 0; }
.bottle-row { display: flex; align-items: center; gap: 8px; }
.price-form { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.price-form .affix { flex: 1; min-width: 0; font-variant-numeric: tabular-nums; }
.price-form input { font-weight: 600; }
.saved { display: inline-flex; align-items: center; gap: 4px; flex: none; font-size: 12px; font-weight: 600; color: var(--cane); }
.add-panel { gap: 12px; padding: 14px; border-radius: var(--r-card); background: var(--paper); }
.add-panel .affix, .add-panel :where(input:not([type="checkbox"])) { background: var(--surface); }
.add-panel .affix input { background: transparent; }

.qty-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: var(--r-control); background: var(--surface); }
.stepper-btn {
  display: grid; place-items: center; width: 44px; height: 44px; border: 0; background: transparent; color: var(--ink); cursor: pointer;
  border-radius: var(--r-control);
}
.stepper-btn:hover { background: var(--sunken); }
.stepper .stepper-value, .stepper .stepper-value:focus {
  width: 40px; height: 44px; padding: 0; border: 0; background: transparent; text-align: center;
  font: 700 17px/1 var(--font-display); -moz-appearance: textfield; appearance: textfield;
}
.stepper-value::-webkit-outer-spin-button, .stepper-value::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.archive-card { display: flex; flex-direction: column; gap: 10px; }
.archive-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.archive-rows { list-style: none; margin: 0; padding: 0; }
.archive-rows li { display: flex; align-items: center; gap: 10px; padding-top: 10px; margin-top: 10px; border-top: 1px solid var(--line); }
.archive-rows li:first-child { margin-top: 0; }
.row-price { font: 600 16px/20px var(--font-body); font-variant-numeric: tabular-nums; }

/* --- marcas ------------------------------------------------------------------------- */

.brand-search { margin-bottom: 16px; display: flex; flex-direction: column; gap: 6px; }
.round-add {
  display: grid; place-items: center; flex: none; width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: var(--primary); color: var(--on-primary); cursor: pointer;
}
.round-add:hover { background: var(--primary-hover); }
.brand-block { padding: 0; }
.brand-head { display: flex; align-items: center; gap: 8px; padding: 8px 4px 8px 16px; border-bottom: 1px solid var(--line); }
.brand-name { flex: 1; font: 700 18px/22px var(--font-display); }
.name-line { display: flex; align-items: center; gap: 8px; padding: 6px 4px 6px 16px; border-bottom: 1px solid var(--line); }
.name-line:last-child { border-bottom: 0; }
.name-text { font-size: 16px; line-height: 22px; font-weight: 500; color: var(--ink); text-decoration: none; }
.name-text:hover { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }
.name-empty { justify-content: space-between; padding-right: 8px; }
.brand-none { border: 1px dashed var(--line-strong); border-radius: var(--r-card); }
.group-title { padding: 12px 16px 4px; font: 600 14px/20px var(--font-body); color: var(--ink-2); }
.brand-none .name-line { border-bottom: 0; padding-right: 8px; }

/* --- conta and login ------------------------------------------------------------------ */

.card-form { padding: 20px; }
.account-card { display: flex; flex-direction: column; gap: 20px; }
.account-user { display: flex; align-items: center; gap: 14px; }
.account-link { margin-top: 16px; }
.user-card { display: flex; flex-direction: column; gap: 14px; padding: 16px; }
.user-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.user-actions > summary { list-style: none; width: fit-content; }
.user-actions > summary::-webkit-details-marker { display: none; }
.user-actions[open] > summary { margin-bottom: 16px; }
.user-actions .form + .menu-divider { margin: 16px 0; }
.user-new { margin-top: 16px; display: flex; flex-direction: column; gap: 16px; }
.account-avatar {
  display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%;
  background: var(--primary-soft); color: var(--on-primary-soft);
}

.auth {
  min-height: 100vh; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 16px;
  padding: 48px max(24px, env(safe-area-inset-right)) 32px max(24px, env(safe-area-inset-left));
}
.auth .banner { width: 100%; max-width: 420px; margin-bottom: 0; }
.auth-inner { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 40px; }
.auth-head { display: flex; flex-direction: column; gap: 20px; }
.brand-mark {
  display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%;
  background: conic-gradient(var(--primary) 0 85%, var(--line) 85% 100%);
}
.brand-mark span {
  display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--paper);
  font: 800 26px/1 var(--font-display); color: var(--primary);
}
.wordmark { margin-top: -12px; font: 800 48px/50px var(--font-display); letter-spacing: -.02em; color: var(--primary); }
.auth-tagline { margin-top: -12px; font-size: 17px; line-height: 26px; color: var(--ink-2); }
.auth-form { gap: 18px; }
.auth-form .affix input[type="password"], .auth-form .affix input[type="text"] { font-weight: 500; }
[data-reveal] .i-eye-off { display: none; }
[data-reveal][aria-pressed="true"] .i-eye { display: none; }
[data-reveal][aria-pressed="true"] .i-eye-off { display: inline; }
.note-box {
  display: flex; gap: 12px; padding: 16px; border-radius: 14px; background: var(--sunken);
  font-size: 14px; line-height: 20px; color: var(--ink-2);
}
.note-box .icon { flex: none; margin-top: 1px; }

/* --- toasts -------------------------------------------------------------------------- */

.toasts {
  position: fixed; z-index: 30; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h) + 88px + env(safe-area-inset-bottom));
  width: min(480px, calc(100% - 32px)); display: grid; gap: 8px; pointer-events: none;
}
.no-nav .toasts { bottom: calc(24px + env(safe-area-inset-bottom)); }
@media (min-width: 900px) { .has-nav .toasts { left: calc(50% + 48px); bottom: 104px; } }
dialog .toasts { bottom: calc(96px + env(safe-area-inset-bottom)); left: 50%; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 0 8px 0 16px;
  border-radius: 14px; background: var(--dark-band); color: var(--dark-band-ink); font-size: 14px; line-height: 20px;
  box-shadow: var(--shadow-overlay); animation: toast-in .2s ease-out, toast-out .3s ease-in 6s forwards;
}
.toast > span { flex: 1; padding-block: 8px; }
.toast-action {
  height: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; color: var(--toast-action);
  font: 600 14px/1 var(--font-body); cursor: pointer;
}
.toast-action:focus-visible { outline-color: var(--toast-action); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); visibility: hidden; } }
@media (prefers-reduced-motion: reduce) {
  .toast { animation: toast-out 0s linear 6s forwards; }
  .wheel-slice { transition: none; }
}

@media (max-width: 380px) {
  .tiles-3 .tile-value { font-size: 20px; line-height: 24px; }
  .bottle-row { flex-wrap: wrap; }
  .price-form { flex-basis: 100%; }
}

/* --- ficha técnica ---------------------------------------------------------------- */

.field-hint { font-size: 13px; line-height: 18px; color: var(--on-primary-soft); }
.duo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ficha-block {
  display: flex; flex-direction: column; gap: 4px; margin: -8px 0 16px; padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.ficha-block .section-head { min-height: 32px; }
.ficha-text { font-size: 16px; line-height: 24px; font-weight: 500; }
.ficha-empty { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.ficha-later { border-top: 1px solid var(--line); padding-top: 4px; }
.ficha-later > summary {
  display: flex; align-items: center; gap: 8px; min-height: 44px; list-style: none; cursor: pointer;
  font: 600 14px/20px var(--font-body); color: var(--primary);
}
.ficha-later > summary::-webkit-details-marker { display: none; }
.ficha-later > summary .icon { margin-left: auto; color: var(--ink-2); }
.ficha-later[open] > summary .icon { transform: rotate(180deg); }
.ficha-later-body { display: flex; flex-direction: column; gap: 16px; padding-top: 8px; }

.volume-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.volume-pick {
  height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r-chip);
  background: var(--surface); color: var(--ink); font: 500 13px/1 var(--font-body); cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.volume-pick:hover { border-color: var(--line-strong); }
.volume-pick[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary); color: var(--on-primary-soft); font-weight: 600; }
.per-litre { font-weight: 400; color: var(--ink-2); font-size: 13px; font-variant-numeric: tabular-nums; }
.sheet-body { display: flex; flex-direction: column; gap: 16px; }

/* --- mapa ------------------------------------------------------------------------- */

.map {
  height: min(62vh, 560px); min-height: 320px; margin-bottom: 8px; border: 1px solid var(--line);
  border-radius: var(--r-card); overflow: hidden; background: var(--sunken); z-index: 0;
}
.map .leaflet-container, .map.leaflet-container { font: 500 13px/1.3 var(--font-body); }
.map-hint { margin-bottom: 24px; font-size: 13px; }
.map-note { margin-top: 16px; font-size: 14px; }
/* Numbered pins: a solid amber disc, bigger for states. Leaflet positions the wrapper; the disc fills it. */
.map-pin-wrap { background: none; border: 0; }
.map-pin {
  display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; border-radius: 999px;
  background: var(--primary); color: var(--on-primary); border: 2px solid var(--surface);
  box-shadow: var(--shadow-raised); font: 700 13px/1 var(--font-body); font-variant-numeric: tabular-nums;
  cursor: pointer; transition: transform .12s ease;
}
.map-pin-state { font: 800 15px/1 var(--font-display); }
/* A state's cachaças with no town: same size as a town pin, outlined and dashed so it doesn't read as one. */
.map-pin-loose { background: var(--surface); color: var(--primary); border: 2px dashed var(--primary); }
.map-pin-wrap:hover .map-pin, .map-pin-wrap:focus-visible .map-pin { transform: scale(1.12); }
.map-pin-wrap:focus-visible { outline: none; }
.map-pin-wrap:focus-visible .map-pin { outline: 3px solid var(--ink); outline-offset: 2px; }
.map .leaflet-control-attribution { font-size: 11px; background: color-mix(in srgb, var(--surface) 85%, transparent); color: var(--ink-2); }
.map .leaflet-control-attribution a { color: var(--ink-2); }
.map .leaflet-bar a { background: var(--surface); color: var(--ink); border-color: var(--line); }
@media (prefers-color-scheme: dark) {
  /* OpenStreetMap only draws light tiles; turn them dark so the map sits in the page. */
  .map .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9) saturate(.6); }
}

/* --- sharing the adega ------------------------------------------------------------- */

.header-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.header-row > .btn { flex: none; margin-top: 18px; }
.share-link { display: flex; gap: 8px; }
.share-link input { flex: 1; min-width: 0; font-size: 14px; }
.list-row-static { cursor: default; }
.shared-note { margin-top: 24px; text-align: center; font-size: 13px; }
