:root {
  /* Text */
  --ink: #121212;
  --muted: #666666;
  /* Surfaces */
  --soft: #f9f9f9;
  --paper: #ffffff;
  --surface-page: #f9f9f9;
  --surface-card: #ffffff;
  --surface-input: #ffffff;
  --surface-raised: #f3f3f3;
  --surface-nav: rgba(255, 255, 255, 0.94);
  /* Borders & lines */
  --line: rgba(0, 0, 0, 0.08);
  --nav: #ffffff;
  --nav-muted: #666666;
  /* Accent */
  --accent: #171918;
  --accent-weak: #f3f3f3;
  --accent-mid: #e0e0e0;
  /* Elevation */
  --shadow: 0 18px 46px rgba(17, 24, 39, 0.08);
  /* Border radius scale */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 28px;
  --radius-full: 999px;
  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
}

/* Dark appearance — only tokens change, no component overrides needed */
html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f4f7f6;
  --muted: #aeb8b5;
  --soft: #1d2524;
  --paper: #202927;
  --surface-page: #171d1c;
  --surface-card: #202927;
  --surface-input: #27312f;
  --surface-raised: #303a38;
  --surface-nav: rgba(32, 41, 39, 0.96);
  --line: rgba(236, 248, 245, 0.1);
  --nav: #1d2524;
  --nav-muted: rgba(236, 248, 245, 0.68);
  --accent: #65d6c6;
  --accent-weak: rgba(101, 214, 198, 0.18);
  --accent-mid: rgba(101, 214, 198, 0.42);
  --shadow: 0 28px 70px rgba(0, 0, 0, 0.28);
}

/* Page-level surfaces */
html[data-theme="dark"] body,
html[data-theme="dark"] .app-shell,
html[data-theme="dark"] .main-panel,
html[data-theme="dark"] .board-view,
html[data-theme="dark"] .feature-module,
html[data-theme="dark"] .auth-screen,
html[data-theme="dark"] .onboarding-screen {
  background: var(--surface-page);
}

/* Card-level surfaces */
html[data-theme="dark"] .toolbar,
html[data-theme="dark"] .topbar,
html[data-theme="dark"] .inline-capture,
html[data-theme="dark"] .daily-summary,
html[data-theme="dark"] .card,
html[data-theme="dark"] .feature-panel,
html[data-theme="dark"] .finance-hero,
html[data-theme="dark"] .upcoming-expenses,
html[data-theme="dark"] .expense-summary-panel,
html[data-theme="dark"] .calendar-shell,
html[data-theme="dark"] .calendar-agenda,
html[data-theme="dark"] .slack-shell,
html[data-theme="dark"] .chat-panel,
html[data-theme="dark"] .message-composer,
html[data-theme="dark"] .card-dialog,
html[data-theme="dark"] .dialog-content,
html[data-theme="dark"] .dialog-header,
html[data-theme="dark"] .auth-phone,
html[data-theme="dark"] .onboarding-phone,
html[data-theme="dark"] .onboarding-card,
html[data-theme="dark"] .mini-stat,
html[data-theme="dark"] .feature-item,
html[data-theme="dark"] .inline-capture-host,
html[data-theme="dark"] .column,
html[data-theme="dark"] .column-header,
html[data-theme="dark"] .unified-card {
  background: var(--surface-card);
  color: var(--ink);
}

/* Input-level surfaces */
html[data-theme="dark"] .search-wrap,
html[data-theme="dark"] .inline-capture-wrap,
html[data-theme="dark"] .expense-summary-row,
html[data-theme="dark"] .settings-toggle-row,
html[data-theme="dark"] .settings-select-row,
html[data-theme="dark"] .settings-connection-row,
html[data-theme="dark"] .calendar-day,
html[data-theme="dark"] .week-day,
html[data-theme="dark"] .calendar-busy-card,
html[data-theme="dark"] .agenda-empty,
html[data-theme="dark"] .comment,
html[data-theme="dark"] .card-info-section,
html[data-theme="dark"] .message-card,
html[data-theme="dark"] textarea,
html[data-theme="dark"] input,
html[data-theme="dark"] select {
  background: var(--surface-input);
  color: var(--ink);
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
  color: rgba(222, 234, 231, 0.48);
}

/* Navigation surface */
html[data-theme="dark"] .phone-tabbar,
html[data-theme="dark"] .desktop-nav {
  background: var(--surface-nav);
  border-color: var(--line);
}

/* Calendar specifics */
html[data-theme="dark"] .calendar-view-switcher {
  background: #18201f;
}

html[data-theme="dark"] .calendar-view-switcher button.active {
  background: #31403d;
  color: var(--ink);
}

html[data-theme="dark"] .calendar-day.selected {
  background: var(--accent);
  color: #13201e;
}

/* Raised chip surfaces */
html[data-theme="dark"] .derived-tag,
html[data-theme="dark"] .card-tag,
html[data-theme="dark"] .topic-pill {
  background: var(--surface-raised);
  color: var(--muted);
}

html[data-theme="dark"] .pill,
html[data-theme="dark"] .meta-chip,
html[data-theme="dark"] .card-state-row span,
html[data-theme="dark"] .quick-response,
html[data-theme="dark"] .quick-message,
html[data-theme="dark"] .card-sync {
  background: var(--surface-raised);
  color: var(--ink);
}

html[data-theme="dark"] .pill.Important,
html[data-theme="dark"] .pill.Waiting,
html[data-theme="dark"] .needs-response-tag {
  background: #111817 !important;
  color: #ffffff !important;
}

/* Inline card capture keeps white textarea for contrast in dark mode */
html[data-theme="dark"] .inline-card-capture textarea {
  background: #ffffff;
  color: #1e1d22;
}

html[data-theme="dark"] .inline-card-capture textarea::placeholder {
  color: rgba(30, 29, 34, 0.48);
}

html[data-theme="dark"] dialog::backdrop {
  background: rgba(4, 8, 8, 0.68);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: #f7f7f7;
  font-family: Manrope, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body.auth-locked {
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  background: var(--surface-page);
}

body.onboarding-locked {
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  background: var(--surface-page);
}

body.poc-locked {
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
}

body.poc-locked .app-shell,
body.poc-locked .phone-tabbar,
body.poc-locked .auth-screen {
  display: none;
}

body:not(.poc-locked) .poc-gate {
  display: none;
}

body.auth-locked .app-shell,
body.auth-locked .phone-tabbar {
  display: none;
}

body:not(.auth-locked) .auth-screen {
  display: none;
}

body.onboarding-locked .app-shell,
body.onboarding-locked .phone-tabbar,
body.onboarding-locked .auth-screen {
  display: none;
}

body:not(.onboarding-locked) .onboarding-screen,
body.poc-locked .onboarding-screen,
body.auth-locked .onboarding-screen {
  display: none;
}

.auth-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 14px;
  background: var(--surface-page);
}

.auth-screen[hidden] {
  display: none !important;
}

.onboarding-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 14px;
  background:
    radial-gradient(circle at 24% 10%, rgba(101, 214, 198, 0.28), transparent 34%),
    linear-gradient(145deg, #f7fbf8 0%, #e8f4ec 100%);
}

.poc-gate {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at 24% 10%, rgba(101, 214, 198, 0.28), transparent 34%),
    linear-gradient(145deg, #f7fbf8 0%, #e8f4ec 100%);
}

.poc-gate-card {
  width: min(100%, 390px);
  display: grid;
  gap: 18px;
  padding: 24px;
  border-radius: 34px;
  background: var(--paper);
  box-shadow: 0 34px 90px rgba(31, 41, 35, 0.12);
}

.poc-gate-card h1 {
  margin: 4px 0 0;
  font-size: 34px;
  line-height: 1;
  letter-spacing: 0;
}

.poc-gate-card p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.poc-gate-kicker {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.poc-gate-card label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.poc-gate-card input {
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: 18px;
  background: #f3f5f2;
  color: var(--ink);
  padding: 0 14px;
  outline: 0;
}

.poc-gate-card input:focus {
  box-shadow: 0 0 0 3px rgba(101, 214, 198, 0.22);
}

.poc-gate-card button {
  min-height: 50px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #ffffff;
  font-weight: 900;
}

.poc-gate-error {
  min-height: 18px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
}

.legal-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 14px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.legal-links a {
  color: inherit;
  text-decoration: none;
}

.legal-links a:hover,
.legal-links a:focus-visible {
  color: var(--ink);
  text-decoration: underline;
}

.auth-phone {
  width: min(100%, 430px);
  min-height: min(820px, calc(100dvh - 28px));
  max-height: calc(100dvh - 28px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px 24px 28px;
  border-radius: 32px;
  background: var(--paper);
  box-shadow: 0 2px 0 var(--line), 0 24px 64px rgba(0, 0, 0, 0.07);
}

/* Family avatars above headline */
.auth-family-avatars {
  display: flex;
  justify-content: center;
  gap: -8px;
  margin: 4px 0 -4px;
}

.auth-family-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 3px solid var(--paper);
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 800;
  margin-left: -10px;
  color: var(--paper);
}

.auth-family-avatar:first-child { margin-left: 0; }

.auth-family-avatar--a {
  background: var(--accent);
}

.auth-family-avatar--b {
  background: var(--ink);
}

.auth-family-avatar--child {
  background: var(--surface-raised);
  color: var(--muted);
}

.auth-family-avatar--child svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
}

/* Value proposition pills */
.auth-value-props {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.auth-value-prop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 12px 8px;
  border-radius: 16px;
  background: var(--surface-page);
  border: 1px solid var(--line);
  text-align: center;
}

.auth-value-prop svg {
  width: 20px;
  height: 20px;
  stroke: var(--accent);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-value-prop span {
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
}

.auth-value-prop em {
  font-style: normal;
  font-size: 10px;
  line-height: 1.3;
  color: var(--muted);
}

/* Demo section */
.auth-demo {
  border-radius: 16px;
  border: 1px solid var(--line);
  overflow: hidden;
}

.auth-demo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface-page);
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.auth-demo-card {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 4px;
}

.auth-demo-card:last-child {
  border-bottom: 0;
}

.auth-demo-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.auth-demo-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
}

.auth-demo-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  background: var(--accent-weak);
  color: var(--accent);
}

.auth-demo-tag.green {
  background: #f0fdf4;
  color: #16a34a;
}

.auth-demo-tag.neutral {
  background: var(--surface-raised);
  color: var(--muted);
}

.onboarding-phone {
  width: min(100%, 430px);
  max-height: calc(100dvh - 28px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px 14px 18px;
  border-radius: 42px;
  background: var(--paper);
  box-shadow: 0 34px 90px rgba(31, 41, 35, 0.12);
  overflow: hidden;
}

.onboarding-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.onboarding-header img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.onboarding-header span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.onboarding-header strong {
  display: block;
  margin-top: 2px;
  font-size: 20px;
  font-weight: 900;
}

.onboarding-sections {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 12px;
  padding-right: 2px;
}

.onboarding-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 26px;
  background: #f7f8f7;
}

.onboarding-card h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.1;
}

.onboarding-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.onboarding-card input,
.onboarding-card select {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  padding: 0 13px;
  outline: 0;
}

.onboarding-toggle {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.onboarding-toggle span {
  display: grid;
  gap: 4px;
}

.onboarding-toggle em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
}

.onboarding-card label > em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  line-height: 1.35;
}

.onboarding-toggle input {
  width: 20px;
  height: 20px;
  min-height: 20px;
  accent-color: var(--accent);
}

.connect-control {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.onboarding-inline-button {
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  background: rgba(101, 214, 198, 0.16);
  color: #0ea58f;
  font-weight: 900;
}

.auth-topline,
.auth-brand-row,
.auth-steps,
.auth-provider-button,
.auth-confirm {
  display: flex;
  align-items: center;
}

.auth-topline {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 24px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.top-steps {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: rgba(101, 214, 198, 0.5);
  font-size: 11px;
  font-weight: 900;
}

.top-steps i {
  width: 7px;
  height: 7px;
  display: block;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.5;
}

.top-steps i.complete {
  opacity: 1;
}

.auth-brand-row {
  gap: 12px;
}

.auth-avatar {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  font-weight: 900;
}

.auth-avatar img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.auth-brand-row span,
.auth-confirm-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.auth-brand-row strong {
  display: block;
  margin-top: 2px;
  font-size: 18px;
  font-weight: 900;
}

.auth-hero {
  margin-top: 4px;
}

.auth-hero h1 {
  max-width: 18ch;
  margin: 0;
  font-size: clamp(28px, 8vw, 38px);
  line-height: 1.1;
  letter-spacing: -0.01em;
  font-weight: 900;
}

.auth-hero p {
  max-width: 32ch;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.auth-steps {
  gap: 8px;
  margin-top: auto;
}

.auth-steps span {
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 32px;
  border-radius: 999px;
  background: #f3f5f2;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.auth-steps span.active {
  background: var(--ink);
  color: #ffffff;
}

.auth-provider-list {
  display: grid;
  gap: 10px;
}

.auth-provider-button {
  width: 100%;
  justify-content: flex-start;
  gap: 12px;
  min-height: 58px;
  border: 0;
  border-radius: 999px;
  padding: 0 16px;
  background: var(--ink);
  color: #ffffff;
  font-size: 15px;
  font-weight: 900;
}

.auth-provider-button.apple {
  background: var(--ink);
  color: #ffffff;
}

.auth-provider-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  font-weight: 900;
}

.apple-mark svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.auth-confirm {
  align-items: stretch;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-radius: 28px;
  background: var(--accent-weak);
}

.auth-confirm strong {
  font-size: 22px;
  font-weight: 900;
}

.auth-confirm p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.auth-mode-toggle {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--soft);
}

.auth-mode-option {
  flex: 1;
  min-height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.auth-mode-option.active {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(17, 24, 39, 0.1);
}

.auth-continue-button,
.auth-switch-button {
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  font-weight: 900;
}

.auth-continue-button {
  margin-top: 4px;
  background: var(--ink);
  color: #ffffff;
}

.auth-switch-button {
  background: transparent;
  color: var(--ink);
}

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

button {
  cursor: pointer;
  touch-action: manipulation;
}

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.sidebar {
  display: none;
  background: var(--nav);
  color: var(--ink);
  flex-direction: column;
  gap: 28px;
  padding: 24px 18px;
  border-right: 1px solid var(--line);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 8px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  font-weight: 800;
}

.brand-name {
  font-weight: 800;
}

.brand-subtitle,
.score-label {
  color: var(--nav-muted);
  font-size: 13px;
}

.topic-list {
  display: grid;
  gap: 6px;
}

.module-block {
  display: grid;
  gap: 10px;
}

.module-list {
  display: grid;
  gap: 4px;
}

.module-link {
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  padding: 7px 10px;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
}

.module-link:hover,
.module-link.active {
  background: transparent;
  color: var(--accent);
}

.topic {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  text-align: left;
}

.topic:hover,
.topic.active {
  background: transparent;
  color: var(--accent);
}

.topic strong {
  color: var(--muted);
  font-size: 12px;
}

.launch-score {
  margin-top: auto;
  padding: 16px;
  border-radius: 8px;
  background: var(--soft);
  border: 1px solid var(--line);
  display: grid;
  gap: 11px;
}

.score-row {
  display: flex;
  justify-content: space-between;
  color: var(--ink);
  font-size: 14px;
}

.main-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface-page);
  min-height: 100dvh;
}

