/* Shared Base — Minimal, Calm, Intuitive iPad Ergonomics */
*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.48;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
}
html { scrollbar-gutter: stable; }

h1, h2, h3, h4, p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

/* Crisp inline SVG icons */
.ic {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

/* Unified Minimal Page Header */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 46px;
}

.top-brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.top-title {
  font-family: var(--font-serif);
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}

.top-sub {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--ink-3);
}

.top-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Buttons — Quiet, Tactile, Uncluttered */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 9px 18px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: var(--raised);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
  user-select: none;
  white-space: nowrap;
}

.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.38; pointer-events: none; }

.btn.primary {
  background: var(--lake);
  color: var(--lake-ink);
  border-color: var(--lake);
}
[data-theme="dark"] .btn.primary {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.btn.amber {
  background: var(--sunset);
  color: var(--sunset-ink);
  border-color: transparent;
}

.btn.pine {
  background: var(--pine);
  color: #FFFFFF;
  border-color: transparent;
}

.btn.ember {
  background: var(--ember);
  color: #FFFFFF;
  border-color: transparent;
}

.btn.soft {
  background: var(--paper-2);
  border-color: transparent;
  color: var(--ink-2);
}
.btn.soft:hover { color: var(--ink); }

.btn.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink-2);
}
.btn.ghost:hover { border-color: var(--line-strong); color: var(--ink); }

.btn.lg {
  min-height: 50px;
  padding: 12px 26px;
  font-size: 0.98rem;
}

.btn.sm {
  min-height: 36px;
  padding: 6px 13px;
  font-size: 0.84rem;
}

.btn.icon-only {
  width: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 50%;
}

/* Segmented Navigation Rail */
.seg-rail {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--paper-2);
  padding: 4px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
}

.seg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 7px 16px;
  border: none;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink-2);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
  white-space: nowrap;
}

.seg-btn:hover { color: var(--ink); }
.seg-btn.active {
  background: var(--raised);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
}

/* Filter Chips */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-2);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.14s ease;
  user-select: none;
  white-space: nowrap;
  flex: none;
}

.chip:hover { border-color: var(--line-strong); color: var(--ink); }
.chip.active {
  background: var(--lake);
  color: var(--lake-ink);
  border-color: var(--lake);
}
[data-theme="dark"] .chip.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

/* Quiet Editorial Labels (Eyebrows) */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.eyebrow.pill {
  padding: 5px 11px;
  border-radius: var(--r-pill);
  background: var(--paper-2);
  color: var(--ink-2);
}

.eyebrow.amber { background: var(--sunset-soft); color: var(--sunset-deep); padding: 5px 11px; border-radius: var(--r-pill); }
[data-theme="dark"] .eyebrow.amber { color: var(--sunset); }
.eyebrow.pine { background: var(--pine-soft); color: var(--pine); padding: 5px 11px; border-radius: var(--r-pill); }
[data-theme="dark"] .eyebrow.pine { color: #5BD9A2; }
.eyebrow.ember { background: var(--ember-soft); color: var(--ember); padding: 5px 11px; border-radius: var(--r-pill); }
[data-theme="dark"] .eyebrow.ember { color: #FF946B; }
.eyebrow.teal { background: var(--teal-soft); color: var(--teal); padding: 5px 11px; border-radius: var(--r-pill); }
[data-theme="dark"] .eyebrow.teal { color: #6AD2DF; }

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 18, 28, 0.48);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop[hidden] { display: none; }

.modal-sheet {
  width: 100%;
  max-width: 520px;
  max-height: 84dvh;
  overflow-y: auto;
  background: var(--raised);
  border-radius: var(--r-lg);
  padding: 26px 28px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.modal-head h2 {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 600;
}

/* Smooth Card Entrance */
@keyframes cardIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.anim-in { animation: cardIn 0.24s cubic-bezier(0.22, 1, 0.36, 1) both; }

/* Toast */
.toast {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--lake);
  color: var(--lake-ink);
  padding: 10px 20px;
  border-radius: var(--r-pill);
  font-weight: 600;
  font-size: 0.88rem;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 200;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Floating 4-App Glass Pill Dock (Signature B-Town Brief Bar) */
.app-pill-dock {
  position: fixed;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 95;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 5px;
  border-radius: 999px;
  background: rgba(14, 21, 29, 0.78);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.20),
    0 2px 6px rgba(0, 0, 0, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  max-width: calc(100vw - 24px);
}

.app-pill-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 7px 16px;
  border-radius: 999px;
  color: rgba(247, 248, 249, 0.74);
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
  transition: background 0.16s ease, color 0.16s ease, transform 0.12s ease;
  user-select: none;
}

.app-pill-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
}

.app-pill-link:active { transform: scale(0.96); }

.app-pill-link.active {
  background: rgba(255, 255, 255, 0.17);
  color: #FFFFFF;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.app-pill-link .ic {
  width: 15px;
  height: 15px;
  opacity: 0.88;
}

@media (max-width: 620px) {
  .app-pill-link {
    padding: 7px 11px;
    font-size: 0.8rem;
    gap: 5px;
  }
}
