/* Clara 2.2 — shared visual system. Loaded last; legacy feature geometry stays intact. */
:root {
  --ink: #253a31;
  --muted: #627469;
  --green: #416c57;
  --paper: #fffefa;
  --cream: #f5f4ee;
  --sage: #e9f0e9;
  --line: #dee4dc;
  --ui-radius: 16px;
  --ui-shadow: 0 2px 8px #233a2d05;
  --ui-danger: #ae473e;
}
body {
  color: var(--ink);
  background: var(--cream);
  font-family: 'DM Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body.dark-mode {
  --ink: #e7eee8;
  --muted: #b1bfb5;
  --green: #a5cfb4;
  --paper: #202c25;
  --cream: #17221c;
  --sage: #2b3c30;
  --line: #405047;
  --ui-danger: #f1a59b;
  color-scheme: dark;
}
.main-content { width: 100%; max-width: 1440px; padding: 30px clamp(24px, 3.2vw, 52px) 48px; }
.sidebar { width: 228px; background: var(--paper); border-right: 1px solid var(--line); padding: 32px 18px 24px; }
.brand { letter-spacing: -1px; }
.sidebar-subtitle { font-size: 12px; line-height: 1.5; }
.main-nav { margin-top: 28px; }
.main-nav .nav-item { border-radius: 10px; font-size: 14px; min-height: 44px; margin-bottom: 4px; }
.main-nav .nav-item.active { background: var(--sage); color: var(--green); box-shadow: none; }
.nav-secondary summary { font-size: 12px; }
.nav-secondary .nav-item { font-size: 13px; }
.topbar { margin-bottom: 32px; min-height: 44px; }
.page-heading, .feature-heading, .calendar-toolbar { margin: 0 0 26px; gap: 20px; align-items: flex-start; }
.page-heading h1, .feature-heading h2, .calendar-toolbar h2 { font-size: clamp(28px, 2.6vw, 36px); line-height: 1.2; letter-spacing: -.8px; }
.feature-heading > div:first-child { min-width: 0; }
.feature-heading > div:first-child > p:not(.eyebrow), .subtitle { font-size: 14px; line-height: 1.6; color: var(--muted); max-width: 620px; }
.eyebrow, .card-kicker, .brain-attention-label { color: var(--muted); font-size: 10px; line-height: 1.5; letter-spacing: 1.2px; }
.heading-actions { gap: 8px; flex-wrap: wrap; }
body .card, body .saved-note-card, body .person-card, body .brain-project-card {
  border-radius: var(--ui-radius); border-color: var(--line); background: var(--paper); color: var(--ink); box-shadow: var(--ui-shadow);
}
body .card { padding: 24px; }
.section-title { gap: 12px; margin-bottom: 18px; }
.section-title > div { min-width: 0; }
.section-title h2 { font-size: 23px; line-height: 1.25; }
.section-title h3 { font-size: 18px; }
button, input, select, textarea, summary, a { -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font-family: inherit; }
button { touch-action: manipulation; }
button:disabled { cursor: not-allowed; opacity: .6; }
body :is(.primary-button, .secondary-button) {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 42px; padding: 11px 16px; border-radius: 10px;
  font: 600 13px 'DM Sans', system-ui, sans-serif; line-height: 1.35; box-shadow: none;
}
body .primary-button { background: var(--action-accent, #416c57); color: #fff; border: 1px solid transparent; }
body .secondary-button { background: var(--paper); color: var(--ink); border: 1px solid var(--line); }
body .primary-button:hover:not(:disabled) { filter: brightness(.94); }
body .secondary-button:hover:not(:disabled) { background: var(--sage); }
body .text-button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 8px 10px; border-radius: 8px; font-size: 13px; line-height: 1.4; color: var(--green); }
body .text-button:hover:not(:disabled) { background: var(--sage); }
body .danger-button { color: var(--ui-danger); }
body .icon-button, body .modal-close { min-width: 40px; min-height: 40px; border-radius: 10px; }
body .modal-close { color: var(--muted); }
body :is(input, select, textarea):not([type='checkbox']):not([type='radio']):not([type='hidden']):not([type='color']) {
  border-color: var(--line); border-radius: 10px; color: var(--ink); background: var(--paper);
  min-width: 0; font-size: 14px; line-height: 1.45;
}
body :is(input, select):not([type='checkbox']):not([type='radio']):not([type='hidden']) { min-height: 42px; }
body textarea { resize: vertical; }
body input::placeholder, body textarea::placeholder { color: var(--muted); opacity: .85; }
body :is(button, a, input, select, textarea, summary):focus-visible { outline: 3px solid var(--green); outline-offset: 3px; }
body :is(input, select, textarea):focus { border-color: var(--green); }
body :is(input[type='checkbox'], input[type='radio']) { accent-color: var(--user-accent, #416c57); flex-shrink: 0; }
.filter-row, .notes-toolbar, .people-toolbar, .shopping-toolbar { margin-bottom: 20px; gap: 10px; }
body :is(.loading-state, .empty-state, .error-state, .brain-empty, .notes-empty, .people-empty) {
  font-size: 14px; line-height: 1.65; padding: 28px 18px; color: var(--muted); overflow-wrap: anywhere;
}
body .error-state { color: var(--ui-danger); }
.error-state button { min-height: 42px; margin: 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); color: var(--green); padding: 8px 12px; }
.save-status, .brain-help, .modal-help { font-size: 13px; line-height: 1.6; color: var(--muted); }
.save-status { overflow-wrap: anywhere; }
.save-status:empty { margin: 0; }
/* Today: a single priority area, then the agenda. No competing gradients. */
body .focus-card { background: var(--sage); border: 1px solid var(--line); box-shadow: none; padding: 18px 22px; border-radius: var(--ui-radius); margin-bottom: 20px; }
.focus-main { min-width: 0; }
.focus-main h2, #focus-title { font-size: 20px; }
.focus-main p, #focus-description { font-size: 13px; line-height: 1.5; }
.focus-icon { width: 38px; height: 38px; font-size: 22px; }
.brain-priorities { margin-bottom: 20px; }
body .brain-priorities .brain-help { margin-bottom: 0; }
.today-overview { border-color: var(--line); box-shadow: none; border-radius: var(--ui-radius); margin-bottom: 20px; }
body .today-overview > div { padding: 16px 18px; background: var(--paper); min-width: 0; }
.today-overview span { font-size: 10px; color: var(--muted); }
.today-overview strong { font: 600 17px 'DM Sans', sans-serif; overflow-wrap: anywhere; }
.main-grid, .lower-grid { gap: 20px; }
.timeline-row { padding: 14px 0; }
.timeline-row .event strong, .task-text { font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.timeline-row .event small, .task-context-line { font-size: 12px; color: var(--muted); line-height: 1.5; }
.timeline-row .time { font-size: 12px; color: var(--muted); }
.task-row { min-height: 58px; }
.task-main { min-width: 0; }
body .task-check { min-width: 24px; width: 24px; height: 24px; border-color: var(--line); }
.timeline-period span { font-size: 10px; }
.quick-add { border-radius: 10px; }
body .day-summary { background: var(--paper); border: 1px solid var(--line); box-shadow: none; border-radius: var(--ui-radius); }
.today-extras > summary { font-size: 14px; }
.today-extras summary span { line-height: 1.5; }
/* One card language across the library, notes, people and habits. */
.library-shortcuts { gap: 12px; }
.library-shortcuts button { min-height: 90px; border-color: var(--line); border-radius: 12px; background: var(--paper); font-size: 13px; }
.library-shortcuts button span { font-size: 22px; }
.library-search { margin: 22px 0 28px; }
.library-section { margin: 26px 0 34px; }
body .brain-project-card { padding: 22px; }
.brain-project-card h3 { font: 600 20px 'DM Sans', sans-serif; line-height: 1.35; margin: 14px 0 10px; }
.brain-project-card > p, .brain-project-card > small { font-size: 13px; }
.project-next-step { background: var(--cream); }
.project-next-step strong { font-size: 13px; }
.brain-record { border-color: var(--line); background: var(--paper); border-radius: 10px; min-height: 58px; }
.brain-record strong { font-size: 14px; line-height: 1.5; }
.brain-record small { font-size: 12px; line-height: 1.5; }
.brain-attention { border-radius: var(--ui-radius); }
body .saved-note-card { border-top-width: 3px; min-height: 290px; }
.saved-note-card > header { padding: 18px 20px 8px; }
.saved-note-icon { width: 38px; height: 38px; border-radius: 10px; font-size: 22px; }
.saved-note-category { font-size: 12px; }
body .saved-note-main { display: flex; align-items: flex-start; justify-content: flex-start; padding: 16px 20px 22px; text-align: left; min-height: 160px; }
.saved-note-body { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; width: 100%; gap: 12px; }
body .saved-note-body h3 { font: 600 20px 'DM Sans', sans-serif; line-height: 1.35; margin: 0; overflow-wrap: anywhere; }
body .saved-note-content { font-size: 14px; line-height: 1.65; color: var(--muted); margin: 0; }
.saved-note-content > :first-child { margin-top: 0; }
.saved-note-card > footer { padding: 10px 14px 10px 20px; border-color: var(--line); gap: 8px; }
.saved-note-card > footer small { font-size: 11px; }
body .saved-note-card > footer small, body .saved-note-category { color: var(--muted); }
.saved-note-card > footer button { min-height: 40px; font-size: 12px; padding: 7px 8px; border-radius: 8px; }
.note-tags { margin: 0; }
.notes-load-more { margin: 22px auto 0; }
.date-picker { padding: 0 12px; }
body .date-picker { background: var(--paper); border-color: var(--line); }
.date-picker input { padding: 8px 0; border: 0; background: transparent; }
body :is(.person-card h3, .habit-card h3, .shopping-group h3) { font: 600 18px 'DM Sans', sans-serif; }
.person-card > p, .person-next-action strong, .person-history-section p, .person-pending-section small { font-size: 13px; line-height: 1.6; }
.person-badges span, .person-next-action span, .person-card-heading > i { font-size: 11px; }
.people-summary span, .people-summary small { font-size: 11px; line-height: 1.5; }
.people-summary > div, .stats-grid > article { padding: 18px; border-color: var(--line); border-radius: 12px; }
.shopping-summary { background: var(--sage); border-color: var(--line); border-radius: var(--ui-radius); box-shadow: none; }
.shopping-add-form { gap: 12px; }
.shopping-add-form label { font-size: 12px; }
.shopping-product-field { min-width: 0; }
.shopping-add-form .primary-button { align-self: end; }
body :is(.task-view-switch, .notes-view-switch, .calendar-view-switch, .shopping-filters, .brain-mode-switch) { background: var(--sage); border-radius: 10px; padding: 4px; }
body :is(.task-view-switch, .notes-view-switch, .calendar-view-switch, .shopping-filters, .brain-mode-switch) button { min-height: 36px; border-radius: 7px; font-size: 12px; }
body :is(.task-view-switch, .notes-view-switch, .calendar-view-switch, .shopping-filters, .brain-mode-switch) button.active { background: var(--paper); color: var(--green); box-shadow: 0 1px 3px #233a2d0a; }
.calendar-controls { gap: 14px; flex-wrap: wrap; }
.calendar-nav button, .calendar-filter { min-height: 40px; }
.calendar-hint { font-size: 12px; line-height: 1.6; }
/* Editors and settings use the same accessible dialog shell. */
body .modal-backdrop { background: #10251c66; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); overflow: hidden; }
body .profile-modal { border-color: var(--line); background: var(--paper); color: var(--ink); padding: 28px; box-shadow: 0 24px 80px #10251c26; overscroll-behavior: contain; }
.profile-modal > h2 { font-size: 27px; line-height: 1.3; padding-right: 32px; overflow-wrap: anywhere; }
body .profile-modal label { font-size: 13px; line-height: 1.5; }
body .profile-modal label, body .shopping-add-form label { color: var(--muted); }
.profile-modal label > small { font-size: 12px; line-height: 1.5; }
body .profile-modal .modal-actions { background: var(--paper); border-top: 1px solid var(--line); padding: 14px 0 4px; margin-top: 20px; bottom: -28px; gap: 8px; flex-wrap: wrap; }
.profile-modal .modal-actions .primary-button { margin-left: auto; }
.profile-modal .modal-actions .text-button { font-size: 13px; }
.editor-more-details > summary { color: var(--green); min-height: 44px; }
.editor-more-details > summary span { font-size: 12px; line-height: 1.5; }
.profile-menu { border-color: var(--line); border-radius: 14px; box-shadow: 0 12px 44px #10251c1a; max-height: calc(100dvh - 90px); overflow: auto; }
.profile-menu > button { min-height: 40px; font-size: 13px; }
.profile-menu > .menu-group-label { display: block; padding: 14px 16px 4px; color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: 1px; }
.app-version { font-size: 11px; }
.brain-view { max-width: 780px; margin-top: 0; }
.brain-hero { padding: 12px 12px 24px; }
.brain-hero-mark { font-size: 30px; margin-bottom: 10px; }
.brain-hero h2 { font-size: clamp(28px, 3vw, 36px); }
.brain-hero > p:not(.eyebrow) { font-size: 14px; }
.brain-composer { box-shadow: var(--ui-shadow); border-color: var(--line); }
body #brain-input { min-height: 150px; font-size: 16px; line-height: 1.7; background: transparent; border: 0; }
.brain-status-pill { font-size: 12px; min-height: 40px; }
.brain-starters button { min-height: 42px; }
.brain-scope { overflow-wrap: anywhere; }
/* Neutral surfaces in dark mode, rather than pale legacy gradients. */
body.dark-mode :is(.card, .saved-note-card, .person-card, .brain-project-card, .profile-modal, .library-shortcuts button, .today-overview > div, .profile-menu) { background: var(--paper); color: var(--ink); border-color: var(--line); }
body.dark-mode :is(.focus-card, .shopping-summary, .brain-guided-review, .brain-attention) { background: var(--sage); color: var(--ink); border-color: var(--line); }
body.dark-mode :is(.secondary-button, .task-filters-more > summary) { background: var(--paper); color: var(--ink); border-color: var(--line); }
body.dark-mode .profile-modal .modal-actions { background: var(--paper); border-color: var(--line); }
body.dark-mode :is(.brain-help, .modal-help, .subtitle, .saved-note-content) { color: var(--muted); }
body.dark-mode .sidebar { background: var(--paper); border-color: var(--line); }
body.dark-mode :is(.main-nav .nav-item, .sidebar .settings) { color: var(--muted); }
body.dark-mode .main-nav .nav-item.active { color: var(--green); }
body.dark-mode .today-overview strong { color: var(--ink); }
body.dark-mode :is(.quick-add, .task-check, .section-title > button) { background: var(--sage); color: var(--green); border-color: var(--line); }
body.dark-mode :is(.timeline-period, .task-row) { border-color: var(--line); }
body.dark-mode .task-context-category { color: var(--muted); }
body.dark-mode #quick-add-button { background: var(--sage); color: var(--green); }
body.dark-mode .project-next-step { background: var(--cream); }
body.dark-mode .primary-button { background: var(--action-accent, #416c57); color: #fff; }
body.dark-mode .danger-button { color: var(--ui-danger); }
/* Entrance screen shares the app typography and controls, without changing auth. */
body.login-page { min-height: 100dvh; padding: 24px 0; background: var(--cream); }
.login-page .login-card { width: min(440px, calc(100% - 32px)); padding: 36px; border-color: var(--line); background: var(--paper); border-radius: 20px; box-shadow: 0 12px 48px #233a2d08; }
.login-page .brand { margin-bottom: 30px; }
.login-page .sub, .login-page .field label, .login-page .privacy { color: var(--muted); line-height: 1.6; }
.login-page .field input { min-height: 48px; font-size: 16px; }
.login-page .button { min-height: 48px; font: 600 14px 'DM Sans', sans-serif; background: #416c57; }
.login-page .passkey-button { min-height: 48px; font: 600 13px 'DM Sans', sans-serif; background: var(--sage); border-color: var(--line); }
.login-page .privacy { font-size: 12px; }
@media (max-width: 1180px) {
  .people-toolbar { grid-template-columns: minmax(160px, 1fr) 1fr; }
  .people-toolbar > .toggle-label { min-height: 42px; }
  .shopping-add-form { grid-template-columns: minmax(160px, 1.5fr) 1fr 1fr; }
  .shopping-supermarket-field { grid-column: span 2; }
  .feature-heading, .calendar-toolbar { flex-wrap: wrap; }
  .task-heading-actions { width: 100%; }
}
@media (max-width: 850px) {
  .main-content { padding: 22px 22px 36px; }
  .topbar { margin-bottom: 26px; }
  .page-heading, .feature-heading, .calendar-toolbar { margin-bottom: 22px; gap: 16px; }
  body .text-button { display: inline-flex; min-height: 44px; }
  body :is(.primary-button, .secondary-button) { min-height: 44px; }
  body :is(input, select, textarea):not([type='checkbox']):not([type='radio']):not([type='hidden']):not([type='color']) { font-size: 16px; }
  body :is(input, select):not([type='checkbox']):not([type='radio']):not([type='hidden']) { min-height: 44px; }
  .mobile-nav { box-shadow: 0 3px 18px #233a2d12; border-color: var(--line); background: var(--paper); }
  .mobile-nav button { font-size: 10px; color: var(--muted); }
  .mobile-nav button.active { background: var(--sage); color: var(--green); }
  /* The Clara tab already gives one-tap access; a second floating shortcut obscures lists. */
  #quick-create-button { display: none; }
  body .profile-modal { padding: 24px; }
  body .profile-modal .modal-actions { bottom: -24px; }
  .saved-note-card > footer button { min-height: 44px; }
}
@media (max-width: 650px) {
  .main-content { padding: 18px 16px 32px; }
  .page-heading h1, .feature-heading h2, .calendar-toolbar h2 { font-size: 28px; }
  body .card { padding: 20px; }
  .section-title h2 { font-size: 22px; }
  .focus-card .focus-main { gap: 12px; }
  body .focus-card { padding: 16px; }
  #focus-description { font-size: 12px; }
  .today-overview > div { padding: 14px 16px; }
  .main-grid, .lower-grid { gap: 16px; }
  .library-shortcuts { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .library-shortcuts button { min-height: 82px; font-size: 12px; }
  .notes-toolbar, .people-toolbar { grid-template-columns: 1fr; }
  .people-summary { gap: 8px; }
  .people-summary > div { padding: 12px; }
  .people-summary span, .people-summary small { font-size: 10px; letter-spacing: .4px; }
  .shopping-add-form { grid-template-columns: 1fr 1fr; }
  .shopping-product-field { grid-column: 1/-1; }
  .shopping-supermarket-field { grid-column: auto; }
  .shopping-add-form > .primary-button { grid-column: 1/-1; }
  .heading-actions, .task-heading-actions { gap: 8px; }
  .task-heading-actions .task-view-switch { width: 100%; display: flex; }
  .task-view-switch button { flex: 1; }
  .feature-heading .heading-actions { width: 100%; }
  body .profile-modal { padding: 22px; }
  body .profile-modal .modal-actions { bottom: -22px; padding-bottom: max(4px, env(safe-area-inset-bottom)); }
  .profile-modal .modal-actions .primary-button { flex: 1 0 auto; }
  .profile-modal > h2 { font-size: 25px; }
  .brain-hero { padding-top: 0; }
  .brain-hero h2 { font-size: 29px; }
  body .brain-composer { padding: 18px; }
  .brain-input-actions { gap: 8px; flex-wrap: wrap; }
  .person-detail-grid { grid-template-columns: 1fr; }
  .login-page .login-card { padding: 28px; }
}
body.compact-mode .card { padding: 18px; }
body.compact-mode .task-row { min-height: 50px; }
body[data-font-scale='large'] { font-size: 17px; }
body[data-font-scale='large'] :is(.task-text, .saved-note-content, .brain-record strong, .person-card > p) { font-size: 16px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
