/* Self-hosted fonts (Section 7 — never link Google Fonts) */
@font-face {
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/playfair-display-600.woff2') format('woff2');
}

@font-face {
  font-family: 'Playfair Display';
  font-style: italic;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/playfair-display-600-italic.woff2') format('woff2');
}

@font-face {
  font-family: 'Caveat';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/caveat-600.woff2') format('woff2');
}

@font-face {
  font-family: 'Anton';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/anton-400.woff2') format('woff2');
}

:root {
  --t-on-danger: #ffffff;
  --font-system: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-hand: 'Caveat', cursive;
  --font-anton: 'Anton', "Arial Black", "Arial Narrow", sans-serif;
}

/* =========================================================
   THE TEN THEMES (Section 6 — all 22 tokens copied exact)
   ========================================================= */
:root,
[data-theme="farmhouse"] {
  --t-text: #4f3a28;
  --t-dim: #87755f;
  --t-page-bg: #fdf8ee;
  --t-surface: #fdf8ee;
  --t-border: #e0d0b4;
  --t-border-soft: #eee1c8;
  --t-chip: #f3e7cd;
  --t-accent: #bc5a32;
  --t-accent-light: #f3ddba;
  --t-accent-deep: #8a5a3b;
  --t-on-accent: #fdf3e3;
  --gold: #f3ddba;
  --gold-dark: #8a5a3b;
  --gold-matte: #f3ddba;
  --t-ink: #4a3423;
  --t-title: #f3ddba;
  --t-cream: #faf1e2;
  --t-cream-dim: #e8dcc6;
  --t-pill-bg: #4a3423;
  --t-danger: #a83a24;
  --t-note-bg: #f6edda;
  --t-custom: #a34a28;
  --header-art: url('header-artwork/farmhouse.png');
}

[data-theme="chalkboard"] {
  --t-text: #f0eee3;
  --t-dim: #b6b3a4;
  --t-page-bg: #2f343c;
  --t-surface: #2f343c;
  --t-border: #4c535d;
  --t-border-soft: #434a53;
  --t-chip: #3d434c;
  --t-accent: #e6cf6b;
  --t-accent-light: #f2e3a0;
  --t-accent-deep: #8f8552;
  --t-on-accent: #26221a;
  --gold: #f2e3a0;
  --gold-dark: #8f8552;
  --gold-matte: #e6cf6b;
  --t-ink: #23272e;
  --t-title: #f2e3a0;
  --t-cream: #f4f1e6;
  --t-cream-dim: #d9d5c6;
  --t-pill-bg: #23272e;
  --t-danger: #e08a76;
  --t-note-bg: #363c44;
  --t-custom: #e6cf6b;
  --header-art: url('header-artwork/chalkboard.png');
}

[data-theme="cyberpunk"] {
  --t-text: #f2f0fa;
  --t-dim: #a5a3c0;
  --t-page-bg: #10101c;
  --t-surface: #10101c;
  --t-border: #34345a;
  --t-border-soft: #262640;
  --t-chip: #1c1c30;
  --t-accent: #ff2ea6;
  --t-accent-light: #33e0ff;
  --t-accent-deep: #9333ea;
  --t-on-accent: #0b0b12;
  --gold: #ff4fd8;
  --gold-dark: #9333ea;
  --gold-matte: #ff2ea6;
  --t-ink: #0b0b12;
  --t-title: #ff4fd8;
  --t-cream: #f5f3ff;
  --t-cream-dim: #d8d4e8;
  --t-pill-bg: #0b0b12;
  --t-danger: #ff6b81;
  --t-note-bg: #1a1030;
  --t-custom: #33e0ff;
  --header-art: url('header-artwork/cyberpunk.png');
}

[data-theme="luxury"] {
  --t-text: #1c1a15;
  --t-dim: #6f695b;
  --t-page-bg: #ffffff;
  --t-surface: #ffffff;
  --t-border: #ddd5bf;
  --t-border-soft: #eee7d2;
  --t-chip: #f1ecd9;
  --t-accent: #b3a369;
  --t-accent-light: #d6c69a;
  --t-accent-deep: #7d7048;
  --t-on-accent: #0a0a0a;
  --gold: #c9a86a;
  --gold-dark: #7d7048;
  --gold-matte: #bfa05f;
  --t-ink: #0a0a0a;
  --t-title: #c9a86a;
  --t-cream: #f5f1e6;
  --t-cream-dim: #e7e5e4;
  --t-pill-bg: #2e2410;
  --t-danger: #8c2f26;
  --t-note-bg: #faf6ea;
  --t-custom: #7a6a35;
  --header-art: url('header-artwork/luxury.png');
}

