/* CouncilBins v2 — design system
   White-label ready: primary colours overridden via :root JS from council config
*/

:root {
  --primary: #0d9488;
  --primary-dark: #0f766e;
  --primary-soft: rgba(13, 148, 136, 0.12);
  --accent: #f59e0b;

  --bg: #f0fdfa;
  --bg-elevated: #ffffff;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-solid: #ffffff;
  --border: rgba(15, 118, 110, 0.12);
  --text: #134e4a;
  --text-muted: #5b716e;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --success: #16a34a;
  --success-soft: #f0fdf4;

  --shadow: 0 8px 28px rgba(15, 118, 110, 0.08);
  --shadow-lg: 0 16px 48px rgba(15, 118, 110, 0.12);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;

  --nav-h: 72px;
  --topbar-h: 72px;
  --max-w: 480px;
  --font: "DM Sans", system-ui, -apple-system, sans-serif;

  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0b1c1a;
  --bg-elevated: #122926;
  --surface: rgba(18, 41, 38, 0.82);
  --surface-solid: #14312d;
  --border: rgba(148, 220, 210, 0.12);
  --text: #e6fffa;
  --text-muted: #8fb5af;
  --primary-soft: rgba(45, 212, 191, 0.14);
  --danger-soft: #3f1515;
  --success-soft: #0f2a1a;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--primary) 18%, transparent), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 55%),
    var(--bg);
  overscroll-behavior-y: none;
}

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

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

a {
  color: var(--primary);
}

img,
svg {
  display: block;
  max-width: 100%;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

/* —— App shell —— */
.app {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  min-height: 100dvh;
  position: relative;
}

.main-shell {
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-h) + 1.25rem + env(safe-area-inset-bottom));
}

.content {
  padding: 0 1rem 1.5rem;
}

.tab-panel {
  animation: fadeUp 0.28s ease;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* —— Glass —— */
.glass {
  background: var(--surface);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

/* —— Boot —— */
.boot-screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 2rem;
  text-align: center;
}

.boot-logo {
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.boot-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0;
}

.boot-sub {
  margin: 0 0 1rem;
  color: var(--text-muted);
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--primary-soft);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* —— Setup —— */
.view-setup {
  padding: 1.5rem 1.25rem 2rem;
  min-height: 100dvh;
}

.setup-hero {
  text-align: center;
  margin-bottom: 1.25rem;
  padding-top: 1rem;
}

.setup-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--primary-dark);
  background: var(--primary-soft);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 1rem;
}

[data-theme="dark"] .setup-badge {
  color: #5eead4;
}

.setup-logo {
  color: var(--primary);
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.setup-hero h1 {
  font-size: clamp(1.6rem, 5vw, 2rem);
  line-height: 1.15;
  margin: 0 0 0.65rem;
  letter-spacing: -0.02em;
}

.lede {
  margin: 0 auto;
  max-width: 32ch;
  color: var(--text-muted);
}

.setup-card {
  margin-bottom: 1.25rem;
}

.setup-features {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.feature-chip {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* —— Top bar —— */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  margin: 0.75rem 1rem 1rem;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.brand-mark {
  color: var(--primary);
  flex-shrink: 0;
}

.brand-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-sub {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.topbar-actions {
  display: flex;
  gap: 0.25rem;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}

.icon-btn:hover,
.icon-btn:focus-visible {
  background: var(--primary-soft);
  color: var(--primary);
  outline: none;
}

/* —— Cards —— */
.card {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.15rem 1.2rem;
  margin-bottom: 0.9rem;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
  letter-spacing: -0.01em;
}

.card-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

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

.small {
  font-size: 0.85rem;
}

.mb {
  margin-bottom: 1rem;
}

.center {
  text-align: center;
}

/* —— Hero collection —— */
.hero-card {
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--primary) 12%, var(--surface-solid)) 0%, var(--surface-solid) 55%);
  border-color: color-mix(in srgb, var(--primary) 22%, var(--border));
}

.hero-kicker {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 0.28rem 0.6rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
}

[data-theme="dark"] .pill {
  color: #5eead4;
}

.pill-live {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: #b45309;
}

[data-theme="dark"] .pill-live {
  color: #fbbf24;
}

.hero-date {
  font-size: clamp(1.65rem, 6vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 0.25rem;
  line-height: 1.15;
}

.hero-cue {
  margin: 0 0 1.1rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.bin-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 0.65rem;
}

.bin-tile {
  border-radius: var(--radius);
  padding: 0.75rem 0.4rem 0.65rem;
  text-align: center;
  color: #fff;
  min-height: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  position: relative;
  overflow: hidden;
}

.bin-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 50%);
  pointer-events: none;
}