.topbar {
  min-height: 116px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  display: none; /* hidden on mobile; shown on desktop via min-width query */
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 32px;
  position: relative;
  overflow: hidden;
}

@media (min-width: 761px) {
  .topbar {
    display: flex;
  }
}

.topbar::after {
  content: none;
  position: absolute;
  right: 120px;
  top: 22px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.12;
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(26px, 3vw, 40px);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button,
.segmented-button {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.primary-button {
  background: var(--accent);
  color: white;
  padding: 0 16px;
  font-weight: 700;
  box-shadow: 0 10px 20px rgba(244, 63, 94, 0.18);
}

.primary-button:hover:not(:disabled) {
  filter: brightness(0.92);
}

.secondary-button {
  background: var(--accent-weak);
  color: var(--accent);
  padding: 0 14px;
  font-weight: 700;
}

.secondary-button:hover:not(:disabled) {
  background: var(--accent-mid);
}

.ghost-button {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
  padding: 0 14px;
}

.ghost-button:hover:not(:disabled) {
  border-color: var(--accent-mid);
  color: var(--ink);
}

.icon-button {
  width: 42px;
  background: var(--paper);
  border-color: var(--line);
  color: var(--ink);
}

.icon-button:hover:not(:disabled) {
  background: var(--soft);
  border-color: var(--accent-mid);
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.attention-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  padding: 18px 32px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.attention-card {
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  background: var(--paper);
  padding: 13px 14px;
  text-align: left;
  min-width: 0;
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.05);
}

.attention-card strong {
  display: block;
  overflow-wrap: anywhere;
}

.attention-card span {
  color: var(--muted);
  font-size: 13px;
}

.workspace {
  padding: 22px 32px 32px;
  padding-bottom: calc(32px + env(safe-area-inset-bottom));
  min-height: 0;
  flex: 1;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 0;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

/* Drawer tab below toolbar */
.toolbar-drawer {
  display: flex;
  align-items: flex-start;
  padding: 0 16px;
  position: relative;
  z-index: 4;
  margin-bottom: -1px;
}

.toolbar-drawer-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 36px;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 16px 16px;
  background: var(--paper);
  cursor: pointer;
  padding: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.toolbar-drawer-tab img {
  border-radius: 50%;
  display: block;
}

@media (min-width: 761px) {
  .toolbar {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 12px 20px 14px;
    background: var(--paper);
    top: 0;
  }

  .toolbar .search-wrap {
    width: 100%;
  }

  .toolbar .top-mini-stats {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: flex-start;
  }

  .toolbar-drawer {
    display: none;
  }

  .attention-strip {
    padding-left: 20px;
    padding-right: 20px;
  }
}

.app-logo-placeholder {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 50%;
  display: block;
  overflow: hidden;
  padding: 0;
  border: 0;
  background: #8edfd1;
  box-shadow: 0 18px 42px rgba(31, 41, 35, 0.07);
  cursor: pointer;
}

.app-logo-placeholder img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.toolbar-new-card {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  min-height: 40px;
  padding: 0 16px;
  white-space: nowrap;
  box-shadow: 0 14px 28px rgba(101, 214, 198, 0.28);
}

.toolbar-new-card svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2.5;
  fill: none;
}

.summary-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 0 20px 12px;
}

.summary-tile {
  min-height: 104px;
  border-radius: 28px;
  background: var(--paper);
  box-shadow: 0 30px 76px rgba(31, 41, 35, 0.075);
  padding: 18px;
  display: grid;
  align-content: space-between;
}

.summary-tile span {
  color: var(--muted);
  font-weight: 700;
}

.summary-tile strong {
  font-size: 42px;
  line-height: 1;
  letter-spacing: 0;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 8px;
  background: var(--soft);
}

.segmented-button {
  min-width: 76px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.top-mini-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.top-mini-stats::-webkit-scrollbar {
  display: none;
}

.daily-summary {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 20px 14px;
  border-radius: 28px;
  background: var(--paper);
  box-shadow: 0 30px 76px rgba(31, 41, 35, 0.075);
  padding: 12px 12px 12px 16px;
}

.daily-summary-main {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.daily-summary-meta {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.daily-summary span,
.daily-summary em,
.daily-summary strong {
  display: block;
}

.daily-summary span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
}

.daily-summary em {
  min-width: 0;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.2;
  font-style: normal;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.daily-summary strong {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.22;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.daily-summary-list {
  display: none;
}

.summary-add-button {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--ink);
}

.summary-add-button svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2.4;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mini-stat {
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  display: grid;
  align-content: center;
  gap: 1px;
  padding: 0 14px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 18px 42px rgba(31, 41, 35, 0.07);
}

.mini-avatar[data-person-filter] {
  cursor: pointer;
}

.mini-avatar[data-person-filter]:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.settings-mini-stat {
  width: 48px;
  flex: 0 0 48px;
  place-items: center;
  padding: 0;
}

.settings-mini-stat svg {
  width: 18px;
  height: 18px;
}

.mini-stat span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.mini-stat strong {
  font-size: 13px;
  white-space: nowrap;
}

.segmented-button.active {
  background: white;
  color: var(--accent);
  box-shadow: 0 3px 12px rgba(31, 47, 42, 0.12);
}

.search-wrap {
  min-height: 48px;
  width: min(420px, 100%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--muted);
}

.search-wrap input {
  border: 0;
  outline: 0;
  background: transparent;
  width: 100%;
  min-width: 0;
}

.board-view {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 14px;
  align-items: start;
}

.column-empty {
  margin: 0;
  padding: 12px 4px;
  color: var(--muted);
  font-size: 13px;
}

.archive-section {
  display: grid;
  gap: 12px;
}

.archive-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  padding: 0 14px;
  cursor: pointer;
}

.archive-toggle span {
  min-width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  background: var(--soft);
  color: var(--muted);
  font-size: 11px;
}

.archive-toggle svg {
  width: 16px;
  height: 16px;
}

.archive-chevron {
  margin-left: auto;
  transition: transform 0.18s ease;
}

.archive-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 14px;
  align-items: start;
}

.column {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
  overflow: hidden;
}

.inline-capture-host {
  margin-top: 0;
  padding: 10px 16px 14px;
  background: var(--surface-page);
  position: relative;
  z-index: 2;
  border-bottom: 1px solid var(--line);
}

.inline-card-capture {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  border: 0;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 6px 6px 16px;
  background: var(--surface-card);
  border: 1px solid var(--line);
}

.inline-card-input-wrap {
  position: relative;
}

.inline-capture-icon {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  color: var(--accent);
  display: grid;
  place-items: center;
  margin-right: 4px;
}

.inline-capture-icon svg {
  width: 20px;
  height: 20px;
}

.inline-capture-input,
.inline-card-capture textarea {
  flex: 1;
  min-width: 0;
  border: 0;
  resize: none;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  padding: 6px 0;
  min-height: unset;
  height: 32px;
  overflow: hidden;
}

.inline-capture-input::placeholder,
.inline-card-capture textarea::placeholder {
  color: var(--muted);
  font-weight: 400;
}

.inline-card-actions {
  display: none;
}

.inline-mic-button {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--accent);
}

.inline-mic-button svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.75;
}

/* Chat thread styles */
.chat-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 0;
  min-height: 40px;
}

.chat-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 8px 0;
  text-align: center;
}

.chat-bubble {
  display: flex;
  flex-direction: column;
  max-width: 80%;
}

.chat-mine {
  align-self: flex-end;
  align-items: flex-end;
}

.chat-theirs {
  align-self: flex-start;
  align-items: flex-start;
}

.chat-meta {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 3px;
  padding: 0 4px;
}

.chat-text {
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 8px 12px;
  font-size: 14px;
  line-height: 1.4;
}

.chat-mine .chat-text {
  background: var(--accent);
  color: var(--ink);
  border-color: transparent;
  border-radius: 16px 16px 4px 16px;
}

.chat-theirs .chat-text {
  border-radius: 16px 16px 16px 4px;
}

.chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 8px 0 4px;
  border-top: 1px solid var(--line);
}

.chat-input-row textarea {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 14px;
  resize: none;
  outline: none;
  background: var(--surface-input);
  color: var(--ink);
  min-height: 36px;
  max-height: 100px;
  overflow-y: auto;
}

.chat-mic-button,
.chat-send-button {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.chat-mic-button {
  background: transparent;
  color: var(--muted);
}

.chat-mic-button svg,
.chat-send-button svg {
  width: 18px;
  height: 18px;
}

.chat-send-button {
  background: var(--accent);
  color: var(--ink);
}

.inline-create-button {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--ink);
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
}

.inline-create-button svg {
  width: 18px;
  height: 18px;
}

.inline-mic-button svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2.4;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.inline-mic-button.recording {
  background: var(--accent);
  color: var(--ink);
  box-shadow: 0 0 0 4px rgba(101, 214, 198, 0.28);
}

.column-header {
  min-height: 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  font-weight: 800;
}

.column-header span {
  min-width: 24px;
  height: 24px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  background: white;
  color: var(--muted);
  font-size: 12px;
}

.column-body {
  display: grid;
  gap: 10px;
  padding: 10px;
  min-height: 140px;
}

.card {
  border: 1px solid rgba(23, 25, 24, 0.10);
  border-radius: 12px;
  background: #ffffff;
  padding: 24px;
  text-align: left;
  box-shadow: none;
  display: grid;
  gap: 20px;
  min-width: 0;
}

@media (min-width: 761px) {
  .card {
    padding: 28px;
  }
}

/* Date + status row */
.card-state-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Board cards: strip the pill background that the features demo .card-state-row span rule applies */
.unified-card .card-state-row span {
  background: transparent !important;
  padding: 0 !important;
  border-radius: 0 !important;
}

.card-date-tag {
  font-size: 10px;
  font-weight: 700;
  color: #777977;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.card-status-label {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  color: #d85b62;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.card-status-done {
  color: #777977;
}

/* People avatars above title */
.card-people-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: -6px; /* gap between avatars and title is handled by grid gap */
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}

.card-title {
  margin: 0;
  font-size: 26px;
  font-weight: 500;
  line-height: 1.15;
  overflow-wrap: anywhere;
  color: #242624;
}

.pill {
  min-height: 23px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 8px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.pill.To-Do,
.pill.Waiting,
.pill.Important,
.pill.Disputed,
.pill.Done,
.pill.Info-Only {
  background: var(--accent-weak);
  border: 1px solid var(--accent-mid);
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.meta-chip {
  background: var(--soft);
  border-radius: 6px;
  padding: 5px 7px;
}

.card-details {
  margin: 0;
  color: #555755;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.card-reminder {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  border-radius: 999px;
  background: var(--accent-weak);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  padding: 7px 10px;
}

.card-reminder svg {
  width: 14px;
  height: 14px;
}

.card-sync {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  padding: 6px 9px;
  color: rgba(43, 48, 44, 0.62);
  font-size: 10px;
  font-weight: 800;
}

.card-sync svg {
  width: 14px;
  height: 14px;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.list-view,
.signal-view {
  display: grid;
  gap: 10px;
}

.list-view {
  padding: 0 32px 32px;
}

.list-card {
  max-width: 760px;
}

.list-row,
.signal-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 14px;
}

.list-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.4fr) repeat(5, minmax(88px, 0.7fr));
  gap: 12px;
  align-items: center;
}

.list-row strong,
.list-row span {
  overflow-wrap: anywhere;
}

.signal-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
}

.signal-card strong {
  display: block;
  font-size: 28px;
  margin-top: 6px;
}

.signal-card span {
  color: var(--muted);
  font-size: 13px;
}

.feature-module {
  padding: 22px 32px 32px;
  display: grid;
  gap: 16px;
}

#cardsModule.cards-content-hidden > :not(.toolbar) {
  display: none !important;
}

#cardsModule.cards-content-hidden {
  display: block;
}

.feature-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 18px;
}

.feature-hero h2 {
  margin: 0 0 10px;
  font-size: 25px;
}

.feature-hero p,
.feature-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.feature-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 8px;
  max-width: none;
}

.module-actions {
  padding: 0 0 2px;
}

.feature-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.feature-stat,
.feature-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 15px;
}

.feature-stat span {
  color: var(--muted);
  font-size: 13px;
}

.feature-stat strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

.feature-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 14px;
  align-items: start;
}

.settings-layout {
  display: block;
  columns: 3;
  column-gap: 14px;
}

.settings-layout > * {
  break-inside: avoid;
  margin-bottom: 14px;
}

.feature-panel {
  display: grid;
  gap: 12px;
  align-content: start;
}

.feature-panel h3 {
  margin: 0;
}

.feature-items,
.toggle-list,
.integration-list,
.timeline,
.shopping-list,
.budget-list {
  display: grid;
  gap: 10px;
}

.feature-item,
.integration-row,
.timeline div,
.toggle-row,
.shopping-row,
.budget-row {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 12px;
}

.feature-item {
  display: grid;
  gap: 5px;
}