[data-theme="matrix"] {
  --t-text: #e8f5e9;
  --t-dim: #9db8a4;
  --t-page-bg: #07130a;
  --t-surface: #07130a;
  --t-border: #1e4028;
  --t-border-soft: #17331f;
  --t-chip: #0e2413;
  --t-accent: #00c94f;
  --t-accent-light: #7dff9e;
  --t-accent-deep: #0d7a38;
  --t-on-accent: #001505;
  --gold: #3dff7c;
  --gold-dark: #0d7a38;
  --gold-matte: #22e06c;
  --t-ink: #000000;
  --t-title: #3dff7c;
  --t-cream: #eaffea;
  --t-cream-dim: #c8e6c9;
  --t-pill-bg: #02140a;
  --t-danger: #ff8a75;
  --t-note-bg: #0e2413;
  --t-custom: #3dff7c;
  --header-art: url('header-artwork/matrix.png');
}

[data-theme="sunset"] {
  --t-text: #fdeedd;
  --t-dim: #c2a18f;
  --t-page-bg: #33173d;
  --t-surface: #33173d;
  --t-border: #5b3263;
  --t-border-soft: #4a284f;
  --t-chip: #47204a;
  --t-accent: #e8823a;
  --t-accent-light: #ffc98a;
  --t-accent-deep: #8a4a72;
  --t-on-accent: #2a1030;
  --gold: #ffb37a;
  --gold-dark: #8a4a72;
  --gold-matte: #f5a65b;
  --t-ink: #2a1030;
  --t-title: #ffb37a;
  --t-cream: #fff3e4;
  --t-cream-dim: #ecd9c8;
  --t-pill-bg: #2a1030;
  --t-danger: #ff8a7a;
  --t-note-bg: #47204a;
  --t-custom: #ffc98a;
  --header-art: url('header-artwork/sunset.png');
}

[data-theme="coastal"] {
  --t-text: #1e3a34;
  --t-dim: #5f7a72;
  --t-page-bg: #fdfcf7;
  --t-surface: #fdfcf7;
  --t-border: #cfded2;
  --t-border-soft: #e2ece2;
  --t-chip: #e6f2ec;
  --t-accent: #ff7a59;
  --t-accent-light: #7fd1c0;
  --t-accent-deep: #1f7a6d;
  --t-on-accent: #07332e;
  --gold: #9fe8d8;
  --gold-dark: #1f7a6d;
  --gold-matte: #7fd1c0;
  --t-ink: #0d4a4a;
  --t-title: #9fe8d8;
  --t-cream: #f4fbf7;
  --t-cream-dim: #d3e8dd;
  --t-pill-bg: #0d4a4a;
  --t-danger: #d64533;
  --t-note-bg: #eef7f1;
  --t-custom: #d64533;
  --header-art: url('header-artwork/coastal.png');
}

[data-theme="fresh-market"] {
  --t-text: #2e2b1c;
  --t-dim: #70725f;
  --t-page-bg: #fffdf4;
  --t-surface: #fffdf4;
  --t-border: #ddd6ba;
  --t-border-soft: #eae4cc;
  --t-chip: #eef0da;
  --t-accent: #2e6b45;
  --t-accent-light: #f5e7bd;
  --t-accent-deep: #bf5138;
  --t-on-accent: #fdf6e3;
  --gold: #f5e7bd;
  --gold-dark: #bf5138;
  --gold-matte: #f5e7bd;
  --t-ink: #20503a;
  --t-title: #f5e7bd;
  --t-cream: #fdf8ea;
  --t-cream-dim: #e9e4cf;
  --t-pill-bg: #20503a;
  --t-danger: #b3402a;
  --t-note-bg: #f7efdb;
  --t-custom: #a34d2e;
  --header-art: url('header-artwork/fresh-market.png');
}

