/* Northfollow web account. Tokens mirror app/src/ui/theme.ts (the design system's source of truth):
   navy for text and dark surfaces, teal for primary actions, orange sparingly, Fredoka only. */

@font-face { font-family: 'Fredoka'; src: url('/fonts/Fredoka-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Fredoka'; src: url('/fonts/Fredoka-Medium.ttf') format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Fredoka'; src: url('/fonts/Fredoka-SemiBold.ttf') format('truetype'); font-weight: 600; font-display: swap; }

:root {
  --navy: #052D49;
  --navy-700: #0B3654;
  --navy-50: #EEF3F7;
  --teal: #00AEC1;
  --teal-400: #1ABDCD;
  --teal-600: #0094A5;
  --teal-ink: #007886;
  --teal-50: #E6F8FA;
  --orange: #FF7A12;
  --orange-50: #FFF3E8;
  --orange-ink: #8A3A05;
  --white: #FFFFFF;
  --gray-050: #F4F6F8;
  --gray-100: #EAEEF2;
  --gray-200: #DAE0E6;
  --gray-400: #98A3AF;
  --gray-600: #55616E;
  --gray-800: #29333D;
  --danger: #D7392B;
  --danger-ink: #B02A1E;
  --danger-soft: #FDECEA;
  --ok-ink: #157A40;
  --ok-soft: #E5F6EC;
  --ai: #6C4DDB;
  --ai-soft: #F1EDFD;
  --hot: #C8287E;
  --warm: #F5C02C;
  --cold: #5468E8;
  --radius-s: 8px;
  --radius-m: 12px;
  --radius-l: 16px;
  --radius-xl: 20px;
  --shadow-s: 0 1px 3px rgba(5, 45, 73, 0.08);
  --shadow-m: 0 4px 12px rgba(5, 45, 73, 0.10);
  --shadow-l: 0 12px 32px rgba(5, 45, 73, 0.14);
  --focus: 0 0 0 3px rgba(0, 174, 193, 0.45);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--gray-050);
  color: var(--navy);
  font-family: 'Fredoka', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
}
h1, h2, h3 { font-weight: 600; line-height: 1.2; margin: 0 0 0.5em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.2rem; }
h3, .h3 { font-size: 1.05rem; }
p { margin: 0 0 0.75em; }
a { color: var(--teal-ink); text-underline-offset: 2px; }
a:hover { color: var(--navy); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-s); }
hr { border: 0; border-top: 1px solid var(--gray-200); margin: 1.25rem 0; }
img { max-width: 100%; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--gray-600); }
.small { font-size: 0.875rem; }
.block { display: block; }
.center { text-align: center; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.break { overflow-wrap: anywhere; font-size: 0.85rem; }
.clamp { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.done { text-decoration: line-through; color: var(--gray-600); }
.task-line { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; }
.task-line p { margin-top: 0; }
.task-group { font-size: 0.95rem; color: var(--gray-600); margin: 1.1rem 0 0.5rem; }
.task-actions { display: flex; align-items: center; gap: 0.25rem; flex-shrink: 0; }
.task-actions .icon-btn { font-size: 1.05rem; width: 36px; height: 36px; }
.noscript { padding: 2rem; text-align: center; }

/* Skip link */
.skip { position: absolute; left: -999px; top: 0.5rem; background: var(--white); padding: 0.5rem 1rem; border-radius: var(--radius-m); z-index: 20; }
.skip:focus { left: 1rem; }

/* Header */
.site-head, .public-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.75rem 1.25rem; background: var(--white); border-bottom: 1px solid var(--gray-200);
  position: sticky; top: 0; z-index: 10;
}
.logo { display: inline-flex; align-items: center; }
.logo img { height: 32px; width: auto; display: block; }
.head-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; justify-content: flex-end; }
.head-user { font-weight: 500; color: var(--navy); text-decoration: none; max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.head-user:hover { text-decoration: underline; }
.site-head .nav-toggle { display: none; }

/* Layout */
.layout { display: grid; grid-template-columns: 15rem minmax(0, 1fr); min-height: calc(100vh - 58px); }
.site-nav { background: var(--white); border-right: 1px solid var(--gray-200); padding: 1rem 0.75rem; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nav-link { display: block; padding: 0.55rem 0.9rem; border-radius: 999px; color: var(--navy); text-decoration: none; font-weight: 500; }
.nav-link:hover { background: var(--teal-50); color: var(--navy); }
.nav-link.current { background: var(--teal-50); color: var(--teal-ink); box-shadow: inset 3px 0 0 var(--teal); }
.nav-link.disabled { color: var(--gray-400); cursor: not-allowed; }
.badge-soon { font-size: 0.7rem; background: var(--gray-100); color: var(--gray-600); border-radius: 999px; padding: 0.05rem 0.45rem; vertical-align: middle; }
.content { padding: 1.5rem 2rem 4rem; max-width: 72rem; width: 100%; }
.content:focus { box-shadow: none; }
.public { padding: 2rem 1rem 4rem; display: flex; flex-direction: column; align-items: center; }

/* Cards and panels */
.card { background: var(--white); border-radius: var(--radius-xl); box-shadow: var(--shadow-m); padding: 1.75rem; width: 100%; max-width: 40rem; }
.card.narrow { max-width: 26rem; }
.panel { background: var(--white); border-radius: var(--radius-xl); box-shadow: var(--shadow-s); padding: 1.25rem 1.5rem; margin-bottom: 1rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.5rem; }
.panel-head h2 { margin: 0; }
.danger-zone { border: 1px solid var(--danger-soft); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; }
.grid-2 > * { min-width: 0; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.page-head h1 { margin: 0; }
.page-actions, .row-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.row-actions { margin-bottom: 1rem; }
.sub { color: var(--gray-600); margin: 0.25rem 0; }
.back { margin-bottom: 0.5rem; }
.badges { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; margin: 0.25rem 0 0.5rem; }

/* Lists */
.cards { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.75rem; }
.card-item { background: var(--white); border-radius: var(--radius-l); box-shadow: var(--shadow-s); padding: 1rem 1.25rem; border: 1px solid var(--gray-100); }
.panel .card-item { box-shadow: none; }
.card-title { margin-bottom: 0.35rem; }
.card-row { display: flex; justify-content: space-between; gap: 0.75rem; align-items: flex-start; }
.plain-list { list-style: none; padding: 0; margin: 0 0 0.75rem; }
.plain-list > li { padding: 0.5rem 0; border-bottom: 1px solid var(--gray-100); }
.plain-list > li:last-child { border-bottom: 0; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.count { color: var(--gray-600); font-size: 0.9rem; margin: 0.5rem 0; }
.pager { display: flex; align-items: center; justify-content: center; gap: 0.75rem; flex-wrap: wrap; margin: 1rem 0; }
.empty { background: var(--white); border-radius: var(--radius-l); padding: 2rem; text-align: center; color: var(--gray-600); }
details > summary { cursor: pointer; color: var(--teal-ink); font-weight: 500; margin: 0.25rem 0; }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.4rem 1rem; margin: 0; }
.facts dt { color: var(--gray-600); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.inline-link { margin-left: 0.5rem; }
.photos { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.5rem; }
.photos img { width: 100%; height: 140px; object-fit: cover; border-radius: var(--radius-m); display: block; background: var(--gray-100); }

/* Tables (contacts, members): rows become cards on narrow screens */
.list-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--white); border-radius: var(--radius-l); overflow: hidden; box-shadow: var(--shadow-s); }
th, td { text-align: left; padding: 0.65rem 0.9rem; border-bottom: 1px solid var(--gray-100); vertical-align: top; }
th { font-weight: 500; color: var(--gray-600); font-size: 0.85rem; background: var(--gray-050); }
/* Sortable table headers: the whole header is a button; the arrow shows the sorted column and direction. */
th:has(> .th-sort) { padding: 0; }
.th-sort { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 0.35rem; width: 100%; padding: 0.65rem 0.9rem; cursor: pointer; font: inherit; color: inherit; white-space: nowrap; }
.th-sort:hover { color: var(--navy); }
.th-sort:focus-visible { box-shadow: var(--focus); border-radius: var(--radius-s); }
.th-sort.on { color: var(--navy); font-weight: 600; }
.th-arrow { font-size: 0.7rem; opacity: 0.45; }
.th-sort.on .th-arrow { opacity: 1; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--teal-50); }
tr.inactive td { color: var(--gray-400); }
.cell-name a { font-weight: 500; }
.cell-name .sub { display: block; font-size: 0.85rem; margin: 0; }

/* Badges */
.heat { display: inline-block; border-radius: 999px; padding: 0.05rem 0.6rem; font-size: 0.8rem; font-weight: 500; }
.heat-hot { background: var(--hot); color: var(--white); }
.heat-warm { background: var(--warm); color: var(--navy); }
.heat-cold { background: var(--cold); color: var(--white); }
.ai-badge { display: inline-block; border-radius: 999px; padding: 0.05rem 0.55rem; font-size: 0.75rem; background: var(--ai-soft); color: var(--ai); margin-left: 0.35rem; }
.ai-attention { background: var(--orange-50); color: var(--orange-ink); }
.badge { display: inline-block; border-radius: 999px; padding: 0.05rem 0.6rem; font-size: 0.8rem; background: var(--gray-100); color: var(--gray-800); }
.badge-warn { background: var(--orange-50); color: var(--orange-ink); }
.status-done { background: var(--ok-soft); color: var(--ok-ink); }
.status-in_progress, .status-planned { background: var(--teal-50); color: var(--teal-ink); }

/* Forms */
.field { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.9rem; min-width: 0; }
.field label, .label { font-weight: 500; font-size: 0.9rem; margin: 0; }
.hint { color: var(--gray-600); font-size: 0.85rem; margin: 0; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=tel], input[type=url], input[type=date], input:not([type]), select, textarea {
  font: inherit; color: var(--navy); background: var(--white);
  border: 1.5px solid var(--gray-200); border-radius: var(--radius-l); padding: 0.6rem 0.85rem; width: 100%; min-height: 44px;
}
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); box-shadow: var(--focus); outline: none; }
input[readonly] { background: var(--gray-050); color: var(--gray-600); }
input[type=file] { font: inherit; }
fieldset { border: 0; padding: 0; margin: 0 0 0.9rem; min-width: 0; }
legend { font-weight: 500; font-size: 0.9rem; padding: 0; margin-bottom: 0.3rem; }
.checks { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; }
.checks legend, .checks .hint { flex-basis: 100%; }
.check { display: inline-flex; align-items: center; gap: 0.4rem; min-height: 36px; cursor: pointer; }
.check input, .choice input { width: 1.15rem; height: 1.15rem; accent-color: var(--teal); }
.choices { display: flex; flex-direction: column; gap: 0.5rem; }
.choice { display: flex; gap: 0.75rem; align-items: flex-start; border: 1.5px solid var(--gray-200); border-radius: var(--radius-l); padding: 0.75rem 1rem; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--teal); background: var(--teal-50); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.inline-form { display: flex; gap: 0.75rem; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { flex: 1 1 14rem; margin-bottom: 0; }
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 0 0.75rem; align-items: end; background: var(--white); padding: 1rem 1rem 0.25rem; border-radius: var(--radius-l); box-shadow: var(--shadow-s); margin-bottom: 0.5rem; }
.filter-search { grid-column: 1 / -1; }
.search-row { display: flex; gap: 0.4rem; align-items: stretch; }
.search-row input { flex: 1 1 auto; min-width: 0; }
.search-row [hidden] { display: none; }
.search-row .btn { flex: 0 0 auto; align-self: center; }
.search-mode { flex: 0 0 auto; width: auto; color: var(--ai); background-color: var(--ai-soft); font-weight: 500; }
.filter-ask { grid-column: 1 / -1; margin-bottom: 0.9rem; }
.ask-label { display: block; font-weight: 500; font-size: 0.9rem; margin-bottom: 0.3rem; }
.ask-glyph { color: var(--ai); }
.ask-row { display: flex; gap: 0.5rem; align-items: center; }
.ask-row input { flex: 1 1 auto; min-width: 0; }
.ask-row .btn { flex: 0 0 auto; }
.ask-out:empty { display: none; }
.ask-out { margin-top: 0.5rem; }
.ask-answer { background: var(--ai-soft); border-radius: var(--radius-m); padding: 0.75rem 1rem; }
.ask-text { white-space: pre-line; margin: 0 0 0.5rem; }
.ask-sources { font-weight: 500; margin: 0.25rem 0; }
.ask-refs { margin: 0 0 0.5rem; padding-left: 1.1rem; }
.ask-busy { margin: 0; }
.filter-reset { margin-bottom: 0.9rem; }
.more-filters { grid-column: 1 / -1; margin-bottom: 0.5rem; }
.more-filters > div { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 0 0.75rem; align-items: end; margin-top: 0.5rem; }
.actions { display: flex; gap: 0.5rem; justify-content: flex-end; flex-wrap: wrap; margin-top: 0.75rem; }
.actions.start { justify-content: flex-start; }
.actions.center { justify-content: center; }
.sent-row { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; margin-top: 0.5rem; }
.sent-row p { margin: 0; }
.or { display: flex; align-items: center; gap: 0.75rem; color: var(--gray-600); margin: 1rem 0; }
.or::before, .or::after { content: ''; flex: 1; border-top: 1px solid var(--gray-200); }
.google-slot { display: flex; justify-content: center; min-height: 44px; }