.bin-tile .bin-glyph {
  font-size: 1.55rem;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

.bin-tile .bin-label {
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.bin-tile[data-type="recycling"] {
  color: #1c1917;
}

.bin-tile[data-type="recycling"] .bin-label {
  text-shadow: none;
}

.bin-tile[data-type="fogo"] {
  color: #1a2e05;
}

.exception-note {
  margin: 0.9rem 0 0;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
}

.address-line {
  margin: 0.15rem 0;
  font-weight: 600;
  font-size: 0.95rem;
}

/* —— Quick grid —— */
.quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.quick-card {
  text-align: left;
  margin: 0;
  transition: transform 0.15s, box-shadow 0.15s;
  width: 100%;
}

.quick-card:hover,
.quick-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  outline: none;
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
}

.quick-icon {
  font-size: 1.4rem;
  display: block;
  margin-bottom: 0.4rem;
}

.quick-title {
  display: block;
  font-weight: 700;
  font-size: 0.92rem;
}

.quick-sub {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

/* —— Forms —— */
.field-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0 0 0.4rem;
}

.optional {
  font-weight: 400;
  color: var(--text-muted);
}

.search-field {
  position: relative;
  margin-bottom: 0.75rem;
}

.search-icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-field input,
textarea,
input[type="text"],
input[type="tel"],
input[type="search"],
input[type="email"] {
  width: 100%;
  padding: 0.8rem 0.95rem;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-field input {
  padding-left: 2.75rem;
}

.search-field input:focus,
textarea:focus,
input[type="text"]:focus,
input[type="tel"]:focus,
input[type="search"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

textarea {
  resize: vertical;
  min-height: 100px;
}

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

@media (max-width: 380px) {
  .field-grid {
    grid-template-columns: 1fr;
  }
}

.form-error {
  background: var(--danger-soft);
  color: var(--danger);
  padding: 0.65rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin: 0.5rem 0;
}

.hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0.75rem 0 0;
}

/* —— Suggestions —— */
.suggest-list {
  list-style: none;
  margin: 0 0 0.5rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-solid);
  max-height: 280px;
  overflow-y: auto;
}

.suggest-list li {
  border-bottom: 1px solid var(--border);
}

.suggest-list li:last-child {
  border-bottom: none;
}

.suggest-list button {
  width: 100%;
  text-align: left;
  padding: 0.8rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  transition: background 0.12s;
}

.suggest-list button:hover,
.suggest-list button:focus-visible {
  background: var(--primary-soft);
  outline: none;
}

.suggest-list .s-main {
  font-weight: 600;
  font-size: 0.95rem;
}

.suggest-list .s-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* —— Buttons —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.75rem 1.1rem;
  border-radius: var(--radius);
  font-weight: 600;
  transition: transform 0.12s, box-shadow 0.12s, background 0.12s, opacity 0.12s;
  text-decoration: none;
}

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

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--primary) 35%, transparent);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.btn-ghost {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid color-mix(in srgb, var(--primary) 45%, transparent);
}

.btn-ghost:hover {
  background: var(--primary-soft);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-sm {
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
  border-radius: 12px;
}

.btn-block {
  width: 100%;
}

.link-btn {
  color: var(--primary);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 0.2rem;
}

/* —— Report choices —— */
.report-types {
  border: 0;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.choice {
  display: flex;
  cursor: pointer;
}

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

.choice-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.8rem 0.95rem;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--bg);
  transition: border-color 0.15s, background 0.15s;
}

.choice-body strong {
  font-size: 0.95rem;
}