[data-theme="monochrome"] {
  --t-text: #171717;
  --t-dim: #666666;
  --t-page-bg: #ffffff;
  --t-surface: #ffffff;
  --t-border: #d6d6d6;
  --t-border-soft: #e7e7e7;
  --t-chip: #efefef;
  --t-accent: #000000;
  --t-accent-light: #e5e5e5;
  --t-accent-deep: #404040;
  --t-on-accent: #ffffff;
  --gold: #ffffff;
  --gold-dark: #404040;
  --gold-matte: #f5f5f5;
  --t-ink: #111111;
  --t-title: #ffffff;
  --t-cream: #ffffff;
  --t-cream-dim: #d4d4d4;
  --t-pill-bg: #171717;
  --t-danger: #262626;
  --t-note-bg: #eeeeee;
  --t-custom: #404040;
  --header-art: url('header-artwork/monochrome.png');
}

[data-theme="retro"] {
  --t-text: #43301c;
  --t-dim: #8a6f4d;
  --t-page-bg: #fdf6e0;
  --t-surface: #fdf6e0;
  --t-border: #ddc491;
  --t-border-soft: #ead9ae;
  --t-chip: #f1e3ba;
  --t-accent: #c75b21;
  --t-accent-light: #f2b33d;
  --t-accent-deep: #6b4a1f;
  --t-on-accent: #fff7e6;
  --gold: #f2b33d;
  --gold-dark: #6b4a1f;
  --gold-matte: #e8a812;
  --t-ink: #3f2412;
  --t-title: #f2b33d;
  --t-cream: #fdf3d8;
  --t-cream-dim: #e8d9b0;
  --t-pill-bg: #3f2412;
  --t-danger: #b3402a;
  --t-note-bg: #f3e5c3;
  --t-custom: #b3541e;
  --header-art: url('header-artwork/retro.png');
}

/* =========================================================
   BASE RESET & TYPOGRAPHY
   ========================================================= */
*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--t-page-bg);
  color: var(--t-text);
  font-family: var(--font-system);
  min-height: 100%;
  overscroll-behavior-y: contain;
}

button, input, select, textarea {
  font-family: inherit;
}

input, textarea, select {
  font-size: 16px; /* Prevents iOS Safari auto-zoom */
}

button {
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

[hidden] {
  display: none !important;
}

/* =========================================================
   SPLASH SCREEN (Section 4 & 6 — fixed colours, never themed)
   ========================================================= */
.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #EAF2F8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 36px;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.splash-screen.lifting {
  opacity: 0;
  transform: translateY(-14px);
  pointer-events: none;
}

.splash-title-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  margin-bottom: 18px;
}

.splash-the {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  line-height: 1.2;
  color: #33526B;
  text-align: center;
}

.splash-ultimate-banner {
  background: #0c0d0f;
  border-radius: 8px;
  padding: 8px 18px 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.splash-ultimate {
  font-family: var(--font-anton);
  font-weight: 400;
  font-size: 40px;
  letter-spacing: 0.05em;
  line-height: 1;
  background: linear-gradient(
    to bottom,
    #ffffff 0%,
    #d7dee6 28%,
    #828fa0 49%,
    #eef2f6 51%,
    #b4bfcb 72%,
    #626e7d 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.splash-appname {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 23px;
  line-height: 1.2;
  color: #33526B;
  text-align: center;
}

.splash-scene-wrap {
  width: 100%;
  max-width: 88%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.splash-scene-svg {
  width: 100%;
  max-width: 400px;
  height: auto;
  display: block;
}

.splash-sleigh-group {
  animation: splashSleighGlide 2.4s ease-in-out infinite;
}

@keyframes splashSleighGlide {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(14px, -7px); }
}

@media (prefers-reduced-motion: reduce) {
  .splash-sleigh-group {
    animation: none !important;
  }
}

.splash-progress-track {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 5px;
  background: rgba(51, 82, 107, 0.14);
}

.splash-progress-fill {
  height: 100%;
  width: 0%;
  background: #F2A03D;
  transition: width 0.28s ease;
}

/* =========================================================
   HEADER (Section 9)
   ========================================================= */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--t-ink);
}

.header-top-strip {
  height: 6px;
  background: var(--t-ink);
}

