/* Theme tokens. `<html data-theme>` is set server-side from the member's
   setting: light, dark or system. `system` (and a page rendered without the
   attribute) follows the OS. `:root` holds the light palette, so a browser
   with no attribute and no JS still gets a readable app. */
:root,
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #F2F4E6;
  --surface: #FBFBF2;
  --surface-raised: #FFFFFF;
  --surface-sunken: #E9EDDA;
  --border: #D8DCC2;
  --border-strong: #74805A;
  --text: #16241A;
  --text-muted: #55613D;
  --primary: #B4E32C;
  --primary-hover: #9FD11A;
  --primary-press: #86B50D;
  --primary-contrast: #16241A;
  --primary-tint: #E7EFCB;
  --accent: #E85D26;
  --accent-ink: #BC440F;
  --accent-tint: #FCEBE2;
  --success: #1D6B45;
  --success-tint: #DDEEE3;
  --warning: #8A5A00;
  --warning-tint: #F6EBCF;
  --danger: #B3261E;
  --danger-tint: #F7E0DD;
  --danger-contrast: #FBFBF2;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(22 36 26 / 8%), 0 8px 24px rgb(22 36 26 / 6%);
}

@media (prefers-color-scheme: dark) {
  /* System (the default) and any page that never set the attribute. An
     explicit light choice is excluded so it wins over a dark OS. */
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    color-scheme: dark;
    --bg: #0C130E;
    --surface: #151E17;
    --surface-raised: #1E2A20;
    --surface-sunken: #080E09;
    --border: #31402F;
    --border-strong: #6B7A63;
    --text: #EEF2E0;
    --text-muted: #A8B49A;
    --primary: #B9E63A;
    --primary-hover: #C9F04F;
    --primary-press: #9FD11A;
    --primary-contrast: #0C130E;
    --primary-tint: #26331C;
    --accent: #FF8A57;
    --accent-ink: #FFB08B;
    --accent-tint: #33201A;
    --success: #5FD39A;
    --success-tint: #122E23;
    --warning: #F2B33D;
    --warning-tint: #33280F;
    --danger: #FF7A6E;
    --danger-tint: #3A1B18;
    --danger-contrast: #0C130E;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%);
  }
}

/* Explicit dark choice. Same palette as the system block above; kept in two
   places because CSS has no way to share a declaration block. */
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0C130E;
  --surface: #151E17;
  --surface-raised: #1E2A20;
  --surface-sunken: #080E09;
  --border: #31402F;
  --border-strong: #6B7A63;
  --text: #EEF2E0;
  --text-muted: #A8B49A;
  --primary: #B9E63A;
  --primary-hover: #C9F04F;
  --primary-press: #9FD11A;
  --primary-contrast: #0C130E;
  --primary-tint: #26331C;
  --accent: #FF8A57;
  --accent-ink: #FFB08B;
  --accent-tint: #33201A;
  --success: #5FD39A;
  --success-tint: #122E23;
  --warning: #F2B33D;
  --warning-tint: #33280F;
  --danger: #FF7A6E;
  --danger-tint: #3A1B18;
  --danger-contrast: #0C130E;
  --shadow: 0 1px 2px rgb(0 0 0 / 40%);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Bricolage Grotesque", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-optical-sizing: auto;
  line-height: 1.5;
  padding-bottom: 84px;
}
a { color: inherit; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--text); }
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; }
h1 { font-size: clamp(2rem, 6vw, 3.25rem); font-weight: 750; margin: 0 0 .5rem; }
h2 { font-size: 1.25rem; margin: 2rem 0 .75rem; }
h3 { font-size: 1.1rem; margin: .5rem 0 .25rem; }
p { margin: .5rem 0; }
.wrap { width: min(1060px, 100% - 2rem); margin-inline: auto; }
.narrow { max-width: 640px; margin-inline: auto; }
.muted { color: var(--text-muted); font-size: .9rem; }
.hint { color: var(--text-muted); font-size: .8rem; display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--surface-raised); padding: .5rem 1rem; z-index: 10; }

.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  width: min(1060px, 100% - 2rem); margin-inline: auto; padding: 1rem 0;
}
.brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 750; text-decoration: none; letter-spacing: -.02em; }
.brand-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 25%, transparent); }
.site-header nav { display: flex; align-items: center; gap: 1rem; font-size: .95rem; }
.site-header nav a { text-decoration: none; }
.site-header nav a:hover { text-decoration: underline; }
.nav-notif { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; }
.nav-badge {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--primary); color: var(--primary-contrast);
  border: 1px solid var(--border-strong); font-size: .72rem; font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.nav-more { position: relative; }
.nav-more > summary {
  display: inline-flex; align-items: center; gap: .35rem; min-height: 44px;
  padding: 0 .25rem; cursor: pointer; font-weight: 600; list-style: none;
}
.nav-more > summary::-webkit-details-marker { display: none; }
.nav-more > summary::after {
  content: ""; width: 6px; height: 6px; margin-top: -3px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
}
.nav-more[open] > summary::after { margin-top: 3px; transform: rotate(225deg); }
.nav-more > summary:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; border-radius: 6px; }
.nav-more-panel {
  position: absolute; inset-inline-end: 0; top: calc(100% + .35rem); z-index: 20;
  display: grid; gap: .1rem; min-width: 200px; padding: .35rem;
  background: var(--surface-raised); border: 1px solid var(--border-strong);
  border-radius: 12px; box-shadow: var(--shadow);
}
.nav-more-panel a, .nav-more-panel button {
  display: flex; align-items: center; width: 100%; min-height: 44px; padding: .5rem .7rem;
  border: 0; border-radius: 8px; background: none; color: inherit;
  font: inherit; font-weight: 500; text-align: left; text-decoration: none; cursor: pointer;
}
.nav-more-panel a:hover, .nav-more-panel button:hover { background: var(--surface-sunken); }
.nav-more-panel form { margin: 0; }
.nav-more-panel a.nav-mobile-only { display: none; }
.inline { display: inline; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 44px; padding: .6rem 1.1rem; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface-raised); color: var(--text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--text); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-contrast); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-primary:active { background: var(--primary-press); }
.btn-small { min-height: 36px; padding: .35rem .8rem; font-size: .875rem; }
.btn-block { width: 100%; }
button.link { border: 0; background: none; color: inherit; font: inherit; padding: 0; cursor: pointer; text-decoration: underline; }

.hero { display: grid; gap: 1.5rem; align-items: end; padding: 2rem 0 1rem; }
.hero.landing { padding: 4rem 0 2rem; max-width: 780px; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; font-weight: 700; color: var(--text-muted); margin: 0 0 .5rem; }
.lede { font-size: 1.1rem; color: var(--text-muted); max-width: 62ch; }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1rem; }
.section-title { margin-top: 2.5rem; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem; box-shadow: var(--shadow);
}
.checkin { margin-bottom: .85rem; }
.checkin-head { display: flex; align-items: center; gap: .65rem; }
.checkin-head > div { flex: 1; min-width: 0; }
.avatar {
  display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px;
  border-radius: 50%; background: var(--primary); color: var(--primary-contrast); font-weight: 750;
}
.rating-pill { background: var(--accent-tint); color: var(--accent-ink); border-radius: 999px; padding: .2rem .6rem; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.note { margin-top: .5rem; }
.checkin-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .75rem; }
.checkin-actions form { margin: 0; }
.chip { display: inline-flex; align-items: center; min-height: 32px; border: 1px solid var(--border-strong); background: var(--surface-raised); border-radius: 999px; padding: .2rem .75rem; font: inherit; font-size: .85rem; cursor: pointer; }
.checkin-actions .chip { min-height: 44px; padding: .35rem .9rem; }
.chip.on { background: var(--primary); border-color: var(--primary); color: var(--primary-contrast); }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; padding: 0; }