.choice-body small {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.choice input:checked + .choice-body {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.choice input:focus-visible + .choice-body {
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.success-block {
  text-align: center;
  padding: 1.5rem 0.5rem;
}

.success-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: var(--success-soft);
  color: var(--success);
  display: grid;
  place-items: center;
  font-size: 1.75rem;
  font-weight: 700;
}

.reference {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--primary);
  margin: 0.25rem 0 1rem;
  font-variant-numeric: tabular-nums;
}

/* —— Calendar —— */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.85rem 0 1rem;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.calendar-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.cal-item {
  display: flex;
  gap: 0.85rem;
  align-items: stretch;
  padding: 0.85rem;
  border-radius: var(--radius);
  background: var(--bg);
  border: 1px solid var(--border);
}

.cal-item.is-next {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
  background: var(--primary-soft);
}

.cal-date {
  min-width: 72px;
  text-align: center;
  padding: 0.35rem 0.25rem;
  border-radius: 12px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.cal-date .dow {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.cal-date .dom {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.1;
}

.cal-date .mon {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

.cal-body {
  flex: 1;
  min-width: 0;
}

.cal-relative {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.35rem;
}

.cal-bins {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.bin-chip {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  color: #fff;
}

.bin-chip[data-type="recycling"],
.bin-chip[data-type="fogo"] {
  color: #1c1917;
}

.cal-note {
  margin: 0.45rem 0 0;
  font-size: 0.78rem;
  color: #b45309;
  font-weight: 500;
}

[data-theme="dark"] .cal-note {
  color: #fbbf24;
}

/* —— Recycle —— */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.25rem 0 1rem;
}

.filter-chip {
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg);
  transition: all 0.12s;
}

.filter-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.recycle-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.recycle-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.85rem;
  border-radius: var(--radius);
  background: var(--bg);
  border: 1px solid var(--border);
}

.recycle-item .r-body {
  flex: 1;
  min-width: 0;
}

.recycle-item h4 {
  margin: 0 0 0.2rem;
  font-size: 0.95rem;
}

.recycle-item p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.recycle-item .r-badge {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  color: #fff;
  max-width: 7.5rem;
  text-align: center;
  line-height: 1.25;
}

.recycle-item .r-badge[data-type="recycling"],
.recycle-item .r-badge[data-type="fogo"] {
  color: #1c1917;
}

.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* —— News —— */
.news-list,
.news-teaser-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.news-item {
  padding: 0.9rem;
  border-radius: var(--radius);
  background: var(--bg);
  border: 1px solid var(--border);
}

.news-item h4 {
  margin: 0 0 0.35rem;
  font-size: 0.98rem;
}

.news-item p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.news-meta {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
}

.news-cat {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  background: var(--primary-soft);
  color: var(--primary-dark);
}

[data-theme="dark"] .news-cat {
  color: #5eead4;
}

.news-cat[data-cat="alert"] {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: #b45309;
}

[data-theme="dark"] .news-cat[data-cat="alert"] {
  color: #fbbf24;
}

.news-cat[data-cat="tip"] {
  background: color-mix(in srgb, #8b5cf6 18%, transparent);
  color: #6d28d9;
}

[data-theme="dark"] .news-cat[data-cat="tip"] {
  color: #c4b5fd;
}

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

.news-teaser-list .news-item {
  padding: 0.75rem;
}

.news-teaser-list .news-item p {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* —— Settings —— */
.settings-group {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

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

.settings-heading {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
}

.toggle-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
}

.toggle-row span {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.toggle-row input[type="checkbox"] {
  appearance: none;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text-muted) 35%, transparent);
  position: relative;
  flex-shrink: 0;
  transition: background 0.15s;
  cursor: pointer;
}

.toggle-row input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s;
}

.toggle-row input[type="checkbox"]:checked {
  background: var(--primary);
}

.toggle-row input[type="checkbox"]:checked::after {
  transform: translateX(20px);
}

.demo-box {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  margin: 1rem -0.25rem 0;
  padding: 1rem !important;
  border-radius: var(--radius);
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent) !important;
}

/* —— Bottom nav —— */
.bottom-nav {
  position: fixed;
  bottom: max(0.65rem, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 1.5rem);
  max-width: calc(var(--max-w) - 1.5rem);
  z-index: 50;
  display: flex;
  justify-content: space-around;
  padding: 0.45rem 0.35rem;
  border-radius: var(--radius-xl);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.45rem 0.2rem;
  border-radius: 14px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 600;
  transition: color 0.15s, background 0.15s;
}

.nav-item svg {
  opacity: 0.85;
}

.nav-item.active {
  color: var(--primary);
  background: var(--primary-soft);
}

.nav-item:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* —— Toast —— */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + 1.5rem + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(12px);
  z-index: 100;
  background: var(--text);
  color: var(--bg);
  padding: 0.75rem 1.15rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  max-width: min(90vw, 360px);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

[data-theme="dark"] .toast {
  background: #ecfdf5;
  color: #0b1c1a;
}

/* —— Skeleton / loading bits —— */
.skeleton {
  background: linear-gradient(90deg, var(--border), transparent, var(--border));
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: 8px;
  min-height: 1em;
}

@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* —— Reduced motion —— */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* —— Desktop polish —— */
@media (min-width: 540px) {
  body {
    padding: 0.5rem 0;
  }

  .app {
    box-shadow: var(--shadow-lg);
    border-radius: 28px;
    overflow: clip;
    min-height: calc(100dvh - 1rem);
    background: color-mix(in srgb, var(--bg) 40%, transparent);
  }
}