.header-band {
  position: relative;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 12px;
  background-color: var(--t-ink);
  background-image: linear-gradient(rgba(0, 0, 0, 0.32), rgba(0, 0, 0, 0.38)), var(--header-art);
  background-size: cover;
  background-position: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.header-spacer {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.header-title {
  margin: 0;
  flex: 1;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  line-height: 1.2;
  color: var(--t-title);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-title em {
  font-style: italic;
}

.settings-gear-btn {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
  color: var(--gold);
  background: transparent;
  border: none;
  padding: 0;
}

.header-ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
}

.ornament-line {
  width: 34px;
  height: 1px;
  background: var(--gold);
  opacity: 0.72;
}

.ornament-diamond-hollow {
  width: 6px;
  height: 6px;
  border: 1.2px solid var(--gold);
  transform: rotate(45deg);
  opacity: 0.85;
}

.ornament-diamond-filled {
  width: 7px;
  height: 7px;
  background: var(--gold);
  transform: rotate(45deg);
}

/* =========================================================
   DEMO BANNER (Section 6 & 11 — FIXED colours)
   ========================================================= */
.demo-banner {
  background: #f6dbcd;
  color: #6e3222;
  border-bottom: 1px solid #e3ac90;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  line-height: 1.3;
}

.demo-banner-btn {
  flex-shrink: 0;
  background: #9c4630;
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

/* =========================================================
   MAIN CONTENT & TWO VIEW TABS (Section 9)
   ========================================================= */
.app-main {
  max-width: 600px;
  margin: 0 auto;
  padding: 12px 14px calc(108px + env(safe-area-inset-bottom, 0px));
}

.view-tabs-wrap {
  margin-bottom: 14px;
}

.view-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--t-surface);
  border: 1px solid var(--t-border);
  border-radius: 999px;
  padding: 3px;
  gap: 3px;
}

.view-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  color: var(--t-dim);
  background: transparent;
  transition: background-color 0.15s ease, color 0.15s ease;
  min-width: 0;
}

.view-tab.active {
  background: var(--t-accent);
  color: var(--t-on-accent);
  font-weight: 600;
}

.view-tab-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.view-tab-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tab-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--t-chip);
  color: var(--t-text);
  flex-shrink: 0;
}

.view-tab.active .tab-count-badge {
  background: rgba(255, 255, 255, 0.22);
  color: var(--t-on-accent);
}

/* Shopper viewing banner when browsing someone else's list */
.shopper-banner {
  background: var(--t-note-bg);
  border: 1px solid var(--t-border);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.shopper-banner-info {
  min-width: 0;
}

.shopper-banner-eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gold-dark);
}

.shopper-banner-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  color: var(--t-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shopper-back-btn {
  flex-shrink: 0;
  background: var(--t-surface);
  color: var(--t-text);
  border: 1px solid var(--t-border);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
}

/* =========================================================
   CATEGORY GROUPS & ITEM ROWS (Section 9 & 10)
   ========================================================= */
.category-section {
  margin-bottom: 16px;
}

.category-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 4px 6px;
}

.category-heading-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
  color: var(--gold-dark);
  margin: 0;
}

.category-heading-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--t-dim);
}

.category-box {
  background: var(--t-surface);
  border: 1px solid var(--t-border);
  border-radius: 14px;
  overflow: hidden;
}

.item-swipe-wrap {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--t-border-soft);
}

.item-swipe-wrap:last-child {
  border-bottom: none;
}

.item-swipe-action {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 88px;
  background: var(--t-danger);
  color: var(--t-on-danger);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
}

.item-row {
  position: relative;
  z-index: 2;
  background: var(--t-surface);
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 13px;
  transition: transform 0.18s ease;
  touch-action: pan-y;
}

.item-check-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--gold-dark);
  background: var(--t-surface);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.item-check-btn.checked {
  background: var(--t-accent);
  border-color: var(--t-accent);
  color: var(--t-on-accent);
}

.item-thumb {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--t-border);
  flex-shrink: 0;
}

.item-body {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.item-name-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.item-name {
  font-size: 16px;
  font-weight: 500;
  color: var(--t-text);
  word-break: break-word;
}

.item-row.is-claimed .item-name {
  color: var(--t-dim);
  text-decoration: line-through;
}

.item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

/* Row pills (Section 8) */
.row-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.4;
  background: var(--t-chip);
  color: var(--gold-dark);
  border: 1px solid var(--t-border);
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-pill-accent {
  background: var(--t-accent);
  color: var(--t-on-accent);
  border-color: var(--t-accent);
  font-weight: 700;
}

.row-pill-claimed {
  background: var(--t-pill-bg);
  color: var(--t-accent-light);
  border-color: var(--t-accent-deep);
  font-weight: 600;
}

.row-link-pill {
  text-decoration: none;
}

.item-star-btn {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--t-dim);
  padding: 0;
}