.drink-card { display: flex; align-items: center; gap: .85rem; text-decoration: none; margin-bottom: .6rem; }
.drink-card:hover { border-color: var(--border-strong); }
.bottle { display: grid; place-items: center; width: 44px; height: 56px; border-radius: 12px 12px 10px 10px; background: var(--surface-sunken); font-weight: 750; }
.results { display: grid; gap: .5rem; }

.rating-pill, .big-rating { font-variant-numeric: tabular-nums; }
.rating-block { display: flex; align-items: baseline; gap: .6rem; margin: 1rem 0; }
.big-rating { font-size: 2.5rem; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin: 1.5rem 0; }
.facts div { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: .6rem .75rem; }
.facts dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); }
.facts dd { margin: .2rem 0 0; font-weight: 600; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .75rem; margin: 1rem 0 2rem; }
.stats div { background: var(--surface-sunken); border-radius: 12px; padding: .85rem 1rem; }
.stats strong { display: block; font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.stats span { color: var(--text-muted); font-size: .8rem; }

.stack { display: grid; gap: 1rem; margin-top: 1.5rem; }
.stack label { display: grid; gap: .35rem; font-weight: 600; font-size: .9rem; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface-raised);
  border: 1px solid var(--border-strong); border-radius: 10px; padding: .7rem .8rem; min-height: 44px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--text); outline-offset: 2px;
}
textarea { min-height: 90px; resize: vertical; }
.searchbar { display: flex; gap: .5rem; margin: 1rem 0; }
.searchbar input { flex: 1; }

.banner { border-radius: 10px; padding: .75rem 1rem; border: 1px solid var(--border); background: var(--surface); }
.banner.error { border-color: var(--danger); background: var(--danger-tint); }
.banner.warn { border-color: var(--accent); background: var(--accent-tint); }
.banner.success { border-color: var(--success); }
.empty { border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 1.5rem; text-align: center; color: var(--text-muted); }
.row { display: flex; align-items: center; gap: .75rem; margin-bottom: .6rem; }
.row > div:nth-child(2) { flex: 1; }
.divider { text-align: center; color: var(--text-muted); margin: 1.25rem 0 .5rem; }
.token-box { background: var(--surface-sunken); border-radius: 10px; padding: 1rem; overflow-x: auto; margin: 1rem 0; }
.token-box code { word-break: break-all; font-size: .9rem; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .85rem; margin: 2rem 0; }
.features h2 { margin-top: 0; font-size: 1.05rem; }

.tabbar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 5;
  display: none; justify-content: space-around; align-items: center;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border-top: 1px solid var(--border); backdrop-filter: blur(10px); padding: .35rem 0 max(.35rem, env(safe-area-inset-bottom));
}
.tabbar a { text-decoration: none; font-size: .75rem; color: var(--text-muted); padding: .5rem .75rem; min-height: 44px; display: grid; place-items: center; }
.tabbar a.scan {
  position: relative; width: 64px; height: 64px; padding: 0; color: var(--text);
  background: none; box-shadow: none; transform: none; font-size: .75rem;
}
.tabbar a.scan .scan-circle {
  position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
  display: grid; place-items: center; width: 52px; height: 52px;
  border-radius: 50%; background: var(--primary); color: var(--primary-contrast);
  border: 1px solid var(--border-strong); box-shadow: var(--shadow);
}
.tabbar a.scan .scan-icon { width: 24px; height: 24px; }
.tabbar a.scan .scan-label { position: absolute; bottom: 1px; font-weight: 700; color: var(--text); }
.tabbar a.scan:focus-visible .scan-circle { outline: 2px solid var(--text); outline-offset: 2px; }
.site-footer { color: var(--text-muted); font-size: .8rem; padding: 2rem 0; border-top: 1px solid var(--border); margin-top: 2rem; }

@media (max-width: 720px) {
  .tabbar { display: flex; }
  .site-header { padding: .5rem 0; gap: .5rem; }
  .site-header nav { display: flex; gap: .6rem; font-size: .9rem; }
  .site-header nav .nav-main { display: none; }
  .nav-more-panel a.nav-mobile-only { display: flex; }
  .hero { padding-top: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Media, profile and feature surfaces */
.checkin-media { width: 100%; max-height: 420px; object-fit: cover; border-radius: 12px; margin: .6rem 0; background: var(--surface-sunken); }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .6rem; }
.media-grid img, .media-grid video { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: var(--surface-sunken); }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; }
.badge-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .85rem; }
.badge-tile.earned { border-color: var(--primary-press); background: color-mix(in srgb, var(--primary) 14%, var(--surface)); }
.badge-tile strong { display: block; }
.progress { height: 8px; background: var(--surface-sunken); border-radius: 999px; overflow: hidden; margin-top: .4rem; }
.progress > span { display: block; height: 100%; background: var(--primary); }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.inline-form { display: inline-flex; gap: .35rem; align-items: center; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; }
textarea, input, select { font: inherit; color: inherit; background: var(--surface-raised); border: 1px solid var(--border-strong); border-radius: 10px; padding: .6rem .7rem; min-height: 44px; }
textarea { width: 100%; resize: vertical; }
label { display: grid; gap: .3rem; font-weight: 600; }
.file-drop { border: 1px dashed var(--border-strong); border-radius: 12px; padding: .9rem; background: var(--surface-sunken); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .7rem; margin: 1rem 0; }
.stat-grid > div { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .8rem; }
.stat-grid strong { font-size: 1.6rem; display: block; font-variant-numeric: tabular-nums; }
.pill-row { display: flex; flex-wrap: wrap; gap: .4rem; }
.pill { border: 1px solid var(--border); border-radius: 999px; padding: .25rem .6rem; font-size: .8rem; background: var(--surface); }
.twin { display: flex; align-items: center; gap: .75rem; }
.twin-meter { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--accent-ink); }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td { text-align: left; padding: .55rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.video-note { font-size: .8rem; color: var(--text-muted); }


/* Notifications */
.notif-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .75rem; margin: 1rem 0;
}
.notif-toolbar p { margin: 0; }
.notif-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.notif-item {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: 1rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.notif-item.unread {
  background: var(--primary-tint); border-color: var(--border-strong);
  box-shadow: inset 3px 0 0 var(--text);
}
.notif-item .avatar { margin-top: .1rem; }
.avatar-system {
  background: var(--primary-tint); color: var(--text);
  border: 1px solid var(--border-strong);
}
.notif-body { flex: 1; min-width: 0; }
.notif-kicker {
  display: flex; flex-wrap: wrap; align-items: center; gap: .45rem;
  margin: 0 0 .15rem; color: var(--text-muted);
  font-size: .72rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
}
.notif-item.unread .notif-kicker { color: var(--text); }
.notif-line { margin: 0; overflow-wrap: anywhere; }
.notif-item.unread .notif-line { font-weight: 600; }
.notif-line strong { font-weight: 750; }
.notif-meta { margin: .2rem 0 0; color: var(--text-muted); font-size: .8rem; }
.notif-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .65rem; }
.notif-actions form { margin: 0; }
.unread-flag {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .1rem .45rem; border: 1px solid var(--border-strong); border-radius: 999px;
  background: var(--surface-raised); color: var(--text);
  font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
}
.unread-flag::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--text);
}