/* Buttons: every tappable control is a pill, labels on teal are navy */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  font: inherit; font-weight: 500; border-radius: 999px; padding: 0.6rem 1.25rem; min-height: 44px;
  border: 1.5px solid transparent; cursor: pointer; text-decoration: none; line-height: 1.2; text-align: center;
}
.btn-small { padding: 0.35rem 0.9rem; min-height: 36px; font-size: 0.9rem; }
.btn-block { width: 100%; }
.btn-primary { background: var(--teal); color: var(--navy); }
.btn-primary:hover { background: var(--teal-400); color: var(--navy); }
.btn-primary:active { background: var(--teal-600); }
.btn-secondary { background: var(--white); color: var(--navy); border-color: var(--navy); }
.btn-secondary:hover { background: var(--navy-50); color: var(--navy); }
.btn-ghost { background: transparent; color: var(--navy); }
.btn-ghost:hover { background: var(--gray-100); color: var(--navy); }
.btn-ghost.danger { color: var(--danger-ink); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: var(--danger-ink); color: var(--white); }
.btn-link { background: none; border: 0; color: var(--teal-ink); font: inherit; text-decoration: underline; cursor: pointer; padding: 0.25rem; min-height: 36px; }
.btn[disabled], .btn[aria-busy=true] { opacity: 0.6; cursor: progress; }
.icon-btn { background: none; border: 0; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--gray-600); width: 44px; height: 44px; border-radius: 999px; }
.icon-btn:hover { background: var(--gray-100); }