.item-star-btn.starred {
  color: var(--gold-dark);
}

/* =========================================================
   OTHER PEOPLE'S LISTS VIEW
   ========================================================= */
.other-lists-intro {
  font-size: 14px;
  color: var(--t-dim);
  margin: 0 0 12px;
  line-height: 1.4;
}

.other-person-card {
  width: 100%;
  text-align: left;
  background: var(--t-surface);
  border: 1px solid var(--t-border);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.other-person-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  color: var(--t-text);
}

.other-person-sub {
  font-size: 13px;
  color: var(--t-dim);
  margin-top: 2px;
}

.other-person-cta {
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--t-chip);
  color: var(--gold-dark);
  border: 1px solid var(--t-border);
  font-size: 13px;
  font-weight: 600;
}

/* =========================================================
   EMPTY STATE (Section 7 — Caveat 600)
   ========================================================= */
.empty-state {
  text-align: center;
  padding: 46px 18px 24px;
}

.empty-headline {
  font-family: var(--font-hand);
  font-weight: 600;
  font-size: 42px;
  line-height: 1.08;
  color: var(--t-text);
  margin: 0 0 10px;
}

.empty-sub {
  font-size: 15px;
  color: var(--t-dim);
  margin: 0 auto 28px;
  max-width: 280px;
  line-height: 1.45;
}

.empty-tap-hint {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.empty-tap-text {
  font-family: var(--font-hand);
  font-weight: 600;
  font-size: 24px;
  color: var(--gold-dark);
  transform: rotate(-4deg);
}

.empty-tap-arrow {
  width: 44px;
  height: 44px;
  color: var(--gold-dark);
}

/* =========================================================
   BOTTOM BAR (Section 8 & 9 — 3-slot layout, Add centered)
   ========================================================= */
.bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 35;
  padding: 10px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, var(--t-page-bg) 72%, rgba(0, 0, 0, 0));
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  pointer-events: none;
}

.bottom-slot-left,
.bottom-slot-center,
.bottom-slot-right {
  display: flex;
  align-items: center;
}

.bottom-slot-left { justify-content: flex-start; }
.bottom-slot-center { justify-content: center; }
.bottom-slot-right { justify-content: flex-end; }

.bottom-slot-center > *,
.bottom-slot-right > *,
.bottom-slot-left > * {
  pointer-events: auto;
}

.round-add-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--t-accent);
  color: var(--t-on-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22);
}

.done-pill-btn {
  height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--t-pill-bg);
  color: var(--gold);
  border: 1px solid var(--gold);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

/* =========================================================
   BUTTONS (Section 8 — exact variants)
   ========================================================= */
.btn-primary {
  width: 100%;
  padding: 13px 16px;
  border-radius: 10px;
  background: var(--t-ink);
  color: var(--gold);
  border: 1px solid var(--gold);
  font-size: 16px;
  font-weight: 600;
  text-align: center;
}

.btn-secondary {
  width: 100%;
  padding: 13px 16px;
  border-radius: 10px;
  background: var(--t-surface);
  color: var(--t-text);
  border: 1px solid var(--t-border);
  font-size: 16px;
  font-weight: 600;
  text-align: center;
}

.btn-row-equal {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn-confirm-cancel {
  min-height: 48px;
  padding: 10px 20px;
  border-radius: 999px;
  background: transparent;
  color: var(--t-text);
  border: 1px solid var(--t-accent-deep);
  font-size: 15px;
  font-weight: 600;
}

.btn-confirm-danger {
  min-height: 48px;
  padding: 10px 20px;
  border-radius: 999px;
  background: var(--t-danger);
  color: var(--t-on-danger);
  border: 1px solid var(--t-danger);
  font-size: 15px;
  font-weight: 600;
}

.btn-confirm-accent {
  min-height: 48px;
  padding: 10px 20px;
  border-radius: 999px;
  background: var(--t-accent);
  color: var(--t-on-accent);
  border: none;
  font-size: 15px;
  font-weight: 600;
}

button:disabled {
  opacity: 0.55;
  pointer-events: none;
}

/* =========================================================
   POP-UP SHEETS & CONFIRM DIALOGS (Section 9)
   ========================================================= */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.52);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet-backdrop.centered {
  align-items: center;
  padding: 16px;
}