.feature-item-editable {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.feature-item-main {
  flex: 1;
  min-width: 0;
}

.feature-item-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.icon-button-sm {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  min-height: unset;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
}

.icon-button-sm:hover {
  background: var(--soft);
  color: var(--ink);
}

.icon-button-sm svg {
  width: 14px;
  height: 14px;
}

.icon-button-danger:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.feature-empty {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
  padding: 4px 0;
}

.feature-item span,
.integration-row span,
.timeline span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.integration-row,
.toggle-row,
.shopping-row,
.budget-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.toggle-row input,
.shopping-row input {
  width: 18px;
  height: 18px;
}

.shopping-row {
  justify-content: flex-start;
}

.shopping-board {
  display: grid;
  gap: 14px;
}

.shopping-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.shopping-group-header h3 {
  margin: 0;
}

.shopping-group-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.shopping-group-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.shopping-clear-btn {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background 0.12s, color 0.12s;
}

.shopping-clear-btn:hover {
  background: var(--surface-raised);
  color: var(--ink);
}

/* Row wrapper to hold label + delete button side by side */
.shopping-row-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.shopping-row-wrap .shopping-row {
  flex: 1;
  min-width: 0;
}

.shopping-row-wrap.bought .shopping-row strong {
  color: var(--muted);
  opacity: 0.62;
  text-decoration: line-through;
}

.shopping-delete-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s, background 0.12s, color 0.12s;
}

.shopping-row-wrap:hover .shopping-delete-btn {
  opacity: 1;
}

.shopping-delete-btn:hover {
  background: #fee2e2;
  color: #dc2626;
}

.shopping-row {
  min-height: 48px;
  cursor: pointer;
}

.shopping-row input {
  flex: 0 0 auto;
  accent-color: var(--accent);
}

.shopping-row strong {
  transition: color 0.16s ease, opacity 0.16s ease;
}

.shopping-row.bought strong {
  color: var(--muted);
  opacity: 0.62;
  text-decoration: line-through;
}

.shopping-row span,
.shopping-row em {
  display: grid;
  gap: 3px;
  font-style: normal;
}

.shopping-row em {
  color: var(--muted);
  font-size: 12px;
}

.budget-row span,
.budget-row em {
  display: grid;
  gap: 3px;
  font-style: normal;
}

.budget-row em {
  color: var(--muted);
  font-size: 12px;
}

.budget-row b {
  white-space: nowrap;
  font-size: 14px;
}

.settings-control-list {
  display: grid;
  gap: 12px;
}

.expense-summary-panel {
  display: grid;
  gap: 2px;
  border-radius: 24px;
  background: var(--paper);
  box-shadow: 0 24px 64px rgba(31, 41, 35, 0.06);
  overflow: hidden;
}

.expense-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #f7f8f7;
  padding: 13px 15px;
}

.expense-summary-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.expense-summary-row strong {
  font-size: 14px;
}

.settings-connection-list {
  display: grid;
  gap: 10px;
}

.settings-connection-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-radius: 22px;
  background: #f5f6f2;
  padding: 14px;
}

.settings-connection-row span {
  display: grid;
  gap: 4px;
}

.settings-connection-row em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
}

.settings-connection-row b {
  color: #0ea58f;
  font-size: 12px;
  white-space: nowrap;
}

.calendar-connect-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.calendar-connect-actions .secondary-button {
  min-height: 34px;
  padding: 0 11px;
  font-size: 11px;
  white-space: nowrap;
}

.feature-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.feature-panel-header h3 {
  margin: 0;
}

.feature-panel-header .secondary-button {
  min-height: 34px;
  padding: 0 12px;
  white-space: nowrap;
}

.settings-toggle-row,
.settings-select-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-radius: 22px;
  background: #f5f6f2;
  padding: 14px;
}

.settings-toggle-row span,
.settings-select-row span {
  display: grid;
  gap: 4px;
}

.settings-toggle-row em,
.settings-select-row em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
}

.settings-toggle-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

.settings-select-row select {
  width: min(180px, 42vw);
  min-height: 40px;
  border: 0;
  border-radius: 999px;
  background: var(--paper);
  padding: 0 13px;
  font-weight: 800;
}

.finance-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-radius: 30px;
  background: var(--paper);
  box-shadow: 0 30px 76px rgba(31, 41, 35, 0.075);
  padding: 20px;
}

.finance-hero span,
.finance-hero p {
  color: var(--muted);
}

.finance-hero span {
  display: block;
  font-size: 12px;
  font-weight: 800;
}

.finance-hero strong {
  display: block;
  margin: 4px 0;
  font-size: 34px;
  line-height: 1;
}

.finance-hero p {
  margin: 0;
  font-size: 13px;
}

.upcoming-expenses {
  display: grid;
  gap: 12px;
  border-radius: 30px;
  background: var(--paper);
  box-shadow: 0 30px 76px rgba(31, 41, 35, 0.075);
  padding: 18px;
}

.upcoming-expense-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.finance-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.finance-panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.finance-panel-head strong {
  white-space: nowrap;
}

.budget-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.required-label {
  margin-left: 6px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
}

.expense-category-field {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
}

.expense-category-field > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.expense-category-field em {
  margin-left: 6px;
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}

.expense-category-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.expense-category-pill {
  min-height: 30px;
  border: 0;
  border-radius: 999px;
  background: #f4f4f4;
  color: var(--ink);
  padding: 0 12px;
  font-size: 12px;
  font-weight: 800;
}

.expense-category-pill.active {
  background: var(--accent);
  color: var(--ink);
}

.expense-actions {
  margin-top: 14px;
}

.connected {
  background: var(--accent-weak);
  color: var(--accent);
}

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.card-dialog {
  width: min(980px, calc(100vw - 28px));
  border: 0;
  border-radius: 34px;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.card-dialog::backdrop {
  background: rgba(16, 24, 21, 0.48);
}

.dialog-content {
  position: relative;
  display: grid;
  gap: 18px;
  padding: 24px;
  border-radius: 34px;
  background: var(--paper);
  box-shadow: 0 30px 76px rgba(31, 41, 35, 0.075);
}

.reminder-dialog {
  width: min(430px, calc(100vw - 28px));
}

.reminder-content {
  gap: 16px;
}

.message-card-context {
  display: grid;
  gap: 5px;
  border-radius: 22px;
  background: var(--accent-weak);
  padding: 14px;
}

.message-card-context span,
.message-card-context p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.message-card-context strong {
  color: var(--ink);
  font-size: 16px;
  line-height: 1.2;
}

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

.message-context-tags {
  gap: 5px;
}

.message-context-tags .card-tag {
  background: rgba(232, 226, 213, 0.62);
  color: rgba(72, 71, 65, 0.62);
  font-size: 8px;
  font-weight: 800;
  padding: 4px 6px;
}

.dialog-header,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.dialog-actions-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

#cardReminderCustomLabel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

#cardReminderCustomLabel[hidden] {
  display: none;
}

.dialog-header-actions {
  position: static;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dialog-header {
  position: sticky;
  top: -24px;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  margin: -24px -24px 0;
  padding: 32px 24px 12px;
  background: var(--paper);
  border-radius: 34px 34px 0 0;
}

.dialog-header h2 {
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.08;
}

.presence-indicator {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  margin: 2px 0 0;
  animation: presence-fade-in 0.3s ease;
}

@keyframes presence-fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.dialog-view-hint {
  margin: -10px 0 0;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 5px;
}

.dialog-view-hint button {
  min-height: unset;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  padding: 0;
  cursor: pointer;
  border-radius: 0;
}

.dialog-card-meta {
  display: grid;
  gap: 8px;
}

.dialog-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
}

.dialog-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.dialog-meta-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  opacity: 0.7;
}

.dialog-meta-cal {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: #0ea58f;
  font-weight: 700;
  text-decoration: none;
  border-radius: 6px;
  padding: 3px 7px;
  background: rgba(14, 165, 143, 0.1);
}

.dialog-meta-cal:hover {
  background: rgba(14, 165, 143, 0.18);
}

.dialog-meta-cal svg {
  width: 13px;
  height: 13px;
}

.dialog-quick-actions {
  margin-top: -2px;
}

.dialog-lower-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.dialog-info-column,
.dialog-thread-column {
  display: grid;
  gap: 12px;
  align-content: start;
}

/* Two-col layout inside dialog: main content + reminder sidebar */
.dialog-two-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.dialog-main-col {
  display: grid;
  gap: 12px;
  align-content: start;
}

.dialog-side-col {
  display: grid;
  gap: 12px;
  align-content: start;
}

@media (min-width: 580px) {
  .dialog-two-col {
    grid-template-columns: 1fr 200px;
    align-items: start;
  }
}

/* Compact thread */
.comment-panel {
  display: grid;
  gap: 0;
}

.chat-list {
  max-height: 180px;
  overflow-y: auto;
}

.chat-input-row textarea {
  min-height: 32px;
  font-size: 13px;
}

.llm-new-card-mode .dialog-lower-grid {
  grid-template-columns: minmax(0, 1fr);
}

.llm-new-card-mode .dialog-thread-column,
.llm-new-card-mode .dialog-info-column .card-info-section,
.llm-new-card-mode .dialog-two-col {
  display: none;
}

.llm-card-chat {
  display: grid;
  gap: 12px;
  border-radius: 28px;
  background: var(--paper);
  padding: 0;
}

.new-card-message-field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.new-card-input-wrap {
  position: relative;
}

.new-card-input-wrap textarea {
  min-height: 180px;
  border: 0;
  border-radius: 28px;
  background: #f7f8f7;
  padding: 16px 58px 16px 16px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}

.new-card-input-wrap .llm-mic-button {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
}

.llm-message {
  display: grid;
  gap: 6px;
  max-width: 86%;
  border-radius: 24px;
  padding: 13px 14px;
  font-size: 14px;
  line-height: 1.42;
}

.llm-message strong,
.llm-message span,
.interpretation-message strong,
.interpretation-message span {
  display: block;
}

.interpretation-message {
  width: min(100%, 560px);
  max-width: 100%;
  border-radius: 24px;
  background: #f7f8f7;
  padding: 13px 14px;
  font-size: 14px;
  line-height: 1.42;
}

.llm-preview-tags {
  margin-top: 4px;
}

.llm-chat-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.llm-mic-button {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.derived-field-bank {
  display: none;
}

.short-info-field {
  gap: 8px;
}

.clean-field {
  display: block;
}

.short-info-field textarea {
  min-height: 132px;
  font-size: 16px;
  line-height: 1.45;
}

/* Details field with inline mic */
.details-field-wrap {
  position: relative;
}

.details-field-wrap #detailsInput {
  width: 100%;
  padding-right: 44px;
  min-height: 132px;
  font-size: 16px;
  line-height: 1.45;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 44px 12px 14px;
  resize: none;
  outline: none;
  background: var(--surface-input);
  color: var(--ink);
}

.inline-mic-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: color 0.15s;
}

.inline-mic-btn:hover {
  color: var(--accent);
}

.inline-mic-btn.recording {
  color: var(--accent);
  animation: pulse 1.2s ease-in-out infinite;
}

.inline-mic-btn svg {
  width: 18px;
  height: 18px;
}

.derived-tags {
  display: none;
}

.derived-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border: 0;
  border-radius: 999px;
  background: #eee9de;
  color: #5c5b56;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
}

.card-info-section {
  display: grid;
  gap: 12px;
  border-radius: 26px;
  background: #f7f8f7;
  padding: 14px;
}

.section-heading {
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
}

.section-action {
  justify-self: start;
}

.section-actions {
  display: flex;
  gap: 8px;
}

.section-actions > * {
  flex: 1;
}

.voice-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-radius: 24px;
  background: var(--accent-weak);
}

.voice-card strong,
.voice-card span {
  display: block;
}

.voice-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.voice-button {
  width: 54px;
  height: 54px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: #ffffff;
}

.voice-button.recording {
  background: var(--accent);
  color: var(--ink);
  animation: pulse-recording 1.1s ease-in-out infinite;
}

.voice-transcript {
  margin-top: -4px;
}

.autofill-button {
  justify-self: start;
}

.voice-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.voice-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.voice-button-sm {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  background: var(--surface-card);
  border: 1px solid var(--line);
  color: var(--accent);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.voice-button-sm svg {
  width: 18px;
  height: 18px;
}

.voice-button-sm.recording {
  background: var(--accent);
  color: var(--ink);
}

.voice-hint {
  font-size: 13px;
  color: var(--muted);
}

.voice-transcript-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  resize: none;
  background: var(--surface-input);
  color: var(--ink);
}

.card-info-section-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: -4px;
}

.details-voice-toggle {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: 8px;
  gap: 5px;
  color: var(--muted);
}

.details-voice-toggle.active {
  color: var(--accent);
  border-color: var(--accent-mid);
}

@keyframes pulse-recording {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(101, 214, 198, 0.45);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(101, 214, 198, 0);
  }
}