/* Messages */
.error-box { background: var(--danger-soft); color: var(--danger-ink); border-radius: var(--radius-m); padding: 0.6rem 0.9rem; margin: 0.5rem 0; }
.ok-box { background: var(--ok-soft); color: var(--ok-ink); border-radius: var(--radius-m); padding: 0.6rem 0.9rem; margin: 0.5rem 0; }
.notice { background: var(--orange-50); color: var(--orange-ink); border-radius: var(--radius-m); padding: 0.6rem 0.9rem; }
.loading { padding: 1rem 0; }
.toasts { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 0.5rem; z-index: 50; width: min(28rem, calc(100% - 2rem)); }
.toast { background: var(--navy); color: var(--white); padding: 0.75rem 1rem; border-radius: var(--radius-l); box-shadow: var(--shadow-l); }
.toast-error { background: var(--danger-ink); }
progress { width: 100%; max-width: 24rem; accent-color: var(--teal); }

/* Dialogs */
.dialog { border: 0; border-radius: 28px; padding: 0; width: min(32rem, calc(100% - 2rem)); max-height: calc(100vh - 2rem); box-shadow: var(--shadow-l); color: var(--navy); }
.dialog.wide { width: min(46rem, calc(100% - 2rem)); }
.dialog::backdrop { background: rgba(2, 19, 31, 0.48); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 1.25rem 0 1.5rem; position: sticky; top: 0; background: var(--white); }
.dialog-head h2 { margin: 0; }
.dialog-body { padding: 0.75rem 1.5rem 1.5rem; }
.qr { display: block; margin: 0.75rem auto; max-width: 100%; height: auto; border-radius: var(--radius-m); }
.invite-app { display: flex; flex-direction: column; gap: 0.5rem; margin: 1rem 0; }
.invite-qr { margin-top: 1rem; }

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .site-head .nav-toggle { display: inline-flex; }
  .site-nav { display: none; border-right: 0; border-bottom: 1px solid var(--gray-200); }
  .site-nav.open { display: block; }
  .content { padding: 1rem 1rem 4rem; }
  .grid-2, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .head-user { display: none; }
}