/* Check-in detail */
.checkin-detail { padding-bottom: .5rem; }
.detail-author { display: flex; align-items: center; gap: .65rem; margin: .75rem 0 1rem; }
.detail-author > div { flex: 1; min-width: 0; }
.detail-media {
  display: block; width: 100%; max-height: 520px; margin: 0 0 1.1rem;
  object-fit: cover; border-radius: var(--radius); background: var(--surface-sunken);
}
.detail-title { margin: .15rem 0 .3rem; font-size: clamp(1.65rem, 5vw, 2.25rem); letter-spacing: -.025em; }
.detail-title a { text-decoration: none; }
.detail-title a:hover { text-decoration: underline; }
.detail-brand { margin: 0 0 1rem; color: var(--text-muted); }
.detail-rating {
  display: inline-flex; align-items: baseline; gap: .6rem;
  padding: .55rem .8rem; border-radius: 10px;
  background: var(--accent-tint); color: var(--accent-ink);
}
.detail-rating strong { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.detail-rating.unrated { background: var(--surface-sunken); color: var(--text-muted); }
.detail-rating-label {
  font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
}
.detail-note { margin: 1rem 0; max-width: 60ch; font-size: 1.02rem; line-height: 1.55; overflow-wrap: anywhere; }
.detail-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 1rem 0; }
.detail-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-top: 1.25rem; }
.detail-actions form { margin: 0; }
.detail-toasts { margin: 0; }
.detail-signin { margin: 0; }
.btn-toasted:disabled {
  background: var(--success-tint); border-color: var(--success);
  color: var(--success); opacity: 1; cursor: default;
}
.btn-danger { background: var(--danger); border-color: var(--danger); color: var(--danger-contrast); }
.btn-danger:hover { border-color: var(--text); }
.danger-zone {
  margin-top: 2rem; padding: 1rem; background: var(--danger-tint);
  border: 1px solid var(--danger); border-radius: var(--radius);
}
.danger-zone h2, .danger-zone h3 { margin: 0 0 .3rem; font-size: 1.02rem; }
.danger-zone p { margin: 0 0 .8rem; }
.danger-zone form { margin: 0; }

/* Settings */
.settings-page { padding-bottom: 1rem; }
.settings-section {
  margin: 0 0 1rem; padding: 1.25rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.settings-section > h2 { margin: 0 0 .2rem; font-size: 1.15rem; }
.settings-intro { margin: 0 0 1rem; color: var(--text-muted); font-size: .9rem; }
.settings-form { display: grid; gap: .9rem; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .75rem; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-top: .15rem; }
.static-field { display: grid; gap: .35rem; }
.static-label { font-size: .9rem; font-weight: 600; }
.readout {
  display: flex; align-items: center; min-height: 44px; margin: 0;
  padding: .6rem .7rem; overflow-wrap: anywhere;
  background: var(--surface-sunken); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text-muted); font-size: .92rem;
}
.settings-sub { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }
.settings-sub h3 { margin: 0 0 .5rem; font-size: 1rem; }
.settings-section input[type="file"] {
  width: 100%; padding: .75rem; background: var(--surface-sunken);
  border: 1px dashed var(--border-strong);
}
.settings-section input[type="time"] { max-width: 180px; }
.check-row {
  display: flex; align-items: flex-start; gap: .7rem; min-height: 44px;
  padding: .55rem 0; border-bottom: 1px solid var(--border); font-weight: 400;
}
.check-row:last-of-type { border-bottom: 0; }
.check-row input[type="checkbox"] {
  flex: 0 0 22px; width: 22px; height: 22px; min-height: 0; margin: .1rem 0 0;
  accent-color: var(--primary-press);
}
.check-copy { display: grid; gap: .1rem; }
.check-copy strong { font-weight: 600; }
.check-copy .hint { font-size: .8rem; }
.settings-note { margin: .5rem 0 0; color: var(--text-muted); font-size: .88rem; }
.session-list { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .6rem; }
.session-row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .8rem .9rem; background: var(--surface-raised);
  border: 1px solid var(--border); border-radius: 10px;
}
.session-info { flex: 1 1 220px; min-width: 0; }
.session-agent { margin: 0; font-size: .9rem; font-weight: 600; overflow-wrap: anywhere; }
.session-meta { margin: .15rem 0 0; color: var(--text-muted); font-size: .78rem; overflow-wrap: anywhere; }
.session-row form { margin: 0; }
.pill-current {
  display: inline-flex; align-items: center; margin-left: .4rem;
  background: var(--primary-tint); border-color: var(--border-strong);
  color: var(--text); font-weight: 700;
}

/* Account recovery */
.auth-note { margin: 1rem 0 0; color: var(--text-muted); font-size: .9rem; }

/* =========================================================================
   Surfaces that had no styling yet. Everything below is additive: scanner,
   profile, insights, and the drink lifecycle form. Nothing above this line
   changed.

   The scanner is dark in both themes on purpose (it sits over a camera feed).
   Its --scanner-* values are the fixed constants from docs/design-direction.md
   section 2.4, scoped to the overlay so they never leak into the page palette.
   ========================================================================= */

/* 1. Barcode scanner overlay ---------------------------------------------- */
.scanner,
[data-scanner] {
  --scanner-base: #0C130E;
  --scanner-chrome: #151E17;
  --scanner-border: #31402F;
  --scanner-edge: rgb(238 242 224 / 0.25);
  --scanner-lime: #B9E63A;
  --scanner-text: #EEF2E0;
  --scanner-text-muted: #A8B49A;

  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: calc(12px + env(safe-area-inset-top)) 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--scanner-base);
  color: var(--scanner-text);
}
/* The overlay ships with the hidden attribute; a display rule would beat it. */
.scanner[hidden],
[data-scanner][hidden] { display: none; }

.scanner-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(440px, 100%);
  margin: auto;
}

.scanner-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.scanner-title {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  color: var(--scanner-text);
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scanner-close,
.scanner-torch {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 48px;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--scanner-border);
  border-radius: 10px;
  background: var(--scanner-chrome);
  color: var(--scanner-text);
  font: inherit;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
}
.scanner-close:hover,
.scanner-torch:hover { border-color: var(--scanner-text-muted); }
.scanner-torch[hidden] { display: none; }
/* Torch is on: lime fill plus a bolder label and an inset edge, so the state
   reads without relying on colour. */
.scanner-torch[aria-pressed="true"] {
  background: var(--scanner-lime);
  border-color: var(--scanner-lime);
  box-shadow: inset 0 0 0 2px var(--scanner-base);
  color: var(--scanner-base);
  font-weight: 800;
}