@keyframes material-enter {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.toolbar,
.inline-card-capture,
.daily-summary,
.attention-strip > .card,
.column-body > .card,
.list-view > .card,
.feature-hero,
.module-actions,
.feature-stat,
.feature-panel,
.finance-hero,
.upcoming-expenses,
.calendar-shell,
.calendar-agenda,
.slack-sidebar,
.chat-panel,
.message-card,
.agenda-card,
.week-day,
.calendar-day:not(.blank),
.shopping-row,
.budget-row,
.settings-toggle-row,
.settings-select-row,
.settings-connection-row {
  animation-name: material-enter;
  animation-duration: 480ms;
  animation-timing-function: cubic-bezier(0.2, 0, 0, 1);
  animation-fill-mode: both;
}

.toolbar {
  animation-duration: 420ms;
}

.inline-card-capture {
  animation-delay: 70ms;
}

.daily-summary {
  animation-delay: 120ms;
}

.feature-hero,
.finance-hero,
.calendar-shell,
.slack-sidebar {
  animation-delay: 80ms;
}

.module-actions,
.upcoming-expenses,
.calendar-agenda,
.chat-panel {
  animation-delay: 130ms;
}

.feature-stat:nth-child(1),
.feature-panel:nth-child(1),
.message-card:nth-child(1),
.agenda-card:nth-child(1),
.shopping-row:nth-child(1),
.budget-row:nth-child(1),
.settings-toggle-row:nth-child(1),
.settings-select-row:nth-child(1),
.settings-connection-row:nth-child(1) {
  animation-delay: 170ms;
}

.feature-stat:nth-child(2),
.feature-panel:nth-child(2),
.message-card:nth-child(2),
.agenda-card:nth-child(2),
.shopping-row:nth-child(2),
.budget-row:nth-child(2),
.settings-toggle-row:nth-child(2),
.settings-select-row:nth-child(2),
.settings-connection-row:nth-child(2) {
  animation-delay: 220ms;
}

.feature-stat:nth-child(3),
.feature-panel:nth-child(3),
.message-card:nth-child(3),
.agenda-card:nth-child(3),
.shopping-row:nth-child(3),
.budget-row:nth-child(3),
.settings-toggle-row:nth-child(3),
.settings-select-row:nth-child(3),
.settings-connection-row:nth-child(3) {
  animation-delay: 270ms;
}

.feature-stat:nth-child(n + 4),
.feature-panel:nth-child(n + 4),
.message-card:nth-child(n + 4),
.agenda-card:nth-child(n + 4),
.shopping-row:nth-child(n + 4),
.budget-row:nth-child(n + 4),
.settings-toggle-row:nth-child(n + 4),
.settings-select-row:nth-child(n + 4),
.settings-connection-row:nth-child(n + 4) {
  animation-delay: 320ms;
}

.attention-strip > .card:nth-child(1),
.column-body > .card:nth-child(1),
.list-view > .card:nth-child(1) {
  animation-delay: 150ms;
}

.attention-strip > .card:nth-child(2),
.column-body > .card:nth-child(2),
.list-view > .card:nth-child(2) {
  animation-delay: 200ms;
}

.attention-strip > .card:nth-child(3),
.column-body > .card:nth-child(3),
.list-view > .card:nth-child(3) {
  animation-delay: 250ms;
}

.column-body > .card:nth-child(n + 4),
.list-view > .card:nth-child(n + 4) {
  animation-delay: 300ms;
}

@media (prefers-reduced-motion: reduce) {
  .toolbar,
  .inline-card-capture,
  .daily-summary,
  .attention-strip > .card,
  .column-body > .card,
  .list-view > .card,
  .feature-hero,
  .module-actions,
  .feature-stat,
  .feature-panel,
  .finance-hero,
  .upcoming-expenses,
  .calendar-shell,
  .calendar-agenda,
  .slack-sidebar,
  .chat-panel,
  .message-card,
  .agenda-card,
  .week-day,
  .calendar-day:not(.blank),
  .shopping-row,
  .budget-row,
  .settings-toggle-row,
  .settings-select-row,
  .settings-connection-row {
    animation: none;
  }
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  color: var(--ink);
  background: var(--paper);
  outline: 0;
}

input:disabled,
select:disabled,
textarea:disabled {
  border-color: transparent;
  background: transparent;
  color: var(--ink);
  opacity: 1;
  padding-left: 0;
  padding-right: 0;
}

button:disabled {
  opacity: 0.45;
  cursor: default;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-weak);
}

.comment-panel {
  display: grid;
  gap: 12px;
}

.comment-list {
  display: grid;
  gap: 8px;
  max-height: 170px;
  overflow: auto;
}

.comment {
  border-radius: 20px;
  background: var(--paper);
  padding: 11px 12px;
  font-size: 13px;
}

.comment strong {
  display: block;
  margin-bottom: 3px;
}

.comment-tags,
.message-auto-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.activity-list {
  display: grid;
  gap: 7px;
}

.activity-row {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
  color: var(--muted);
  font-size: 12px;
}

.activity-row strong {
  color: var(--ink);
  font-size: 12px;
  white-space: nowrap;
}

.activity-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.toast {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  max-width: min(400px, calc(100vw - 40px));
  width: max-content;
  border-radius: 24px;
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  font-weight: 700;
  padding: 12px 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 9999;
}

