/* Voice-recognition dictate icons hidden from the UI.
   Only the visual is hidden - the buttons stay in the DOM and all
   dictation JS/event listeners are untouched. Delete this block to
   bring the mic icons back. */
#voiceButton,
#commentMicButton,
#cardMessageMicButton {
  display: none !important;
}

:root {
  /* Text */
  --ink: #121212;
  --muted: #666666;
  /* Surfaces */
  --soft: #f9f9f9;
  --paper: #ffffff;
  --surface-page: #ffffff;
  --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"] .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"] .unified-card {
  background: var(--surface-card);
  color: var(--ink);
}

html[data-theme="dark"] .column,
html[data-theme="dark"] .column-header {
  background: transparent;
  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"] .card-sync {
  background: var(--surface-raised);
  color: var(--ink);
}

html[data-theme="dark"] .quick-response,
html[data-theme="dark"] .quick-message {
  background: transparent;
  color: var(--ink);
  border: 1px solid rgba(197, 194, 182, 0.35);
}

html[data-theme="dark"] .quick-response-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #171918;
}

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;
}

/* Prevent Safari from auto-zooming when tapping inputs (triggers when font-size < 16px) */
@supports (-webkit-touch-callout: none) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
  select,
  textarea {
    font-size: max(16px, 1em) !important;
  }
}

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);
}

/* Dev-only ?preview= banner. Never rendered on production - see requestedPreviewScreen(). */
#previewBanner {
  position: fixed;
  z-index: 9999;
  top: 0;
  left: 0;
  right: 0;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  color: #fff;
  background: #b3261e;
  pointer-events: none;
}

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;
  max-height: 100vh;
  max-height: 100dvh;
  display: grid;
  /* Top-align + scroll so a screen taller than the phone (invite, sign-up) can be
     scrolled to its buttons on mobile Safari. Both min/max resolve to 100dvh on
     dvh-aware browsers, so there is no vh/dvh conflict. */
  align-items: start;
  justify-items: center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px;
  background: var(--surface-page);
}

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

/* Full-app paywall shown when the free trial is over and the user hasn't paid. */
.paywall-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
}
/* The paywall reuses the .auth-screen class for its layout, but the body is
   'paywall-locked', NOT 'auth-locked'. So the rule above -
   `body:not(.auth-locked) .auth-screen { display: none }` - was hiding the
   paywall while `paywall-locked`'s overflow:hidden still froze the whole page.
   Anyone past their 7-day trial saw a frozen, unusable app instead of the
   subscribe/enter-code screen. Force the paywall visible whenever it is in the
   DOM (specificity (0,3,1) beats the hide rule's (0,2,1)). Bart, 2026-07-18. */
body:not(.auth-locked) .paywall-screen.auth-screen {
  display: grid;
}
body.paywall-locked {
  overflow: hidden;
}

.onboarding-screen {
  min-height: 100vh;
  min-height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  display: grid;
  /* Scrollable so the tall setup form reaches "Finish setup" on mobile. */
  align-items: start;
  justify-items: center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  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(2, 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;
}

.onboarding-child-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.onboarding-child-row input {
  flex: 1;
}

.onboarding-child-remove {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--muted, #94a3b8);
  padding: 0 4px;
  line-height: 1;
  border-radius: 4px;
  transition: color 0.15s;
}

.onboarding-child-remove:hover {
  color: var(--error, #ef4444);
}

.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-consent-row {
  margin: 6px 0 2px;
}

.auth-consent-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  line-height: 1.4;
}

.auth-consent-label input[type="checkbox"] {
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--ink);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.auth-consent-label a {
  color: var(--ink);
  text-decoration: underline;
}

.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);
}

/* ============================================================
   BUTTON DESIGN SYSTEM  (v0.31.9 - piloted on Expenses screen)
   One shape (pill), one set of sizes, driven by tokens below.
   Usage:  <button class="btn btn--primary">
           <button class="btn btn--secondary btn--sm">
   Variants: primary | secondary | tertiary | strong | approve | dispute | paid
   Sizes:    default | --sm      Layout: --block | --icon
   ------------------------------------------------------------
   NOTE: the older .primary-button / .secondary-button / .ghost-button /
   .icon-button / .settlement-request-btn / .expense-action-btn rules are
   still used by the rest of the app and are left untouched during the
   pilot. Once .btn is rolled out everywhere, those can be removed.
   ============================================================ */
:root {
  --btn-radius: 999px;      /* pill shape - the single agreed shape */
  --btn-h: 40px;            /* standard height */
  --btn-h-sm: 30px;         /* small height */
  --btn-pad-x: 18px;
  --btn-pad-x-sm: 14px;
  --btn-font: 14px;
  --btn-font-sm: 12px;
  --btn-weight: 700;
}

.btn {
  min-height: var(--btn-h);
  border-radius: var(--btn-radius);
  border: 1px solid transparent;
  padding: 0 var(--btn-pad-x);
  font-size: var(--btn-font);
  font-weight: var(--btn-weight);
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* A button keeps its own height even inside a stretched flex/grid parent,
     so every .btn of the same variant is always the same size. */
  align-self: center;
  gap: 8px;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, filter .15s, opacity .15s;
}
.btn:disabled { opacity: .5; cursor: default; }

/* Sizes & layout */
.btn--sm { min-height: var(--btn-h-sm); padding: 0 var(--btn-pad-x-sm); font-size: var(--btn-font-sm); }
.btn--block { width: 100%; }
.btn--icon { width: var(--btn-h); padding: 0; }
.btn--icon.btn--sm { width: var(--btn-h-sm); }

/* Variants */
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover:not(:disabled) { filter: brightness(0.92); }

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

.btn--tertiary { background: transparent; border-color: var(--line); color: var(--muted); }
.btn--tertiary:hover:not(:disabled) { border-color: var(--accent-mid); color: var(--ink); }

/* Strong = high-emphasis dark CTA (settlement bar, request payment) */
.btn--strong { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn--strong:hover:not(:disabled) { opacity: .9; }
html[data-theme="dark"] .btn--strong { background: var(--surface-alt, #2a2a2a); color: #fff; border-color: var(--line); }

/* Semantic outline actions (expense cards) - fill on hover */
.btn--approve { background: transparent; border-color: var(--line); color: var(--muted); }
.btn--approve:hover:not(:disabled) { background: #d1fae5; border-color: #6ee7b7; color: #065f46; }
.btn--dispute { background: transparent; border-color: var(--line); color: var(--muted); }
.btn--dispute:hover:not(:disabled) { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.btn--paid { background: transparent; border-color: var(--line); color: var(--muted); }
.btn--paid:hover:not(:disabled) { background: var(--teal, #65d6c6); border-color: var(--teal, #65d6c6); color: #fff; }

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(min(100%, 300px), 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 Parenting Tip card - subtle strip, same family as daily-summary */
.daily-tip-card {
  display: flex;
  align-items: center;
  margin: 0 20px 14px;
  padding: 14px 16px;
}
.daily-tip-card.hidden { display: none; }
.daily-tip-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}
.daily-tip-label {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  text-transform: uppercase;
}
.daily-tip-text {
  margin: 0;
  color: var(--ink);
  font-size: 26px;
  line-height: 1.35;
  font-weight: 500;
}
.daily-tip-dismiss {
  flex: 0 0 auto;
  margin-left: auto;
  align-self: flex-start;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  padding: 0 4px;
  color: var(--muted);
  white-space: nowrap;
}
.daily-tip-dismiss:hover { color: var(--ink); }

.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;
}

.mini-stat-right {
  margin-left: auto;
}

.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(4, minmax(180px, 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(4, minmax(180px, 1fr));
  gap: 14px;
  align-items: start;
}

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

.inline-capture-host {
  margin-top: 0;
  padding: 10px 16px 14px;
  background: color-mix(in srgb, var(--accent) 25%, transparent);
  position: relative;
  z-index: 2;
  border-bottom: 1px solid var(--line);
}

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

.inline-capture-label {
  flex: 1;
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
  text-align: left;
}

.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;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: -6px; /* gap between avatars and title is handled by grid gap */
}

.card-people-icons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-people-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.card-people-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: 6px;
  padding: 0;
}

.card-people-action-btn:hover {
  color: var(--ink);
  background: rgba(23, 25, 24, 0.06);
}

/* Card has messages you have not seen yet - see cardHasUnreadMessages(). */
.card-people-action-btn.card-action-unread {
  color: var(--accent);
  position: relative;
}

.card-people-action-btn.card-action-unread::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  border: 1.5px solid var(--surface-card);
}

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

.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;
}

/* The board card shows the note you typed as its one text, at normal body size
   (.card-details), capped at 4 lines with an ellipsis so a long note can't make a
   giant card. Full text is in the card dialog. */
.card-note {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.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;
  /* Card note / body text. Relative unit (1em == 16px at the default base) so it
     scales with the browser/device font-size. */
  font-size: 1em;
  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;
}

/* Calendar-import cards get a teal tint to distinguish from family-sync badge */
.card-cal-import {
  background: rgba(0, 150, 136, 0.10);
  color: rgba(0, 110, 100, 0.85);
}
html[data-theme="dark"] .card-cal-import {
  background: rgba(0, 188, 166, 0.15);
  color: rgba(0, 220, 190, 0.9);
}

/* Import calendar settings */
.import-cal-selector {
  display: flex;
  align-items: center;
  gap: 6px;
}
.import-range-selector {
  display: flex;
  align-items: center;
  gap: 6px;
}
.import-cal-action-row {
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.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;
}

/* Fix: display:grid above overrides the browser's [hidden]{display:none}, so
   panels hidden via the attribute (Apple Calendar, mediator) stayed visible. */
.feature-panel[hidden] {
  display: none !important;
}

.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,
.shopping-bulk-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,
.shopping-bulk-btn:hover {
  background: var(--surface-raised);
  color: var(--ink);
}

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

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

.shopping-icon-btn--danger:hover {
  background: color-mix(in srgb, var(--error, #e53e3e) 12%, transparent);
  color: var(--error, #e53e3e);
}

/* 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-row-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  opacity: 0.25;
  transition: opacity 0.12s;
}

.shopping-row-wrap:hover .shopping-row-actions,
.shopping-row-wrap:focus-within .shopping-row-actions {
  opacity: 1;
}

.shopping-row .shopping-icon-btn {
  opacity: 0.25;
  transition: opacity 0.12s;
}

.shopping-row-wrap:hover .shopping-row .shopping-icon-btn,
.shopping-row-wrap:focus-within .shopping-row .shopping-icon-btn {
  opacity: 1;
}

.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;
  transition: background 0.12s, color 0.12s;
}

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

.shopping-item-cost {
  font-size: 12px;
  color: var(--muted);
  margin-left: 6px;
  font-variant-numeric: tabular-nums;
}

.shopping-cost-input-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-right: 4px;
}

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

.shopping-cost-input {
  width: 72px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 6px;
  font-size: 13px;
  background: var(--surface-2, #fff);
  color: var(--ink);
}

.shopping-cost-save {
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-1);
  font-size: 12px;
  cursor: pointer;
  color: var(--ink);
}

.shopping-cost-save:hover {
  background: var(--surface-2);
}

.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;
}

/* Sub-headings that group the calendar settings into clear blocks */
.settings-subheading {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 16px 0 4px;
  padding: 0 2px;
}
.feature-panel-header + .settings-subheading { margin-top: 6px; }

.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;
  /* Each card takes its natural height. Without this the grid stretches a
     short card to match a tall neighbour, which then stretches its button
     row and makes identical buttons look different sizes. */
  align-items: start;
}

.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(1120px, calc(100vw - 24px));
  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;
}

.reminder-recurring-section {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.reminder-recurring-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.recur-day-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 20px;
  cursor: pointer;
  background: var(--surface);
  transition: background 0.12s, color 0.12s;
}

.recur-day-pill:has(input:checked) {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Shopping: add-list row */
.shopping-add-list-row {
  display: flex;
  justify-content: center;
  padding: 8px 0 16px;
}

/* Expense: hero actions row */
.expense-hero-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* Expense: month filter */
.expense-month-filter {
  padding: 0 0 4px;
}

.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 4px;
  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;
  margin-top: -10px;
}

.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-inline-save {
  width: 100%;
  margin-top: 4px;
}

.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;
  min-width: 0;
}

/* 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;
  /* one column that may shrink to the dialog width - without this the implicit
     column grew to its widest child and the card dialog spilled off phones */
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-content: start;
  min-width: 0;
}

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

@media (min-width: 580px) {
  .dialog-two-col {
    grid-template-columns: minmax(0, 1fr) 240px;
    align-items: start;
  }
}
@media (min-width: 900px) {
  /* On wider screens give the sidebar more room so the Polish button rows
     (Dodaj przypomnienie, split chips, etc.) aren't clipped; main is narrower. */
  .dialog-two-col {
    grid-template-columns: minmax(0, 1fr) 300px;
  }
}

/* Sidebar panels: never let a button row overflow the column and get clipped -
   let it wrap, and let the buttons shrink instead of pushing past the edge. */
.dialog-side-col .section-actions {
  flex-wrap: wrap;
}
.dialog-side-col .section-actions > * {
  flex: 1 1 auto;
  min-width: 0;
}

/* 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;
}

/* Mini calendar picker in Add Do dialog */
.mini-cal-picker {
  margin-top: 8px;
  padding: 8px 6px 6px;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 10px;
  user-select: none;
}

.mc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
  padding: 0 2px;
}

.mc-month-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
}