.scanner-view {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 46vh;
  overflow: hidden;
  border: 1px solid var(--scanner-border);
  border-radius: 16px;
  background: var(--scanner-base);
  box-shadow: 0 2px 12px rgb(0 0 0 / 35%);
}
/* A hairline window inside the feed, so the target area is legible. */
.scanner-view::after {
  content: "";
  position: absolute;
  inset: 20px;
  border: 1px solid var(--scanner-edge);
  border-radius: 10px;
  pointer-events: none;
}
.scanner-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--scanner-base);
}
.scanner-status {
  position: relative;
  z-index: 1;
  align-self: end;
  justify-self: stretch;
  margin: 0;
  padding: 10px 14px;
  border-top: 1px solid var(--scanner-border);
  background: color-mix(in srgb, var(--scanner-base) 78%, transparent);
  color: var(--scanner-text);
  font-size: .9375rem;
  line-height: 1.45;
  text-align: center;
}

.scanner-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.scanner-actions .btn {
  min-height: 48px;
  background: var(--scanner-chrome);
  border-color: var(--scanner-border);
  color: var(--scanner-text);
}
.scanner-actions .btn:hover { border-color: var(--scanner-text-muted); }

.scanner-manual {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--scanner-border);
  border-radius: var(--radius);
  background: var(--scanner-chrome);
}
.scanner-field,
.scanner-manual label {
  color: var(--scanner-text);
  font-size: .8125rem;
  font-weight: 600;
}
.scanner-manual input {
  min-height: 48px;
  background: var(--scanner-base);
  border-color: var(--scanner-border);
  color: var(--scanner-text);
  font-size: 1.125rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
}
.scanner-manual input::placeholder { color: var(--scanner-text-muted); }
.scanner-manual .hint {
  color: var(--scanner-text-muted);
  font-size: .75rem;
}
.scanner-manual .scanner-submit {
  min-height: 48px;
  background: var(--scanner-lime);
  border-color: var(--scanner-lime);
  color: var(--scanner-base);
  font-weight: 700;
}
.scanner-manual .scanner-submit:hover {
  background: color-mix(in srgb, var(--scanner-lime) 88%, #FFFFFF);
  border-color: var(--scanner-lime);
}

/* The page focus ring is pine, which vanishes on near-black chrome. */
.scanner :is(button, input, a, summary, select):focus-visible,
.scanner:focus-visible {
  outline: 2px solid var(--scanner-text);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .scanner,
  .scanner *,
  .scanner *::before,
  .scanner *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* 2. Profile page ---------------------------------------------------------
   Shared list furniture here is also used by Insights and Integrations. */
.profile-page { padding-bottom: 1rem; }

.profile-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 8px 0 20px;
}
.profile-avatar {
  display: grid;
  flex: 0 0 72px;
  place-items: center;
  width: 72px;
  height: 72px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--primary-tint);
  color: var(--text);
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.profile-identity { min-width: 0; }
.profile-name {
  margin: 0;
  font-size: clamp(1.5rem, 5vw, 2rem);
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
}
.profile-handle {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: .875rem;
}
.profile-handle-text { overflow-wrap: anywhere; }
.profile-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--primary-tint);
  color: var(--text);
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.profile-joined {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: .75rem;
  font-variant-numeric: tabular-nums;
}
.profile-bio {
  max-width: 60ch;
  margin: 0 0 16px;
  font-size: 1rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.profile-owner { margin: 0 0 12px; }

.profile-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 24px;
  padding: 0;
}
.profile-stat {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.profile-stat dt {
  color: var(--text-muted);
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.profile-stat dd {
  margin: 4px 0 0;
  font-size: 1.5rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
@media (min-width: 480px) {
  .profile-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.profile-section { margin: 0 0 24px; }
/* Section heading shared by profile and insights. */
.section-heading {
  margin: 0 0 12px;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
}
.profile-page .checkin { margin-bottom: 12px; }
.profile-empty p { margin: 4px 0; }

.pagination {
  display: flex;
  justify-content: center;
  margin: 16px 0 0;
}
.empty-title {
  margin: 0 0 4px;
  color: var(--text);
  font-size: 1.0625rem;
  font-weight: 700;
}
.empty-actions { margin: 16px 0 0; }

.list-stack {
  display: grid;
  gap: 8px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}
.list-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-decoration: none;
}
.list-card:hover { border-color: var(--border-strong); }
.list-card-body {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.list-card-name { font-size: 1rem; letter-spacing: -0.01em; }
.list-card-note { overflow-wrap: anywhere; }
.list-card .pill { flex: 0 0 auto; }

/* 3. Insights ------------------------------------------------------------- */
.insights-page { padding-bottom: 1rem; }

.range-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 24px;
}
.range-tab {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--text);
  font-size: .875rem;
  font-weight: 600;
  text-decoration: none;
}
.range-tab:hover { background: var(--surface-sunken); }
/* Current range: lime fill, heavier label and an inset edge, not colour alone. */
.range-tab[aria-current="page"] {
  background: var(--primary);
  border-color: var(--primary-press);
  box-shadow: inset 0 0 0 1px var(--primary-press);
  color: var(--primary-contrast);
  font-weight: 700;
}
.range-tab[aria-current="page"]:hover { background: var(--primary-hover); }

.insight-cards {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  margin: 0 0 24px;
}
@media (min-width: 520px) {
  .insight-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Keep a lone third card from sitting half-width. */
  .insight-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
}
.insight-card {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.insight-label {
  margin: 0;
  color: var(--text-muted);
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.insight-value {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin: 6px 0 0;
  font-size: 1.75rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}
.insight-unit {
  color: var(--text-muted);
  font-size: .875rem;
  font-weight: 600;
  letter-spacing: 0;
}
.insight-note {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: .8125rem;
}

.caffeine-clock {
  margin: 0 0 24px;
  padding: 16px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
}
.caffeine-clock-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 1rem;
}
.caffeine-clock-icon { flex: 0 0 auto; color: var(--text-muted); }
.caffeine-clock-intro {
  margin: 6px 0 12px;
  color: var(--text-muted);
  font-size: .875rem;
}
.clock-rows {
  display: grid;
  gap: 0;
  margin: 0;
}
.clock-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}
.clock-row:first-child { padding-top: 0; border-top: 0; }
.clock-row dt {
  color: var(--text-muted);
  font-size: .8125rem;
  font-weight: 600;
}
.clock-row dd {
  margin: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.caffeine-note {
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  color: var(--text);
  font-size: .875rem;
}

.insights-section { margin: 0 0 24px; }
.top-list {
  counter-reset: rank;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  list-style: none;
}
.top-item {
  position: relative;
  counter-increment: rank;
  display: grid;
  gap: 2px;
  padding: 12px 14px 12px 40px;
  border-top: 1px solid var(--border);
}
.top-item:first-child { border-top: 0; }
.top-item::before {
  content: counter(rank);
  position: absolute;
  top: 12px;
  left: 14px;
  color: var(--text-muted);
  font-size: .8125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.top-link {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  text-decoration: none;
}
.top-link:hover .top-name { text-decoration: underline; text-underline-offset: 3px; }
.top-name { font-weight: 700; }
.top-brand {
  color: var(--text-muted);
  font-size: .8125rem;
}
.top-meta {
  color: var(--text-muted);
  font-size: .75rem;
  font-variant-numeric: tabular-nums;
}

.series-card {
  margin: 0 0 8px;
  padding: 0;
}
.series-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 12px 16px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.series-summary::-webkit-details-marker { display: none; }
.series-summary::after {
  content: "";
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform 120ms ease;
}
.series-card[open] .series-summary::after {
  margin-top: 4px;
  transform: rotate(225deg);
}
.day-list {
  margin: 0;
  padding: 0 16px 12px;
  list-style: none;
}
.day-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}
.day-date {
  color: var(--text-muted);
  font-size: .75rem;
  font-variant-numeric: tabular-nums;
}
.day-values {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  color: var(--text-muted);
  font-size: .75rem;
}
.day-value {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}
.day-number {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.day-row.day-empty .day-values-empty { color: var(--text-muted); }

@media (prefers-reduced-motion: reduce) {
  .series-summary::after { transition: none; }
}

/* 4. Drink lifecycle admin form ------------------------------------------- */
.lifecycle-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin: 12px 0 0;
}
.lifecycle-form label {
  flex: 1 1 160px;
  min-width: 0;
  font-size: .8125rem;
}
.lifecycle-form .form-actions {
  flex: 0 0 auto;
  margin: 0;
}
.lifecycle-form .hint { font-size: .75rem; }

/* =========================================================================
   5. v1.2 wiring: theme, install card, feed toast toggle, sharing, list
   maintenance, saved venues, notification actions, follows, AI picks.

   Everything here is additive. Spacing, radii and type sizes follow the
   existing scale (4px grid, 10/14/20px radii) so the new controls sit in the
   same rhythm as the rest of the app.
   ========================================================================= */

/* 5.1 Theme ---------------------------------------------------------------
   `data-theme` lives on <html>. The palette blocks are at the top of this
   file; select controls follow through `color-scheme`, which is why no
   per-control overrides are needed here. Theme switches never animate: no
   rule in this file transitions a colour token. */

/* 5.2 Install card -------------------------------------------------------
   Ships hidden; the client layer reveals it when installing is worthwhile
   and no dismissal is remembered. Copy stays true for every browser. */
.install-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  padding: 12px 8px 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--primary-tint);
  color: var(--text);
}
.install-card[hidden],
[data-install-card][hidden] { display: none !important; }
.install-card-glyph { flex: 0 0 auto; color: var(--text); }
.install-card-body { flex: 1; min-width: 0; }
.install-card-title {
  margin: 0;
  font-size: .9375rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.install-card-copy {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: .8125rem;
  line-height: 1.4;
}
.install-card-dismiss {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--text);
  cursor: pointer;
}
.install-card-dismiss:hover { background: var(--surface-sunken); }

/* 5.3 Feed toast toggle and share ---------------------------------------- */
.toast-toggle { gap: 6px; font-weight: 600; }
.toast-toggle .toast-glyph { display: none; font-size: .8125rem; line-height: 1; }
/* Pressed: lime fill, a check glyph and a heavier label. Never colour alone. */
.toast-toggle[aria-pressed="true"],
.toast-toggle[aria-pressed="true"]:hover {
  background: var(--primary);
  border-color: var(--primary-press);
  box-shadow: inset 0 0 0 1px var(--primary-press);
  color: var(--primary-contrast);
  font-weight: 700;
}
.toast-toggle[aria-pressed="true"] .toast-glyph { display: inline; }
.toast-count { font-variant-numeric: tabular-nums; }
.chip-share { color: var(--text); }
.chip-share:hover { background: var(--surface-sunken); }
[data-share] { cursor: pointer; }
[data-share]:active { transform: none; }

/* 5.4 List maintenance --------------------------------------------------- */
.list-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
}
.list-meta .pill { background: var(--surface); }
.list-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }

.list-edit {
  margin: 0 0 16px;
  padding: 0;
}
.list-edit-summary,
.list-delete > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 12px 16px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.list-edit-summary::-webkit-details-marker,
.list-delete > summary::-webkit-details-marker { display: none; }
.list-edit-summary::after,
.list-delete > summary::after {
  content: "";
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform 120ms ease;
}
.list-edit[open] > .list-edit-summary::after,
.list-delete[open] > summary::after {
  margin-top: 4px;
  transform: rotate(225deg);
}
.list-edit-form {
  gap: 12px;
  margin: 0;
  padding: 0 16px 16px;
}
.list-edit-form .hint { font-weight: 400; }
.list-delete {
  margin: 0 16px 16px;
  padding: 12px 14px;
  border: 1px solid var(--danger);
  border-radius: 10px;
  background: var(--danger-tint);
}
.list-delete > summary {
  min-height: 44px;
  padding: 0;
  color: var(--text);
}
.list-delete[open] > summary { margin-bottom: 4px; }
.list-delete-copy {
  margin: 0 0 12px;
  font-size: .875rem;
  line-height: 1.45;
}
.list-delete form { margin: 0; }
.list-item-note { max-width: 60ch; color: var(--text); }

/* 5.5 Saved venues ------------------------------------------------------- */
.saved-venues-page { padding-bottom: 16px; }
.saved-venues {
  display: grid;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}
.saved-venue {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
}
.saved-venue-body {
  display: grid;
  gap: 2px;
  flex: 1 1 180px;
  min-width: 0;
}
.saved-venue-body strong { font-size: 1rem; letter-spacing: -0.01em; }
.saved-venue-body strong a { text-decoration: none; }
.saved-venue-body strong a:hover { text-decoration: underline; text-underline-offset: 3px; }
.saved-venue form { margin: 0; }
.saved-venues-more { margin: 20px 0 0; font-size: .875rem; }
.page-actions { margin: 0 0 12px; }

/* 5.6 Notification actions ---------------------------------------------- */
/* Accept reads as the affirmative action with a glyph, a mint surface and a
   deeper border; declining stays neutral because it is not destructive. */
.btn-accept {
  gap: 6px;
  border-color: var(--success);
  background: var(--success-tint);
  color: var(--success);
  font-weight: 700;
}
.btn-accept:hover {
  border-color: var(--success);
  background: var(--success-tint);
  box-shadow: inset 0 0 0 1px var(--success);
}
.notif-actions .btn { min-height: 44px; }
.notif-actions .btn-small { min-height: 44px; }

/* 5.7 Follows ------------------------------------------------------------ */
.profile-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: .8125rem;
}
.profile-counts strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.profile-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
}
.profile-actions form { margin: 0; }
/* Following: quiet pressed state, not a second lime action. */
.btn-following {
  gap: 6px;
  border-color: var(--border-strong);
  background: var(--primary-tint);
  color: var(--text);
  font-weight: 700;
}
.btn-following:hover { border-color: var(--text); background: var(--primary-tint); }

/* 5.8 AI picks ----------------------------------------------------------- */
.ai-next { margin: 0 0 8px; }
.ai-next h2 { margin-top: 0; }
.ai-next-intro {
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: .875rem;
}
.ai-next-list {
  display: grid;
  gap: 8px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}