@media (max-width: 640px) {
  h1 { font-size: 1.45rem; }
  .site-head, .public-head { padding: 0.6rem 1rem; }
  .logo img { height: 24px; }
  .head-actions { flex-wrap: nowrap; gap: 0.25rem; }
  .head-actions .btn-small { padding: 0.35rem 0.6rem; }
  .card, .panel { padding: 1.1rem; border-radius: var(--radius-l); }
  .facts { grid-template-columns: minmax(0, 1fr); gap: 0 0; }
  .facts dd { margin-bottom: 0.5rem; }
  /* Table rows as cards */
  table, thead, tbody, tr, td { display: block; width: 100%; }
  table { background: transparent; box-shadow: none; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  tr { background: var(--white); border-radius: var(--radius-l); box-shadow: var(--shadow-s); margin-bottom: 0.6rem; padding: 0.6rem 0.9rem; }
  td { border: 0; padding: 0.15rem 0; }
  td[data-label]:not(:empty)::before { content: attr(data-label) ': '; color: var(--gray-600); font-size: 0.85rem; }
  td:empty { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* Signature: Plain / HTML tabs and the preview (account page). */
.tabs { display: flex; gap: 0.25rem; border-bottom: 1.5px solid var(--gray-200); margin: 0.75rem 0 0.75rem; }
.tab { background: none; border: 0; border-bottom: 3px solid transparent; margin-bottom: -1.5px; padding: 0.5rem 0.9rem; font: inherit; font-weight: 700; color: var(--gray-600); cursor: pointer; min-height: 44px; }
.tab[aria-selected=true] { color: var(--navy); border-bottom-color: var(--teal); }
textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85rem; }
.signature-preview { border: 1.5px dashed var(--gray-200); border-radius: var(--radius-l); padding: 0.75rem 1rem; margin-bottom: 0.75rem; overflow-x: auto; }
.signature-preview img { max-width: 100%; height: auto; }

/* Language menu with flags (header). */
.lang-menu { position: relative; }
.lang-menu > summary { list-style: none; display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer; }
.lang-menu > summary::-webkit-details-marker { display: none; }
.lang-menu > summary::after { content: ''; border: 4px solid transparent; border-top-color: currentColor; margin-top: 4px; }
.lang-list { position: absolute; right: 0; top: calc(100% + 0.35rem); z-index: 30; background: var(--white); border-radius: var(--radius-l); box-shadow: var(--shadow-l); padding: 0.35rem; margin: 0; list-style: none; min-width: 11rem; }
.lang-list button { display: flex; align-items: center; gap: 0.5rem; width: 100%; min-height: 40px; padding: 0.4rem 0.7rem; background: none; border: 0; border-radius: var(--radius-m); font: inherit; color: var(--navy); text-align: left; cursor: pointer; }
.lang-list button:hover, .lang-list button:focus-visible { background: var(--gray-100); }
.lang-list button[aria-current=true] { font-weight: 700; }
.flag { display: inline-block; width: 20px; height: 14px; object-fit: cover; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12); }

/* Super admin (/admin): page tabs as links, stat tiles. */
.admin-tabs { flex-wrap: wrap; }
a.tab { display: inline-flex; align-items: center; text-decoration: none; }
.tab[aria-current=page] { color: var(--navy); border-bottom-color: var(--teal); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: 0.75rem; margin: 0.75rem 0 1rem; }
.stat { background: var(--white); border-radius: var(--radius-l); box-shadow: var(--shadow-s); padding: 0.85rem 1rem; }
.stat-value { font-size: 1.5rem; font-weight: 600; margin: 0; color: var(--navy); }
.stat-label { color: var(--gray-600); font-size: 0.85rem; margin: 0; }
.ai-search-note:not(:empty) { margin-top: 0.4rem; }

/* Task board (owner request 2026-10-30): Trello-like columns of white cards. The board scrolls sideways
   on its own, so the page never does; on a phone each column is most of the screen wide. */
.view-toggle { display: inline-flex; gap: 0.25rem; background: var(--white); border-radius: 999px; padding: 0.2rem; box-shadow: var(--shadow-s); }
.board-hint { margin: 0.25rem 0 0.5rem; }
.board { display: flex; align-items: flex-start; gap: 0.85rem; overflow-x: auto; padding: 0.25rem 0.1rem 1rem; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
.board-col { flex: 0 0 17.5rem; max-width: 17.5rem; background: var(--gray-100); border-radius: var(--radius-l); padding: 0.5rem 0.5rem 0.6rem; scroll-snap-align: start; border: 2px solid transparent; transition: border-color 0.12s, background 0.12s; }
.board-col.collapsed { flex-basis: 11rem; max-width: 11rem; }
.board-col.drop-target { border-color: var(--teal); background: var(--teal-50); }
.board-col-head { margin: 0 0 0.4rem; font-size: 1rem; }
.board-col-toggle { display: flex; align-items: center; gap: 0.5rem; width: 100%; min-height: 40px; padding: 0.3rem 0.5rem; background: none; border: 0; border-radius: var(--radius-m); font: inherit; font-weight: 600; color: var(--navy); text-align: left; cursor: pointer; }
.board-col-toggle:hover { background: var(--gray-200); }
.board-col-title { flex: 1 1 auto; }
.board-col-count { background: var(--white); color: var(--gray-800); border-radius: 999px; padding: 0 0.55rem; font-size: 0.8rem; font-weight: 500; }
.board-col-chevron { color: var(--gray-600); font-size: 0.8rem; }
.board-col-todo .board-col-head { box-shadow: inset 0 -3px 0 var(--gray-400); border-radius: var(--radius-m); }
.board-col-in_progress .board-col-head { box-shadow: inset 0 -3px 0 var(--teal); border-radius: var(--radius-m); }
.board-col-waiting .board-col-head { box-shadow: inset 0 -3px 0 var(--warm); border-radius: var(--radius-m); }
.board-col-done .board-col-head { box-shadow: inset 0 -3px 0 var(--ok-ink); border-radius: var(--radius-m); }
.board-col-cancelled .board-col-head { box-shadow: inset 0 -3px 0 var(--gray-600); border-radius: var(--radius-m); }
.board-cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; min-height: 2.5rem; }
.board-empty, .board-more { margin: 0.4rem 0.3rem 0; }
.board-card { background: var(--white); border-radius: var(--radius-m); box-shadow: var(--shadow-s); padding: 0.6rem 0.7rem 0.5rem; border: 1px solid var(--gray-200); cursor: grab; }
.board-card:hover { box-shadow: var(--shadow-m); }
.board-card.dragging { opacity: 0.5; cursor: grabbing; }
.board-card.cancelled .board-card-text { text-decoration: line-through; color: var(--gray-600); }
.board-card-top { display: flex; align-items: flex-start; gap: 0.5rem; }
.board-check { flex: 0 0 auto; width: 20px; height: 20px; margin: 0.15rem 0 0; accent-color: var(--teal-ink); cursor: pointer; }
.board-card-text { flex: 1 1 auto; min-width: 0; background: none; border: 0; padding: 0; font: inherit; color: var(--navy); text-align: left; cursor: pointer; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.board-card-text:hover { text-decoration: underline; }
.board-check:checked + .board-card-text { text-decoration: line-through; color: var(--gray-600); }
.board-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; margin: 0.4rem 0 0.2rem; }
.board-card-meta:empty { display: none; }
.board-card-meta .avatar { margin-left: auto; }
.board-card-foot { margin: 0.2rem 0 0; overflow-wrap: anywhere; }
.board-card-status { margin-top: 0.35rem; }
select.board-status { min-height: 32px; padding: 0.15rem 0.5rem; font-size: 0.85rem; border-radius: var(--radius-s); width: 100%; }
.prio { display: inline-block; border-radius: 999px; padding: 0 0.55rem; font-size: 0.75rem; font-weight: 600; }
.prio-high { background: var(--danger-soft); color: var(--danger-ink); }
.prio-medium { background: var(--warm); color: var(--navy); }
.prio-low { background: var(--gray-100); color: var(--gray-800); }
.due { display: inline-block; border-radius: 999px; padding: 0 0.5rem; font-size: 0.75rem; background: var(--gray-050); color: var(--gray-800); border: 1px solid var(--gray-200); }
.due-today { background: var(--orange-50); color: var(--orange-ink); border-color: var(--orange-50); }
.due-overdue { background: var(--danger); color: var(--white); border-color: var(--danger); }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 999px; background: var(--navy); color: var(--white); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.02em; flex: 0 0 auto; }
.status-chip { display: inline-block; border-radius: 999px; padding: 0 0.55rem; font-size: 0.75rem; background: var(--gray-100); color: var(--gray-800); }
.status-in_progress { background: var(--teal-50); color: var(--teal-ink); }
.status-waiting { background: var(--orange-50); color: var(--orange-ink); }
.status-done { background: var(--ok-soft); color: var(--ok-ink); }
.task-badges { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; margin: 0.15rem 0 0.25rem; }
.task-line > span .task-badges { display: flex; }
.task-delete { margin-right: auto; }
@media (max-width: 640px) {
  .board-col { flex-basis: 82vw; max-width: 82vw; }
  .board-col.collapsed { flex-basis: 10rem; max-width: 10rem; }
}