.sheet-card {
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  background: var(--t-surface);
  color: var(--t-text);
  border-radius: 18px 18px 0 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--t-border);
}

.sheet-backdrop.centered .sheet-card {
  border-radius: 18px;
}

.sheet-band {
  background: var(--t-ink);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sheet-eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
  margin-bottom: 2px;
}

.sheet-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  line-height: 1.2;
  color: var(--t-cream);
}

.sheet-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.42);
  color: var(--t-cream);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.sheet-body {
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--t-dim);
  margin-bottom: 5px;
}

.text-input,
.select-input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--t-border);
  background: var(--t-page-bg);
  color: var(--t-text);
  font-size: 16px;
  outline: none;
}

.text-input:focus,
.select-input:focus {
  border-color: var(--t-accent);
}

.field-error {
  font-size: 13px;
  color: var(--t-danger);
  margin-top: 4px;
}

.photo-preview-box {
  border: 1px solid var(--t-border);
  background: var(--t-note-bg);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.photo-preview-img {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--t-border);
  flex-shrink: 0;
}

.photo-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.small-chip-btn {
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--t-chip);
  color: var(--t-text);
  border: 1px solid var(--t-border);
  font-size: 13px;
  font-weight: 600;
}

.confirm-body-text {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
  color: var(--t-text);
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

/* =========================================================
   SETTINGS FULL-SCREEN PANEL (Section 9 & 11)
   ========================================================= */
.settings-panel {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: var(--t-page-bg);
  display: flex;
  flex-direction: column;
}

.settings-head {
  background: var(--t-ink);
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
}

.settings-head-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.section-switcher-wrap {
  position: relative;
  flex: 1;
}

.section-switcher-pill {
  width: 100%;
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--t-cream);
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 600;
}

.section-switcher-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--t-surface);
  border: 1px solid var(--t-border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
  z-index: 10;
}

.section-switcher-option {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 500;
  color: var(--t-text);
  border-bottom: 1px solid var(--t-border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-switcher-option:last-child {
  border-bottom: none;
}

.section-switcher-option.active {
  font-weight: 700;
  color: var(--t-accent);
}

.settings-add-row {
  display: flex;
  gap: 8px;
}

.settings-add-row .text-input {
  flex: 1;
}

.settings-add-btn {
  width: auto;
  padding: 0 16px;
}

.settings-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
}

.settings-box {
  background: var(--t-surface);
  border: 1px solid var(--t-border);
  border-radius: 14px;
  overflow: hidden;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--t-border-soft);
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-row-name {
  font-size: 15px;
  color: var(--t-text);
  min-width: 0;
  word-break: break-word;
}

.settings-row-name.is-custom {
  font-style: italic;
  color: var(--t-custom);
}

.settings-row-name.is-hidden {
  color: var(--t-dim);
}

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

.hidden-pill {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--t-chip);
  color: var(--t-dim);
  font-size: 11px;
  font-weight: 600;
}

.settings-action-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--t-accent);
  padding: 4px 6px;
}

.settings-foot {
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--t-border);
  background: var(--t-surface);
  text-align: center;
  flex-shrink: 0;
}

.tour-replay-btn {
  font-size: 14px;
  font-weight: 600;
  color: var(--t-accent);
  padding: 4px 8px;
}

.version-label {
  font-size: 12px;
  color: var(--t-dim);
  margin-top: 4px;
}

/* Themes picker */
.theme-group-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
  color: var(--gold-dark);
  margin: 12px 0 8px;
}

.theme-group-title:first-child {
  margin-top: 0;
}

.theme-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.theme-card {
  text-align: left;
  padding: 12px;
  border-radius: 12px;
  border: 2px solid var(--t-border);
  background: var(--t-surface);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.theme-card.active {
  border-color: var(--t-accent);
}

.theme-swatches {
  display: flex;
  gap: 4px;
}

.theme-swatch {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(128, 128, 128, 0.25);
}

.theme-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--t-text);
}

.demo-lock-card {
  background: var(--t-note-bg);
  border: 1px solid var(--t-border);
  border-radius: 14px;
  padding: 18px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Popover menu on List row "..." */
.list-popover-anchor {
  position: relative;
}

.list-popover-menu {
  position: absolute;
  right: 0;
  top: 100%;
  min-width: 150px;
  background: var(--t-surface);
  border: 1px solid var(--t-border);
  border-radius: 12px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.24);
  z-index: 25;
  overflow: hidden;
}