[data-theme="dark"] .toast {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

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

@media (min-width: 1081px) {
  .phone-tabbar {
    display: none;
  }
  .sidebar {
    display: flex;
  }
  .app-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .attention-strip,
  .board-view,
  .feature-stat-grid,
  .signal-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .feature-hero,
  .feature-layout,
  .upcoming-expense-list {
    grid-template-columns: 1fr;
  }

  .settings-layout {
    columns: 1;
  }

  .feature-actions {
    justify-content: flex-start;
    max-width: none;
  }

  .list-row {
    grid-template-columns: 1fr 1fr;
  }

  .list-view {
    padding: 0 20px 32px;
  }
}

/* Tabbar visible at all widths below sidebar breakpoint */
@media (max-width: 1080px) {
  .phone-tabbar {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 30;
    min-height: 52px;
    display: grid;
    grid-template-columns: repeat(5, minmax(48px, 1fr)) 54px;
    overflow-x: auto;
    scrollbar-width: none;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 18px 42px rgba(36, 49, 67, 0.18);
    backdrop-filter: blur(16px);
  }
  .phone-tabbar::-webkit-scrollbar { display: none; }
  /* Add bottom padding so content isn't hidden under the tabbar */
  .workspace, .feature-module {
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 760px) {
  body {
    background: var(--paper);
    overscroll-behavior-y: none;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: calc(12px + env(safe-area-inset-top)) 12px 10px;
    gap: 10px;
    box-shadow: 0 8px 24px rgba(17, 24, 39, 0.06);
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .brand-subtitle,
  .score-label {
    font-size: 12px;
  }

  .topic-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .module-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .topic-list::-webkit-scrollbar,
  .module-list::-webkit-scrollbar {
    display: none;
  }

  .topic,
  .module-link {
    min-width: max-content;
    border: 1px solid var(--line);
    background: var(--paper);
  }

  .topic {
    min-height: 38px;
    grid-template-columns: 8px auto auto;
    padding: 8px 10px;
  }

  .module-block {
    gap: 7px;
  }

  .module-link {
    min-height: 36px;
    padding: 8px 11px;
  }

  .launch-score {
    display: none;
  }

  .topbar,
  .toolbar,
  .dialog-header,
  .dialog-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar,
  .attention-strip,
  .workspace {
    padding-left: 14px;
    padding-right: 14px;
  }

  .topbar {
    min-height: auto;
    gap: 14px;
    padding-top: 18px;
    padding-bottom: 14px;
  }

  .topbar::after {
    right: 18px;
    top: 14px;
    width: 54px;
    height: 54px;
  }

  h1 {
    font-size: 26px;
    line-height: 1.08;
    max-width: 320px;
  }

  .attention-strip {
    gap: 10px;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .topbar-actions {
    width: 100%;
  }

  .topbar-actions .primary-button {
    flex: 1;
  }

  .attention-strip,
  .board-view,
  .dialog-lower-grid,
  .form-grid,
  .feature-stat-grid,
  .signal-grid,
  .upcoming-expense-list,
  .finance-grid,
  .budget-form {
    grid-template-columns: 1fr;
  }

  .board-view {
    gap: 12px;
  }

  .column,
  .card,
  .list-row,
  .feature-hero,
  .feature-stat,
  .feature-panel,
  .feature-item,
  .integration-row,
  .timeline div,
  .toggle-row {
    border-radius: 12px;
  }

  .column-header {
    min-height: 42px;
  }

  .column-body {
    min-height: 0;
  }

  .card {
    padding: 14px;
  }

  .card-top {
    display: flex;
    gap: 10px;
  }

  .pill {
    width: fit-content;
  }

  .card-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .list-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .feature-module {
    padding: 14px 14px calc(24px + env(safe-area-inset-bottom));
  }

  .feature-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .feature-actions .secondary-button {
    width: 100%;
  }

  .week-strip {
    grid-template-columns: repeat(7, 78px);
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .week-strip::-webkit-scrollbar {
    display: none;
  }

  .day-slot {
    grid-template-columns: 46px minmax(0, 1fr);
  }

  .segmented,
  .search-wrap,
  .top-mini-stats {
    width: 100%;
  }

  .mini-stat {
    flex: 1;
    min-width: 0;
  }

  .settings-mini-stat {
    max-width: 48px;
  }

  .segmented-button {
    flex: 1;
  }

  .card-dialog {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .dialog-content {
    min-height: 100dvh;
    padding: calc(16px + env(safe-area-inset-top)) 14px calc(20px + env(safe-area-inset-bottom));
    align-content: start;
  }

  .dialog-thread-column {
    gap: 12px;
  }

  .dialog-actions > div {
    display: grid;
    gap: 8px;
    width: 100%;
  }

  .dialog-actions .ghost-button,
  .dialog-actions .secondary-button,
  .dialog-actions .primary-button {
    width: 100%;
  }

  input,
  select,
  textarea,
  .primary-button,
  .secondary-button,
  .ghost-button,
  .icon-button,
  .segmented-button {
    min-height: 44px;
  }

  .toast {
    max-width: calc(100vw - 28px);
  }
}

.sidebar,
.launch-score,
.topbar,
.ghost-button,
.icon-button,
.attention-strip,
.search-wrap,
.column,
.column-header,
.card,
.pill,
.list-row,
.signal-card,
.feature-hero,
.feature-stat,
.feature-panel,
.feature-item,
.integration-row,
.timeline div,
.toggle-row,
.topic,
.module-link,
input,
select,
textarea {
  border: 0;
}

.topbar-title {
  display: none;
}

.topbar {
  min-height: auto;
  padding-top: 0;
  padding-bottom: 0;
}

.topbar-actions {
  margin-left: 0;
}

.attention-card {
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
}

/* Reference-inspired mobile app skin */
:root {
  --ink: #1e1d22;
  --muted: #78747e;
  --soft: #edf5ef;
  --paper: #ffffff;
  --line: rgba(30, 29, 34, 0.08);
  --nav: #eef5ef;
  --nav-muted: rgba(30, 29, 34, 0.66);
  --accent: #65d6c6;
  --accent-weak: #dff8f3;
  --accent-mid: #aeece3;
  --sage: #eaf3e8;
  --peach: #f6d3b5;
  --shadow: 0 28px 70px rgba(31, 41, 35, 0.08);
}

body {
  background: var(--surface-page);
}

.app-shell {
  background: var(--nav);
}

.sidebar {
  background: transparent;
  padding: 28px 20px;
}

.brand-mark,
.icon-button {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 12px 28px rgba(31, 41, 35, 0.1);
}

.brand-mark {
  width: 48px;
  height: 48px;
}

.brand-name {
  font-size: 22px;
  letter-spacing: 0;
}

.topic,
.module-link {
  border-radius: 999px;
  font-weight: 500;
}

.topic.active,
.module-link.active {
  background: var(--ink);
  color: #ffffff;
  box-shadow: 0 12px 22px rgba(30, 29, 34, 0.16);
}

.topic.active strong {
  color: rgba(255, 255, 255, 0.72);
}

.launch-score {
  background: rgba(255, 255, 255, 0.34);
  border-radius: 28px;
  backdrop-filter: blur(14px);
}

.main-panel {
  background: var(--surface-page);
  border-radius: 0 0 0 36px;
  overflow: hidden;
}

.topbar,
.attention-strip {
  background: var(--surface-page);
}

.topbar {
  padding: 0 20px;
}

.primary-button {
  border-radius: 999px;
  background: var(--accent);
  color: var(--ink);
  box-shadow: 0 14px 28px rgba(101, 214, 198, 0.28);
}

.secondary-button,
.segmented-button.active {
  border-radius: 999px;
}

.segmented {
  background: rgba(101, 214, 198, 0.18);
  border-radius: 999px;
}

.segmented-button {
  border-radius: 999px;
  color: var(--ink);
}

.segmented-button.active {
  background: var(--ink);
  color: #ffffff;
}

.attention-strip {
  gap: 16px;
}

.attention-card {
  border: 0;
  border-left: 0;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow);
  padding: 18px;
}

.attention-card:first-child {
  background: var(--paper);
}

.attention-card:nth-child(2) {
  background: var(--paper);
}

.attention-card:nth-child(3) {
  background: var(--paper);
}

.workspace {
  padding: 16px 20px calc(32px + env(safe-area-inset-bottom));
}

.search-wrap {
  min-height: 48px;
  border-radius: 999px;
  background: #f4f4f4;
}

.column {
  background: transparent;
}

.column-header {
  background: transparent;
  padding: 10px 4px 12px;
  font-size: 21px;
}

.column-header span {
  border-radius: 999px;
  background: var(--accent-weak);
  color: var(--ink);
}

.column-body {
  padding: 0;
}

.inline-card-capture {
  width: calc(100% - 32px);
  max-width: 600px;
  margin: 0 auto;
  border-radius: 999px;
  background: var(--surface-card);
  border: 1px solid var(--line);
  padding: 6px 6px 6px 16px;
  gap: 4px;
}

.card,
.list-row,
.signal-card,
.feature-hero,
.feature-stat,
.feature-panel {
  border-radius: 30px;
  background: var(--paper);
  box-shadow: 0 30px 76px rgba(31, 41, 35, 0.075);
}

.card {
  padding: 20px;
  gap: 14px;
}

.unified-card {
  position: relative;
  border: 0;
  border-radius: 24px;
  background: var(--paper);
  box-shadow: 0 26px 68px rgba(31, 41, 35, 0.08);
}

.card-tags {
  margin-top: -2px;
}

.card-tag {
  border: 0;
  cursor: pointer;
  color: var(--ink);
}

.card-tag:hover,
.derived-tag:hover {
  opacity: 1;
}

.card-money-tag {
  background: var(--accent) !important;
  color: var(--ink) !important;
}

.needs-response-tag {
  /* legacy class - handled by card-status-label now */
}

.calendar-card,
.expense-preview-card,
.message-linked-card,
.inline-card-preview {
  width: 100%;
}

.calendar-card .quick-actions,
.message-linked-card .quick-actions,
.inline-card-preview .quick-actions {
  margin-top: 2px;
}

.expense-preview-card {
  box-shadow: 0 22px 58px rgba(31, 41, 35, 0.06);
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
}

.expense-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.expense-card-title {
  font-size: 14px;
  font-weight: 700;
  display: block;
}

.expense-card-detail {
  font-size: 12px;
  color: var(--muted);
  display: block;
  margin-top: 2px;
}

.expense-card-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.expense-amount {
  font-size: 14px;
  font-weight: 700;
}

.expense-status-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--surface-2, rgba(0,0,0,0.06));
  color: var(--muted);
}

.expense-status-badge.expense-status-paid { background: #d1fae5; color: #065f46; }
.expense-status-badge.expense-status-disputed { background: #fee2e2; color: #991b1b; }
.expense-status-badge.expense-status-important { background: #fef3c7; color: #92400e; }
.expense-status-badge.expense-status-waiting { background: #e0f2fe; color: #0369a1; }

html[data-theme="dark"] .expense-status-badge.expense-status-paid { background: #064e3b; color: #6ee7b7; }
html[data-theme="dark"] .expense-status-badge.expense-status-disputed { background: #7f1d1d; color: #fca5a5; }

.expense-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.expense-action-btn {
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 99px;
  border: 1.5px solid var(--border);
  background: transparent;
  cursor: pointer;
  color: var(--ink);
  transition: background 0.15s, color 0.15s;
}

.expense-action-btn.approve:hover { background: #d1fae5; border-color: #6ee7b7; color: #065f46; }
.expense-action-btn.dispute:hover { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.expense-action-btn.paid:hover { background: var(--teal, #65d6c6); border-color: var(--teal, #65d6c6); color: white; }

.message-card .unified-card,
.thread-context-card .unified-card {
  box-shadow: 0 16px 42px rgba(31, 41, 35, 0.07);
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.quick-complete,
.quick-response {
  min-height: 38px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  padding: 0 8px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quick-complete {
  background: #171918;
  color: #ffffff;
  border: 1px solid #171918;
}

.quick-complete:hover:not(:disabled) {
  background: #2a2a2a;
  border-color: #2a2a2a;
}

.quick-complete:disabled {
  background: var(--soft);
  color: var(--muted);
  border: 1px solid rgba(23, 25, 24, 0.14);
}

.quick-response {
  background: #ffffff;
  color: #171918;
  border: 1px solid rgba(23, 25, 24, 0.14);
}

.quick-response:hover:not(:disabled) {
  background: var(--soft);
}

/* Footer: Reminder + Message */
.card-footer-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.card-footer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  border: 0;
  background: #ffffff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  border-radius: 6px;
}

.card-footer-btn:hover {
  color: var(--ink);
}

.card-footer-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.quick-message {
  background: var(--paper);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding-top: 7px;
  padding-bottom: 4px;
}

.quick-message svg {
  width: 14px;
  height: 14px;
}

.quick-complete:disabled,
.quick-response:disabled,
.quick-message:disabled {
  background: #eeeeef;
  color: var(--muted);
  box-shadow: none;
  cursor: default;
}

.done-card {
  opacity: 0.6;
  box-shadow: none;
}

.done-card .card-title,
.done-card .card-details,
.done-card .card-state-row,
.done-card .card-meta {
  color: var(--muted);
}

.card-title {
  font-size: 22px;
  line-height: 1.12;
}

.card-people {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 0;
  border-radius: 999px;
  background: transparent;
  flex: 0 0 auto;
}

.card-title-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.mini-avatar {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.08);
}

.mini-avatar[data-person-name]::after {
  content: attr(data-person-name);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 30;
  transform: translate(-50%, 4px);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  border-radius: 999px;
  padding: 6px 9px;
  background: rgba(30, 29, 34, 0.92);
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 12px 28px rgba(31, 47, 42, 0.18);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.mini-avatar[data-person-name]:hover::after,
.mini-avatar[data-person-name]:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.dialog-card-meta .mini-avatar {
  width: 64px;
  height: 64px;
  font-size: 28px;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.08);
}

.parent-a-mini {
  background: #1e1d22;
}

.parent-b-mini {
  background: #d99c22;
}

.both-mini {
  background: linear-gradient(135deg, #1e1d22 0 50%, #d99c22 50% 100%);
}

.child-assignee-mini,
.child-mini {
  background: #78c7be;
}

.pet-mini {
  background: #c9c7b7;
  color: var(--ink);
}

.mini-join {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.pill,
.meta-chip {
  border-radius: 999px;
}

.pill {
  min-height: 24px;
  padding: 0 9px;
  background: #f3f3f4;
  border: 0;
  color: var(--ink);
  font-size: 10px;
}

.pill.Important,
.pill.Waiting {
  background: var(--ink);
  color: #ffffff;
}

.meta-chip {
  background: #f4f4f4;
  padding: 5px 8px;
  font-size: 10px;
}

.card-details {
  font-size: 15px;
}

.card-state-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.card-state-row span {
  border-radius: 999px;
  background: #f4f4f4;
  padding: 6px 10px;
}

.feature-item,
.integration-row,
.timeline div,
.toggle-row,
.shopping-row,
.budget-row,
.comment,
input,
select,
textarea {
  border-radius: 20px;
}

.phone-tabbar {
  display: none;
}

.calendar-shell,
.calendar-agenda {
  border-radius: 30px;
  background: var(--paper);
  box-shadow: 0 30px 76px rgba(31, 41, 35, 0.075);
  padding: 20px;
}

.calendar-shell {
  display: grid;
  gap: 14px;
}

.calendar-privacy-note {
  display: grid;
  gap: 3px;
  border-radius: 18px;
  background: rgba(101, 214, 198, 0.16);
  padding: 12px 14px;
}

.calendar-privacy-note strong {
  font-size: 13px;
}

.calendar-privacy-note span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
}

.calendar-topline,
.agenda-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.calendar-topline > div {
  display: grid;
  justify-items: center;
  gap: 2px;
}

.calendar-kicker {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.round-nav {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: #f4f4f4;
  color: var(--ink);
  font-size: 24px;
}

.calendar-view-switcher {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 5px;
  border-radius: 999px;
  background: #f4f4f4;
}

.calendar-view-switcher button {
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.calendar-view-switcher button.active {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(31, 41, 35, 0.08);
}

.calendar-body {
  display: grid;
  gap: 12px;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.calendar-weekdays span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.calendar-day {
  min-height: 48px;
  border: 0;
  border-radius: 18px;
  background: #f5f6f2;
  color: var(--ink);
  display: grid;
  place-items: center;
  gap: 3px;
  padding: 5px;
}

.calendar-day.blank {
  background: transparent;
}

.calendar-day.selected {
  background: var(--ink);
  color: #ffffff;
}

.calendar-day:active,
.week-day:active {
  transform: scale(0.98);
}

.calendar-day span {
  min-height: 6px;
  display: flex;
  gap: 3px;
}

.calendar-day i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: block;
}

.calendar-day i.event {
  background: #65d6c6;
}

.calendar-day i.payment {
  background: #f59e0b;
}

.calendar-day i.request {
  background: #ef6461;
}

.calendar-day i.busy {
  background: #76808a;
}

.calendar-agenda {
  display: grid;
  gap: 12px;
}

.agenda-list {
  display: grid;
  gap: 12px;
}

.agenda-empty {
  border-radius: 24px;
  background: #f5f6f2;
  color: var(--muted);
  padding: 16px;
  font-size: 13px;
  font-weight: 800;
}

.calendar-busy-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 3px 10px;
  border-radius: 22px;
  background: #eef0ef;
  padding: 13px 14px;
}

.calendar-busy-card span {
  grid-row: span 2;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.calendar-busy-card strong {
  font-size: 14px;
}

.calendar-busy-card em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
}

.calendar-busy-card.busy-parent-a {
  background: #1e1d22;
  color: #fff;
}

.calendar-busy-card.busy-parent-a span,
.calendar-busy-card.busy-parent-a strong {
  color: rgba(255, 255, 255, 0.9);
}

.calendar-busy-card.busy-parent-b {
  background: #d99c22;
  color: #fff;
}

.calendar-busy-card.busy-parent-b span,
.calendar-busy-card.busy-parent-b strong {
  color: rgba(255, 255, 255, 0.95);
}

.agenda-heading span,
.agenda-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.agenda-heading strong {
  display: block;
  font-size: 22px;
}

.agenda-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  border: 0;
  border-radius: 24px;
  padding: 14px;
  background: #f5f6f2;
  color: var(--ink);
  text-align: left;
}

.agenda-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.agenda-badge {
  border-radius: 999px;
  background: var(--paper);
  padding: 7px 10px;
  color: var(--ink) !important;
}

.agenda-card.event {
  background: #e5f8f4;
}

.agenda-card.payment {
  background: #fff3d7;
}

.agenda-card.request {
  background: #ffe5e4;
}

.week-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.week-day {
  min-height: 92px;
  border: 0;
  border-radius: 22px;
  background: #f5f6f2;
  color: var(--ink);
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 4px;
  padding: 10px 6px;
}

.week-day span,
.week-day em,
.day-heading span,
.day-slot > span {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.week-day strong {
  font-size: 22px;
}

.week-day em {
  font-size: 10px;
  text-align: center;
}

.week-day.selected {
  background: var(--ink);
  color: #ffffff;
}

.week-day.selected span,
.week-day.selected em {
  color: rgba(255, 255, 255, 0.76);
}

.day-heading {
  display: grid;
  gap: 3px;
  border-radius: 24px;
  background: #f5f6f2;
  padding: 14px;
}

.day-heading strong {
  font-size: 24px;
}

.day-schedule {
  display: grid;
  gap: 10px;
}

.day-slot {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.day-slot > div {
  display: grid;
  gap: 8px;
}

.day-slot em {
  display: block;
  border-radius: 20px;
  background: #f5f6f2;
  color: var(--muted);
  padding: 12px;
  font-size: 13px;
  font-style: normal;
  font-weight: 800;
}

.slack-shell {
  display: grid;
  grid-template-columns: minmax(160px, 0.34fr) minmax(0, 1fr);
  gap: 14px;
  min-height: min(660px, calc(100dvh - 170px));
}

.slack-sidebar,
.chat-panel {
  border-radius: 30px;
  background: var(--paper);
  box-shadow: 0 30px 76px rgba(31, 41, 35, 0.075);
}

.slack-sidebar {
  padding: 16px;
  display: flex;
  flex-wrap: wrap;
  align-content: start;
  gap: 8px;
}

.slack-channel {
  min-height: 32px;
  border: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  background: #eee9de;
  color: #7d7c77;
  font-size: 11px;
  font-weight: 700;
  opacity: 0.8;
  letter-spacing: 0;
}

.slack-channel.active {
  background: #eee9de;
  color: #7d7c77;
  opacity: 1;
}

.slack-channel strong {
  min-width: 0;
  height: auto;
  border-radius: 0;
  display: inline;
  background: transparent;
  color: inherit;
  font-size: 11px;
}

.slack-channel strong:empty {
  display: none;
}

.chat-panel {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.chat-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  background: var(--paper);
}

.thread-mode {
  display: flex;
  gap: 8px;
  padding: 0 18px 10px;
}

.thread-mode button {
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  background: #f4f4f4;
  color: var(--ink);
  padding: 0 12px;
  font-size: 12px;
  font-weight: 800;
}

.thread-mode button.active {
  background: var(--ink);
  color: #ffffff;
}

.chat-header span {
  width: fit-content;
  min-height: 19px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #eee9de;
  color: #7d7c77;
  padding: 0 7px;
  font-size: 8px;
  font-weight: 700;
  opacity: 0.8;
}

.chat-header strong {
  font-size: 22px;
}

.message-list {
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 6px 18px 18px;
}

.thread-context-card {
  display: grid;
  gap: 8px;
  border-radius: 24px;
  background: transparent;
  padding: 0;
  box-shadow: none;
}

.thread-context-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.thread-context-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.message-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px;
  border-radius: 24px;
  background: #f5f6f2;
}

.message-card.own-message {
  background: var(--accent-weak);
}

.message-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

.message-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.message-meta span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.message-card p {
  margin: 0;
  color: var(--ink);
  line-height: 1.42;
}

.message-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.message-reactions button,
.composer-icon,
.composer-send {
  border: 0;
  border-radius: 999px;
  min-height: 32px;
  padding: 0 11px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 800;
}

.inline-card-preview {
  display: grid;
  gap: 10px;
  border-radius: 24px;
  background: var(--paper);
  padding: 14px;
}

.inline-card-preview span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.message-composer {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 8px;
  padding: 14px;
  background: var(--paper);
}

.message-composer input {
  min-height: 44px;
  border-radius: 999px;
  background: #f4f4f4;
}

.composer-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  background: var(--ink);
  color: #ffffff;
  font-size: 22px;
}

.composer-icon svg,
.message-mic-button svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.composer-mic,
.message-mic-button {
  background: var(--ink);
  color: #ffffff;
}

.composer-mic.recording,
.message-mic-button.recording {
  background: var(--accent);
  color: var(--ink);
  animation: pulse-recording 1.1s ease-in-out infinite;
}

.message-input-wrap {
  position: relative;
}

.message-input-wrap textarea {
  padding-right: 54px;
}

.message-mic-button {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
}

.composer-send {
  background: var(--accent);
}

@media (max-width: 760px) {
  .slack-shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .slack-sidebar {
    display: flex;
    overflow-x: auto;
    border-radius: 24px;
    padding: 10px;
    scrollbar-width: none;
  }

  .slack-sidebar::-webkit-scrollbar {
    display: none;
  }

  .slack-channel {
    min-width: max-content;
  }

  .chat-panel {
    min-height: calc(100dvh - 270px);
    border-radius: 28px;
  }

  .chat-header {
    min-height: 64px;
    padding: 14px;
  }

  .chat-header strong {
    font-size: 19px;
  }

  .message-list {
    padding: 4px 12px 12px;
  }

  .message-composer {
    padding: 10px;
  }
}

@media (min-width: 761px) {
  .app-shell {
    min-height: 100dvh;
    margin-top: 0;
    margin-bottom: 0;
    border-radius: 0;
    overflow: visible;
    box-shadow: none;
  }
}

@media (max-width: 760px) {
  body {
    background: var(--nav);
  }

  .app-shell {
    max-width: none;
    background: var(--nav);
  }

  .sidebar {
    background: transparent;
    box-shadow: none;
    padding: calc(16px + env(safe-area-inset-top)) 18px 8px;
  }

  .brand-name {
    font-size: 24px;
  }

  .topic-list,
  .module-list {
    margin-left: -18px;
    margin-right: -18px;
    padding-left: 18px;
    padding-right: 18px;
  }

  .topic,
  .module-link {
    background: rgba(255, 255, 255, 0.58);
    min-height: 46px;
    padding: 0 16px;
  }

  .main-panel {
    border-radius: 0;
    padding-bottom: calc(86px + env(safe-area-inset-bottom));
  }

  .topbar {
    padding: 0 10px;
  }

  .topbar-actions {
    display: none;
  }


  .attention-strip,
  .workspace,
  .feature-module {
    padding-left: 10px;
    padding-right: 10px;
  }

  .attention-card,
  .card,
  .signal-card,
  .feature-hero,
  .feature-stat,
  .feature-panel {
    border-radius: 28px;
  }

  .board-view {
    display: block;
  }

  .column {
    margin-bottom: 20px;
  }

  .column-header {
    font-size: 20px;
  }

  .column-body {
    gap: 14px;
  }

  .toolbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
  }

  .toolbar {
    position: sticky;
    top: 0;
    z-index: 18;
    margin: 0;
    padding: 8px 10px;
    border-radius: 0;
    background: var(--paper);
    box-shadow: none;
  }

  .toolbar .search-wrap {
    width: auto;
  }

  .toolbar .top-mini-stats {
    grid-column: 1 / -1;
  }

  .app-logo-placeholder {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
  }

  .summary-tiles {
    padding: 0 10px 12px;
    gap: 10px;
  }

  .summary-tile {
    min-height: 92px;
    border-radius: 24px;
    padding: 15px;
  }

  .summary-tile strong {
    font-size: 34px;
  }

  .phone-tabbar {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 30;
    min-height: 56px;
    display: grid;
    grid-template-columns: repeat(5, minmax(56px, 1fr)) 58px;
    overflow-x: auto;
    scrollbar-width: none;
    align-items: center;
    gap: 4px;
    padding: 5px 8px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 18px 42px rgba(36, 49, 67, 0.18);
    backdrop-filter: blur(16px);
  }

  .phone-tabbar::-webkit-scrollbar {
    display: none;
  }

  .phone-tab,
.phone-fab {
    border: 0;
    background: transparent;
    color: var(--muted);
  }

  .phone-tab {
    display: grid;
    justify-items: center;
    gap: 1px;
    font-size: 10px;
    font-weight: 800;
  }

  .phone-tab svg {
    width: 18px;
    height: 18px;
  }

  .phone-tab.active {
    color: var(--accent);
  }

  .phone-fab {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    justify-self: center;
    background: var(--accent);
    color: var(--ink);
    box-shadow: 0 12px 28px rgba(101, 214, 198, 0.32);
    position: relative;
    user-select: none;
    -webkit-user-select: none;
  }

  .phone-fab svg {
    grid-area: 1 / 1;
    transition: opacity 0.18s ease, transform 0.18s ease;
  }

  .phone-fab .fab-mic-icon {
    opacity: 0;
    transform: scale(0.72);
  }

  .phone-fab.recording {
    background: var(--ink);
    color: var(--paper);
    transform: scale(1.04);
  }

  .phone-fab.recording .fab-plus-icon {
    opacity: 0;
    transform: scale(0.72);
  }

  .phone-fab.recording .fab-mic-icon {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 760px) {
  .sidebar {
    position: fixed;
    left: 12px;
    right: 12px;
    top: auto;
    bottom: calc(70px + env(safe-area-inset-bottom));
    z-index: 25;
    max-height: 52dvh;
    overflow: auto;
    padding: 14px;
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 18px 42px rgba(36, 49, 67, 0.18);
    backdrop-filter: blur(16px);
    transform: translateY(18px);
    opacity: 0;
    pointer-events: none;
    transition: 0.18s ease;
  }

  body.show-mobile-menu .sidebar {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .topic-list,
  .module-list {
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
  }

  .topic {
    grid-template-columns: auto auto;
  }

  .main-panel {
    min-height: 100dvh;
    padding-bottom: calc(82px + env(safe-area-inset-bottom));
  }

  .workspace,
  .feature-module {
    padding-bottom: calc(82px + env(safe-area-inset-bottom));
  }

  .phone-tabbar {
    left: 0;
    right: 0;
    bottom: 0;
    min-height: calc(58px + env(safe-area-inset-bottom));
    border-radius: 22px 22px 0 0;
    background: var(--paper);
    box-shadow: 0 -18px 42px rgba(36, 49, 67, 0.13);
    backdrop-filter: none;
    padding: 5px 10px calc(5px + env(safe-area-inset-bottom));
  }

  .card-dialog {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    height: auto;
    max-height: calc(100dvh - 24px);
    border-radius: 30px;
  }

  .dialog-content {
    min-height: 0;
    max-height: calc(100dvh - 24px);
    overflow: auto;
    border-radius: 30px;
    padding: 20px 16px calc(22px + env(safe-area-inset-bottom));
  }
}

.main-panel,
.topbar,
.attention-strip,
.workspace,
.feature-module {
  background: var(--nav);
}

.dialog-content .dialog-header {
  position: sticky;
  top: -24px;
  z-index: 6;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  background: var(--paper);
}

.dialog-content .dialog-header-actions {
  justify-self: end;
}

.reminder-content .dialog-header {
  top: -24px;
  padding-right: 24px;
}

.reminder-content .dialog-header-actions {
  justify-self: end;
}

.summary-tiles {
  display: none;
}

.mini-stat {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  flex: 0 0 auto;
  padding: 0 11px;
  text-align: left;
}

.mini-stat strong {
  color: #0ea58f;
  font-size: 12px;
}

.mini-stat:nth-child(3) strong {
  color: #d99c22;
}

@media (max-width: 760px) {
  .daily-summary {
    margin: 0 14px 12px;
    border-radius: 24px;
    padding: 12px 13px;
  }

  .dialog-content .dialog-header {
    top: -20px;
    margin: -20px -16px 0;
    padding: 28px 16px 12px;
    border-radius: 30px 30px 0 0;
  }

  .reminder-content .dialog-header {
    padding-right: 16px;
  }

  .phone-tabbar {
    grid-template-columns: repeat(5, minmax(56px, 1fr)) 58px;
  }
}

@media (min-width: 761px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    display: none;
  }

  .main-panel {
    padding-bottom: 96px;
  }

  .phone-tabbar {
    position: fixed;
    left: 50%;
    right: auto;
    bottom: 18px;
    z-index: 30;
    width: min(760px, calc(100% - 48px));
    min-height: 56px;
    display: grid;
    grid-template-columns: repeat(5, minmax(64px, 1fr)) 50px;
    align-items: center;
    gap: 4px;
    padding: 7px 10px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 18px 42px rgba(36, 49, 67, 0.18);
    backdrop-filter: blur(16px);
    transform: translateX(-50%);
  }

  .phone-tab,
  .phone-fab {
    border: 0;
    background: transparent;
    color: var(--muted);
  }

  .phone-tab {
    display: grid;
    justify-items: center;
    gap: 1px;
    min-width: 0;
    font-size: 10px;
    font-weight: 800;
  }

  .phone-tab svg {
    width: 18px;
    height: 18px;
  }

  .phone-tab.active {
    color: var(--accent);
  }

  .phone-fab {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    justify-self: center;
    background: var(--accent);
    color: var(--ink);
    box-shadow: 0 12px 28px rgba(101, 214, 198, 0.32);
    position: relative;
    user-select: none;
    -webkit-user-select: none;
  }

  .phone-fab svg {
    grid-area: 1 / 1;
    transition: opacity 0.18s ease, transform 0.18s ease;
  }

  .phone-fab .fab-mic-icon {
    opacity: 0;
    transform: scale(0.72);
  }

  .phone-fab.recording {
    background: var(--ink);
    color: var(--paper);
    transform: scale(1.04);
  }

  .phone-fab.recording .fab-plus-icon {
    opacity: 0;
    transform: scale(0.72);
  }

  .phone-fab.recording .fab-mic-icon {
    opacity: 1;
    transform: scale(1);
  }
}

@media (min-width: 761px) {
  .topbar {
    display: none;
  }

  .topbar-actions {
    margin-left: auto;
  }

  .topbar-actions .icon-button {
    width: 40px;
    min-height: 40px;
  }

  .topbar-actions .primary-button {
    min-height: 40px;
    padding: 0 14px;
  }

  .toolbar {
    width: 100%;
    margin: 0;
    grid-template-columns: 40px minmax(220px, 1fr) 40px auto;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 0;
    background: var(--paper);
    box-shadow: none;
  }

  .toolbar .app-logo-placeholder,
  .toolbar .settings-mini-stat {
    width: 40px;
    height: 40px;
    min-height: 40px;
    flex-basis: 40px;
  }

  .toolbar .search-wrap {
    min-height: 40px;
  }

  .toolbar-new-card {
    display: inline-flex;
  }

  .toolbar .top-mini-stats {
    grid-column: 1 / -1;
    gap: 6px;
  }

  .toolbar .mini-stat:not(.settings-mini-stat) {
    min-height: 34px;
    padding: 0 12px;
    box-shadow: none;
    background: var(--soft);
  }

  .daily-summary {
    align-items: stretch;
    width: min(calc(100% - 40px), 760px);
    margin: 0 auto 14px;
    padding: 12px;
  }

  .daily-summary-main {
    width: 100%;
    gap: 7px;
  }

  .daily-summary-main > strong {
    display: none;
  }

  .daily-summary-meta {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 0 8px 2px;
  }

  .daily-summary-list {
    display: grid;
    gap: 4px;
  }

  .daily-summary-row {
    width: 100%;
    min-height: 34px;
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr) 118px auto;
    align-items: center;
    gap: 10px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--ink);
    padding: 3px 4px 3px 10px;
    text-align: left;
  }

  .daily-summary-row:hover {
    background: #f5f5f2;
  }

  .daily-summary-row .daily-row-date {
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
    width: fit-content;
  }

  .daily-row-state {
    justify-self: start;
    white-space: nowrap;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    padding: 5px 8px;
    line-height: 1;
  }

  .daily-row-state.acknowledged {
    color: rgba(72, 71, 65, 0.62);
    background: rgba(232, 226, 213, 0.62);
  }

  .daily-summary-row strong {
    min-width: 0;
    font-size: 13px;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .daily-row-people {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    justify-self: end;
    min-width: 104px;
    gap: 5px;
  }

  .daily-row-people .mini-avatar {
    width: 26px;
    height: 26px;
    font-size: 10px;
  }

  .daily-row-people .mini-join {
    font-size: 10px;
    line-height: 1;
  }

  .daily-summary .summary-add-button {
    align-self: flex-start;
    width: 40px;
    height: 40px;
    flex-basis: 40px;
  }
}

/* Keep this final: it overrides light-only component rules declared above. */
html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f4f7f6;
  --muted: #aeb8b5;
  --soft: #1d2524;
  --paper: #202927;
  --line: rgba(236, 248, 245, 0.1);
  --nav: #1d2524;
  --nav-muted: rgba(236, 248, 245, 0.68);
  --accent: #65d6c6;
  --accent-weak: rgba(101, 214, 198, 0.18);
  --accent-mid: rgba(101, 214, 198, 0.42);
  --sage: #24322f;
  --peach: #48382f;
  --shadow: 0 28px 70px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] body,
html[data-theme="dark"] .app-shell,
html[data-theme="dark"] .main-panel,
html[data-theme="dark"] .board-view,
html[data-theme="dark"] .feature-module,
html[data-theme="dark"] .auth-screen,
html[data-theme="dark"] .onboarding-screen,
html[data-theme="dark"] .poc-gate {
  background: #171d1c;
}

html[data-theme="dark"] .toolbar,
html[data-theme="dark"] .topbar,
html[data-theme="dark"] .inline-capture,
html[data-theme="dark"] .daily-summary,
html[data-theme="dark"] .card,
html[data-theme="dark"] .feature-panel,
html[data-theme="dark"] .finance-hero,
html[data-theme="dark"] .upcoming-expenses,
html[data-theme="dark"] .expense-summary-panel,
html[data-theme="dark"] .calendar-shell,
html[data-theme="dark"] .calendar-agenda,
html[data-theme="dark"] .slack-shell,
html[data-theme="dark"] .chat-panel,
html[data-theme="dark"] .message-composer,
html[data-theme="dark"] .card-dialog,
html[data-theme="dark"] .dialog-content,
html[data-theme="dark"] .dialog-header,
html[data-theme="dark"] .auth-phone,
html[data-theme="dark"] .onboarding-phone,
html[data-theme="dark"] .onboarding-card,
html[data-theme="dark"] .poc-gate-card,
html[data-theme="dark"] .mini-stat,
html[data-theme="dark"] .feature-item {
  background: #202927;
  color: var(--ink);
}

html[data-theme="dark"] .search-wrap,
html[data-theme="dark"] .inline-capture-wrap,
html[data-theme="dark"] .expense-summary-row,
html[data-theme="dark"] .settings-toggle-row,
html[data-theme="dark"] .settings-select-row,
html[data-theme="dark"] .settings-connection-row,
html[data-theme="dark"] .calendar-day,
html[data-theme="dark"] .week-day,
html[data-theme="dark"] .calendar-busy-card,
html[data-theme="dark"] .agenda-empty,
html[data-theme="dark"] .comment,
html[data-theme="dark"] .card-info-section,
html[data-theme="dark"] .message-card,
html[data-theme="dark"] .form-field,
html[data-theme="dark"] textarea,
html[data-theme="dark"] input,
html[data-theme="dark"] select {
  background: #27312f;
  color: var(--ink);
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
  color: rgba(222, 234, 231, 0.48);
}

html[data-theme="dark"] .phone-tabbar,
html[data-theme="dark"] .desktop-nav {
  background: rgba(32, 41, 39, 0.96);
  border-color: var(--line);
}

html[data-theme="dark"] .calendar-view-switcher {
  background: #18201f;
}

html[data-theme="dark"] .calendar-view-switcher button.active {
  background: #31403d;
  color: var(--ink);
}

html[data-theme="dark"] .calendar-day.selected {
  background: var(--accent);
  color: #13201e;
}

html[data-theme="dark"] .derived-tag,
html[data-theme="dark"] .card-tag,
html[data-theme="dark"] .topic-pill {
  background: #35362f;
  color: #c5c2b6;
}

html[data-theme="dark"] dialog::backdrop {
  background: rgba(4, 8, 8, 0.68);
}

html[data-theme="dark"] .inline-capture-host,
html[data-theme="dark"] .column,
html[data-theme="dark"] .column-header,
html[data-theme="dark"] .unified-card {
  background: #202927;
}

html[data-theme="dark"] .card-details,
html[data-theme="dark"] .card-title,
html[data-theme="dark"] .card-state-row,
html[data-theme="dark"] .card-meta {
  color: var(--ink);
}

html[data-theme="dark"] .pill,
html[data-theme="dark"] .meta-chip,
html[data-theme="dark"] .card-state-row span,
html[data-theme="dark"] .quick-response,
html[data-theme="dark"] .quick-message,
html[data-theme="dark"] .card-sync {
  background: #303a38;
  color: var(--ink);
}

html[data-theme="dark"] .pill.Important,
html[data-theme="dark"] .pill.Waiting,
html[data-theme="dark"] .needs-response-tag {
  background: #111817 !important;
  color: #ffffff !important;
}

html[data-theme="dark"] .inline-card-capture textarea {
  background: #ffffff;
  color: #1e1d22;
}

html[data-theme="dark"] .inline-card-capture textarea::placeholder {
  color: rgba(30, 29, 34, 0.48);
}

html[data-theme="dark"] .inline-create-button {
  background: var(--accent);
  color: var(--ink);
  box-shadow: none;
}

html[data-theme="dark"] .slack-sidebar,
html[data-theme="dark"] .chat-header,
html[data-theme="dark"] .inline-card-preview {
  background: #202927;
  color: var(--ink);
}

html[data-theme="dark"] .slack-channel,
html[data-theme="dark"] .slack-channel.active,
html[data-theme="dark"] .chat-header span {
  background: #35362f;
  color: #c5c2b6;
}

html[data-theme="dark"] .thread-mode button,
html[data-theme="dark"] .message-reactions button {
  background: #303a38;
  color: var(--ink);
}

html[data-theme="dark"] .thread-mode button.active {
  background: #111817;
  color: #ffffff;
}

html[data-theme="dark"] .dialog-header-actions .icon-button,
html[data-theme="dark"] .dialog-content .voice-button,
html[data-theme="dark"] .dialog-content .message-mic-button {
  background: #17312d;
  color: #f4f7f6;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
}

html[data-theme="dark"] .column,
html[data-theme="dark"] .column-header {
  background: transparent;
}

html[data-theme="dark"] .calendar-connect-actions .secondary-button {
  background: #303a38;
  color: var(--ink);
}

html[data-theme="dark"] .calendar-connect-actions .secondary-button.connected {
  background: rgba(101, 214, 198, 0.18);
  color: var(--accent);
}

html[data-theme="dark"] .integration-row,
html[data-theme="dark"] .toggle-row,
html[data-theme="dark"] .shopping-row,
html[data-theme="dark"] .budget-row {
  background: #27312f;
  color: var(--ink);
}

input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  flex: 0 0 20px;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(30, 29, 34, 0.28);
  border-radius: 4px;
  background: var(--paper);
  display: inline-grid;
  place-content: center;
  cursor: pointer;
}

.settings-toggle-row input[type="checkbox"],
.shopping-row input[type="checkbox"],
.toggle-row input[type="checkbox"],
.onboarding-toggle input[type="checkbox"],
.connect-control input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  padding: 0;
}

input[type="checkbox"]::before {
  content: "";
  width: 9px;
  height: 5px;
  border-left: 2px solid #17312d;
  border-bottom: 2px solid #17312d;
  opacity: 0;
  transform: translateY(-1px) rotate(-45deg);
}

input[type="checkbox"]:checked {
  border-color: var(--accent);
  background: var(--accent);
}

input[type="checkbox"]:checked::before {
  opacity: 1;
}

input[type="checkbox"]:focus-visible {
  outline: 3px solid rgba(101, 214, 198, 0.34);
  outline-offset: 2px;
}

html[data-theme="dark"] input[type="checkbox"] {
  border-color: rgba(244, 247, 246, 0.34);
  background: #27312f;
}

html[data-theme="dark"] input[type="checkbox"]:checked {
  border-color: var(--accent);
  background: var(--accent);
}

html[data-theme="dark"] .calendar-privacy-note {
  border: 1px solid rgba(101, 214, 198, 0.12);
  background: rgba(101, 214, 198, 0.14);
}

html[data-theme="dark"] .round-nav {
  background: rgba(101, 214, 198, 0.12);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(101, 214, 198, 0.14);
}

html[data-theme="dark"] .calendar-view-switcher {
  background: rgba(8, 16, 15, 0.52);
}

html[data-theme="dark"] .calendar-view-switcher button {
  color: rgba(244, 247, 246, 0.66);
}

html[data-theme="dark"] .calendar-view-switcher button.active {
  background: rgba(101, 214, 198, 0.18);
  color: #f4f7f6;
  box-shadow: none;
}

html[data-theme="dark"] .day-heading,
html[data-theme="dark"] .day-slot em {
  background: rgba(244, 247, 246, 0.055);
  color: rgba(244, 247, 246, 0.72);
}

html[data-theme="dark"] .day-heading {
  border: 1px solid rgba(244, 247, 246, 0.06);
}

html[data-theme="dark"] .day-heading span,
html[data-theme="dark"] .day-slot > span {
  color: rgba(244, 247, 246, 0.62);
}

html[data-theme="dark"] .week-day,
html[data-theme="dark"] .calendar-busy-card,
html[data-theme="dark"] .agenda-empty {
  background: rgba(244, 247, 246, 0.055);
}

html[data-theme="dark"] .agenda-card {
  background: rgba(244, 247, 246, 0.07);
  color: var(--ink);
}

html[data-theme="dark"] .agenda-card.event {
  background: rgba(101, 214, 198, 0.14);
}

html[data-theme="dark"] .agenda-card.payment {
  background: rgba(217, 156, 34, 0.15);
}

html[data-theme="dark"] .agenda-card.request {
  background: rgba(239, 100, 97, 0.14);
}

html[data-theme="dark"] .agenda-badge {
  background: rgba(244, 247, 246, 0.1);
  color: var(--ink) !important;
}

.shopping-capture {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px 38px;
  gap: 7px;
  margin-top: 12px;
}

.shopping-capture input {
  min-width: 0;
  min-height: 40px;
  border: 0;
  border-radius: 999px;
  background: rgba(101, 214, 198, 0.12);
  padding: 0 14px;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
}

.shopping-mic,
.shopping-add {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.shopping-mic {
  background: var(--ink);
  color: #ffffff;
}

.shopping-mic svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.shopping-mic.recording {
  background: var(--accent);
  color: var(--ink);
  animation: pulse-recording 1.1s ease-in-out infinite;
}

.shopping-add {
  background: var(--accent);
  color: var(--ink);
  font-size: 23px;
  line-height: 1;
}

html[data-theme="dark"] .shopping-capture input {
  background: rgba(244, 247, 246, 0.075);
}

html[data-theme="dark"] .shopping-mic {
  background: rgba(101, 214, 198, 0.16);
  color: var(--accent);
}

html[data-theme="dark"] .shopping-mic.recording {
  background: var(--accent);
  color: #13201e;
}

.shopping-buyer-avatar {
  width: 24px;
  height: 24px;
  margin-left: auto;
  flex: 0 0 24px;
  font-size: 11px;
}

html[data-theme="dark"] .inline-mic-button,
html[data-theme="dark"] .voice-button,
html[data-theme="dark"] .composer-mic,
html[data-theme="dark"] .message-mic-button,
html[data-theme="dark"] .shopping-mic {
  background: rgba(101, 214, 198, 0.16);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(101, 214, 198, 0.16);
}

html[data-theme="dark"] .inline-mic-button:hover,
html[data-theme="dark"] .voice-button:hover,
html[data-theme="dark"] .composer-mic:hover,
html[data-theme="dark"] .message-mic-button:hover,
html[data-theme="dark"] .shopping-mic:hover {
  background: rgba(101, 214, 198, 0.24);
}

html[data-theme="dark"] .inline-mic-button.recording,
html[data-theme="dark"] .voice-button.recording,
html[data-theme="dark"] .composer-mic.recording,
html[data-theme="dark"] .message-mic-button.recording,
html[data-theme="dark"] .shopping-mic.recording,
html[data-theme="dark"] .phone-fab.recording {
  background: var(--accent);
  color: #13201e;
  box-shadow: 0 0 0 4px rgba(101, 214, 198, 0.22);
}

html[data-theme="dark"] .dialog-content .voice-button,
html[data-theme="dark"] .dialog-content .message-mic-button {
  background: rgba(101, 214, 198, 0.16);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(101, 214, 198, 0.16);
}

html[data-theme="dark"] .dialog-content .voice-button.recording,
html[data-theme="dark"] .dialog-content .message-mic-button.recording {
  background: var(--accent);
  color: #13201e;
  box-shadow: 0 0 0 4px rgba(101, 214, 198, 0.22);
}

/* Keep first-run surfaces calm and readable in dark mode. */
html[data-theme="dark"] .auth-screen,
html[data-theme="dark"] .onboarding-screen {
  background:
    radial-gradient(circle at 24% 10%, rgba(101, 214, 198, 0.16), transparent 34%),
    linear-gradient(145deg, #151d1b 0%, #111817 100%);
}

html[data-theme="dark"] .auth-phone,
html[data-theme="dark"] .onboarding-phone {
  background: rgba(32, 41, 39, 0.96);
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.38);
}

html[data-theme="dark"] .auth-steps span {
  background: rgba(244, 247, 246, 0.07);
  color: rgba(244, 247, 246, 0.62);
}

html[data-theme="dark"] .auth-steps span.active {
  background: var(--accent);
  color: #13201e;
}

html[data-theme="dark"] .auth-provider-button {
  background: #111817;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(244, 247, 246, 0.1);
}

html[data-theme="dark"] .auth-provider-button.apple {
  background: #111817;
  color: var(--ink);
}

html[data-theme="dark"] .auth-provider-mark {
  background: rgba(244, 247, 246, 0.94);
  color: #13201e;
}

html[data-theme="dark"] .auth-confirm {
  background: rgba(101, 214, 198, 0.1);
  box-shadow: inset 0 0 0 1px rgba(101, 214, 198, 0.14);
}

html[data-theme="dark"] .auth-confirm label,
html[data-theme="dark"] .auth-confirm-label {
  color: rgba(244, 247, 246, 0.7);
}

html[data-theme="dark"] .auth-confirm input {
  background: rgba(244, 247, 246, 0.09);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(244, 247, 246, 0.1);
}

html[data-theme="dark"] .auth-continue-button {
  background: var(--accent);
  color: #13201e;
}

html[data-theme="dark"] .auth-switch-button {
  color: var(--accent);
}

html[data-theme="dark"] .onboarding-card {
  background: rgba(244, 247, 246, 0.055);
  box-shadow: inset 0 0 0 1px rgba(244, 247, 246, 0.06);
}

html[data-theme="dark"] .onboarding-card input,
html[data-theme="dark"] .onboarding-card select {
  background: rgba(244, 247, 246, 0.08);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(244, 247, 246, 0.08);
}

html[data-theme="dark"] .onboarding-inline-button {
  background: rgba(101, 214, 198, 0.14);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(101, 214, 198, 0.14);
}

/* ─── Conflict detection ─────────────────────────────────────────────────── */

.conflict-banner {
  display: flex;
  gap: 10px;
  background: color-mix(in srgb, #f59e0b 12%, transparent);
  border: 1px solid color-mix(in srgb, #f59e0b 40%, transparent);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  font-size: 13px;
  line-height: 1.5;
}

.conflict-icon {
  font-size: 16px;
  flex-shrink: 0;
  padding-top: 1px;
}

.conflict-banner strong {
  font-weight: 600;
}

.conflict-reason {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.conflict-ai-suggestion {
  display: block;
  font-size: 12px;
  color: var(--ink);
  font-style: italic;
  margin-top: 4px;
  min-height: 0;
}

.conflict-ai-suggestion:empty {
  display: none;
}

.conflict-suggestions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.conflict-suggestions .ghost-button {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 6px;
}

.conflict-dot {
  display: inline-block;
  font-size: 9px;
  color: #f59e0b;
  vertical-align: middle;
  margin-left: 2px;
}

.conflict-dot-small {
  font-size: 11px;
  color: #f59e0b;
  margin-left: 4px;
}

.calendar-day.has-conflict .conflict-dot {
  color: #f59e0b;
}

.agenda-card.has-conflict {
  border-left: 3px solid #f59e0b;
}

.week-conflict-dot {
  font-size: 9px;
  color: #f59e0b;
  vertical-align: super;
}

/* ─── Recurring events ───────────────────────────────────────────────────── */

.recurring-icon {
  display: inline-block;
  font-size: 12px;
  color: var(--muted);
  margin-left: 4px;
  vertical-align: middle;
}

.calendar-day i.recurring::after {
  content: "↻";
  font-style: normal;
  font-size: 8px;
  position: absolute;
  top: -3px;
  right: -4px;
  color: var(--muted);
}

.calendar-day i.recurring {
  position: relative;
}

/* ─── Recurrence picker ──────────────────────────────────────────────────── */

.recurrence-days-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 4px 0;
}

.recurrence-days-row label {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}

.recurrence-days-row label input {
  width: auto;
  margin: 0;
}

/* ─── Recurrence scope dialog ────────────────────────────────────────────── */

.recurrence-scope-dialog {
  border-radius: 14px;
  border: none;
  padding: 20px 24px;
  max-width: 320px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  background: var(--surface);
  color: var(--ink);
}

.recurrence-scope-dialog p {
  font-size: 14px;
  margin-bottom: 16px;
  line-height: 1.5;
}

.recurrence-scope-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ─── Apple Calendar / CalDAV settings ───────────────────────────────────── */

.apple-calendar-section .feature-note {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
  line-height: 1.5;
}

.apple-calendar-section .feature-note a {
  color: var(--accent);
}

.apple-cal-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.apple-cal-form .clean-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

/* ─── Feature badge ──────────────────────────────────────────────────────── */

.feature-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
}

.badge-connected {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent);
}

.badge-pending {
  background: color-mix(in srgb, var(--muted) 15%, transparent);
  color: var(--muted);
}

.status-connected {
  color: var(--accent);
  font-weight: 600;
}

.status-pending {
  color: var(--muted);
}

.status-error {
  color: #dc2626;
  font-weight: 600;
}

/* ─── Co-parent calendar section ─────────────────────────────────────────── */

.coparent-calendar-section .feature-note {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 12px;
}

/* ─── Calendar day cell has-conflict ─────────────────────────────────────── */

.calendar-day.has-conflict > strong {
  color: #f59e0b;
}

html[data-theme="dark"] .conflict-banner {
  background: color-mix(in srgb, #f59e0b 10%, transparent);
  border-color: color-mix(in srgb, #f59e0b 30%, transparent);
}

.dialog-conflict-banner {
  margin: 0 0 12px;
  flex-direction: column;
  gap: 6px;
}

.dialog-conflict-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

/* ─── Notification permission prompt ─────────────────────────────────────── */

.notif-prompt {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%);
  width: min(360px, calc(100vw - 32px));
  background: var(--card-bg, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  z-index: 900;
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: notif-slide-up 0.3s ease;
}
.notif-prompt.hidden { display: none; }

@keyframes notif-slide-up {
  from { transform: translateX(-50%) translateY(16px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0);    opacity: 1; }
}

.notif-prompt-icon { font-size: 24px; margin-bottom: 4px; }

.notif-prompt-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text, #111);
  margin: 0;
}

.notif-prompt-body {
  font-size: 13px;
  color: var(--muted, #78747e);
  margin: 0 0 8px;
  line-height: 1.5;
}

.notif-prompt-actions {
  display: flex;
  gap: 8px;
}

.notif-prompt-actions .primary-button {
  flex: 1;
  font-size: 13px;
  padding: 10px 16px;
}

.notif-prompt-actions .ghost-button {
  font-size: 13px;
  padding: 10px 12px;
  background: transparent;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 999px;
  color: var(--muted, #78747e);
  cursor: pointer;
  white-space: nowrap;
}

html[data-theme="dark"] .notif-prompt {
  background: var(--card-bg, #1e1e2e);
  border-color: var(--border, #333);
}

/* ─── Toggle switch ───────────────────────────────────────────────────────── */

.toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-knob {
  width: 40px;
  height: 22px;
  background: var(--border, #d1d5db);
  border-radius: 999px;
  transition: background 0.2s;
  position: relative;
}

.toggle-knob::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-knob {
  background: #65d6c6;
}

.toggle-switch input:checked + .toggle-knob::after {
  transform: translateX(18px);
}

.toggle-switch input:disabled + .toggle-knob {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ─── Version badge (sidebar desktop + settings mobile) ──────────────────── */

.sidebar-version {
  margin-top: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.version-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted, #78747e);
  letter-spacing: 0.05em;
}

.version-date {
  font-size: 10px;
  color: var(--muted, #78747e);
  opacity: 0.7;
}

.settings-version-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  font-size: 11px;
  color: var(--muted, #78747e);
  opacity: 0.7;
  margin-top: 8px;
}

/* Prominent version panel in Settings */
.settings-version-panel {
  column-span: all;          /* span all CSS columns in settings-layout */
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--surface-raised, #f3f4f6);
  border-radius: var(--radius-md, 16px);
  margin-top: 4px;
}

.settings-version-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-version-name {
  font-weight: 800;
  font-size: 16px;
  color: var(--ink);
  letter-spacing: -.3px;
}

.settings-version-number {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .1px;
}

.settings-version-date {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

/* Sidebar needs flex-column so version badge sticks to bottom */
.sidebar {
  display: flex;
  flex-direction: column;
}

/* ─── Card type badge ─────────────────────────────────────────────────────── */

.card-type-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 999px;
}

.card-type-vaccine {
  background: color-mix(in srgb, #65d6c6 15%, transparent);
  color: #2a9d8f;
}

html[data-theme="dark"] .card-type-vaccine {
  background: color-mix(in srgb, #65d6c6 12%, transparent);
  color: #65d6c6;
}

/* ─── Upgrade modal (SEG-05) ─────────────────────────────────────────────── */

.upgrade-modal {
  max-width: 420px;
  width: 90vw;
}

.upgrade-reason {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 16px;
  padding: 10px 14px;
  background: var(--surface-raised);
  border-radius: var(--radius-sm);
}

.upgrade-feature-list {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.upgrade-feature-list li {
  font-size: 14px;
  padding-left: 20px;
  position: relative;
  color: var(--ink);
}

.upgrade-feature-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}

.upgrade-pricing {
  font-size: 15px;
  color: var(--muted);
  margin-bottom: 24px;
}

.upgrade-pricing strong {
  color: var(--ink);
  font-size: 18px;
}

/* ─── SEG-06: Expense payment panel ─────────────────────────────────────────── */

.payment-request-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.payment-amount-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-input);
  border: 1.5px solid var(--border, #e5e7eb);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}

.payment-currency-label {
  font-weight: 700;
  font-size: 14px;
  color: var(--muted);
  flex-shrink: 0;
}

.payment-amount-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  outline: none;
  min-width: 0;
}

.payment-amount-input::-webkit-inner-spin-button,
.payment-amount-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

.payment-split-select {
  width: 100%;
  padding: 8px 10px;
  border: 1.5px solid var(--border, #e5e7eb);
  border-radius: var(--radius-sm);
  background: var(--surface-input);
  color: var(--ink);
  font-size: 14px;
  cursor: pointer;
}

.payment-request-btn {
  width: 100%;
  margin-top: 2px;
}

/* Shared color tokens for payment states */
.payment-chip-paid    { background: #dcfce7; color: #15803d; }
.payment-chip-pending { background: #fef9c3; color: #92400e; }

/* Payment status chip - full-width, in card dialog side panel */
.payment-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  width: 100%;
  box-sizing: border-box;
}

/* Payment chip - pill, on expense list cards */
.payment-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .2px;
  text-decoration: none;
  flex-shrink: 0;
}

.payment-chip-receipt {
  background: var(--surface-raised);
  color: var(--muted);
  border: 1px solid var(--border, #e5e7eb);
}

.payment-chip-receipt:hover {
  color: var(--ink);
}

/* Expense list card action - awaiting state */
.expense-action-pending {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: #92400e;
  background: #fef9c3;
}

/* Request payment button */
.expense-action-btn.request-payment {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.expense-action-btn.request-payment:hover {
  opacity: .85;
}

/* Balance row in expense summary panel */
.expense-summary-balance {
  border-top: 1px solid var(--border, #e5e7eb);
  margin-top: 4px;
  padding-top: 10px;
}

.balance-positive { color: #15803d; font-weight: 700; }
.balance-negative { color: #dc2626; font-weight: 700; }
.balance-zero     { color: var(--muted); font-weight: 600; }

/* ─── SEG-06: Receipt panel ──────────────────────────────────────────────────── */

.receipt-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  width: 100%;
  justify-content: center;
}

.receipt-thumbnail {
  display: block;
  max-width: 100%;
  max-height: 160px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-top: 10px;
  border: 1px solid var(--border, #e5e7eb);
  cursor: pointer;
}

.receipt-preview-link {
  display: block;
  margin-top: 8px;
  text-decoration: none;
}

.receipt-file-link {
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
}

/* ─── SEG-09: Cookie consent banner ─────────────────────────────────────────── */

/* Fix: CSS display:flex overrides [hidden] attribute (UA style loses to author style) */
.cookie-banner[hidden] {
  display: none !important;
}

.cookie-banner {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom) + 72px); /* above tab bar on mobile */
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100vw - 32px), 480px);
  /* Always use a dark background so white text is always readable */
  background: #171918;
  color: #ffffff;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 1200;
  box-shadow: 0 4px 24px rgba(0,0,0,.35);
  animation: slideUpBanner .25s ease;
}

@media (min-width: 1081px) {
  .cookie-banner {
    bottom: 24px;
    left: auto;
    right: 24px;
    transform: none;
    width: auto;
    max-width: 440px;
  }
}

@keyframes slideUpBanner {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@media (min-width: 1081px) {
  @keyframes slideUpBanner {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
  }
}

.cookie-banner-text {
  flex: 1;
  font-size: 13px;
  line-height: 1.4;
  margin: 0;
  color: rgba(255,255,255,.85);
}

.cookie-banner-text a {
  color: rgba(255,255,255,.7);
  text-decoration: underline;
}

.cookie-banner-btn {
  flex-shrink: 0;
  background: rgba(255,255,255,.15) !important;
  color: #fff !important;
  border: 1px solid rgba(255,255,255,.25) !important;
  padding: 7px 16px !important;
  font-size: 13px !important;
  min-height: 34px !important;
  border-radius: 8px !important;
}

.cookie-banner-btn:hover {
  background: rgba(255,255,255,.25) !important;
}

/* ─── Card dialog buttons - neutral black/wireframe (not accent-coloured) ───── */

.card-dialog .primary-button,
.reminder-dialog .primary-button {
  background: #171918 !important;
  color: #ffffff !important;
  box-shadow: none !important;
  border-color: #171918 !important;
}

.card-dialog .primary-button:hover:not(:disabled),
.reminder-dialog .primary-button:hover:not(:disabled) {
  background: #2a2a2a !important;
  border-color: #2a2a2a !important;
  filter: none !important;
}

.card-dialog .secondary-button,
.reminder-dialog .secondary-button {
  background: transparent !important;
  color: var(--ink) !important;
  border-color: var(--line) !important;
  box-shadow: none !important;
}

.card-dialog .secondary-button:hover:not(:disabled),
.reminder-dialog .secondary-button:hover:not(:disabled) {
  background: var(--surface-raised) !important;
  border-color: var(--ink) !important;
}

html[data-theme="dark"] .card-dialog .primary-button,
html[data-theme="dark"] .reminder-dialog .primary-button {
  background: var(--ink) !important;
  color: #171918 !important;
  border-color: var(--ink) !important;
}

html[data-theme="dark"] .card-dialog .primary-button:hover:not(:disabled),
html[data-theme="dark"] .reminder-dialog .primary-button:hover:not(:disabled) {
  opacity: 0.88;
  filter: none !important;
}

/* ─── Custody / parenting schedule calendar coloring ────────────────────────── */

/* Day cell tints - palette-matched: teal for mine, warm slate for co-parent */
.calendar-day.custody-mine {
  background: var(--custody-mine-bg, rgba(101, 214, 198, 0.2));
}
.calendar-day.custody-mine.selected {
  background: var(--ink);
}
.calendar-day.custody-co {
  background: var(--custody-co-bg, rgba(118, 128, 138, 0.14));
}
.calendar-day.custody-co.selected {
  background: var(--ink);
}
.calendar-day.custody-split {
  background: linear-gradient(135deg, var(--custody-mine-bg, rgba(101,214,198,0.2)) 50%, var(--custody-co-bg, rgba(118,128,138,0.14)) 50%);
}
.calendar-day.custody-split.selected {
  background: var(--ink);
}

/* Week view: colored left border */
.week-day.custody-mine {
  border-left: 3px solid var(--custody-mine-color, #65d6c6);
}
.week-day.custody-co {
  border-left: 3px solid var(--custody-co-color, #76808a);
}
.week-day.custody-split {
  border-left: 3px solid;
  border-image: linear-gradient(to bottom, var(--custody-mine-color, #65d6c6) 50%, var(--custody-co-color, #76808a) 50%) 1;
}

/* Dark mode adjustments */
html[data-theme="dark"] .calendar-day.custody-mine {
  background: var(--custody-mine-bg, rgba(101, 214, 198, 0.16));
}
html[data-theme="dark"] .calendar-day.custody-co {
  background: var(--custody-co-bg, rgba(118, 128, 138, 0.12));
}
html[data-theme="dark"] .calendar-day.custody-mine.selected,
html[data-theme="dark"] .calendar-day.custody-co.selected,
html[data-theme="dark"] .calendar-day.custody-split.selected {
  background: var(--accent);
}

/* Desktop: slightly taller day cells for richer look */
@media (min-width: 1081px) {
  .calendar-day:not(.blank) {
    min-height: 60px;
    border-radius: 14px;
  }
  .calendar-grid {
    gap: 6px;
  }
}

/* ─── Custody legend in month view ──────────────────────────────────────────── */
.custody-legend {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 4px 2px 6px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.custody-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.custody-legend-dot {
  width: 22px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* ─── Custody schedule button in calendar header ─────────────────────────────── */
.custody-schedule-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface-raised, #f3f3f3);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  cursor: pointer;
  align-self: center;
  justify-self: end;
  transition: color 0.15s, background 0.15s;
}
.custody-schedule-btn:hover {
  color: var(--ink);
  background: var(--accent-weak);
}
html[data-theme="dark"] .custody-schedule-btn {
  background: var(--surface-raised);
}

/* ─── Custody day strip in agenda panel ─────────────────────────────────────── */
.custody-day-strip {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--soft, #f9f9f9);
  border: 1px solid var(--line);
  margin-bottom: 4px;
}
html[data-theme="dark"] .custody-day-strip {
  background: var(--surface-raised);
}
.custody-day-who {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
}
.custody-day-dot-sm {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.custody-override-badge {
  font-size: 10px;
  font-weight: 700;
  background: var(--accent-weak);
  color: var(--accent);
  padding: 2px 7px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.custody-split-time {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}
.custody-day-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.custody-chip {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.12s;
}
.custody-chip:hover {
  border-color: var(--ink);
  color: var(--ink);
}
.custody-chip.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.custody-chip-reset {
  color: var(--muted);
  opacity: 0.7;
}
html[data-theme="dark"] .custody-chip {
  background: var(--surface-input);
}
html[data-theme="dark"] .custody-chip.active {
  background: var(--accent);
  color: #13201e;
  border-color: var(--accent);
}
.custody-split-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  width: 100%;
}

/* ─── Custody week overview strip (desktop agenda) ───────────────────────────── */
.custody-week-overview {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 12px;
}
.custody-week-ov-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 2px 8px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  color: var(--muted);
  transition: background 0.12s;
}
.custody-week-ov-day:hover {
  background: var(--soft);
}
.custody-week-ov-day.selected {
  background: var(--surface-raised);
  border-color: var(--line);
  color: var(--ink);
}
.custody-week-ov-bar {
  display: block;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  margin-bottom: 2px;
}
.custody-week-ov-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.custody-week-ov-num {
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
}
.custody-week-ov-count {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  background: var(--accent-weak);
  border-radius: 999px;
  padding: 1px 5px;
}
html[data-theme="dark"] .custody-week-ov-day.selected {
  background: var(--surface-raised);
}

/* ─── Custody schedule dialog body ──────────────────────────────────────────── */
.custody-schedule-dialog {
  max-width: 440px;
}
.custody-dialog-body {
  padding: 4px 0 8px;
}
.custody-dialog-fields {
  display: grid;
  gap: 16px;
}
.custody-dialog-field {
  display: grid;
  gap: 8px;
}
.custody-dialog-field > span {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
.custody-dialog-swatch-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.custody-dialog-swatch-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}
.custody-dialog-preview {
  display: flex;
  gap: 16px;
  padding: 10px 14px;
  background: var(--soft);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
html[data-theme="dark"] .custody-dialog-preview {
  background: var(--surface-raised);
}

/* Custody settings color swatches */
.custody-color-swatches {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.custody-swatch {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.1s;
}
.custody-swatch:hover {
  transform: scale(1.2);
}
.custody-swatch.active {
  border-color: var(--ink);
  outline: 2px solid var(--paper);
  outline-offset: -4px;
}