.ai-next-card { margin: 0; }

@media (prefers-reduced-motion: reduce) {
  .list-edit-summary::after,
  .list-delete > summary::after { transition: none; }
}

/* 5.9 Feed tabs ----------------------------------------------------------- */
/* Two quiet chips: Friends is the default feed, Following is the narrower one.
   Same shape and states as .range-tabs on Insights, so the app has one tab
   idiom. The current tab carries lime fill, an inset edge and a heavier label
   so it is not signalled by colour alone. */
.feed-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}
.feed-tab {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--text);
  font-size: .875rem;
  font-weight: 600;
  text-decoration: none;
}
.feed-tab:hover { background: var(--surface-sunken); }
.feed-tab[aria-current="page"] {
  background: var(--primary);
  border-color: var(--primary-press);
  box-shadow: inset 0 0 0 1px var(--primary-press);
  color: var(--primary-contrast);
  font-weight: 700;
}
.feed-tab[aria-current="page"]:hover { background: var(--primary-hover); }

/* 6. Check-in comments --------------------------------------------------- */
.comments { margin: 32px 0 0; }
.comments-heading {
  margin: 0;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
}
.comments-error { margin: 12px 0 0; }
.comments-list {
  display: grid;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}
.comment {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.comment .comment-avatar {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  font-size: .8125rem;
}
.comment-body { flex: 1; min-width: 0; }
.comment-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  margin: 0;
}
.comment-meta strong { font-size: .9375rem; overflow-wrap: anywhere; }
.comment-date {
  color: var(--text-muted);
  font-size: .75rem;
  font-variant-numeric: tabular-nums;
}
.comment-text {
  margin: 4px 0 0;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.comment-delete { margin: 8px 0 0; }
/* A "Delete" that is quiet but still a full 44px target. */
.comment-delete .btn { min-height: 44px; }
.comments-empty {
  margin: 16px 0 0;
  padding: 16px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-muted);
  text-align: center;
}
.comment-form {
  display: grid;
  gap: 6px;
  margin: 20px 0 0;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.comment-form label { font-size: .9rem; }
.comment-form textarea { min-height: 96px; }
.comment-form .hint { font-weight: 400; }
.comment-form .form-actions { margin: 4px 0 0; }
.comments-signin { margin: 20px 0 0; }

.chip-comments {
  gap: 6px;
  color: var(--text);
  text-decoration: none;
}
.chip-comments:hover { background: var(--surface-sunken); }
.chip-comments svg { flex: 0 0 auto; }
.comment-count { font-variant-numeric: tabular-nums; }

/* 7. Venue photos and menus ---------------------------------------------- */
.venue-media { margin: 32px 0 0; }
.venue-media-error { margin: 0 0 16px; }
.venue-media-intro {
  margin: 0 0 16px;
  color: var(--text-muted);
  font-size: .9rem;
  max-width: 60ch;
}
.media-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.media-item {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}
.media-thumb {
  display: block;
  background: var(--surface-sunken);
}
.media-thumb img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}
.media-meta {
  display: grid;
  gap: 2px;
  padding: 10px 12px 4px;
}
.media-kind {
  margin: 0;
  font-size: .8125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.media-credit {
  margin: 0;
  color: var(--text-muted);
  font-size: .75rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.media-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  margin-top: auto;
  padding: 6px 12px 12px;
}
.media-actions form,
.media-delete { margin: 0; }
.media-actions .btn { min-height: 44px; }
/* Reporting sits inside a disclosure so the card stays quiet by default. */
.media-report { flex: 1 1 100%; }
.media-report > summary {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  color: var(--text-muted);
  font-size: .8125rem;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}
.media-report > summary::-webkit-details-marker { display: none; }
.media-report > summary:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
  border-radius: 8px;
}
.media-report > summary::after {
  content: "";
  width: 7px;
  height: 7px;
  margin-top: -3px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
}
.media-report[open] > summary { color: var(--text); }
.media-report[open] > summary::after {
  margin-top: 3px;
  transform: rotate(225deg);
}
.media-report-form {
  display: grid;
  gap: 10px;
  margin: 0 0 4px;
  padding: 12px;
  background: var(--surface-sunken);
  border-radius: 10px;
}
.media-report-form label { font-size: .8125rem; }
.media-report-form .hint { font-weight: 400; }
.media-report-form .btn { justify-self: start; min-height: 44px; }

.media-upload {
  display: grid;
  gap: 14px;
  margin: 20px 0 0;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.media-upload h3 { margin: 0; font-size: 1rem; }
.media-upload label { font-size: .875rem; }
.media-upload .hint { font-weight: 400; }
.media-upload input[type="file"] {
  width: 100%;
  padding: .65rem;
  background: var(--surface-sunken);
  border: 1px dashed var(--border-strong);
}
.media-upload .form-actions { margin: 0; }

/* 8. Compare ------------------------------------------------------------- */
.compare-page { padding-bottom: 16px; }
.compare-back { margin: 0 0 12px; font-size: .875rem; }
.compare-back a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--accent-ink);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.compare-intro {
  max-width: 60ch;
  margin: 0;
  color: var(--text-muted);
  font-size: 1.02rem;
}
.compare-error { margin: 16px 0 0; }

.compare-picker {
  margin: 20px 0 0;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.compare-picker-title {
  margin: 0;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
}
.compare-picker-hint {
  margin: 2px 0 14px;
  color: var(--text-muted);
  font-size: .85rem;
}
.compare-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.compare-field {
  display: grid;
  gap: 4px;
  font-size: .8125rem;
  font-weight: 600;
}
.compare-field input {
  width: 100%;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}
.compare-picker-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin: 16px 0 0;
}
.compare-picker-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--accent-ink);
  font-size: .875rem;
  font-weight: 600;
}
@media (min-width: 600px) {
  .compare-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 900px) {
  .compare-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.compare-scroll-hint {
  margin: 20px 0 8px;
  color: var(--text-muted);
  font-size: .8125rem;
}
.compare-scroll {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.compare-scroll:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}
.compare-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
}
.compare-table th,
.compare-table td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}
.compare-table tbody tr:last-child th,
.compare-table tbody tr:last-child td { border-bottom: 0; }
.compare-table thead th {
  min-width: 132px;
  padding: 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-strong);
}
/* The detail column stays put while the drinks scroll past it. */
.compare-table tbody th,
.compare-table .compare-corner {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
  box-shadow: inset -1px 0 0 var(--border);
}
.compare-table .compare-corner { z-index: 2; }
.compare-table tbody th {
  width: 96px;
  min-width: 96px;
  color: var(--text-muted);
  font-size: .8125rem;
  font-weight: 600;
}
.compare-table td {
  font-size: .875rem;
  font-variant-numeric: tabular-nums;
}
.compare-table .compare-corner {
  width: 96px;
  min-width: 96px;
}
.compare-drink-name {
  display: block;
  font-size: .9375rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.compare-drink-name a { text-decoration: none; }
.compare-drink-name a:hover { text-decoration: underline; text-underline-offset: 3px; }
.compare-missing { color: var(--text-muted); }
.compare-rating { font-weight: 600; white-space: nowrap; }
.compare-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.compare-tag {
  padding: 1px 7px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--text);
  font-size: .6875rem;
  font-weight: 600;
  white-space: nowrap;
}
.compare-empty { margin: 20px 0 0; }
.compare-note {
  margin: 16px 0 0;
  color: var(--text-muted);
  font-size: .8125rem;
}
@media (min-width: 1024px) {
  .compare-scroll-hint { display: none; }
}