.list-popover-item {
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--t-text);
  border-bottom: 1px solid var(--t-border-soft);
}

.list-popover-item:last-child {
  border-bottom: none;
}

.list-popover-item.danger {
  color: var(--t-danger);
}

/* =========================================================
   WELCOME / INSTALL CARD (Section 5 & 6 — fixed control colours)
   ========================================================= */
.install-card-head {
  background: var(--t-ink);
  padding: 16px;
}

.install-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.install-step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  line-height: 1.35;
}

.install-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--t-chip);
  color: var(--gold-dark);
  font-weight: 700;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.drawn-phone-circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #3a3a3c;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.drawn-a2hs-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 6px;
  background: #48484a;
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
}

.drawn-ios-switch {
  display: inline-block;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: #34c759;
  position: relative;
  vertical-align: middle;
}

.drawn-ios-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
}

/* =========================================================
   WELCOME TOUR (8 Slides — Section 5, 7, 8, 9)
   ========================================================= */
.tour-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: var(--t-page-bg);
  display: flex;
  flex-direction: column;
}

.tour-slides-viewport {
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
}

.tour-slide-content {
  max-width: 400px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.tour-icon-tile {
  width: 132px;
  height: 132px;
  border-radius: 28px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.16);
  overflow: hidden;
  background: #ffffff;
}

.tour-icon-tile img {
  width: 100%;
  height: 100%;
  display: block;
}

.tour-tagline {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 24px;
  color: var(--t-text);
  margin: 0;
}

.tour-headline {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 24px;
  color: var(--t-text);
  margin: 0;
}

.tour-caption {
  font-size: 15px;
  line-height: 1.45;
  color: var(--t-dim);
  margin: 0;
}

.tour-miniature {
  width: 100%;
  background: var(--t-surface);
  border: 1px solid var(--t-border);
  border-radius: 16px;
  padding: 14px;
  text-align: left;
  position: relative;
}

.tour-hand-note {
  font-family: var(--font-hand);
  font-weight: 600;
  font-size: 24px;
  color: var(--gold-dark);
  transform: rotate(-4deg);
  display: inline-block;
  margin-top: 6px;
}

.tour-footer {
  padding: 14px 18px calc(18px + env(safe-area-inset-bottom, 0px));
  display: grid;
  grid-template-columns: 96px 1fr 116px;
  align-items: center;
  gap: 8px;
}

.tour-skip-btn {
  min-height: 48px;
  padding: 0 14px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--t-accent-deep);
  color: var(--t-text);
  font-size: 15px;
  font-weight: 600;
}

.tour-skip-spacer {
  width: 96px;
  height: 48px;
}

.tour-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
}

.tour-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--t-border);
}

.tour-dot.active {
  background: var(--t-accent);
  width: 18px;
  border-radius: 999px;
}

.tour-next-btn {
  min-height: 48px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--t-accent);
  color: var(--t-on-accent);
  font-size: 15px;
  font-weight: 700;
}

/* =========================================================
   TOASTS (Section 9 — animated drain bar, no wrapping)
   ========================================================= */
.toast-container {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: calc(82px + env(safe-area-inset-bottom, 0px));
  z-index: 150;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  width: fit-content;
  max-width: 100%;
  background: var(--t-ink);
  color: var(--t-cream);
  border: 1px solid var(--gold-dark);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.toast-inner {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

.toast-msg {
  white-space: nowrap;
}

.toast-action {
  color: var(--gold);
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  flex-shrink: 0;
}

.toast-drain {
  height: 3px;
  background: var(--gold);
  width: 100%;
  transform-origin: left center;
}

/* =========================================================
   BLOCKING UPDATE / MAINTENANCE / PROCESSING SCREENS
   ========================================================= */
.blocking-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--t-page-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.blocking-card {
  width: 100%;
  max-width: 360px;
  background: var(--t-surface);
  border: 1px solid var(--t-border);
  border-radius: 18px;
  overflow: hidden;
  text-align: center;
}

.blocking-card-band {
  background: var(--t-ink);
  padding: 16px;
}

.blocking-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  color: var(--t-cream);
}

.blocking-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.blocking-text {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
  color: var(--t-text);
}

.processing-sleigh {
  width: 120px;
  height: 70px;
  margin: 0 auto;
  animation: splashSleighGlide 1.6s ease-in-out infinite;
}