.mc-nav {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
  padding: 0 4px;
  display: flex;
  align-items: center;
  border-radius: 6px;
  transition: color 0.12s, background 0.12s;
}

.mc-nav:hover {
  color: var(--accent);
  background: var(--accent-weak);
}

.mc-grid {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
  table-layout: fixed;
}

.mc-grid th {
  text-align: center;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 2px 0 5px;
  font-size: 0.68rem;
  text-transform: uppercase;
}

.mc-grid td {
  text-align: center;
  padding: 2px;
}

.mc-day {
  width: 100%;
  min-height: 38px;
  border: none;
  background: var(--surface, #f5f6f2);
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  transition: background 0.1s, color 0.1s;
}

.mc-day:hover {
  filter: brightness(0.93);
}

.mc-today {
  font-weight: 800;
  color: var(--accent);
}

.mc-selected {
  background: var(--ink) !important;
  color: #fff !important;
  font-weight: 700;
}
.mc-today.mc-selected {
  background: var(--accent) !important;
  box-shadow: none;
}

/* Custody background tints - match main calendar */
.mc-day.custody-mine {
  background: var(--custody-mine-bg, rgba(101, 214, 198, 0.22));
  border-top: 3px solid var(--custody-mine-color, #65d6c6);
}
.mc-day.custody-co {
  background: var(--custody-co-bg, rgba(118, 128, 138, 0.18));
  border-top: 3px solid var(--custody-co-color, #f59e0b);
}
.mc-day.custody-split {
  background: linear-gradient(
    to right,
    color-mix(in srgb, var(--custody-mine-color, #65d6c6) 22%, transparent) 50%,
    color-mix(in srgb, var(--custody-co-color, #f59e0b) 22%, transparent) 50%
  );
  border-top: 3px solid transparent;
  border-image: linear-gradient(to right, var(--custody-mine-color, #65d6c6) 50%, var(--custody-co-color, #f59e0b) 50%) 1;
}
.mc-day.mc-selected.custody-mine,
.mc-day.mc-selected.custody-co,
.mc-day.mc-selected.custody-split {
  background: var(--ink) !important;
  border-image: none;
  border-top-color: var(--ink);
}
.mc-day.mc-today.mc-selected {
  background: var(--accent) !important;
  border-top-color: var(--accent);
}

/* Event dot in mini-cal */
.mc-day-dot {
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.mc-day.mc-selected .mc-day-dot {
  background: rgba(255, 255, 255, 0.7);
}

/* Mini-cal custody legend */
.mc-custody-legend {
  display: flex;
  gap: 10px;
  padding: 0 10px 6px;
}
.mc-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: var(--muted);
}
.mc-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Time range bar in mini cal */
.mc-time-range {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 8px 10px 4px;
  padding: 7px 14px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 10px;
}
.mc-time-range-start,
.mc-time-range-end {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.mc-time-range-arrow {
  font-size: 14px;
  color: var(--accent);
  font-weight: 700;
}

.mc-clear {
  display: block;
  margin: 6px auto 0;
  background: none;
  border: none;
  font-size: 0.72rem;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.1s;
}

.mc-clear:hover {
  color: var(--ink);
}

.mc-lock-assignee-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px 2px;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.mc-lock-assignee-row input[type="checkbox"] {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  cursor: pointer;
}
.mc-lock-assignee-row:hover { color: var(--ink); }

/* ---- Date + Time row in card popup ---- */
.card-due-row {
  display: flex;
  flex-wrap: wrap; /* on phones: date on one line, time on the next - the date never shrinks to its icon */
  align-items: center;
  gap: 6px;
  margin: 10px 0 0;
  padding: 8px 10px;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.card-due-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  flex-shrink: 0;
}

.card-due-label-time {
  margin-left: 6px;
}

.card-due-input {
  flex: 1 1 130px;
  min-width: 0;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-card);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

.card-due-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 18%, transparent);
}

.card-time-input {
  flex: 0 0 auto;
  width: 108px;
}

/* Phones: when the row wraps, "GODZINA" must move down WITH its time field.
   The date takes the rest of line 1, so the time label starts line 2. */
@media (max-width: 520px) {
  .card-due-input:not(.card-time-input) { flex-basis: calc(100% - 70px); }
  .card-due-label-time { margin-left: 0; }
}

.card-due-clear {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 3px 5px;
  border-radius: 5px;
  transition: color 0.1s, background 0.1s;
}

.card-due-clear:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--ink) 8%, transparent);
}

.time-ambiguity-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  margin: 4px 0 0;
  font-size: 0.82rem;
  color: var(--ink);
}
.time-ambiguity-row.hidden { display: none; }
.time-ambiguity-label { flex: 1; }
.time-ambiguity-btn {
  padding: 3px 10px;
  border-radius: 5px;
  border: 1.5px solid var(--accent);
  background: var(--bg);
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.time-ambiguity-btn:hover {
  background: var(--accent);
  color: #fff;
}

.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;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  border-radius: 26px;
  background: #f7f8f7;
  padding: 14px;
}

/* Fix: the display:grid above overrides the browser's [hidden]{display:none}
   (author style beats UA style), so panels toggled via the `hidden` attribute
   in JS - Payment, Receipt, Ledger - never actually hid and leaked stale
   content (e.g. a previous card's cost) onto the next card. */
.card-info-section[hidden] {
  display: none !important;
}

.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);
}

/* ─── Card checklist ─────────────────────────────────────────────────────────── */

.card-checklist {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.checklist-header {
  display: flex;
  flex-wrap: wrap; /* the "extract from text" button drops to its own line on narrow phones */
  align-items: center;
  gap: 8px;
}

.checklist-progress {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  min-width: 28px;
}

.checklist-parse-btn {
  margin-left: auto;
  font-size: 12px;
  padding: 3px 10px;
}

.checklist-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 4px;
  border-radius: 8px;
  transition: background 0.1s;
}

.checklist-item:hover {
  background: var(--surface-raised);
}

.checklist-item-done .checklist-item-text {
  text-decoration: line-through;
  opacity: 0.45;
}

.checklist-check-btn {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 2px solid var(--line);
  background: transparent;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}

.checklist-item-done .checklist-check-btn {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.checklist-check-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.checklist-item-text {
  flex: 1;
  font-size: 14px;
  color: var(--ink);
}

.checklist-empty {
  font-size: 13px;
  color: var(--muted);
  padding: 4px 0;
  list-style: none;
}

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

.checklist-item:hover .checklist-shop-btn,
.checklist-item:hover .checklist-delete-btn {
  opacity: 1;
}

.checklist-shop-btn svg,
.checklist-delete-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.checklist-shop-btn:hover { color: var(--accent); }
.checklist-delete-btn:hover { color: var(--danger, #e55); }

.checklist-add-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.checklist-add-row input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 14px;
  background: var(--surface-page);
  color: var(--ink);
}

.checklist-add-row input:focus {
  outline: none;
  border-color: var(--accent);
}

/* Separate the Messages block from the Checklist so "Dodaj element" (checklist)
   is not mistaken for "Napisz wiadomość" (chat). Messages gets its own heading,
   a divider above it, and a rounded composer bar (vs the checklist's plain input). */
.comment-panel {
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.messages-header {
  margin-bottom: 8px;
}
.chat-input-row {
  background: var(--surface-input);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 6px;
}
.chat-input-row textarea {
  background: transparent;
  border: none;
}

.checklist-add-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.checklist-add-icon-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2.5;
  fill: none;
  stroke-linecap: round;
}

.checklist-add-all-shop {
  align-self: flex-start;
  font-size: 12px;
}

/* Kanban tile progress badge */
.card-checklist-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-radius: 6px;
  padding: 2px 7px;
  margin-bottom: 2px;
}

.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: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.94);
  max-width: min(560px, calc(100vw - 48px));
  width: max-content;
  border-radius: 22px;
  /* --paper / --ink track the theme, so the pill is a light card in light mode
     and a dark card in dark mode (matches the theme instead of inverting). */
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  font-size: 24px;
  line-height: 1.35;
  font-weight: 700;
  text-align: center;
  padding: 26px 34px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 9999;
}

[data-theme="dark"] .toast {
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.6);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* sidebar intentionally hidden on all screen sizes - bottom tabbar used instead */

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

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

  .board-view {
    grid-template-columns: repeat(2, minmax(160px, 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: #f4f4f4;
  --paper: #ffffff;
  --line: rgba(30, 29, 34, 0.08);
  --nav: #ffffff;
  --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;
  border: none;
}

.column-header {
  background: transparent;
  border-bottom: none;
  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);
  overflow: hidden;
}

/* Delicate owner colour line on top of every Do card */
.unified-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 24px 24px 0 0;
  opacity: 0;
}
.unified-card.card-owner-mine::before {
  background: var(--custody-mine-color, #65d6c6);
  opacity: 1;
}
.unified-card.card-owner-co::before {
  background: var(--custody-co-color, #f59e0b);
  opacity: 1;
}
.unified-card.card-owner-both::before {
  background: linear-gradient(to right, var(--custody-mine-color, #65d6c6) 50%, var(--custody-co-color, #f59e0b) 50%);
  opacity: 1;
}

/* Needs-response glow — delicate warm shadow to make card stand out */
.unified-card.card-needs-response {
  box-shadow:
    0 0 0 1px rgba(216, 91, 98, 0.12),
    0 4px 16px rgba(216, 91, 98, 0.12),
    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;
}

/* "Paid" chip - a status of the EXPENSE attribute, shown independently of the
   task's Done label (a card can be Done and/or Paid, in any order). */
.card-paid-tag {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 999px;
  background: #d1fae5;
  color: #065f46;
  white-space: nowrap;
}
html[data-theme="dark"] .card-paid-tag {
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
}

/* Who-will-do-it hand-over request banner (DO-CARD-MODEL.md §4b) */
.handoff-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin: 2px 0 8px;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.handoff-asked { background: var(--accent-weak); color: var(--ink); }
.handoff-waiting { background: #fef9c3; color: #92400e; }
.handoff-declined { background: #fee2e2; color: #991b1b; }
.handoff-actions { display: flex; gap: 6px; flex-shrink: 0; }
html[data-theme="dark"] .handoff-waiting { background: rgba(234, 179, 8, 0.18); color: #fde68a; }
html[data-theme="dark"] .handoff-declined { background: rgba(239, 68, 68, 0.18); color: #fca5a5; }

.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;
  /* Keep buttons at their own height - never let a tall row stretch them. */
  align-items: center;
}

.expense-action-btn {
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  transition: background 0.15s, color 0.15s, border-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 {
  /* Wrap to a second row when the card is narrow - the fixed 4 equal columns
     cut the labels off ("to zrob", "szę zró"). */
  display: flex;
  flex-wrap: wrap;
  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);
}

.quick-response-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink);
  font-weight: 800;
}

.quick-response-active:hover:not(:disabled) {
  background: var(--accent);
  opacity: 0.88;
}

/* Standard Do card action row now uses the .btn design system - make them fill
   the 4-column grid and stay compact enough for the labels. */
.quick-actions .btn {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  padding: 0 10px;
  font-size: 11px;
  white-space: nowrap;
}

/* Several reminders per card (gap 6) - chips in the card's reminder panel */
.reminders-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.reminders-list:empty { display: none; }
.reminder-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 4px 3px 10px;
  border-radius: 999px;
  background: var(--accent-weak);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}
.reminder-chip-x {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 0 3px;
}
.reminder-chip-x:hover { color: var(--danger, #e55); }

/* 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: 1px solid rgba(23, 25, 24, 0.14);
  background: transparent;
  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: 42px;
  height: 42px;
  font-size: 18px;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}

.dialog-person-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.dialog-person-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.parent-a-mini {
  background: var(--custody-mine-color, #65d6c6);
}

.parent-b-mini {
  background: var(--custody-co-color, #76808a);
}

.both-mini {
  background: linear-gradient(135deg, var(--custody-mine-color, #65d6c6) 0 50%, var(--custody-co-color, #76808a) 50% 100%);
}

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

.caregiver-mini {
  background: #9b6bb5;
}

.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-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 page two-column layout:
   - LEFT column (narrow, ~1/3): agenda (week overview + today's Dos + Opieka/care
     tools) on top, then a small gap, then the month/week/day mini calendar.
   - RIGHT column (~2/3): the Teams-style day/week calendar. */
.calendar-page-2col {
  display: grid;
  gap: 16px;
}

.calendar-left-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

/* Mobile: the calendar page's cards (day/agenda card + calendar card) must be
   allowed to shrink to the viewport. Grid/flex children default to
   min-width:auto, which refuses to shrink below their content's intrinsic width
   and spills off the right edge - seen in Chrome on iOS, where the day card and
   calendar card were cut off (Bart, 2026-07-18). min-width:0 lets them fit; any
   genuinely wide inner grid still scrolls inside its own bcal-scroll. */
@media (max-width: 760px) {
  .calendar-page-2col,
  .calendar-page-2col > *,
  .calendar-left-col,
  .calendar-left-col > *,
  .board-cal-section {
    min-width: 0;
    max-width: 100%;
  }
}

/* Agenda sits above the mini calendar inside the left column */
.calendar-left-col .calendar-agenda { order: -1; }
.calendar-left-col .calendar-shell  { order: 0; }

/* The drag handle between the two columns. Hidden while the page is a single
   stacked column - there is nothing to resize then. */
.cal-col-resizer {
  display: none;
}

@media (min-width: 1081px) {
  /* --cal-left-w is set by dragging the divider and remembered per device. With
     no saved width we fall back to the 1:2 ratio, i.e. the left column is 1/3. */
  .calendar-page-2col {
    grid-template-columns: var(--cal-left-w, minmax(280px, 1fr)) 6px minmax(0, 2fr);
    align-items: start;
    /* 7 + 6 (handle) + 7 = the same 20px separation as before */
    column-gap: 7px;
  }
  /* Keep the wide calendar aligned to the top of the row */
  .calendar-page-2col > .board-cal-section.cal-page-variant {
    min-width: 0;
  }

  .cal-col-resizer {
    display: block;
    align-self: stretch; /* beats the container's align-items:start */
    position: relative;
    min-height: 140px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: col-resize;
    touch-action: none; /* let pointermove drive the drag, not the page scroll */
  }
  /* The visible bar. Subtle until hovered, focused or dragged. */
  .cal-col-resizer::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 4px;
    transform: translateX(-50%);
    border-radius: 999px;
    background: var(--line);
    opacity: 0.55;
    transition: background 0.15s ease, opacity 0.15s ease;
  }
  .cal-col-resizer:hover::before,
  .cal-col-resizer:focus-visible::before,
  .cal-col-resizer.is-dragging::before {
    background: var(--accent);
    opacity: 1;
  }
  .cal-col-resizer:focus-visible {
    outline: none;
  }
}

/* While dragging: keep the resize cursor everywhere and stop the drag from
   selecting text across the page. */
body.cal-col-resizing {
  cursor: col-resize;
  user-select: none;
}

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

/* Calendar sync strip - below month/week grid */
.cal-sync-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

/* Sync items reuse custody-schedule-btn; just override layout defaults */
.cal-sync-item {
  justify-self: unset;
  align-self: unset;
}

.cal-sync-connected {
  color: var(--accent) !important;
  border-color: var(--accent) !important;
  background: var(--accent-weak) !important;
}

.cal-sync-gear-btn {
  justify-self: unset;
  align-self: unset;
  margin-left: auto;
}

/* Custom-dates recurrence picker */
.custom-dates-picker {
  margin-top: 8px;
}
.custom-dates-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  min-height: 24px;
}
.custom-date-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--color-accent, #0d9488);
  color: #fff;
  border-radius: 12px;
  padding: 2px 8px 2px 10px;
  font-size: 12px;
  font-weight: 500;
}
.custom-date-chip button {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
  opacity: 0.8;
}
.custom-date-chip button:hover { opacity: 1; }
.custom-dates-hint {
  font-size: 12px;
  color: var(--color-text-muted, #888);
  font-style: italic;
}

.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: 12px;
  background: #f4f4f4;
}

.calendar-view-switcher button {
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  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: 8px;
  background: #f5f6f2;
  color: var(--ink);
  display: grid;
  place-items: center;
  gap: 3px;
  padding: 5px;
}

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

.calendar-day.selected {
  /* Teal accent fill in both light and dark mode (never black). */
  background: var(--accent);
  color: #13201e;
}

.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: 10px;
  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: 10px;
  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: var(--custody-mine-color, #65d6c6);
  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: var(--custody-co-color, #76808a);
  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: 10px;
  padding: 14px;
  background: #f5f6f2;
  color: var(--ink);
  text-align: left;
}

/* Handover (przekazanie) row in the day agenda - tinted with the two parents'
   colours so it reads as a handover, not a Do card. */
.agenda-handover-card {
  cursor: pointer;
  background: linear-gradient(to right,
    color-mix(in srgb, var(--custody-mine-color, #65d6c6) 16%, #f5f6f2),
    color-mix(in srgb, var(--custody-co-color, #76808a) 16%, #f5f6f2));
}
html[data-theme="dark"] .agenda-handover-card {
  background: linear-gradient(to right,
    color-mix(in srgb, var(--custody-mine-color, #65d6c6) 24%, var(--paper)),
    color-mix(in srgb, var(--custody-co-color, #76808a) 24%, var(--paper)));
}
.agenda-handover-card .card-handover-badge {
  margin-right: 4px;
  font-weight: 800;
}

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

.agenda-badge {
  border-radius: 6px;
  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 column grid (Teams-style) ─────────────────────────────────────── */

.week-grid-view {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface, #fff);
  max-height: 72vh;
  font-size: 12px;
}
.wg-header {
  display: grid;
  grid-template-columns: 52px repeat(7, 1fr);
  border-bottom: 2px solid var(--line);
  background: var(--bg, #f8f8f5);
  position: sticky;
  top: 0;
  z-index: 2;
}
.wg-allday-row {
  display: grid;
  grid-template-columns: 52px repeat(7, 1fr);
  border-bottom: 1px solid var(--line);
  background: var(--bg, #f8f8f5);
  min-height: 36px;
}
.wg-allday-label {
  font-size: 10px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 6px;
}
.wg-allday-cell {
  border-left: 1px solid var(--line);
  padding: 4px 4px;
  min-height: 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  align-items: flex-start;
}
.wg-col-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 2px 6px;
  gap: 1px;
  border-left: 1px solid var(--line);
  cursor: pointer;
  user-select: none;
}
.wg-col-head:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.wg-col-dow {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.wg-col-num {
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
}
.wg-today .wg-col-num {
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.wg-today .wg-col-dow { color: var(--accent); }
.wg-vac-dot { font-size: 10px; }
.wg-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.wg-row {
  display: grid;
  grid-template-columns: 52px repeat(7, 1fr);
  min-height: 52px;
  border-bottom: 1px solid var(--line);
}
.wg-row:last-child { border-bottom: none; }
.wg-time-label {
  font-size: 10px;
  color: var(--muted);
  padding: 6px 6px 0 4px;
  text-align: right;
  line-height: 1;
  user-select: none;
  flex-shrink: 0;
}
.wg-slot-cell {
  border-left: 1px solid var(--line);
  padding: 3px 4px;
  min-height: 52px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: background 0.1s;
}
.wg-slot-cell.wg-drop-target,
.wg-allday-cell.wg-drop-target {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
  border-radius: 4px;
}
/* Card chips inside grid cells */
.wg-card {
  background: var(--accent, #0d9488);
  color: #fff;
  border-radius: 6px;
  padding: 3px 6px;
  cursor: grab;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 24px;
  user-select: none;
  transition: opacity 0.15s, box-shadow 0.15s;
  overflow: hidden;
  max-width: 100%;
}
.wg-card:hover { box-shadow: 0 2px 6px rgba(0,0,0,0.18); }
.wg-card.wg-dragging { opacity: 0.45; cursor: grabbing; }
.wg-card.wg-card-done { background: var(--muted, #999); opacity: 0.6; }
.wg-card-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
.wg-card-time {
  font-size: 10px;
  opacity: 0.8;
  flex-shrink: 0;
}
.wg-card-avatar {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
/* Custody tints on day columns */
.wg-col-head.custody-mine  { border-top: 3px solid var(--custody-mine-color, #4d9cf8); }
.wg-col-head.custody-co    { border-top: 3px solid var(--custody-co-color, #f59e0b); }
.wg-col-head.custody-split {
  border-top: 3px solid transparent;
  border-image: linear-gradient(to right, var(--custody-mine-color, #65d6c6) 50%, var(--custody-co-color, #f59e0b) 50%) 1;
}
.wg-col-head.custody-split.custody-split-co-first {
  border-image: linear-gradient(to right, var(--custody-co-color, #f59e0b) 50%, var(--custody-mine-color, #65d6c6) 50%) 1;
}

/* Hide week grid on mobile, show classic week-strip */
@media (max-width: 700px) {
  .week-grid-view { display: none; }
}
/* Hide mobile fallback strip on desktop */
@media (min-width: 701px) {
  .week-strip-mobile-only { display: none; }
}

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

/* Week view simplified strip (Teams calendar handles scheduling) */
.week-strip-view {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  padding: 4px 0;
}

.week-strip-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 6px;
  border-radius: 14px;
  border: 2px solid transparent;
  background: var(--surface-raised);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.week-strip-day:hover { background: color-mix(in srgb, var(--accent) 8%, var(--surface-raised)); }

.week-strip-day.week-strip-selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface-raised));
}

.week-strip-day.week-strip-today .week-strip-num {
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.week-strip-dow {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.week-strip-num {
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

.week-strip-count {
  font-size: 10px;
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  padding: 1px 6px;
  font-weight: 700;
}

/* Custody colouring on week strip days - matches the month calendar cells:
   soft tint background + 4px colour bar on top (split: left/right gradient) */
.week-strip-day.custody-mine  {
  border-top: 4px solid var(--custody-mine-color, #65d6c6);
  background: var(--custody-mine-bg, rgba(101,214,198,0.18));
}
.week-strip-day.custody-co    {
  border-top: 4px solid var(--custody-co-color, #f59e0b);
  background: var(--custody-co-bg, rgba(118,128,138,0.13));
}
.week-strip-day.custody-split {
  border-top: 4px solid transparent;
  background:
    linear-gradient(to right, var(--custody-mine-color, #65d6c6) 50%, var(--custody-co-color, #f59e0b) 50%) 0 0 / 100% 4px no-repeat,
    linear-gradient(
      to right,
      color-mix(in srgb, var(--custody-mine-color, #65d6c6) 22%, transparent) 50%,
      color-mix(in srgb, var(--custody-co-color, #f59e0b) 22%, transparent) 50%
    );
}
.week-strip-day.custody-split.custody-split-co-first {
  background:
    linear-gradient(to right, var(--custody-co-color, #f59e0b) 50%, var(--custody-mine-color, #65d6c6) 50%) 0 0 / 100% 4px no-repeat,
    linear-gradient(
      to right,
      color-mix(in srgb, var(--custody-co-color, #f59e0b) 22%, transparent) 50%,
      color-mix(in srgb, var(--custody-mine-color, #65d6c6) 22%, transparent) 50%
    );
}

/* Selected day on the week strip = solid teal accent fill, identical to the
   month view's selected cell in both light and dark mode (never black).
   Listed AFTER the custody rules so it overrides their tint - the current day
   looks the same in every calendar view. */
.week-strip-day.week-strip-selected,
.week-strip-day.week-strip-selected.custody-mine,
.week-strip-day.week-strip-selected.custody-co,
.week-strip-day.week-strip-selected.custody-split {
  background: var(--accent);
  border-color: var(--accent);
  color: #13201e;
}
.week-strip-day.week-strip-selected .week-strip-dow,
.week-strip-day.week-strip-selected .week-strip-num {
  color: #13201e;
}
/* When the selected day is also today, drop the teal number-circle so the
   solid fill is the single highlight (matches the month view). */
.week-strip-day.week-strip-selected.week-strip-today .week-strip-num {
  background: transparent;
  color: #13201e;
  width: auto;
  height: auto;
}

.week-day {
  min-height: 92px;
  border: 0;
  border-radius: 10px;
  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));
}

/* Messages feed - cards with messages */
.messages-feed {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0;
}

.messages-empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.messages-feed-card {
  background: var(--surface-card);
  border: 1px solid var(--border, rgba(23,25,24,0.1));
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: background 0.15s;
}

.messages-feed-card:hover {
  background: var(--surface-raised);
}

.messages-feed-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.messages-feed-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.messages-feed-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.messages-feed-last {
  font-size: 13px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.messages-feed-author {
  font-weight: 600;
  margin-right: 4px;
}

.messages-feed-body {
  color: var(--muted);
}

.messages-feed-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
}

.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);
}

/* Permanent system notices (e.g. account-deletion record) - centred, no avatar */
.message-card.message-system {
  grid-template-columns: 1fr;
  background: transparent;
  padding: 8px 12px;
  justify-items: center;
}

.message-system-text {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
  text-align: center;
}

.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-y: auto;
    overflow-x: hidden;
    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"] .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"] .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"] .card-sync {
  background: #303a38;
  color: var(--ink);
}

html[data-theme="dark"] .card-footer-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid rgba(197, 194, 182, 0.25);
}

html[data-theme="dark"] .card-people-action-btn:hover {
  background: rgba(197, 194, 182, 0.1);
}

html[data-theme="dark"] .mc-day {
  background: rgba(197, 194, 182, 0.07);
}
html[data-theme="dark"] .mc-day.custody-mine {
  background: var(--custody-mine-bg, rgba(101, 214, 198, 0.14));
}
html[data-theme="dark"] .mc-day.custody-co {
  background: var(--custody-co-bg, rgba(118, 128, 138, 0.10));
}
html[data-theme="dark"] .mc-day.mc-selected {
  background: var(--accent) !important;
}

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: #18201f;
}

html[data-theme="dark"] .calendar-view-switcher button {
  color: var(--muted);
}

html[data-theme="dark"] .calendar-view-switcher button.active {
  background: #31403d;
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(31, 41, 35, 0.08);
}

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 {
  margin-top: 12px;
}

/* Single pill: [ 🎤  type here... ──── + ] */
.shopping-input-wrap {
  display: flex;
  align-items: center;
  border-radius: 999px;
  background: rgba(101, 214, 198, 0.12);
  padding: 3px;
  gap: 0;
}

.shopping-capture input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 9px 8px;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  outline: none;
}

.shopping-mic {
  display: inline-grid;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  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 {
  display: inline-grid;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  background: var(--accent);
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
}

html[data-theme="dark"] .shopping-input-wrap {
  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));
  /* Match the app: use the real theme variables (the old --card-bg/--text/--border
     don't exist here, so the title fell back to near-black and was invisible on the
     dark surface). --paper/--ink/--line adapt to light and dark. */
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--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-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}

.notif-prompt-body {
  font-size: 13px;
  color: var(--ink);
  opacity: 0.8;
  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;
}

/* Privacy link in the Settings footer, next to the build date */
.settings-version-panel { flex-wrap: wrap; gap: 8px 16px; }
.settings-version-meta {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.settings-version-privacy {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.settings-version-privacy:hover { color: var(--ink); }
.settings-legal-links { display: inline-flex; align-items: center; gap: 14px; flex-wrap: wrap; }

/* flex-direction: column already set in base .sidebar rule */

/* ─── 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;
}

.card-type-kid {
  background: color-mix(in srgb, #f59e0b 14%, transparent);
  color: #b45309;
  text-transform: none;
  letter-spacing: 0;
}
html[data-theme="dark"] .card-type-kid {
  background: color-mix(in srgb, #fbbf24 12%, transparent);
  color: #fbbf24;
}

/* ─── 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; }

/* ─── Settlement banner ──────────────────────────────────────────────────────── */

.settlement-banner {
  margin: 0 0 12px;
  padding: 14px 16px;
  background: var(--surface-raised, #f8f9fa);
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 14px;
}

.settlement-banner-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 12px;
}

.settlement-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  margin-bottom: 2px;
}

.settlement-amount {
  display: block;
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.1;
}

.settlement-who-owes {
  font-size: 13px;
  font-weight: 700;
}

.settlement-request-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 11px 14px;
  background: var(--ink, #1a1a1a);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  justify-content: center;
  transition: opacity .15s;
}

.settlement-request-btn:hover { opacity: .85; }
.settlement-request-btn:active { opacity: .7; }

/* Settlement modal items */
.settlement-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--line, #e5e7eb);
  gap: 8px;
}

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

.settlement-item-left { flex: 1; }

.settlement-item-title {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.settlement-item-date {
  font-size: 11px;
  color: var(--muted);
}

.settlement-item-right {
  text-align: right;
  flex-shrink: 0;
}

.settlement-item-total {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.settlement-item-share {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

/* Dark mode adjustments */
html[data-theme="dark"] .settlement-banner {
  background: var(--surface-raised, #1e1e1e);
  border-color: var(--line, #2e2e2e);
}

html[data-theme="dark"] .settlement-request-btn {
  background: var(--surface-alt, #2a2a2a);
  color: #fff;
  border: 1px solid var(--line, #3a3a3a);
}

/* ─── Settlement dialog internals ───────────────────────────────────────────── */

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

.sdlg-content {
  gap: 20px;
}

/* Balance strip */
.sdlg-balance-strip {
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sdlg-balance-positive {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}

.sdlg-balance-negative {
  background: #fff1f2;
  border: 1px solid #fecdd3;
}

.sdlg-balance-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 2px;
}

.sdlg-balance-amount {
  display: block;
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
}

.sdlg-balance-positive .sdlg-balance-amount { color: #15803d; }
.sdlg-balance-negative .sdlg-balance-amount { color: #dc2626; }

.sdlg-balance-breakdown {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
}

/* Section label */
.sdlg-section-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  margin: 0 0 8px;
}

/* Breakdown rows */
.sdlg-rows {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

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

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

.sdlg-row-left { flex: 1; }

.sdlg-row-title {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.sdlg-row-meta {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
}

.sdlg-row-right {
  text-align: right;
  flex-shrink: 0;
}

.sdlg-row-total {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.sdlg-row-share {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

.sdlg-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px 2px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.sdlg-total-row strong {
  color: var(--ink);
  font-size: 15px;
}

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

/* BLIK row */
.sdlg-blik-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-input, #fafafa);
  color: var(--muted);
}

.sdlg-phone-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14px;
  color: var(--ink);
  outline: none;
}

/* Message */
.sdlg-message {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--surface-input, #fafafa);
  resize: vertical;
  box-sizing: border-box;
  font-family: inherit;
}

.sdlg-field-hint {
  font-size: 11px;
  color: var(--muted);
  margin: 4px 0 0;
}

.sdlg-send-btn {
  display: flex;
  align-items: center;
  gap: 7px;
}

.sdlg-legal-note {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  margin: -8px 0 0;
  padding: 0 8px;
}

/* Dark mode */
html[data-theme="dark"] .sdlg-balance-positive {
  background: rgba(21,128,61,.12);
  border-color: rgba(21,128,61,.3);
}

html[data-theme="dark"] .sdlg-balance-negative {
  background: rgba(220,38,38,.12);
  border-color: rgba(220,38,38,.3);
}

html[data-theme="dark"] .sdlg-blik-row,
html[data-theme="dark"] .sdlg-message {
  background: var(--surface-input, #1e1e1e);
}

/* ─── 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 ─────────────────────────
   Unified rule: ALL views (month cell, week strip button, day heading) use the
   same 4 px top color bar so the marking is instantly recognisable everywhere.
   Split days get a 50/50 left-right gradient on that bar.
   ──────────────────────────────────────────────────────────────────────────── */

/* Shared top-bar mixin applied to month cells, week-strip buttons, day heading, and week-overview buttons */

/* calendar-day and week-day have no border-radius issue - use border-top + border-image as before */
.calendar-day.custody-mine,
.week-day.custody-mine,
.custody-week-ov-day.custody-mine {
  border-top: 4px solid var(--custody-mine-color, #65d6c6);
}
.calendar-day.custody-co,
.week-day.custody-co,
.custody-week-ov-day.custody-co {
  border-top: 4px solid var(--custody-co-color, #f59e0b);
}
.calendar-day.custody-split,
.week-day.custody-split,
.custody-week-ov-day.custody-split {
  border-top: 4px solid transparent;
  border-image: linear-gradient(
    to right,
    var(--custody-mine-color, #65d6c6) 50%,
    var(--custody-co-color, #f59e0b) 50%
  ) 1;
}
.calendar-day.custody-split.custody-split-co-first,
.week-day.custody-split.custody-split-co-first,
.custody-week-ov-day.custody-split.custody-split-co-first {
  border-image: linear-gradient(
    to right,
    var(--custody-co-color, #f59e0b) 50%,
    var(--custody-mine-color, #65d6c6) 50%
  ) 1;
}

/* day-heading has border-radius:24px — border-image won't show, use box-shadow inset instead */
.day-heading.custody-mine {
  box-shadow: inset 0 4px 0 var(--custody-mine-color, #65d6c6);
}
.day-heading.custody-co {
  box-shadow: inset 0 4px 0 var(--custody-co-color, #f59e0b);
}
/* Split: 50/50 gradient strip via background-image; mine-first by default */
.day-heading.custody-split {
  background:
    linear-gradient(to right,
      var(--custody-mine-color, #65d6c6) 50%,
      var(--custody-co-color, #f59e0b) 50%
    ) 0 0 / 100% 4px no-repeat,
    var(--day-card-bg, #f5f6f2);
}
.day-heading.custody-split.custody-split-co-first {
  background:
    linear-gradient(to right,
      var(--custody-co-color, #f59e0b) 50%,
      var(--custody-mine-color, #65d6c6) 50%
    ) 0 0 / 100% 4px no-repeat,
    var(--day-card-bg, #f5f6f2);
}
html[data-theme="dark"] .day-heading.custody-split,
html[data-theme="dark"] .day-heading.custody-split.custody-split-co-first {
  --day-card-bg: #1e2023;
}

/* Keep subtle background tint on month cells and week-overview buttons for at-a-glance scanning */
.calendar-day.custody-mine,
.custody-week-ov-day.custody-mine  { background: var(--custody-mine-bg, rgba(101,214,198,0.18)); }
.calendar-day.custody-co,
.custody-week-ov-day.custody-co    { background: var(--custody-co-bg, rgba(118,128,138,0.13)); }
.calendar-day.custody-split,
.custody-week-ov-day.custody-split {
  background: linear-gradient(
    to right,
    color-mix(in srgb, var(--custody-mine-color, #65d6c6) 22%, transparent) 50%,
    color-mix(in srgb, var(--custody-co-color, #f59e0b) 22%, transparent) 50%
  );
}
.calendar-day.custody-split.custody-split-co-first,
.custody-week-ov-day.custody-split.custody-split-co-first {
  background: linear-gradient(
    to right,
    color-mix(in srgb, var(--custody-co-color, #f59e0b) 22%, transparent) 50%,
    color-mix(in srgb, var(--custody-mine-color, #65d6c6) 22%, transparent) 50%
  );
}

/* Selected / focused states override the custody tint with the teal accent
   (both light and dark mode - never black). */
.calendar-day.custody-mine.selected,
.calendar-day.custody-co.selected,
.calendar-day.custody-split.selected {
  background: var(--accent);
  color: #13201e;
}

/* Dark mode - keep tints readable */
html[data-theme="dark"] .calendar-day.custody-mine,
html[data-theme="dark"] .custody-week-ov-day.custody-mine  { background: var(--custody-mine-bg, rgba(101,214,198,0.14)); }
html[data-theme="dark"] .calendar-day.custody-co,
html[data-theme="dark"] .custody-week-ov-day.custody-co    { background: var(--custody-co-bg, rgba(118,128,138,0.10)); }
/* Split days need a dark-mode override too, otherwise the plain dark
   `.calendar-day` background (higher specificity) hides the left/right split
   gradient - which made split days look solid in the month view while the
   schedule editor showed them split. Now they match. */
html[data-theme="dark"] .calendar-day.custody-split,
html[data-theme="dark"] .custody-week-ov-day.custody-split {
  background: linear-gradient(
    to right,
    color-mix(in srgb, var(--custody-mine-color, #65d6c6) 22%, transparent) 50%,
    color-mix(in srgb, var(--custody-co-color, #f59e0b) 22%, transparent) 50%
  );
}
html[data-theme="dark"] .calendar-day.custody-split.custody-split-co-first,
html[data-theme="dark"] .custody-week-ov-day.custody-split.custody-split-co-first {
  background: linear-gradient(
    to right,
    color-mix(in srgb, var(--custody-co-color, #f59e0b) 22%, transparent) 50%,
    color-mix(in srgb, var(--custody-mine-color, #65d6c6) 22%, transparent) 50%
  );
}
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: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 14px;
  cursor: pointer;
  align-self: center;
  justify-self: end;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.custody-schedule-btn:hover {
  color: var(--ink);
  background: rgba(0, 0, 0, 0.05);
  border-color: var(--ink);
}

/* ─── Custody day strip in agenda panel ─────────────────────────────────────── */
.custody-day-strip {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 10px;
  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: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.custody-chip:hover {
  color: var(--ink);
  background: rgba(0, 0, 0, 0.05);
  border-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.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 {
  /* Solid teal fill, matching the month view's selected/current day so the
     current day looks identical in every calendar view. */
  background: var(--accent);
  border-color: var(--accent);
  color: #13201e;
}
/* Selecting a day resets border-color above, which would hide the custody
   top-border color. Re-assert it so you can still see who has the child.
   Split days keep their gradient because it is drawn with border-image. */
.custody-week-ov-day.custody-mine.selected {
  border-top-color: var(--custody-mine-color, #65d6c6);
}
.custody-week-ov-day.custody-co.selected {
  border-top-color: var(--custody-co-color, #f59e0b);
}
.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(--accent);
  color: #13201e;
}

/* ─── Custody schedule dialog body ──────────────────────────────────────────── */
.custody-schedule-dialog {
  max-width: 440px;
  border: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
}
.custody-dialog-body {
  padding: 20px 20px 16px;
  background: var(--paper);
  border-radius: 18px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.12);
}
.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;
}

/* ─── Calendar toolbar row (schedule + vacations side-by-side) ──────────── */

.calendar-toolbar-row {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.custody-vacations-btn {
  background: var(--surface-card, #fff);
  border: 1px solid var(--line);
  gap: 5px;
}
html[data-theme="dark"] .custody-vacations-btn {
  background: var(--surface-raised, #1e2027);
}
.vac-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  line-height: 1;
}

/* ─── Calendar right-panel tab bar ─────────────────────────────────────── */

.cal-panel-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 5px;
  border-radius: 12px;
  background: #f4f4f4;
  flex-shrink: 0;
}
html[data-theme="dark"] .cal-panel-tabs {
  background: #18201f;
}
.cal-panel-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.cal-panel-tab.active {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(31, 41, 35, 0.08);
}
html[data-theme="dark"] .cal-panel-tab.active {
  background: #31403d;
  color: var(--ink);
}
.cal-panel-tab:hover:not(.active) {
  color: var(--ink);
  background: rgba(0,0,0,0.04);
}
.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent, #65d6c6);
  color: #fff;
  border-radius: 8px;
  font-size: 9px;
  font-weight: 800;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  line-height: 1;
}

/* ─── Care tools list (replaces the calendar panel tab bar) ────────────── */

.care-tools {
  margin-top: 14px;
  border-top: 1px solid rgba(31, 41, 35, 0.08);
  padding-top: 8px;
}
.care-tools-title {
  margin: 0 0 2px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.care-tools-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 0 2px;
  border: 0;
  border-bottom: 1px solid rgba(31, 41, 35, 0.06);
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  transition: color 0.15s;
}
.care-tools-row:last-child {
  border-bottom: 0;
}
.care-tools-row:hover {
  color: var(--accent, #65d6c6);
}
.care-tools-row svg {
  color: var(--muted);
  flex-shrink: 0;
}
.care-tools-row > span:first-of-type {
  flex: 1;
  min-width: 0;
}
.care-tools-chevron {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 18px;
  font-weight: 400;
  line-height: 1;
}
html[data-theme="dark"] .care-tools {
  border-top-color: rgba(255, 255, 255, 0.08);
}
html[data-theme="dark"] .care-tools-row {
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

.care-panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.care-panel-head strong {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
}

/* ─── Calendar panel content areas ─────────────────────────────────────── */

.cal-panel-content {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
}

.cal-inline-panel-schedule,
.cal-inline-panel-changes,
.cal-inline-panel-vacations {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 16px;
}
.sched-panel-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}
.sched-panel-actions .primary-button {
  flex: 1;
  min-width: 120px;
}
.changes-section-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.04em;
  padding: 4px 0 6px;
  border-bottom: 1px solid var(--line);
}

/* ─── Vacation indicator on calendar days ─────────────────────────────────── */

.calendar-day.vacation-period {
  outline: 2px solid var(--accent, #4d9cf8);
  outline-offset: -2px;
}
.vacation-dot {
  font-size: 9px;
  line-height: 1;
  opacity: 0.85;
  display: inline-block;
}

/* ─── Vacation management list ────────────────────────────────────────────── */

.vacation-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.vacation-list-item:last-child {
  border-bottom: none;
}
.vacation-list-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.vacation-list-info strong {
  font-size: 13px;
  color: var(--ink);
}
.vacation-list-info span {
  font-size: 11px;
  color: var(--muted);
}
.vacation-list-owner {
  font-size: 11px;
  color: var(--accent);
}
.vacation-add-details summary {
  user-select: none;
  list-style: none;
}
.vacation-add-details summary::-webkit-details-marker { display: none; }

/* ─── Vacation dialog v2 ──────────────────────────────────────────────────── */

.vac-dialog-body {
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.vac-dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.vac-dialog-header h3 {
  margin: 0;
  font-size: 16px;
}
.vac-dialog-desc {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 12px;
}
.vac-empty-msg {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  padding: 10px 0;
  margin: 0;
}
.vac-item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.vac-edit-btn {
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  padding: 3px 8px;
  line-height: 1;
  transition: color 0.15s, border-color 0.15s;
}
.vac-edit-btn:hover, .vac-edit-btn.active {
  color: var(--accent);
  border-color: var(--accent);
}
.vacation-list-item.vac-editing {
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  border-radius: 8px;
  padding-left: 6px;
  margin-left: -6px;
}
.vac-form-section {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.vac-form-heading {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}
/* Range calendar reuses .mini-cal-picker sizing but sits inline */
.vac-range-cal {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  padding: 8px;
}
/* Date in an active range gets a band background */
.mc-day.vac-in-range {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  border-radius: 0;
  color: var(--ink);
}
td.vac-in-range-cell {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
/* Start/end endpoints */
.mc-day.vac-ep {
  background: var(--accent) !important;
  color: #fff !important;
  border-radius: 50% !important;
}
/* Other existing vacation days shown as amber hint */
.mc-day.vac-existing-day {
  background: color-mix(in srgb, #f59e0b 25%, transparent);
  color: var(--ink);
}
.vac-range-display {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  flex-wrap: wrap;
}
.vac-range-label {
  color: var(--muted);
}
.vac-range-val {
  font-weight: 600;
  color: var(--ink);
  font-size: 13px;
}
.vac-range-val.placeholder {
  color: var(--muted);
  font-weight: 400;
  font-style: italic;
}
.vac-range-arrow {
  color: var(--muted);
}
.vac-range-clear-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  padding: 0 4px;
  margin-left: 4px;
}
.vac-range-clear-btn:hover { color: var(--danger, #ef4444); }
/* Manual date inputs below vacation calendar */
.vac-date-inputs-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.vac-date-inputs-row .clean-field {
  flex: 1;
  min-width: 0;
}
.vac-date-hint {
  font-size: 11px;
  color: var(--muted);
  margin: 0;
  padding: 0;
}
/* Change request dialog mini calendar */
.cr-single-cal {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  padding: 8px;
}
.vac-form-btns {
  display: flex;
  gap: 8px;
  align-items: center;
}
#vacAlternatingRows { display: flex; flex-direction: column; gap: 8px; }
#vacAlternatingRows.hidden { display: none; }

/* ─── Custody vacation banner in day strip ────────────────────────────────── */

.custody-vacation-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  color: var(--accent);
  margin-top: 6px;
  gap: 8px;
}

/* ─── Change request cards in agenda ──────────────────────────────────────── */

.change-request-card {
  background: var(--surface-card, #fff);
  border: 1px solid var(--line);
  border-left: 3px solid #f59e0b;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
html[data-theme="dark"] .change-request-card {
  background: var(--surface-raised, #1e2027);
}
.change-request-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.change-request-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.change-request-status {
  font-size: 11px;
  font-weight: 700;
}
.change-request-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.change-request-body strong {
  font-size: 13px;
  color: var(--ink);
}
.change-request-reason {
  font-size: 12px;
  color: var(--muted);
}
.change-request-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 2px;
}

/* ─── "Change" chip in custody strip ─────────────────────────────────────── */

.custody-chip-secondary {
  color: var(--muted) !important;
  border-color: var(--line) !important;
  font-size: 11px;
}

/* ─── Parenting Schedule Editor Dialog ──────────────────────────────────────── */

.sched-editor-dialog {
  max-width: 460px;
  width: 100%;
}

.sched-editor-content {
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
}

.sched-dialog-body {
  overflow-y: auto;
  padding: 4px 0 8px;
  flex: 1;
}

/* Month calendar grid */
.sched-month-cal {
  margin-bottom: 4px;
}

.sched-cal-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.sched-cal-table thead th {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  padding: 4px 0 6px;
  letter-spacing: 0.03em;
}

.sched-cal-table td {
  padding: 2px;
  text-align: center;
}

.sched-day-btn {
  width: 100%;
  aspect-ratio: 1;
  border: 2px solid transparent;
  border-radius: 8px;
  background: var(--soft);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  transition: border-color 0.1s, transform 0.1s;
  position: relative;
  line-height: 1;
}

.sched-day-btn:hover {
  border-color: var(--accent, #65d6c6);
  transform: scale(1.08);
}

/* Custody colouring - matches the month calendar cells exactly:
   soft tint background + 4px colour bar on top; split days show a
   left/right 50/50 gradient. The top bar is drawn as a background
   strip (not border-image) so border-radius and the selection border
   keep working. */
.sched-day-btn.sched-mine {
  background: var(--custody-mine-bg, rgba(101,214,198,0.18));
  border-top: 4px solid var(--custody-mine-color, #65d6c6);
}

.sched-day-btn.sched-co {
  background: var(--custody-co-bg, rgba(118,128,138,0.13));
  border-top: 4px solid var(--custody-co-color, #f59e0b);
}

.sched-day-btn.sched-split {
  border-top: 4px solid transparent;
  background:
    linear-gradient(to right, var(--custody-mine-color, #65d6c6) 50%, var(--custody-co-color, #f59e0b) 50%) 0 0 / 100% 4px no-repeat,
    linear-gradient(
      to right,
      color-mix(in srgb, var(--custody-mine-color, #65d6c6) 22%, transparent) 50%,
      color-mix(in srgb, var(--custody-co-color, #f59e0b) 22%, transparent) 50%
    );
}

.sched-day-btn.sched-split.sched-split-co-first {
  background:
    linear-gradient(to right, var(--custody-co-color, #f59e0b) 50%, var(--custody-mine-color, #65d6c6) 50%) 0 0 / 100% 4px no-repeat,
    linear-gradient(
      to right,
      color-mix(in srgb, var(--custody-co-color, #f59e0b) 22%, transparent) 50%,
      color-mix(in srgb, var(--custody-mine-color, #65d6c6) 22%, transparent) 50%
    );
}

/* Today = solid teal fill, identical to the month view's current day.
   Applies to every picker that uses sched-day-btn: Harmonogram opieki editor,
   Request Change (Zamiany dni) popup, and the Wakacje date picker.
   The stacked selectors out-rank the custody split background rules so the
   teal fill always wins; the custody top bar is kept, same as the month view. */
.sched-day-btn.sched-today,
.sched-day-btn.sched-mine.sched-today,
.sched-day-btn.sched-co.sched-today,
.sched-day-btn.sched-split.sched-today,
.sched-day-btn.sched-split.sched-split-co-first.sched-today {
  font-weight: 800;
  background: var(--accent, #65d6c6);
  color: #13201e;
}

.sched-day-btn.sched-selected {
  border-color: var(--ink) !important;
  border-width: 2px;
  transform: scale(1.08);
}

.sched-day-btn.sched-override {
  font-weight: 800;
}

/* Dashed ring for pending (divorced mode) changes not yet sent */
.sched-day-btn.sched-pending {
  outline: 2px dashed var(--accent, #f59e0b);
  outline-offset: 1px;
}

.sched-split-dot {
  font-size: 8px;
  line-height: 1;
  color: var(--muted);
}

/* Plane marker on the days of a vacation being set - coloured (inline style) to
   the chosen parent. Flows below the day number like the split dot. */
.vac-cell-plane {
  font-size: 9px;
  line-height: 1;
  margin-top: 1px;
  pointer-events: none;
}

/* Day action panel */
.sched-day-panel {
  background: var(--soft);
  border-radius: 12px;
  padding: 10px 12px;
  margin: 8px 0 6px;
}

.sched-day-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
}

.sched-day-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sched-day-hint {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  padding: 10px 0;
  margin: 0;
}

/* Handover panel (split day) */
.sched-handover-panel {
  margin-top: 10px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.sched-handover-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 120px;
}

.sched-handover-field span {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sched-handover-field input,
.sched-handover-field select {
  font-size: 13px;
  padding: 6px 8px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
}

/* Propagate section */
.sched-propagate-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 0 4px;
  border-top: 1px solid var(--line);
  margin-top: 8px;
}

.sched-propagate-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sched-propagate-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Divorced mode notice */
.sched-divorced-notice {
  background: color-mix(in srgb, #f59e0b 12%, transparent);
  border: 1px solid color-mix(in srgb, #f59e0b 35%, transparent);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--ink);
  margin: 6px 0;
}

/* Pending changes list (divorced mode) */
.sched-pending-section {
  background: var(--soft);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  margin: 6px 0;
}

.sched-pending-list {
  margin: 6px 0 0;
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sched-pending-list li {
  font-size: 12px;
  color: var(--ink);
}

/* Settings panel buttons for schedule/vacation */
.sched-settings-buttons {
  align-items: center;
}

.sched-settings-open-btn {
  white-space: nowrap;
  flex-shrink: 0;
}

/* Multi-day selection helpers */
.sched-sel-count {
  display: block;
  font-size: 11px;
  color: var(--text-secondary, #888);
  margin-top: 4px;
  font-style: italic;
}
.sched-day-label {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.sched-clear-sel {
  font-size: 11px;
  padding: 2px 8px;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 10px;
  background: transparent;
  color: var(--text-secondary, #888);
  cursor: pointer;
}
.sched-clear-sel:hover { background: var(--surface-hover, #f0f0f0); }
.sched-clear-schedule-btn {
  font-size: 12px;
  color: var(--danger, #e53935);
  border-color: var(--danger, #e53935);
  opacity: 0.8;
  width: 100%;
}
.sched-clear-schedule-btn:hover { opacity: 1; }

/* Vacation range picking on the shared calendar */
.sched-day-btn.vac-range-start,
.sched-day-btn.vac-range-end {
  outline: 3px solid var(--accent, #2196f3);
  outline-offset: 1px;
}
.sched-day-btn.vac-range-in {
  opacity: 0.65;
  outline: 2px dashed var(--accent, #2196f3);
  outline-offset: 1px;
}
td.vac-range-in-cell {
  background: color-mix(in srgb, var(--accent, #2196f3) 8%, transparent);
}
.sched-day-btn.vac-existing-day {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ─── SEG-13: Guest preview (read-only invite, no account) ─────────────────── */

.guest-preview-link {
  display: block;
  width: 100%;
  margin: 14px 0 0;
  padding: 10px;
  background: none;
  border: none;
  color: var(--accent-strong, var(--ink));
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

.guest-preview-note {
  margin: 2px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.guest-preview-phone {
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

.guest-banner {
  margin: 12px 0;
  padding: 10px 14px;
  border-radius: var(--radius-md, 16px);
  background: var(--soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.guest-card-list {
  flex: 1;
  min-height: 80px;
  overflow-y: auto;
  margin: 8px 0 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.guest-card-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md, 16px);
  background: var(--surface-card, var(--paper));
  border: 1px solid var(--line);
}

.guest-card-row strong {
  flex: 1 1 100%;
  font-weight: 800;
}

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

.guest-card-status {
  margin-left: auto;
  font-style: normal;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: var(--radius-full, 999px);
  background: var(--soft);
  color: var(--muted);
}

.guest-empty {
  text-align: center;
  color: var(--muted);
  padding: 24px 0;
}

.guest-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.guest-actions .auth-switch-button {
  width: 100%;
}

.guest-privacy-line {
  margin: 14px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.guest-privacy-line a {
  color: inherit;
  font-weight: 700;
}

/* ─── SEG-16: Payment history ledger panel ─────────────────────────────────── */

.ledger-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  gap: 6px;
}

.ledger-toggle:hover { color: var(--ink); }

.ledger-chevron {
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.ledger-event {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line, #f0f0f0);
  font-size: 12px;
}

.ledger-event:last-child { border-bottom: none; }

.ledger-event-icon {
  flex-shrink: 0;
  font-size: 14px;
  line-height: 1.4;
}

.ledger-event-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  color: var(--ink);
}

.ledger-event-body strong {
  font-size: 12px;
  font-weight: 700;
}

.ledger-event-time {
  font-size: 11px;
  color: var(--muted);
}

#ledgerContent {
  margin-top: 8px;
}

/* ─── Board week calendar (Teams-style) ──────────────────────────────────────── */
.board-cal-section {
  display: flex;
  flex-direction: column;
  width: 100%;
  box-sizing: border-box;
  background: var(--surface-page);
  border-top: 1px solid var(--line);
  /* Fill remaining viewport height */
  height: calc(100dvh - 260px);
  min-height: 380px;
}

.board-cal-section.cal-page-variant {
  border-top: none;
  border-radius: 12px;
  border: 1px solid var(--line);
}

/* The day calendar scrolls WITHIN its own bounded area. The previous "grow to full
   height + rely on the page's scroll" model left the grid clipped by an ancestor on
   some layouts, so you couldn't scroll past the first visible hours (Bart,
   2026-08-05). A bounded max-height + inner scroll always works, independent of
   whatever wraps the section. */
.board-cal-section {
  height: auto;
  min-height: 0;
  max-height: calc(100dvh - 150px);
  overflow: hidden;
}
.board-cal-section .board-cal-grid-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.board-cal-section .bcal-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

/* Collapsible header - board page only. The calendar page renders its own
   section (#calPageBcalSection) and never gets the toggle or .is-collapsed. */
.board-cal-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  box-sizing: border-box;
  border: none;
  border-bottom: 1px solid var(--line);
  background: var(--surface-page);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  padding: 0 16px;
  cursor: pointer;
  text-align: left;
}

.board-cal-toggle svg {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.board-cal-section:not(.is-collapsed) .board-cal-chevron {
  transform: rotate(180deg);
}

.board-cal-section.cal-page-variant .board-cal-toggle {
  display: none;
}

/* Id selector keeps this winning over the mobile 100dvh rule below */
#boardCalSection.is-collapsed {
  height: auto;
  min-height: 0;
  scroll-snap-align: none;
}

#boardCalSection.is-collapsed .board-cal-nav,
#boardCalSection.is-collapsed .board-cal-grid-wrap {
  display: none;
}

.board-cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  flex-shrink: 0;
  background: var(--surface-page);
  border-bottom: 1px solid var(--line);
}

.board-cal-nav-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 1;
}

.board-cal-nav-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  min-width: 140px;
  text-align: center;
}

.bcal-today-btn {
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  cursor: pointer;
  opacity: 0.8;
}
.bcal-today-btn:hover {
  opacity: 1;
}

/* Mobile-only compact day circle inside the nav */
.bcal-mob-day {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.bcal-num-today {
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

/* Week / 3 Days toggle */
.bcal-toggle {
  display: flex;
  gap: 6px;
  background: #f4f4f4;
  border-radius: 12px;
  padding: 5px;
}

html[data-theme="dark"] .bcal-toggle {
  background: #18201f;
}

.bcal-toggle-btn {
  background: transparent;
  border: none;
  border-radius: 8px;
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.bcal-toggle-btn.active {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(31, 41, 35, 0.08);
}

html[data-theme="dark"] .bcal-toggle-btn.active {
  background: #31403d;
  color: var(--ink);
}

.bcal-toggle-btn:not(.active):hover {
  color: var(--ink);
  background: rgba(0, 0, 0, 0.04);
}

.bcal-edge-btn {
  margin: 0 6px;
  flex-shrink: 0;
}

/* ---- Time-grid calendar layout ---- */

/* Outer wrapper - fills all available vertical space */
.board-cal-grid-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Top-level flex column inside the grid wrap */
.bcal-tg-outer {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface-page);
}

/* Sticky day-name header row (gutter space + one cell per day) */
.bcal-header-row {
  display: flex;
  flex-shrink: 0;
  border-bottom: 2px solid var(--line);
  background: var(--surface-raised);
  position: sticky;
  top: 0;
  z-index: 10;
}

/* Day view (single column) header bar showing the day number + custody colour.
   Wanted on the calendar page's big calendar only; the board page's inline
   calendar keeps its day view header-free (its nav already shows the date). */
.board-cal-section:not(.cal-page-variant) .bcal-header-single {
  display: none;
}

/* Empty space in header row to align with time gutter */
.bcal-tg-head {
  width: 52px;
  flex-shrink: 0;
  border-right: 1px solid var(--line);
}

/* Day name cells in header row */
.bcal-col-head {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px 6px;
  border-right: 1px solid var(--line);
  user-select: none;
}
.bcal-col-head:last-child { border-right: none; }

/* Custody tints on day headers */
.bcal-col-head.custody-mine  { border-bottom: 3px solid var(--custody-mine-color, #65d6c6); }
.bcal-col-head.custody-co    { border-bottom: 3px solid var(--custody-co-color, #f59e0b); }
.bcal-col-head.custody-split {
  border-bottom: 3px solid transparent;
  border-image: linear-gradient(to right, var(--custody-mine-color, #65d6c6) 50%, var(--custody-co-color, #f59e0b) 50%) 1;
}
.bcal-col-head.custody-split.custody-split-co-first {
  border-image: linear-gradient(to right, var(--custody-co-color, #f59e0b) 50%, var(--custody-mine-color, #65d6c6) 50%) 1;
}

/* Today highlight */
.bcal-today .bcal-dow { color: var(--accent); }
.bcal-today .bcal-num {
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.bcal-dow {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.bcal-num {
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1;
}

/* Scrollable body: gutter + day columns side by side */
.bcal-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  position: relative;
}

/* Time gutter - fixed 52px wide, shows hour labels */
.bcal-tg-body {
  width: 52px;
  flex-shrink: 0;
  position: relative;
  border-right: 1px solid var(--line);
}

.bcal-tg-label {
  position: absolute;
  right: 6px;
  transform: translateY(-50%);
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  pointer-events: none;
  line-height: 1;
}

/* Flex row of day columns - must be position:relative so the now-line absolute child works */
.bcal-days {
  flex: 1;
  display: flex;
  position: relative;
}

/* Individual day column */
.bcal-day-col {
  flex: 1;
  position: relative;
  border-right: 1px solid var(--line);
  min-width: 0;
  container-type: inline-size;
}
.bcal-day-col:last-child { border-right: none; }

/* Today column tint */
.bcal-today-col {
  background: color-mix(in srgb, var(--accent) 4%, transparent);
}

/* The day picked on the calendar page's month/week/day picker. Scoped to
   .cal-page-variant on purpose: only the calendar page has a picker, so the board
   (Tablica) must not paint this even though it shares the same markup.
   Stronger than today's 4% tint, and wins when a day is both (2 classes vs 1). */
.cal-page-variant .bcal-selected-col {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.cal-page-variant .bcal-col-head.bcal-selected {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

/* Hour and half-hour lines */
.bcal-hour-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--line);
  pointer-events: none;
}

.bcal-half-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: color-mix(in srgb, var(--line) 50%, transparent);
  pointer-events: none;
}

/* Drop-over highlight */
.bcal-day-col.bcal-drop-over {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
}

/* Current-time indicator line */
.bcal-now-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  pointer-events: none;
  z-index: 5;
}
.bcal-now-line::before {
  content: "";
  position: absolute;
  left: 0;
  top: -4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

/* Card wrapper - absolutely positioned in day column */
.bcal-card-wrap {
  position: absolute;
  left: 4px;
  right: 4px;
  z-index: 2;
  transition: opacity 0.15s, transform 0.1s;
}
.bcal-card-wrap.bcal-dragging { opacity: 0.35; transform: scale(0.97); }

.bcal-drag-handle {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 13px;
  color: var(--muted);
  cursor: grab;
  line-height: 1;
  z-index: 3;
  padding: 2px 3px;
  border-radius: 4px;
  user-select: none;
}
.bcal-drag-handle:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--ink); }
.bcal-card-wrap:active .bcal-drag-handle { cursor: grabbing; }

/* Compact event chip inside the time grid */
.bcal-chip {
  position: absolute;
  left: 4px;
  right: 4px;
  height: 22px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 8px 0 6px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--accent) 18%, var(--surface-raised));
  border-left: 3px solid var(--accent);
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
  z-index: 2;
  user-select: none;
  transition: background 0.12s, transform 0.1s;
}
/* Per-occurrence controls on a recurring instance chip (DO-CARD-MODEL.md §6) */
.bcal-chip-ctrls {
  position: absolute;
  top: 50%;
  right: 3px;
  transform: translateY(-50%);
  display: flex;
  gap: 3px;
  align-items: center;
  z-index: 3;
}
.bcal-chip-btn {
  width: 16px;
  height: 16px;
  line-height: 15px;
  text-align: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.28);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  opacity: .55;
  transition: opacity .12s, background .12s;
}
.bcal-chip:hover .bcal-chip-btn { opacity: 1; }
.bcal-chip-skip:hover { background: var(--danger, #e55); }
.bcal-chip-cant:hover { background: var(--ink, #333); }
.bcal-chip-accept { background: rgba(16, 185, 129, .85); opacity: .9; }
.bcal-chip-accept:hover { background: #059669; opacity: 1; }
.bcal-chip-decline:hover { background: var(--danger, #e55); }
.bcal-chip-pending { color: #fff; opacity: .85; font-size: 13px; padding: 0 2px; }
.bcal-chip:hover, .bcal-chip:focus-visible {
  background: color-mix(in srgb, var(--accent) 30%, var(--surface-raised));
  outline: none;
  transform: scaleY(1.06);
}
.bcal-chip.bcal-chip-done {
  opacity: 0.45;
  text-decoration: line-through;
}
.bcal-chip-time {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
  letter-spacing: 0.01em;
}
.bcal-chip-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

/* Split-day handover band - highlights the handover hour */
.bcal-split-band {
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: none;
  z-index: 1;
  background: linear-gradient(
    to bottom,
    color-mix(in srgb, var(--custody-mine-color, #65d6c6) 18%, transparent),
    color-mix(in srgb, var(--custody-co-color, #76808a) 18%, transparent)
  );
  border-top: 2px solid color-mix(in srgb, var(--custody-mine-color, #65d6c6) 60%, transparent);
  border-bottom: 2px solid color-mix(in srgb, var(--custody-co-color, #76808a) 60%, transparent);
}

/* Handover card pinned at split time - looks like a Do card */
.bcal-handover-marker {
  position: absolute;
  left: 4px;
  right: 4px;
  z-index: 3;
  transform: translateY(-50%);
  cursor: pointer;
}
.bcal-handover-card {
  border-left: 3px solid color-mix(in srgb, var(--custody-mine-color, #65d6c6) 80%, transparent) !important;
  background: color-mix(in srgb, var(--custody-mine-color, #65d6c6) 10%, var(--surface)) !important;
  margin: 0 !important;
}
.bcal-handover-card:hover {
  background: color-mix(in srgb, var(--custody-mine-color, #65d6c6) 18%, var(--surface)) !important;
}
.card-handover-badge {
  font-size: 13px;
  margin-right: 2px;
}

/* Kanban card dragging into calendar */
.bcal-kanban-dragging { opacity: 0.5; }

/* Recurring card instances in the time grid */
.bcal-rec-instance { opacity: 0.88; }
.bcal-rec-badge {
  position: absolute;
  top: 4px;
  left: 22px;
  font-size: 11px;
  color: var(--accent);
  z-index: 3;
  line-height: 1;
  pointer-events: none;
}


/* Mobile adjustments */
@media (max-width: 640px) {
  html {
    scroll-snap-type: y proximity;
  }
  .board-cal-section {
    height: 100dvh;
    min-height: 100dvh;
    scroll-snap-align: start;
  }
  .board-cal-section.cal-page-variant {
    height: 100dvh;
    min-height: 100dvh;
    border-radius: 0;
    border-left: none;
    border-right: none;
    scroll-snap-align: start;
  }
  .board-cal-nav {
    position: sticky;
    top: env(safe-area-inset-top);
    z-index: 20;
  }
  /* Board page: hide the header row (a compact day circle in the nav stands in).
     Calendar page big calendar: keep the full header bar (day number + custody
     colour) visible on mobile too. */
  .board-cal-section:not(.cal-page-variant) .bcal-header-row {
    display: none;
  }
  .board-cal-section .board-cal-nav-title,
  .board-cal-section .bcal-today-btn {
    display: none;
  }
  .board-cal-section .bcal-mob-day {
    display: flex;
  }
  .bcal-scroll {
    overflow-x: auto;
  }
  .bcal-days {
    min-width: 360px; /* 2 days * ~180px */
  }
}

/* ─── Caregivers panel - people rows ──────────────────────────────────────── */

.cg-people-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 4px;
}

.cg-person-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.cg-person-row .mini-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  margin-top: 2px;
}

.cg-person-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cg-person-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.cg-person-name-row strong {
  font-size: 14px;
}

.cg-role-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: var(--soft);
  border-radius: 99px;
  padding: 1px 7px;
  letter-spacing: .02em;
}

.cg-swatches {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding-top: 2px;
}

.cg-schedule-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.cg-schedule-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cg-schedule-info strong {
  font-size: 13px;
}

.cg-schedule-info em {
  font-size: 12px;
  font-style: normal;
  color: var(--muted);
}

.cg-extra-header {
  padding: 12px 0 4px;
}

/* ─── SEG-21: In-app guide system ─────────────────────────────────────────── */

/* Dark overlay behind everything */
#guide-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 9000;
  pointer-events: all;
  cursor: pointer;
}

/* Transparent cutout that sits above the overlay, revealing the target */
#guide-spotlight {
  position: absolute;
  z-index: 9010;
  border-radius: 8px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  transition: top 0.25s ease, left 0.25s ease, width 0.25s ease, height 0.25s ease;
  display: none;
}

/* Tooltip card */
#guide-tooltip {
  position: fixed;
  z-index: 9020;
  width: 320px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  padding: 20px;
  pointer-events: all;
}

/* Centered modal variant (no spotlight target) */
#guide-tooltip.guide-tooltip-center {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Mobile: fixed to bottom, full width */
#guide-tooltip.guide-tooltip-mobile {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
  transform: none;
  top: auto;
}

/* Inner layout */
.guide-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.guide-dots {
  display: flex;
  gap: 5px;
}

.guide-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border, #e2e8f0);
  transition: background 0.2s;
}

.guide-dot.guide-dot-done {
  background: var(--accent, #6366f1);
}

.guide-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.guide-skip {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  color: var(--muted, #94a3b8);
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.15s;
}

.guide-dontshow {
  text-decoration: underline;
  opacity: 0.85;
}

.guide-skip:hover {
  color: var(--text, #1e293b);
}

.guide-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text, #1e293b);
  margin: 0 0 8px;
  line-height: 1.35;
}

.guide-body {
  font-size: 14px;
  color: var(--muted, #64748b);
  line-height: 1.55;
  margin: 0 0 16px;
}

.guide-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.guide-step-count {
  font-size: 12px;
  color: var(--muted, #94a3b8);
}

.guide-next {
  min-width: 90px;
}

.guide-back {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--muted, #94a3b8);
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.15s;
}

.guide-back:hover {
  color: var(--text, #1e293b);
}

.guide-back-hidden {
  visibility: hidden;
  pointer-events: none;
}

/* Help & Tours section in Settings */
.guide-tours-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.guide-tour-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border, #e2e8f0);
}

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

.guide-tour-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.guide-tour-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text, #1e293b);
}

.guide-tour-desc {
  font-size: 12px;
  color: var(--muted, #94a3b8);
  line-height: 1.4;
}

/* ─── Quick Expense Dialog ─────────────────────────────────────────────── */

.quick-expense-dialog {
  width: min(420px, 94vw);
  border-radius: 16px;
  padding: 0;
  border: none;
  box-shadow: 0 30px 76px rgba(31, 41, 35, 0.075);
  background: var(--paper);
  overflow: visible;
}

.quick-expense-dialog::backdrop {
  background: rgba(15,23,42,0.45);
  backdrop-filter: blur(2px);
}

.qed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line, #e2e8f0);
}

.qed-header strong {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink, #1e293b);
}

.qed-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted, #94a3b8);
  font-size: 16px;
  line-height: 1;
  padding: 4px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

.qed-close-btn:hover {
  color: var(--ink, #1e293b);
  background: var(--surface-hover, #f1f5f9);
}

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

.qed-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.qed-row {
  flex-direction: row;
  gap: 12px;
}

.qed-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted, #64748b);
  letter-spacing: 0.02em;
}

.qed-input {
  padding: 9px 12px;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 8px;
  font-size: 14px;
  color: var(--ink, #1e293b);
  background: var(--surface-input, #f8fafc);
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
  box-sizing: border-box;
}

.qed-input:focus {
  outline: none;
  border-color: var(--accent, #6366f1);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

/* Split chips */
.qed-split-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.qed-chip {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--line, #e2e8f0);
  background: var(--surface-input, #f8fafc);
  color: var(--ink, #1e293b);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.qed-chip:hover {
  border-color: var(--accent, #6366f1);
  background: var(--accent-light, #eef2ff);
  color: var(--accent, #6366f1);
}

.qed-chip.active {
  border-color: var(--accent, #6366f1);
  background: var(--accent, #6366f1);
  color: #fff;
}

.qed-custom-share {
  padding: 4px 0 0;
}

/* Recurring row */
.qed-recurring-row {
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

.qed-recurring-label {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink, #1e293b);
}

.qed-checkbox {
  width: 15px;
  height: 15px;
  accent-color: var(--accent, #6366f1);
  cursor: pointer;
}

.qed-freq-select {
  flex: 1;
  font-size: 13px;
  padding: 7px 10px;
}

/* Footer */
.qed-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--line, #e2e8f0);
}

/* Dark mode inputs */
html[data-theme="dark"] .qed-input,
html[data-theme="dark"] .qed-chip {
  background: color-mix(in srgb, var(--paper) 80%, #000);
  border-color: var(--line);
  color: var(--ink);
}

/* ─── Expense split chips (inside payment panel side column) ──────────────── */

.expense-split-section {
  margin-bottom: 12px;
}

.expense-amount-display {
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}

.expense-split-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted, #94a3b8);
  margin-bottom: 8px;
}

.expense-split-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.expense-split-chip {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-raised, #f3f3f3);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  white-space: nowrap;
}

.expense-split-chip:hover {
  color: var(--ink);
  background: var(--accent-weak);
}

.expense-split-chip.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.expense-request-section {
  margin-top: 10px;
}

html[data-theme="dark"] .expense-split-chip {
  background: var(--surface-raised);
}

html[data-theme="dark"] .expense-split-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #13201e;
}

/* ─── Expense tab bar ──────────────────────────────────────────────────── */

.expense-tab-bar {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: #f0f1ee;
  align-self: flex-start;
  margin-bottom: 2px;
}

html[data-theme="dark"] .expense-tab-bar {
  background: var(--surface-raised, #1e2027);
}

/* reuse cal-panel-tab but override grid to flex */
.expense-tab-bar .cal-panel-tab {
  flex: 1;
  font-size: 12px;
  padding: 6px 14px;
}

/* ─── Recurring expense groups ─────────────────────────────────────────── */

.recurring-freq-group {
  margin-bottom: 20px;
}

.recurring-freq-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.recurring-freq-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.recurring-freq-total {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.recurring-inline-badge {
  display: inline-block;
  margin-top: 3px;
  font-size: 11px;
  color: var(--accent, #6366f1);
  font-weight: 500;
}

.recurring-expense-card {
  cursor: default;
}

/* --- Email login hidden (keep code, show later if needed) --- */
#authPasswordForm,
#inviteEmailForm {
  display: none !important;
}

/* --- Powiadomienia (notification bell) --- */
.notif-bell-wrap { position: relative; display: inline-flex; align-items: center; margin-right: 6px; }
.notif-bell {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0; border-radius: 50%;
  border: 1px solid var(--line); background: transparent; color: var(--ink);
  cursor: pointer; position: relative;
}
.notif-bell svg { width: 18px; height: 18px; }
.notif-bell:hover { border-color: var(--accent); }
.notif-badge {
  position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px;
  padding: 0 4px; box-sizing: border-box; border-radius: 999px;
  background: #ef4444; color: #fff; font-size: 10px; font-weight: 800;
  line-height: 16px; text-align: center;
}
.notif-badge.hidden { display: none; }
.notif-popup {
  position: fixed; z-index: 4000;   /* fixed so the filter row's overflow can't clip it */
  width: min(340px, 92vw); max-height: 70vh; overflow-y: auto;
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28); padding: 6px;
}
.notif-popup.hidden { display: none; }
.notif-popup-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 8px; }
.notif-clear { background: none; border: 0; color: var(--accent); font-size: 12px; font-weight: 700; cursor: pointer; }
.notif-list { display: flex; flex-direction: column; gap: 2px; }
.notif-item {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  width: 100%; text-align: left; background: none; border: 0; cursor: pointer;
  padding: 9px 10px; border-radius: 8px; color: var(--ink);
}
.notif-item:hover { background: var(--surface-input, rgba(127, 127, 127, 0.08)); }
.notif-item-text { font-size: 13px; line-height: 1.35; }
.notif-item-time { font-size: 11px; color: var(--muted); white-space: nowrap; flex: 0 0 auto; }
.notif-unread .notif-item-text { font-weight: 700; }
.notif-unread .notif-item-text::before { content: "•"; color: var(--accent); margin-right: 6px; }
.notif-empty { padding: 16px; text-align: center; color: var(--muted); font-size: 13px; }