/* 9. Profile badges and top styles -------------------------------------- */
.badge-shelf {
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}
.badge-shelf .badge-tile {
  display: grid;
  gap: 2px;
  align-content: start;
  min-height: 0;
}
.badge-shelf .badge-tile strong {
  font-size: .9375rem;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.badge-shelf-desc {
  color: var(--text-muted);
  font-size: .8125rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.badge-shelf-date {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: .6875rem;
  font-variant-numeric: tabular-nums;
}
.top-styles {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--border);
}
.top-style { border-bottom: 1px solid var(--border); }
.top-style-link {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 10px 0;
  color: var(--text);
  text-decoration: none;
}
a.top-style-link:hover .top-style-name { text-decoration: underline; text-underline-offset: 3px; }
.top-style-name { font-weight: 600; overflow-wrap: anywhere; }
.top-style-count {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: .8125rem;
  font-variant-numeric: tabular-nums;
}

/* =========================================================================
   10. Safety controls, drink gallery, admin notes

   Additive. Blocked people and the profile block control, the drink photo
   gallery, and the internal report note log. Same 4px rhythm, radii and
   tokens as the rest of the file. No new colours; lime stays a fill.
   ========================================================================= */

/* 10.1 Settings link row -------------------------------------------------- */
.settings-row-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface-raised);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}
.settings-row-link:hover {
  background: var(--surface-sunken);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.settings-row-link .pill {
  flex: 0 0 auto;
  border-color: var(--border-strong);
  background: var(--primary-tint);
  color: var(--text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* 10.2 Blocked people list ----------------------------------------------- */
.blocked-list {
  display: grid;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}
.blocked-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
}
.blocked-avatar {
  width: 44px;
  height: 44px;
  font-size: 1rem;
}
.blocked-identity {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.blocked-name {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.blocked-handle {
  margin: 0;
  color: var(--text-muted);
  font-size: .8125rem;
  overflow-wrap: anywhere;
}
.blocked-date {
  margin: 0;
  color: var(--text-muted);
  font-size: .75rem;
  font-variant-numeric: tabular-nums;
}
.blocked-row form {
  margin: 0;
  justify-self: end;
}
.blocked-row .btn { min-height: 44px; }
.blocked-empty { margin-top: 16px; }
.settings-back { margin: 20px 0 0; }
.settings-back a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--accent-ink);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
@media (max-width: 420px) {
  .blocked-row { grid-template-columns: auto minmax(0, 1fr); }
  .blocked-row form {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

/* 10.3 Profile block control ---------------------------------------------- */
/* The blocked state is a calm status panel, not an error: sunken surface,
   a stronger border and the word "Blocked" carry it. */
.profile-blocked {
  margin: 0 0 12px;
  padding: 14px 16px;
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-sunken);
}
.profile-blocked-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-weight: 750;
  letter-spacing: -0.01em;
}
.profile-blocked-title svg { flex: 0 0 auto; }
.profile-blocked-copy {
  max-width: 60ch;
  margin: 6px 0 12px;
  color: var(--text-muted);
  font-size: .9rem;
  line-height: 1.45;
}
.profile-blocked-form { margin: 0; }
.profile-blocked-form .btn { min-height: 44px; }

/* A quiet text control that opens a two-step confirmation. It sits on its
   own row below follow and share, so it never reads as the primary action. */
.profile-block {
  flex: 1 1 100%;
  margin: 0;
}
.profile-block > summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 4px;
  color: var(--text-muted);
  font-size: .875rem;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}
.profile-block > summary::-webkit-details-marker { display: none; }
.profile-block > summary::after {
  content: "";
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  margin-top: -3px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform 120ms ease;
}
.profile-block > summary:hover {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.profile-block > summary:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
  border-radius: 8px;
}
.profile-block[open] > summary { color: var(--text); }
.profile-block[open] > summary::after {
  margin-top: 3px;
  transform: rotate(225deg);
}
.profile-block-panel {
  display: grid;
  gap: 10px;
  margin: 8px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.profile-block-panel p {
  max-width: 60ch;
  margin: 0;
  color: var(--text-muted);
  font-size: .875rem;
  line-height: 1.45;
}
.profile-block-panel form { margin: 0; }
.profile-block-panel .btn { min-height: 44px; }

/* 10.4 Drink gallery ------------------------------------------------------ */
.drink-gallery { margin: 32px 0 0; }
.gallery-intro {
  max-width: 60ch;
  margin: 0 0 16px;
  color: var(--text-muted);
  font-size: .9rem;
}
.gallery-error { margin: 0 0 16px; }
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
@media (min-width: 480px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
  }
}
.gallery-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 8px;
}
.gallery-photo {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  background: var(--surface-sunken);
}
.gallery-meta {
  display: grid;
  gap: 4px;
  padding: 0 2px;
}
.gallery-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  justify-self: start;
  padding: 1px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--primary-tint);
  color: var(--text);
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: .02em;
}
.gallery-badge svg { flex: 0 0 auto; }
.gallery-credit {
  margin: 0;
  color: var(--text-muted);
  font-size: .75rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.gallery-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 2px;
}
.gallery-actions form { margin: 0; }
.gallery-actions .btn { min-height: 44px; }
.gallery-remove {
  border-color: var(--danger);
  background: var(--surface-raised);
  color: var(--danger);
}
.gallery-remove:hover {
  border-color: var(--danger);
  background: var(--danger-tint);
  color: var(--danger);
}
.gallery-empty { margin-top: 16px; }
.gallery-upload {
  display: grid;
  gap: 14px;
  max-width: 600px;
  margin: 20px 0 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.gallery-upload h3 {
  margin: 0;
  font-size: 1rem;
}
.gallery-upload label { font-size: .875rem; }
.gallery-upload .hint { font-weight: 400; }
.gallery-upload input[type="file"] {
  width: 100%;
  padding: .65rem;
  background: var(--surface-sunken);
  border: 1px dashed var(--border-strong);
}
.gallery-upload .form-actions { margin: 0; }

/* 10.5 Admin report notes -------------------------------------------------- */
/* Visually secondary to the report actions: sunken panel, small heading and
   compact log. The textarea is capped so lines stay readable on wide screens. */
.report-notes {
  margin: 14px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-sunken);
}
.report-notes-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 12px;
  margin: 0 0 8px;
}
.report-notes-title {
  margin: 0;
  color: var(--text-muted);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.report-notes-hint {
  color: var(--text-muted);
  font-size: .6875rem;
}
.note-log {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}
.note-log-item {
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.note-log-item:first-child {
  padding-top: 0;
  border-top: 0;
}
.note-log-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  margin: 0;
}
.note-log-author {
  font-size: .8125rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.note-log-date {
  color: var(--text-muted);
  font-size: .75rem;
  font-variant-numeric: tabular-nums;
}
.note-log-body {
  max-width: 72ch;
  margin: 4px 0 0;
  font-size: .9rem;
  overflow-wrap: anywhere;
  white-space: pre-line;
}
.note-log-delete { margin: 4px 0 0; }
.note-log-delete .btn {
  min-height: 44px;
  padding: 0 6px;
  border-color: transparent;
  background: none;
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.note-log-delete .btn:hover {
  border-color: transparent;
  color: var(--text);
}
.note-log-empty {
  margin: 0 0 4px;
  font-size: .8125rem;
}
.note-form {
  display: grid;
  gap: 8px;
  max-width: 640px;
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.note-form label { font-size: .8125rem; }
.note-form textarea { min-height: 80px; }
.note-form .hint { font-weight: 400; }
.note-form .btn {
  justify-self: start;
  min-height: 44px;
}

/* =========================================================================
   First-run setup and runtime settings
   ========================================================================= */

.nav-setup {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: .9rem;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
}
.nav-setup:hover { text-decoration-color: var(--text); }

/* 1. First-run setup ------------------------------------------------------ */
.setup-page {
  max-width: 560px;
  padding-bottom: .5rem;
}
.setup-page h1 { margin-bottom: .35rem; }
.setup-page .lede { font-size: 1rem; line-height: 1.55; }
.setup-page .banner { margin-top: 1rem; }
.setup-note {
  margin: 1.25rem 0 1rem;
  padding: .95rem 1rem;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: 10px;
}
.setup-note h2 {
  margin: 0 0 .3rem;
  font-size: 1rem;
  letter-spacing: -.01em;
}
.setup-note p {
  margin: 0;
  color: var(--text-muted);
  font-size: .9rem;
  line-height: 1.5;
}
.setup-note code,
.settings-card code {
  padding: .05em .3em;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .85em;
  white-space: nowrap;
}
.setup-form {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
  padding: clamp(1rem, 4vw, 1.25rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.setup-form label {
  font-size: .9rem;
  font-weight: 600;
}
.setup-form .hint {
  font-weight: 400;
  line-height: 1.45;
}
.setup-form .btn-save {
  justify-self: start;
  min-width: 190px;
}
.setup-form .btn-primary { border-color: var(--border-strong); }
.field-optional {
  color: var(--text-muted);
  font-size: .8rem;
  font-weight: 400;
}
.setup-form .field-label { font-weight: 600; }
.setup-page .auth-note { margin-top: 1.25rem; }

/* 2. Admin settings shell ------------------------------------------------- */
.admin-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: .75rem 1rem;
  margin: 0 0 1.25rem;
}
.admin-head h1 { margin: 0; }
.admin-head .eyebrow { margin-bottom: .3rem; }
.admin-head > .btn { flex: 0 0 auto; }
.admin-head .btn svg { flex: 0 0 auto; }
.btn-admin-settings { border-color: var(--border-strong); }

.settings-shell { padding-bottom: 1rem; }
.settings-head {
  display: grid;
  gap: .35rem;
  margin-bottom: 1.25rem;
}
.settings-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: .75rem 1rem;
}
.settings-head-row h1 { margin: 0; }
.settings-head .eyebrow { margin: 0 0 .25rem; }
.settings-head .lede {
  margin: 0;
  max-width: 68ch;
  font-size: 1rem;
  line-height: 1.55;
}
.settings-head-row > .btn { flex: 0 0 auto; }
.settings-shell > .banner { margin: 0 0 1rem; }

.settings-layout { display: block; }
.settings-nav {
  position: sticky;
  top: 0;
  z-index: 4;
  margin: 0 0 1rem;
  padding: .3rem 0 .4rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.settings-nav-title { display: none; }
.settings-nav ul {
  display: flex;
  gap: .2rem;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
}
.settings-nav li { flex: 0 0 auto; }
.settings-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: .25rem .7rem;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: .875rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.settings-nav a:hover {
  background: var(--surface-sunken);
  color: var(--text);
}

.settings-sections {
  display: grid;
  gap: 1rem;
  min-width: 0;
}
.settings-card {
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  scroll-margin-top: 4.25rem;
}
.settings-card:target { border-color: var(--border-strong); }
.settings-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .35rem .75rem;
  margin-bottom: .2rem;
}
.settings-card-head h2 {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: -.015em;
}
.settings-card .hint {
  font-weight: 400;
  line-height: 1.45;
}
.settings-card .settings-form {
  max-width: 640px;
  margin-top: .75rem;
}
.settings-card .form-actions { margin-top: .15rem; }
.settings-card .field-narrow { max-width: 180px; }
.settings-card .settings-sub .hint { margin: .15rem 0 .65rem; }
.settings-test-form { margin: 0; }
.settings-test-form .btn { min-width: 170px; }
.btn-save { min-width: 150px; }

.settings-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  min-height: 24px;
  padding: 0 .55rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-sunken);
  color: var(--text-muted);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1;
  white-space: nowrap;
}
.settings-badge-source::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: .65;
}
.settings-badge-source[data-source="db"] {
  background: var(--primary-tint);
  color: var(--text);
}
.settings-badge-source[data-source="env"] {
  background: var(--surface-raised);
  color: var(--text);
}
.settings-badge-restart {
  background: var(--warning-tint);
  border-color: var(--warning);
  color: var(--warning);
}

.secret-block {
  display: grid;
  gap: .85rem;
  padding: .85rem .9rem;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.secret-current {
  display: grid;
  gap: .2rem;
}
.secret-readout {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .3rem;
  margin: 0;
  font-size: .95rem;
}
.secret-readout.muted { font-size: .9rem; }
.secret-mask,
.secret-last4 {
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
}
.secret-mask {
  font-size: 1.15rem;
  letter-spacing: .06em;
}
.secret-last4 {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-weight: 700;
}
.secret-block .hint { font-weight: 400; }

.settings-facts {
  display: grid;
  margin: .75rem 0 .25rem;
  border-top: 1px solid var(--border);
}
.settings-facts > div {
  display: grid;
  grid-template-columns: minmax(120px, 32%) minmax(0, 1fr);
  gap: .25rem .9rem;
  padding: .7rem 0;
  border-bottom: 1px solid var(--border);
}
.settings-facts dt {
  margin: 0;
  color: var(--text-muted);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.settings-facts dd {
  margin: 0;
  font-size: .925rem;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.settings-card > .hint { margin-top: .6rem; }

@media (min-width: 900px) {
  .settings-layout {
    display: grid;
    grid-template-columns: 196px minmax(0, 1fr);
    align-items: start;
    gap: 1.75rem;
  }
  .settings-nav {
    position: sticky;
    top: 1.5rem;
    margin: 0;
    padding: .25rem 1rem .25rem 0;
    background: transparent;
    border-bottom: 0;
    border-right: 1px solid var(--border);
  }
  .settings-nav-title {
    display: block;
    margin: 0 0 .4rem;
    color: var(--text-muted);
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
  }
  .settings-nav ul {
    display: grid;
    gap: 2px;
    overflow: visible;
  }
  .settings-nav a { width: 100%; }
  .settings-card { scroll-margin-top: 1.25rem; }
}

@media (max-width: 480px) {
  .settings-facts > div {
    grid-template-columns: 1fr;
    gap: .15rem;
  }
}
