/* Taskly — design tokens, layout, components. Light (Cloud) + dark (Midnight Navy).
 * Visual system carried over from the MindStack guidelines (navy + blue, Inter).
 * Brand palette: Midnight Navy #102A4C, Core Blue #176FE5, Sky Blue #35B7F4,
 * Layer Blue #258FDB, Slate #53677D, Ice Blue #EEF7FD, Cloud #F7FBFE, White.
 * Roughly 65% white/cloud, 20% ice blue, 10% navy text, 5% saturated blue.
 * Core Blue + white label = 4.7:1 (AA). Sky Blue is never used for small text.
 * Status colours are functional only and always paired with a label.
 */

/* No blinking text cursor on ordinary page text (e.g. clicking "To Do 65" while
 * Chrome's caret browsing, F7, is on). Real text fields keep their cursor. */
html { caret-color: transparent; }
input, textarea, select, [contenteditable]:not([contenteditable="false"]) { caret-color: auto; }

:root {
  /* Surfaces */
  --bg: #f7fbfe;              /* Cloud — app canvas */
  --sidebar: #ffffff;         /* navigation rail */
  --surface: #ffffff;         /* cards */
  --surface-2: #f7fbfe;
  --surface-3: #f0f6fc;       /* quiet hover */
  --border: #e1eaf3;
  --border-strong: #cad7e5;
  --ice: #eef7fd;             /* Ice Blue — soft panels */

  /* Text */
  --text: #102a4c;            /* Midnight Navy — body text, headings */
  --text-2: #2c4566;
  --muted: #53677d;           /* Slate — secondary text and labels */
  --slate: #6b7f95;           /* icons and metadata dots */
  --brand-deep: #102a4c;      /* wordmark "Mind", titles */

  /* Accent and status */
  --accent: #176fe5;          /* Core Blue — primary actions, active states */
  --accent-hover: #135fc8;
  --accent-strong: #1560cc;   /* blue text that stays 4.5:1 on Ice Blue */
  --accent-soft: #e4f1fc;     /* selected navigation (navy label on top) */
  --accent-text: #ffffff;
  --ok: #157347;
  --ok-fill: #22a06b;
  --ok-soft: #e3f5ec;
  --warn: #8a5300;
  --warn-fill: #f2b32b;
  --warn-soft: #fff4db;
  --danger: #b42318;          /* errors and Delete (white text 6:1) */
  --danger-fill: #e5484d;
  --danger-soft: #fdecec;
  --high: var(--danger);
  --high-soft: var(--danger-soft);
  --medium: var(--warn);
  --medium-soft: var(--warn-soft);
  --low: var(--muted);
  --low-soft: var(--surface-3);

  --shadow-sm: none;
  --shadow: 0 1px 2px rgba(16, 42, 76, 0.05), 0 10px 28px rgba(16, 42, 76, 0.08);
  --radius: 12px;             /* cards 10–14 */
  --radius-sm: 9px;           /* controls 8–10 */
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --display: var(--font);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  --ease: 180ms ease;
  color-scheme: light;
}

/* ---------------------------------------------------------------- base */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.25; margin: 0; font-weight: 600; }
h2 { font-size: 1.125rem; letter-spacing: -0.01em; }
h3 { font-size: 0.95rem; margin: 14px 0 6px; }
p { margin: 0; }
a { color: var(--accent-strong); }
ul { padding-left: 20px; margin: 6px 0; }
li { margin: 3px 0; }
kbd {
  font-family: var(--mono); font-size: 0.72em; font-weight: 500; padding: 1px 5px;
  border: 1px solid var(--border-strong); border-radius: 5px;
  background: var(--surface); color: var(--muted);
}
.icon {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}
.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;
}
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 80; }
.skip-link:focus { left: 12px; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 8px 48px 72px; }
.muted { color: var(--muted); }
.sub { color: var(--muted); font-size: 0.9rem; margin-top: 2px; }
.hint { color: var(--muted); font-size: 0.84rem; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }

/* -------------------------------------------------------------- inputs */

input, select, textarea, button { font: inherit; }
input[type="text"], input[type="url"], input[type="email"], input[type="search"],
input[type="tel"], input[type="datetime-local"], input[type="password"],
input[type="date"], input[type="time"], input[type="number"],
input:not([type]), select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--ease), box-shadow var(--ease);
}
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 85%, transparent); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
textarea { min-height: 128px; resize: vertical; padding: 12px 14px; font-size: 1rem; line-height: 1.6; }
label { color: var(--text-2); font-size: 0.8rem; font-weight: 500; }
.file-input {
  width: 100%; padding: 16px; border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text-2);
  cursor: pointer;
}
.file-input:hover { border-color: var(--accent); }

/* ------------------------------------------------------------- buttons */

button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 14px; min-height: 36px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-text);
  font-size: 0.9rem; font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--ease), border-color var(--ease), color var(--ease);
}
button:hover { background: var(--accent-hover); }
button:disabled { cursor: not-allowed; opacity: 0.5; }
button.secondary {
  background: var(--surface); color: var(--text); border-color: var(--border-strong);
}
button.secondary:hover { background: var(--surface-3); }
button.danger { background: #b42318; color: #fff; }
button.danger:hover { filter: brightness(0.94); }
button.big { padding: 11px 20px; font-size: 0.95rem; }
button.record { background: #b42318; color: #fff; }
button.record[aria-busy="true"] { animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px var(--danger-soft); } }
button.link-button {
  min-height: 0; padding: 0; background: none; border: 0; color: var(--accent-strong);
  font-weight: 600; font-size: inherit;
}
button.link-button:hover { background: none; text-decoration: underline; }
button.small { min-height: 32px; padding: 5px 11px; font-size: 0.82rem; }
button.icon-button { padding: 7px; background: transparent; color: var(--text-2); border-color: transparent; }
button.icon-button:hover { background: var(--surface-3); }

/* --------------------------------------------------------- app shell */

.app-shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.main-col { min-width: 0; display: flex; flex-direction: column; }

.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 16px; padding: 14px 10px 12px;
  background: var(--sidebar); border-right: 1px solid var(--border); z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 4px 8px; }
.logo-mark { flex: none; color: var(--sidebar); display: block; }
.lockup .logo-mark { color: var(--surface); }
.brand-text { display: grid; min-width: 0; line-height: 1.2; }
.brand-name { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.015em; color: var(--brand-deep); }
.brand-name span { color: var(--accent); }
.brand-tagline { font-size: 0.7rem; line-height: 1.35; color: var(--muted); }
.brand-tagline > span { display: block; white-space: nowrap; }
.sidebar-actions { display: grid; gap: 2px; }
button.new-capture, button.nav-item {
  width: 100%; min-height: 32px; justify-content: flex-start; gap: 10px; padding: 6px 10px;
  background: transparent; color: var(--text-2); border: 0; border-radius: 8px;
  font-size: 0.9rem; font-weight: 500;
}
button.new-capture:hover, button.nav-item:hover { background: color-mix(in srgb, var(--text) 6%, transparent); color: var(--text); }
button.new-capture kbd { margin-left: auto; }
button.new-capture { color: var(--accent-strong); font-weight: 600; }
button.new-capture .icon { stroke-width: 2.2; }
.nav { display: grid; gap: 1px; }
.nav-label { margin: 16px 10px 4px; font-size: 0.75rem; font-weight: 500; color: var(--muted); }
button.nav-item .icon { color: var(--slate); }
button.nav-item[aria-current="page"] { background: var(--accent-soft); color: var(--text); font-weight: 600; }
button.nav-item[aria-current="page"] .icon { color: var(--text); }
.nav-item .badge { margin-left: auto; }
.sidebar-foot { margin-top: auto; display: grid; gap: 6px; padding-top: 10px; border-top: 1px solid var(--border); }
.streak { padding: 0 10px; font-size: 0.8rem; color: var(--muted); }
.scrim { position: fixed; inset: 0; z-index: 35; background: rgba(23, 24, 23, 0.4); }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 20px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
}
.menu-button { display: none; }
.crumbs { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; font-size: 0.875rem; color: var(--muted); }
.crumbs span:last-child { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.page-header { padding: 28px 0 24px; }
.page-header h1 { font-size: 1.75rem; font-weight: 600; letter-spacing: -0.02em; color: var(--brand-deep); }
.tagline { color: var(--muted); font-size: 0.95rem; margin-top: 4px; }
body[data-page="home"] .page-header { display: none; }

.account { position: relative; }
.account summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px; border-radius: var(--radius-sm); max-width: 260px;
}
.account summary::-webkit-details-marker { display: none; }
.account summary:hover { background: var(--surface-3); }
.avatar {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none;
  background: #102a4c; color: #fff; font-size: 0.8rem; font-weight: 600;
}
.avatar .icon { width: 16px; height: 16px; }
.account-email { margin-top: 12px; font-size: 0.8rem; color: var(--muted); overflow-wrap: anywhere; }
.account-name { font-size: 0.84rem; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu {
  position: absolute; right: 0; top: calc(100% + 6px); width: min(340px, 90vw);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px; z-index: 30;
}
.auth-form label { display: grid; gap: 6px; }
.auth-form .row button { flex: 1; }
.account-menu .hint { margin-top: 10px; }

/* Account card: who you are, then a list of actions, then Sign out. */
.account-menu { padding: 8px; width: min(320px, 92vw); }
.acct-head { display: flex; align-items: center; gap: 12px; padding: 10px 10px 12px; }
.acct-avatar { flex: none; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent, #2C58DD), #5B7CF0); color: #fff;
  font: 700 1.1rem/1 var(--display, inherit); }
.acct-id { min-width: 0; flex: 1; }
.account-menu .account-who { margin: 0; font: 600 0.98rem/1.3 var(--display, inherit); color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu .account-email { margin: 2px 0 0; font-size: 0.8rem; color: var(--text-2); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.acct-badge { flex: none; align-self: flex-start; margin-top: 2px; padding: 3px 8px; border-radius: 999px;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.02em; background: var(--yellow-10, #FFF8E1); color: var(--yellow-text, #A57800); }
.acct-badge[hidden] { display: none; }
.acct-list { display: grid; gap: 2px; padding: 6px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.account-menu button.acct-item, .account-menu button#accountDataLink {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 0; margin: 0; padding: 9px 10px;
  border: 0; border-radius: 12px; background: transparent; color: var(--text); text-align: left;
  font: 600 0.88rem/1.25 var(--font, inherit); white-space: normal; box-shadow: none; justify-content: flex-start; }
.account-menu button.acct-item:hover, .account-menu button#accountDataLink:hover { background: var(--surface-3, #F2F1EC); color: var(--text); }
.account-menu button.acct-item[hidden] { display: none; }
.acct-item svg, .acct-signout svg, .acct-note svg { flex: none; width: 18px; height: 18px; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.acct-item svg { width: 34px; height: 34px; padding: 8px; border-radius: 10px; background: var(--accent-soft, #EAEFFC); color: var(--accent, #2C58DD); }
.acct-item span { display: grid; gap: 1px; }
.acct-item small { font-weight: 400; font-size: 0.76rem; color: var(--text-2); }
.account-menu button.acct-signout { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  min-height: 40px; margin: 8px 0 2px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--border);
  background: transparent; color: #B42318; font: 600 0.88rem/1 var(--display, inherit); box-shadow: none; }
.account-menu button.acct-signout:hover { background: #FDECEC; border-color: #F5C2C0; color: #B42318; }
.acct-hidden { display: none !important; }
.acct-note { display: flex; align-items: center; gap: 6px; margin: 6px 4px 2px; font-size: 0.74rem; color: var(--text-2); }
.acct-note svg { width: 14px; height: 14px; }
.account-menu #devLoginForm { margin: 4px 4px 0; }
.acct-dev-hint { margin: 10px 4px 0; font-size: 0.76rem; color: var(--text-2); }
.acct-dev-hint[hidden] { display: none; }

.bottom-nav { display: none; }
.badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 6px;
  display: inline-grid; place-items: center; font-size: 0.72rem; font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: color-mix(in srgb, var(--text) 7%, transparent); color: var(--text-2);
}
.badge.alert { background: var(--danger-soft); color: var(--danger); }

/* -------------------------------------------------------------- cards */

.tab-panel { animation: fade-in 0.2s ease-out; }
@keyframes fade-in { from { opacity: 0; transform: translateY(3px); } }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; margin-bottom: 16px;
}
.card.subtle { background: transparent; }
.card-head { margin-bottom: 16px; }
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.card-head h2 .icon { color: var(--slate); }
.card.hero { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.section-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 0 0 16px; flex-wrap: wrap;
}
.grid-2 { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.grid-2 > .card { margin-bottom: 0; }
.grid-2.align-start { align-items: start; margin-bottom: 16px; }

/* Lists read like a database view: one surface, quiet dividers. */
.list {
  display: grid; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.list:empty { display: none; }
.list > .panel { margin: 0; border: 0; border-radius: 0; background: transparent; padding: 20px; }

.empty {
  display: grid; place-items: center; gap: 8px; text-align: center;
  padding: 32px 16px; color: var(--muted); border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
}
.empty-icon { width: 24px; height: 24px; color: var(--slate); }

/* ----------------------------------------------------- status / toast */

.status { min-height: 0; margin: 8px 0 0; font-size: 0.875rem; color: var(--muted); }
.status:empty { margin: 0; }
.status.error { color: var(--danger); }
.banner { border-radius: var(--radius-sm); padding: 10px 14px; margin: 0 0 12px; font-size: 0.9rem; }
.banner.warn { background: var(--warn-soft); color: var(--warn); }

.toasts {
  position: fixed; right: 20px; bottom: 20px; z-index: 60;
  display: grid; gap: 8px; width: min(380px, calc(100vw - 32px));
}
.toast {
  background: #102a4c; color: #f7fbfe; padding: 11px 14px; border-radius: var(--radius-sm);
  box-shadow: var(--shadow); font-size: 0.9rem; animation: toast-in 0.2s ease-out;
}
.toast.error { background: var(--danger); color: #fff; }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: all 0.25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* -------------------------------------------------------------- pills */

.pill, .chip {
  display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--text) 6%, transparent); color: var(--text-2); margin-left: 6px;
  font-size: 0.75rem; font-weight: 500; vertical-align: middle;
}
.pill[data-level="high"] { background: var(--high-soft); color: var(--high); }
.pill[data-level="medium"] { background: var(--medium-soft); color: var(--medium); }
.pill[data-level="low"] { background: var(--low-soft); color: var(--low); }
.pill[data-level="duplicate"], .pill[data-level="near_duplicate"] { background: var(--warn-soft); color: var(--warn); }
.pill[data-level="completed"] { background: var(--ok-soft); color: var(--ok); }
.chip { margin-left: 4px; font-size: 0.72rem; }
.chip[data-level="live"] { background: var(--ok-soft); color: var(--ok); }
.chip[data-level="builtin"] { background: var(--accent-soft); color: var(--accent-strong); }

/* ------------------------------------------------------------ capture */

.segmented {
  display: flex; gap: 2px; padding: 3px; background: color-mix(in srgb, var(--text) 5%, transparent);
  border-radius: var(--radius-sm); margin-bottom: 16px; overflow-x: auto;
}
.segmented [role="tab"] {
  flex: 1; min-height: 34px; background: transparent; color: var(--text-2); padding: 6px 10px;
  border-radius: 8px; font-weight: 500;
}
.segmented [role="tab"]:hover { background: color-mix(in srgb, var(--surface) 60%, transparent); }
.segmented [role="tab"][aria-selected="true"] {
  background: var(--surface); color: var(--text); font-weight: 600;
  box-shadow: 0 1px 2px rgba(23, 24, 23, 0.08);
}
.segmented .icon { width: 16px; height: 16px; }
.capture-pane { display: grid; gap: 8px; }
.capture-pane > .row { margin-top: 4px; }
.voice-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.voice-actions .file-input { flex: 1; min-width: 180px; padding: 9px; }
.voice-capture audio { width: 100%; margin-top: 6px; }

/* ------------------------------------------------------------- agents */

.switch { display: flex; gap: 10px; align-items: center; cursor: pointer; margin: 16px 0 0; font-size: 0.875rem; font-weight: 500; color: var(--text-2); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  flex: none; width: 34px; height: 20px; border-radius: 999px; background: var(--border-strong);
  position: relative; transition: background var(--ease);
}
.switch-track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform var(--ease);
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(14px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

.inline-form { display: flex; gap: 8px; align-items: stretch; }
.inline-form input { flex: 1; min-width: 0; }
.agent-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
button.tile {
  justify-content: flex-start; gap: 10px; padding: 12px 14px; min-height: 48px; white-space: normal; text-align: left;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); font-weight: 500;
}
button.tile .icon { color: var(--slate); }
button.tile:hover { background: var(--surface-3); border-color: var(--border-strong); }
button.tile:hover .icon { color: var(--accent-strong); }

.agent-result { border-top: 1px solid var(--border); margin-top: 20px; padding-top: 16px; }
.agent-result h3 { margin: 0 0 8px; }
.agent-card {
  padding: 12px 14px; margin-top: 8px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
}
.agent-card .task-actions { margin-top: 8px; }
.agent-card.applied { opacity: 0.55; }
.agent-slot { font-weight: 600; margin-top: 16px; color: var(--accent-strong); font-size: 0.8rem; }
.agent-steps { margin-top: 12px; font-size: 0.84rem; color: var(--text-2); }
.agent-steps summary { cursor: pointer; color: var(--muted); }
.agent-steps ol { margin: 6px 0 0; }
.agent-steps code, .provenance code {
  font-family: var(--mono); background: var(--surface-3); padding: 1px 5px; border-radius: 5px; font-size: 0.8em;
}

/* ---------------------------------------------------------------- ask */

.ask-form { display: grid; gap: 12px; }
.ask-examples { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
button.chip-button {
  min-height: 30px; padding: 4px 11px; border-radius: 8px; background: var(--surface); color: var(--text-2);
  border: 1px solid var(--border); font-weight: 500; font-size: 0.84rem;
}
button.chip-button:hover { background: var(--accent-soft); color: var(--accent-strong); border-color: transparent; }
.ask-output { margin-top: 16px; }
.ask-output .confidence, .agent-card .confidence { font-size: 0.8rem; color: var(--muted); margin-bottom: 6px; }
.ask-output .citation {
  margin-top: 10px; padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
}

/* ------------------------------------------------- notes, tasks, items */

.note, .task {
  background: transparent; border: 0; border-bottom: 1px solid var(--border); border-radius: 0;
  padding: 16px 20px; transition: background var(--ease);
}
.list > .note:last-child, .list > .task:last-child { border-bottom: 0; }
.note:hover, .task:hover { background: var(--surface-2); }
.note-text { overflow-wrap: anywhere; }
.task-meta { color: var(--muted); font-size: 0.82rem; margin-top: 4px; font-variant-numeric: tabular-nums; }
.note-actions, .task-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.note-actions button, .task-actions button { min-height: 30px; padding: 4px 11px; font-size: 0.82rem; }
.note-actions button:not(.secondary):not(.danger), .task-actions button:not(.secondary):not(.danger) { }
.note-edit-input { min-height: 80px; }
.time { color: var(--muted); font-size: 0.78rem; margin-top: 6px; font-variant-numeric: tabular-nums; }
.capture-thumb { max-width: 180px; max-height: 130px; border-radius: 8px; margin-top: 8px; border: 1px solid var(--border); display: block; }
.provenance { font-size: 0.82rem; color: var(--text-2); margin-top: 6px; }
.provenance .label { font-weight: 600; color: var(--text); }
.why { color: var(--muted); font-size: 0.84rem; margin-top: 3px; font-style: italic; }
#loadMoreItems { width: calc(100% - 40px); margin: 12px 20px 16px; }

.task-toolbar { display: flex; align-items: center; gap: 8px; }
.task-toolbar select { width: auto; min-width: 140px; }

.search-toolbar {
  display: flex; flex-wrap: wrap; align-items: end; gap: 12px; padding: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 16px;
}
.search-toolbar label { display: grid; gap: 6px; min-width: 130px; }
.search-toolbar label.grow { flex: 1; min-width: 220px; }
.search-actions { display: flex; gap: 8px; }

/* ----------------------------------------- dashboard / analysis / topics */

.panel {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 16px; margin: 10px 0;
}
.dashboard { display: grid; gap: 12px; }
.dashboard .panel, .dashboard-grid .panel { margin: 0; }
.dashboard-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.panel > h3:first-child, .panel > strong:first-child { margin-top: 0; }
.panel > h3:first-child { margin-bottom: 8px; }
.topic-list { display: grid; gap: 8px; margin-top: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.topic { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.topic strong { display: block; font-weight: 600; }
.relation { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; margin: 8px 0; }
.topic-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }

/* ---------------------------------------------------------- attention */

.briefing { font-size: 0.95rem; }
.briefing strong { font-size: 1rem; font-weight: 600; }
[data-view-pane="list"] > .briefing {
  margin-bottom: 14px; padding: 12px 16px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border);
}
[data-view-pane="list"] > #calendarPreview { margin-bottom: 14px; }
.task-group {
  margin: 0; padding: 14px 20px 4px; font-size: 0.9rem; font-weight: 600; color: var(--text-2);
  border-top: 1px solid var(--border);
}
.task-group:first-child { border-top: 0; }
.task-actions .snooze-menu { width: auto; min-height: 30px; padding: 4px 10px; font-size: 0.82rem; }
.attention-grid {
  display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 16px;
}
.attention-grid .panel { background: var(--surface); margin: 0; }
.attention-grid .panel > h3:first-child::before {
  content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 8px; vertical-align: middle; background: var(--slate);
}
.attention-grid .panel:nth-child(1) > h3:first-child::before { background: var(--danger-fill); }
.attention-grid .panel:nth-child(2) > h3:first-child::before { background: var(--accent); }
.attention-grid .panel:nth-child(5) > h3:first-child::before { background: var(--warn-fill); }
.attention-grid .task-meta { padding: 8px 0; border-bottom: 1px solid var(--border); }
.attention-grid .task-meta:last-child { border-bottom: 0; }
#calendarPreview > button { margin-top: 10px; }

/* --------------------------------------------------------- reminders */

#whatsappCard .inline-form { margin-top: 10px; }
#whatsappCard h3 { font-size: 0.95rem; margin: 0 0 4px; }
.channel { padding: 16px 0; border-top: 1px solid var(--border); }
.channel:first-of-type { border-top: 0; padding-top: 4px; }
.channel .status:empty { display: none; }
#telegramStatus { display: grid; gap: 8px; }
.consent-box {
  display: grid; gap: 10px; margin: 4px 0 12px; padding: 12px 14px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border); font-size: 0.85rem; color: var(--text-2);
}
.consent-box p { margin: 0; }
.digest-form { display: grid; gap: 12px; margin-top: 4px; }
.digest-form .switch { margin: 6px 0 0; }
.digest-form .field-grid { max-width: 420px; }
.digest-form .channel-actions { margin-top: 0; }

.gmail-card .status:empty { display: none; }
.gmail-card .channel-actions:not(:has(button:not([hidden]))) { display: none; }
.tg-code { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tg-code code {
  font-family: var(--mono); font-size: 1rem; font-weight: 500; padding: 6px 10px;
  border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border);
  user-select: all;
}
.tg-code button { padding: 6px 12px; font-size: 0.84rem; }
.channel-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.channel-actions:not(:has(button:not([hidden]))) { display: none; }
.reminder-heading { padding-top: 16px; border-top: 1px solid var(--border); }
.reminder-list { margin-top: 0; }
.reminder-channel { font-weight: 600; }
.reminder-form fieldset { border: 0; padding: 0; margin: 0; display: flex; gap: 12px; align-items: center; }
.reminder-form fieldset legend { padding: 0; margin-bottom: 5px; font-size: 0.875rem; }
.reminder-form fieldset label { display: inline-flex; gap: 5px; align-items: center; }
.reminder-form input[type="radio"] { min-width: 0; width: auto; accent-color: var(--accent); }
.reminder {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.reminder:last-child { border-bottom: 0; }
.reminder::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--slate); }
.reminder button { min-height: 30px; padding: 4px 11px; font-size: 0.82rem; }
.reminder-main { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.reminder-pending::before { background: var(--danger-fill); }
.reminder-sent::before { background: var(--ok-fill); }
.reminder-sent .reminder-state { color: var(--ok); font-weight: 600; }
.reminder-failed::before { background: var(--danger-fill); }
.reminder-failed .reminder-state { color: var(--danger); font-weight: 600; }
.reminder-cancelled, .reminder-skipped { opacity: 0.6; }
.reminder-form {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-top: 12px;
  padding: 14px; border-radius: var(--radius-sm); background: var(--accent-soft);
}
.reminder-form label { display: grid; gap: 5px; }
.reminder-form input { width: auto; min-width: 220px; }
.reminder-form .status { flex-basis: 100%; }
.reminder-form .status:empty { display: none; }

/* --------------------------------------------------------- sign in */

body.locked .app-shell, body.locked .bottom-nav, body.locked .toasts { display: none !important; }
.auth-gate {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(3px);
}
.auth-gate[hidden] { display: none; }
body.locked .auth-gate { background: var(--bg); }
.auth-card { width: min(420px, 100%); display: grid; gap: 14px; box-shadow: var(--shadow); padding: 28px; }
.lockup { display: flex; align-items: center; gap: 14px; padding-bottom: 4px; }
.lockup-divider { width: 1px; align-self: stretch; background: var(--border-strong); }
.lockup .brand-text { flex: 1; }
.lockup .brand-name { font-size: 1.6rem; }
.lockup .brand-tagline { font-size: 0.85rem; color: var(--text-2); }
.lockup .auth-close { align-self: flex-start; }
.auth-card-head { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.auth-card-head h2 { flex: 1; font-size: 1.25rem; font-weight: 600; margin: 0; color: var(--brand-deep); }
.name-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.optional { font-weight: 400; color: var(--muted); }
.auth-tagline { color: var(--muted); font-size: 0.9rem; margin-top: -6px; }
.auth-close { min-height: 32px; padding: 4px 10px; }
.auth-tabs { margin-bottom: 0; }
#authForm { display: grid; gap: 12px; }
#authForm label { display: grid; gap: 6px; font-weight: 500; font-size: 0.85rem; }
#authForm input { width: 100%; }
#authForm .status:empty { display: none; }
.account-wide { width: 100%; margin-top: 8px; }
.auth-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin: -4px 0 0; font-size: 0.85rem; }
.auth-links:not(:has(button:not([hidden]))) { display: none; }
/* Sign-in alert box: "Your account has not been activated yet" + Resend button */
.auth-alert { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: 10px; border: 1px solid transparent; }
.auth-alert[hidden] { display: none; }
.auth-alert.error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.auth-alert.ok { background: var(--conn-ok-bg); color: var(--conn-ok); border-color: var(--conn-box-border); }
.auth-alert.info { background: var(--accent-soft); color: var(--accent-strong, var(--accent)); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.auth-alert-icon { flex: none; margin-top: 1px; }
.auth-alert-body { display: grid; gap: 10px; justify-items: start; min-width: 0; }
.auth-alert-body p { margin: 0; font-size: 0.9rem; line-height: 1.45; color: var(--text); }
.auth-alert-btn { width: auto; min-height: 0; padding: 7px 12px; border-radius: 8px; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); box-shadow: none; }
.auth-alert-btn:hover:not(:disabled) { border-color: currentColor; background: var(--surface-2); }
.auth-alert-btn:disabled { opacity: 0.7; cursor: default; }
#authForgotRow { justify-content: flex-end; }

.verify-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 0 0 16px; padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--warn-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent);
  font-size: 0.9rem;
}
.verify-banner > span { flex: 1; min-width: 200px; }
.verify-banner .icon { color: var(--warn); flex: none; }

/* Settings › Your data & account */
.data-card .channel h3 { margin: 0 0 4px; font-size: 1rem; }
.danger-zone h3 { color: var(--danger); }
.delete-form { display: grid; gap: 12px; margin-top: 12px; padding: 14px; border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); background: var(--danger-soft); }
.delete-form label { display: grid; gap: 6px; font-weight: 500; font-size: 0.85rem; }
.delete-form input { width: 100%; }
.delete-form .channel-actions { margin-top: 0; }
.delete-warning { margin: 0; font-size: 0.9rem; color: var(--text); }
.delete-form .status:empty { display: none; }
#accountDataLink { margin-top: 10px; justify-content: flex-start; font-size: 0.85rem; white-space: normal; text-align: left; }

/* ------------------------------------------------------------ chat */

.chat-layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }
.chat-card { display: flex; flex-direction: column; gap: 14px; }
.chat-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.chat-log {
  display: flex; flex-direction: column; gap: 12px; min-height: 300px; max-height: 60vh;
  overflow-y: auto; padding: 4px 2px;
}
.chat-empty { color: var(--text-2); font-size: 0.93rem; }
.chat-empty ul { margin: 6px 0 0 18px; display: grid; gap: 4px; }
.chat-msg { max-width: 86%; padding: 10px 14px; border-radius: 12px; line-height: 1.55; overflow-wrap: anywhere; }
.chat-msg p { margin: 0 0 6px; }
.chat-msg p:last-child { margin-bottom: 0; }
.chat-msg ul, .chat-msg ol { margin: 4px 0 8px 20px; display: grid; gap: 3px; }
.chat-msg .md-h { font-size: 0.98rem; margin: 10px 0 4px; }
.chat-msg .md-h:first-child { margin-top: 0; }
.chat-msg code { font-family: var(--mono); font-size: 0.82em; background: var(--surface-3); padding: 1px 5px; border-radius: 5px; }
.chat-user { align-self: flex-end; background: var(--accent-soft); color: var(--text); border-bottom-right-radius: 4px; }
.chat-assistant { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-thinking { color: var(--muted); font-style: italic; }
.chat-steps { margin-top: 8px; font-size: 0.82rem; color: var(--muted); }
.chat-steps summary { cursor: pointer; }
.chat-steps ol { margin: 4px 0 0 18px; }
.chat-actions { display: grid; gap: 8px; margin-top: 10px; }
.chat-action {
  display: flex; gap: 10px; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border);
}
.chat-action.applied { border-color: color-mix(in srgb, var(--ok-fill) 40%, transparent); opacity: 0.75; }
.chat-action-main { min-width: 0; font-size: 0.9rem; }
.chat-action button { min-height: 30px; padding: 4px 12px; font-size: 0.82rem; flex-shrink: 0; }
.chat-actions > button.secondary { justify-self: start; min-height: 30px; padding: 4px 12px; font-size: 0.82rem; }
.chat-quote { font-size: 0.85rem; color: var(--text-2); font-style: italic; margin-top: 3px; }
.chat-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-form { display: flex; gap: 8px; align-items: stretch; }
.chat-form textarea { flex: 1; min-width: 0; resize: vertical; min-height: 48px; }
.chat-side { display: grid; gap: 12px; position: sticky; top: 72px; }
.chat-side h2 { font-size: 1rem; }
.conn { padding: 10px 0; border-top: 1px solid var(--border); display: grid; gap: 8px; }
.conn:first-of-type { border-top: 0; }
.conn h3 { font-size: 0.9rem; margin: 0; }
.conn .inline-form { flex-wrap: wrap; }
.conn .inline-form input { min-width: 140px; }
.conn .status:empty { display: none; }
.conn > button { justify-self: start; }
.memory-form { display: grid; gap: 8px; }
.memory-form label { display: grid; gap: 4px; font-size: 0.82rem; font-weight: 500; }
.memory-form select, .memory-form input { width: 100%; min-width: 0; }
.memory-search { display: flex; gap: 6px; }
.memory-search button { padding: 6px 10px; font-size: 0.84rem; }
.memory-form .channel-actions { margin-top: 2px; }
.memory-form .channel-actions button { padding: 7px 12px; font-size: 0.84rem; }
.memory-heading { margin-top: 6px !important; }
.memory-list { display: grid; gap: 6px; }
.memory-row {
  display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface-2); font-size: 0.86rem; overflow-wrap: anywhere;
}
.memory-actions { display: flex; gap: 6px; }
.memory-actions button { min-height: 30px; padding: 4px 10px; font-size: 0.8rem; }

/* --------------------------------------------------------------- home */


.home-hero {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  padding: 36px 0 28px;
}
.eyebrow { font-size: 0.875rem; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.home-hero h2 {
  font-size: 2rem; font-weight: 700; letter-spacing: -0.025em; margin: 4px 0 6px; color: var(--brand-deep); min-height: 1.25em;
}
.home-hero .sub { font-size: 1rem; color: var(--text-2); max-width: 56ch; }
.home-hero-stats { display: flex; align-items: center; gap: 20px; }
.ring {
  --pct: 0; width: 84px; height: 84px; border-radius: 50%; flex: none;
  display: grid; place-content: center; text-align: center;
  background:
    radial-gradient(closest-side, var(--bg) 82%, transparent 83%),
    conic-gradient(var(--accent) calc(var(--pct) * 1%), var(--border) 0);
  transition: background var(--ease);
}
.ring.pop { animation: pop 0.3s ease-out; }
@keyframes pop { 50% { transform: scale(1.06); } }
.ring-num { font-size: 1.4rem; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.ring-label { font-size: 0.68rem; color: var(--muted); }
.streak-card { display: grid; gap: 2px; font-size: 0.9rem; color: var(--text-2); }
.streak-card strong { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }

.quick-capture {
  display: flex; align-items: center; gap: 10px; margin-bottom: 16px; padding: 8px 8px 8px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color var(--ease), box-shadow var(--ease);
}
.quick-capture input { flex: 1; min-width: 0; border: 0; padding: 10px 4px; font-size: 1rem; background: transparent; }
.quick-capture input:focus { box-shadow: none; }
.quick-capture:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.quick-capture-icon { color: var(--slate); }

.stat-grid {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
button.stat {
  display: grid; justify-items: start; justify-content: stretch; gap: 2px; padding: 16px 20px; text-align: left;
  min-height: 0; background: transparent; color: var(--text); border: 0; border-right: 1px solid var(--border); border-radius: 0;
}
button.stat:last-child { border-right: 0; }
button.stat:hover { background: var(--surface-2); }
.stat-num { font-size: 1.6rem; font-weight: 600; line-height: 1.15; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 0.8rem; color: var(--muted); font-weight: 500; }
.stat-overdue.hot .stat-num { color: var(--danger); }

.row-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.focus-list, .recent-list { display: grid; gap: 2px; grid-template-columns: minmax(0, 1fr); }
.focus-row {
  display: flex; gap: 12px; align-items: flex-start; padding: 10px 8px; border-radius: 8px;
  transition: background var(--ease), opacity 0.25s;
}
.focus-row:hover { background: var(--surface-2); }
.focus-row.completing { opacity: 0.45; }
.focus-row.completing .focus-text { text-decoration: line-through; color: var(--muted); }
.focus-body { min-width: 0; flex: 1; }
.focus-text { overflow-wrap: anywhere; font-weight: 500; }
.focus-row .task-meta .pill { margin-left: 0; margin-right: 6px; }
button.check {
  flex: none; width: 20px; height: 20px; min-height: 0; padding: 0; margin-top: 2px; border-radius: 6px;
  background: var(--surface); border: 1.5px solid var(--border-strong);
}
button.check:hover { background: var(--accent-soft); border-color: var(--accent); }
.completing button.check { background: var(--accent); border-color: var(--accent); }
.completing button.check::after { content: ""; width: 10px; height: 5px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }

button.recent-row {
  display: flex; gap: 12px; align-items: center; justify-content: flex-start; width: 100%;
  min-height: 40px; padding: 8px; background: transparent; color: var(--text); font-weight: 400;
  border-radius: 8px; text-align: left; white-space: normal;
}
button.recent-row:hover { background: var(--surface-2); }
.recent-row .icon { color: var(--slate); }
.recent-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-time { color: var(--muted); font-size: 0.78rem; flex: none; font-variant-numeric: tabular-nums; }

.empty.small { padding: 20px 14px; font-size: 0.9rem; border-style: dashed; }
.empty.small .link-button { margin-top: 2px; }
/* Loading placeholders hold the layout without shimmering. */
.skeleton { height: 40px; border-radius: 8px; background: var(--surface-3); }

.progress { height: 4px; border-radius: 999px; background: var(--border); overflow: hidden; margin-bottom: 12px; }
.progress span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width 0.25s ease; }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; }
.checklist li { display: flex; align-items: center; gap: 12px; padding: 10px 0; margin: 0; border-bottom: 1px solid var(--border); }
.checklist li:last-child { border-bottom: 0; }
.checklist-body { flex: 1; min-width: 0; display: grid; }
.checklist-body strong { font-weight: 500; }
.check-dot {
  flex: none; width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center;
  border: 1.5px solid var(--border-strong); color: #fff;
}
.check-dot .icon { width: 13px; height: 13px; stroke-width: 3; }
.checklist li.done .check-dot { background: var(--accent); border-color: var(--accent); }
.checklist li.done strong { color: var(--muted); text-decoration: line-through; }

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

/* ------------------------------------------------------ capture page */

.grid-capture { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }
.grid-capture > .card { margin-bottom: 0; }
.capture-card textarea { min-height: 200px; border-color: var(--border); }
.capture-help h2 { font-size: 1rem; margin-bottom: 10px; }
.capture-help h3 { font-size: 0.9rem; margin-top: 18px; }
.steps { padding-left: 18px; margin: 0; display: grid; gap: 8px; font-size: 0.9rem; color: var(--text-2); }
.steps strong { font-weight: 600; color: var(--text); }
.plain { list-style: none; padding: 0; font-size: 0.9rem; color: var(--text-2); }
.plain li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.plain .icon { color: var(--slate); }

/* ------------------------------------------------- tasks / settings */

.filter-pills { display: flex; flex-wrap: wrap; max-width: 100%; gap: 2px; padding: 3px; background: color-mix(in srgb, var(--text) 5%, transparent); border-radius: var(--radius-sm); }
button.filter-pill { min-height: 32px; background: transparent; color: var(--text-2); padding: 5px 14px; border-radius: 8px; font-weight: 500; }
button.filter-pill:hover { background: color-mix(in srgb, var(--surface) 60%, transparent); }
button.filter-pill[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(23, 24, 23, 0.08); }

.agent-ask { margin-top: 16px; }
.conn-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.conn-grid > .card { margin: 0; }
.conn-grid > #whatsappCard { grid-column: 1 / -1; }
.conn-grid .card > form, .conn-grid .card > button { margin-top: 12px; }
.conn-line { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); display: grid; gap: 4px; font-weight: 500; font-size: 0.875rem; }
.chat-connect-hint { display: grid; gap: 10px; justify-items: start; }
.chat-side:has(#memorySection:not([hidden])) .chat-connect-hint { display: none; }

/* --------------------------------------------------------- responsive */

@media (max-width: 1080px) {
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  button.stat:nth-child(3) { border-right: 0; }
  button.stat:nth-child(-n+3) { border-bottom: 1px solid var(--border); }
  .grid-capture { grid-template-columns: minmax(0, 1fr); }
  .wrap { padding: 8px 28px 72px; }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: min(280px, 85vw);
    transform: translateX(-102%); transition: transform 0.22s ease; box-shadow: var(--shadow);
  }
  .sidebar.open { transform: none; }
  .menu-button { display: inline-flex; }
  .topbar { padding: 8px 12px; gap: 8px; }
  .grid-2, .conn-grid { grid-template-columns: minmax(0, 1fr); }
  .chat-layout { grid-template-columns: minmax(0, 1fr); }
  .chat-side { position: static; }
  .wrap { padding: 4px 16px 104px; }
  .page-header { padding: 16px 0 20px; }
  .page-header h1 { font-size: 1.6rem; }
  .bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: end;
    padding: 6px 6px calc(8px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 96%, transparent); backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
  }
  .bottom-nav button {
    position: relative; flex-direction: column; gap: 2px; min-height: 52px; padding: 6px 2px;
    background: transparent; color: var(--muted); font-size: 0.7rem; font-weight: 500;
  }
  .bottom-nav button .icon { width: 22px; height: 22px; }
  .bottom-nav button[aria-current="page"] { color: var(--accent-strong); font-weight: 600; }
  .bottom-nav .badge { position: absolute; top: 2px; right: calc(50% - 22px); height: 17px; min-width: 17px; font-size: 0.64rem; }
  .bottom-nav button.bottom-capture {
    justify-self: center; width: 52px; height: 52px; border-radius: 16px; margin-bottom: 2px;
    background: var(--accent); color: var(--accent-text);
  }
  .bottom-nav button.bottom-capture .icon { width: 24px; height: 24px; stroke-width: 2.2; }
  .toasts { bottom: 88px; }
}
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .account summary { padding: 2px; }
  .account-name { display: none; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  button.stat { border-bottom: 1px solid var(--border); }
  button.stat:nth-child(2n) { border-right: 0; }
  button.stat:nth-child(3) { border-right: 1px solid var(--border); }
  .stat-grid .stat-items { grid-column: 1 / -1; border-bottom: 0; }
  .home-hero { padding: 20px 0; }
  .home-hero h2 { font-size: 1.6rem; }
  .ring { width: 72px; height: 72px; }
  .new-capture kbd { display: none; }
  .card { padding: 18px; }
  .agent-actions, .action-grid { grid-template-columns: minmax(0, 1fr); }
  .inline-form { flex-direction: column; }
  .search-toolbar label, .search-toolbar label.grow { min-width: 100%; }
  .card.hero button { width: 100%; }
  .chat-msg { max-width: 100%; }
  .chat-form { flex-direction: column; }
  .chat-action { flex-direction: column; align-items: stretch; }
  .note, .task { padding: 14px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.bottom-nav button:not(.bottom-capture):hover { background: transparent; color: var(--text); }
.bottom-nav button.bottom-capture:hover { background: var(--accent-hover); }

/* ------------------------------------------------ help, legal and footer */

.side-help { display: flex; flex-wrap: wrap; gap: 2px 10px; padding: 6px 10px 2px; font-size: 0.75rem; }
.side-help a, .footer-links a, .legal-note a, .doc-nav a, .doc-back { color: var(--muted); text-decoration: none; }
.side-help a:hover, .footer-links a:hover, .legal-note a:hover, .doc-back:hover { color: var(--accent-strong); text-decoration: underline; }
.legal-note { font-size: 0.78rem; color: var(--muted); }
.legal-note a { color: var(--accent-strong); text-decoration: underline; }

.app-footer { border-top: 1px solid var(--border); margin-top: 24px; }
.app-footer-inner {
  max-width: 1180px; margin: 0 auto; padding: 20px 48px 28px;
  display: grid; gap: 10px; font-size: 0.82rem; color: var(--muted);
}
.footer-tagline strong { color: var(--brand-deep); font-weight: 600; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 32px; }
.footer-group { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.footer-label { font-weight: 600; color: var(--text-2); }
.footer-copy { font-size: 0.78rem; }

.doc-body { min-height: 100vh; display: flex; flex-direction: column; }
.doc-header {
  position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.doc-header-inner {
  max-width: 1100px; margin: 0 auto; padding: 12px 24px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px;
}
.doc-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.doc-nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
.doc-nav a { padding: 6px 12px; border-radius: 8px; font-size: 0.9rem; font-weight: 500; color: var(--text-2); }
.doc-nav a:hover { background: var(--surface-3); }
.doc-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.doc-back { font-size: 0.875rem; font-weight: 600; color: var(--accent-strong); }

.doc-main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 40px 24px 56px; }
.doc-main p, .doc-main li { line-height: 1.7; color: var(--text); }
.doc-main p + p { margin-top: 10px; }
.doc-main ul { margin: 8px 0 12px; }
.doc-hero { padding-bottom: 24px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.doc-eyebrow { font-size: 0.8rem; font-weight: 600; color: var(--accent-strong); margin-bottom: 6px; }
.doc-hero h1 { font-size: 1.75rem; font-weight: 600; letter-spacing: -0.02em; color: var(--brand-deep); margin-bottom: 12px; }
.doc-lede { font-size: 1.05rem; }
.doc-meta { font-size: 0.82rem; color: var(--muted) !important; margin-bottom: 14px; font-variant-numeric: tabular-nums; }

.doc-toc { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.doc-toc > a {
  padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  font-size: 0.84rem; color: var(--text-2); text-decoration: none;
}
.doc-toc > a:hover { border-color: var(--accent); color: var(--accent-strong); }
.doc-toc-list { display: block; padding: 16px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.doc-toc-list ol { margin: 0; padding-left: 20px; columns: 2; column-gap: 32px; font-size: 0.875rem; }
.doc-toc-list li { line-height: 1.6; margin: 2px 0; break-inside: avoid; }
.doc-toc-list a { color: var(--accent-strong); text-decoration: none; }
.doc-toc-list a:hover { text-decoration: underline; }

.doc-section, .faq-group { scroll-margin-top: 84px; }
.doc-section { padding-top: 8px; margin-bottom: 20px; }
.doc-main h2 { font-size: 1.15rem; font-weight: 600; color: var(--brand-deep); margin: 20px 0 8px; }
.doc-main h3 { font-size: 0.95rem; font-weight: 600; margin: 16px 0 4px; }

.faq-group { margin-bottom: 24px; }
.faq-item { border-bottom: 1px solid var(--border); }
.faq-item summary {
  list-style: none; cursor: pointer; display: flex; justify-content: space-between; gap: 16px;
  padding: 14px 4px; font-weight: 500; color: var(--text);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: ""; flex: none; width: 8px; height: 8px; margin-top: 6px;
  border-right: 2px solid var(--slate); border-bottom: 2px solid var(--slate);
  transform: rotate(45deg); transition: transform var(--ease);
}
.faq-item[open] summary::after { transform: rotate(-135deg); margin-top: 10px; }
.faq-item summary:hover { color: var(--accent-strong); }
.faq-item > p, .faq-item > ul { padding: 0 4px; }
.faq-item > :last-child { padding-bottom: 14px; }

.doc-callout { padding: 20px 22px; border-radius: var(--radius); background: var(--ice); margin-top: 20px; }
.doc-callout h3 { margin-top: 0; color: var(--brand-deep); font-size: 1.05rem; }
.doc-closing { margin-top: 32px; padding: 20px 0 0; border-top: 1px solid var(--border); color: var(--text-2); }
.doc-contact { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin: 8px 0 0; font-size: 0.95rem; }
.doc-contact dt { font-weight: 600; color: var(--text-2); }
.doc-contact dd { margin: 0; }

/* Details still to be filled in before publishing (see the pre-publication checklist). */
.placeholder { padding: 1px 6px; border-radius: 6px; background: var(--warn-soft); color: var(--warn); font-size: 0.92em; }
.placeholder-note {
  padding: 10px 14px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn) !important; font-size: 0.9rem;
}

@media (max-width: 900px) {
  .app-footer-inner { padding: 18px 16px 104px; }
}
@media (max-width: 640px) {
  .doc-header-inner { padding: 10px 16px; }
  .doc-nav { order: 3; flex-basis: 100%; }
  .doc-back { margin-left: auto; }
  .doc-main { padding: 28px 16px 40px; }
  .doc-toc-list ol { columns: 1; }
  .app-footer-inner { padding-left: 16px; padding-right: 16px; }
}

.doc-body .app-footer-inner { padding-bottom: 28px; }

/* ======================================================================
 * Top bar + Home hero (mockup v2), lighter blue canvas, multicolour accents.
 * Accent colours are decorative chips beside text labels, never the only
 * signal. Text colours keep 4.5:1 on their soft backgrounds.
 * ==================================================================== */

:root {
  --bg: #f3f8fe;                 /* lighter blue canvas */
  --sky-wash: #e3f1fd;
  --ring-track: #d6e9fb;
  --tone-blue: #176fe5;   --tone-blue-soft: #e4f1fc;
  --tone-violet: #6847d6; --tone-violet-soft: #efeafe;
  --tone-teal: #0b7f71;   --tone-teal-soft: #daf3ef;
  --tone-amber: #a35f00;  --tone-amber-soft: #fff0d4;
  --tone-coral: #c7364d;  --tone-coral-soft: #fde7eb;
  --tone-pink: #b2317f;   --tone-pink-soft: #fbe5f1;
}
.tone-blue   { --tone: var(--tone-blue);   --tone-soft: var(--tone-blue-soft); }
.tone-violet { --tone: var(--tone-violet); --tone-soft: var(--tone-violet-soft); }
.tone-teal   { --tone: var(--tone-teal);   --tone-soft: var(--tone-teal-soft); }
.tone-amber  { --tone: var(--tone-amber);  --tone-soft: var(--tone-amber-soft); }
.tone-coral  { --tone: var(--tone-coral);  --tone-soft: var(--tone-coral-soft); }
.tone-pink   { --tone: var(--tone-pink);   --tone-soft: var(--tone-pink-soft); }

/* ---- top bar: full width above the sidebar ---- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: 72px; padding: 0 20px 0 12px; gap: 14px;
  display: flex; align-items: center;
  background:
    radial-gradient(42% 160% at 100% 0%, rgba(53, 183, 244, 0.20), transparent 70%),
    radial-gradient(30% 140% at 82% 120%, rgba(23, 111, 229, 0.10), transparent 70%),
    var(--surface);
  backdrop-filter: none;
  border-bottom: 1px solid var(--border);
}
.menu-button { display: inline-flex; }
.topbar .icon-button { width: 42px; height: 42px; min-height: 0; padding: 0; border-radius: 12px; color: var(--text); }
.topbar .icon-button .icon { width: 22px; height: 22px; }
.top-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; min-width: 0; }
.top-brand .brand-name { font-size: 1.3rem; }
.top-brand .brand-tagline { font-size: 0.78rem; color: var(--text-2); white-space: nowrap; }
.top-divider { width: 1px; height: 32px; background: var(--border-strong); margin: 0 8px; flex: none; }
.top-title {
  flex: 1; min-width: 0; margin: 0; font-size: 1.15rem; font-weight: 600; color: var(--brand-deep);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.top-actions { display: flex; align-items: center; gap: 10px; }
.bell { position: relative; }
.bell-dot {
  position: absolute; top: 9px; right: 10px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--tone-blue); box-shadow: 0 0 0 2px var(--surface);
}
.account summary { padding: 0; border-radius: 12px; }
.account summary:hover { background: transparent; }
.topbar .avatar { width: 42px; height: 42px; border-radius: 12px; font-size: 1rem; }
.topbar .avatar .icon { width: 20px; height: 20px; }
.account-who { margin: 0 0 10px; font-weight: 600; color: var(--brand-deep); }

.app-shell { min-height: calc(100vh - 72px); }
.sidebar { top: 72px; height: calc(100vh - 72px); }
body.nav-collapsed .app-shell { grid-template-columns: minmax(0, 1fr); }
body.nav-collapsed .sidebar { display: none; }
body.locked .topbar { display: none !important; }

/* ---- Home hero ---- */
.home-hero {
  position: relative; isolation: isolate;
  display: flex; align-items: center; justify-content: space-between; gap: 32px; flex-wrap: wrap;
  padding: 40px 0 32px;
}
.hero-deco {
  position: absolute; z-index: -1; right: -60px; top: -30px; width: 620px; height: 320px; pointer-events: none;
  background:
    radial-gradient(closest-side, rgba(53, 183, 244, 0.16), transparent),
    radial-gradient(40% 60% at 30% 70%, rgba(104, 71, 214, 0.06), transparent 70%);
}
.hero-date { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; font-size: 1rem; color: var(--text-2); }
.hero-date .icon { width: 20px; height: 20px; color: var(--slate); }
.hero-sep { color: var(--slate); }
.hero-greeting { font-weight: 600; color: var(--accent-strong); }
.hero-greeting:empty, .hero-sep:has(+ .hero-greeting:empty) { display: none; }
.home-hero .hero-headline {
  margin: 0 0 14px; max-width: 19ch;
  font-size: clamp(1.9rem, 1.1rem + 2.2vw, 2.7rem); font-weight: 800; line-height: 1.14; letter-spacing: -0.03em;
  color: var(--brand-deep);
}
.hero-highlight {
  color: var(--accent-strong);
  background: linear-gradient(90deg, rgba(53, 183, 244, 0.55), rgba(23, 111, 229, 0.30)) no-repeat 0 94% / 100% 0.2em;
  border-radius: 2px;
}
.hero-steps { display: flex; flex-wrap: wrap; gap: 4px 0; margin: 0; font-size: 1.05rem; color: var(--text-2); }
.hero-steps span + span::before { content: "·"; margin: 0 12px; color: var(--slate); }
.hero-hook {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 18px; padding: 6px 14px;
  border-radius: 999px; background: var(--tone-blue-soft); color: var(--text-2); font-size: 0.9rem;
}
.hero-hook::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: linear-gradient(135deg, #35b7f4, #176fe5); }
.home-hero-text { flex: 1 1 460px; min-width: 0; }
.home-hero-stats { flex: 0 1 auto; display: flex; align-items: center; gap: 20px; }
.home-hero .ring {
  width: 124px; height: 124px;
  background:
    radial-gradient(closest-side, var(--bg) 84%, transparent 85%),
    conic-gradient(#35b7f4 0%, #176fe5 calc(var(--pct) * 1%), var(--ring-track) 0);
}
.home-hero .ring-num { font-size: 2.1rem; font-weight: 700; color: var(--brand-deep); }
.home-hero .ring-label { font-size: 0.85rem; color: var(--text-2); }
.hero-divider { width: 1px; align-self: stretch; min-height: 84px; background: var(--border-strong); }
.home-hero .streak-card {
  display: flex; align-items: center; gap: 14px; padding: 16px 22px; border-radius: 18px;
  background: linear-gradient(135deg, var(--tone-blue-soft), var(--surface));
  border: 1px solid var(--border);
}
.flame { flex: none; }
.streak-text { display: grid; gap: 2px; }
.streak-text strong { font-size: 1.05rem; font-weight: 600; color: var(--brand-deep); }
.streak-text > span { font-size: 0.9rem; color: var(--text-2); }
.home-hero .streak-card { max-width: 290px; }

.quick-capture {
  padding: 10px 10px 10px 20px; border-radius: 999px; margin-bottom: 20px;
  box-shadow: 0 4px 16px rgba(23, 26, 43, 0.06);
}
.quick-capture input { font-size: 1.05rem; }
.quick-capture-icon { color: var(--accent); }
#quickCaptureButton { padding: 10px 22px; border-radius: 999px; font-size: 0.95rem; font-family: var(--display); }

/* ---- multicolour chips ---- */
.tone-chip {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  background: var(--tone-soft); color: var(--tone);
}
.tone-chip .icon { width: 18px; height: 18px; }
button.stat[class*="tone-"] { grid-template-columns: auto 1fr; column-gap: 12px; align-items: center; }
button.stat[class*="tone-"] .tone-chip { grid-row: span 2; }
.tile[class*="tone-"] .icon,
.recent-row[class*="tone-"] .icon {
  width: 32px; height: 32px; padding: 7px; border-radius: 9px; box-sizing: border-box;
  color: var(--tone); background: var(--tone-soft);
}
button.tile[class*="tone-"]:hover .icon { color: var(--tone); }
.recent-row[class*="tone-"] .icon { width: 28px; height: 28px; padding: 6px; }
.progress span { background: linear-gradient(90deg, #35b7f4, #176fe5); }

@media (max-width: 900px) {
  .topbar { height: 60px; padding: 0 12px; gap: 10px; }
  .top-brand .brand-tagline, .top-divider { display: none; }
  .top-brand .brand-name { font-size: 1.15rem; }
  .top-title { font-size: 1rem; }
  .sidebar { top: 0; height: 100vh; z-index: 50; }
  body.nav-collapsed .sidebar { display: flex; }
  .app-shell { min-height: calc(100vh - 60px); }
  .home-hero { padding: 24px 0; gap: 20px; }
  .hero-deco { width: 100%; right: 0; }
  .home-hero .ring { width: 104px; height: 104px; }
  .home-hero .ring-num { font-size: 1.7rem; }
}
@media (max-width: 640px) {
  .top-title { display: none; }
  .hero-divider { display: none; }
  .home-hero-stats { gap: 16px; flex-wrap: wrap; }
  .hero-steps { font-size: 0.95rem; }
  /* Phones: a compact hero, so the capture box is on the first screen. */
  .home-hero { padding: 10px 0 16px; gap: 14px; }
  .home-hero .hero-headline { font-size: 1.55rem; margin-bottom: 8px; }
  .hero-date { margin-bottom: 8px; font-size: 0.9rem; }
  .hero-steps { display: none; }
  .hero-hook { margin-top: 4px; font-size: 0.84rem; }
  .home-hero-stats { flex-wrap: nowrap; gap: 12px; width: 100%; }
  .home-hero .ring { width: 78px; height: 78px; flex: none; }
  .home-hero .ring-num { font-size: 1.35rem; }
  .home-hero .ring-label { font-size: 0.7rem; }
  .home-hero .streak-card { flex: 1; max-width: none; padding: 12px 14px; gap: 10px; }
  .streak-text strong { font-size: 0.95rem; }
  .streak-text > span { font-size: 0.82rem; }
}

/* ======================================================================
 * Tasks: + chooser, task panel, board, calendar, Home "Your tasks",
 * notifications. Priority colours are subtle dots + labels, never colour alone.
 * ==================================================================== */

:root {
  --p-urgent: #e5484d; --p-urgent-soft: #fdecec; --p-urgent-text: #b42318;
  --p-high: #f97316;   --p-high-soft: #fff1e6;   --p-high-text: #b54708;
  --p-medium: #eab308; --p-medium-soft: #fef8d9; --p-medium-text: #854d0e;
  --p-low: #22a06b;    --p-low-soft: #e5f6ee;    --p-low-text: #157347;
}
.prio-urgent { --p: var(--p-urgent); --p-soft: var(--p-urgent-soft); --p-text: var(--p-urgent-text); }
.prio-high   { --p: var(--p-high);   --p-soft: var(--p-high-soft);   --p-text: var(--p-high-text); }
.prio-medium { --p: var(--p-medium); --p-soft: var(--p-medium-soft); --p-text: var(--p-medium-text); }
.prio-low    { --p: var(--p-low);    --p-soft: var(--p-low-soft);    --p-text: var(--p-low-text); }
.prio-dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--p, var(--slate)); }
.prio-tag {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px;
  background: var(--p-soft); color: var(--p-text); font-size: 0.74rem; font-weight: 600;
}

/* ---------------------------------------------------------------- modals */
body.modal-open { overflow: hidden; }
.modal-backdrop {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px;
  background: rgba(16, 42, 76, 0.32); backdrop-filter: blur(2px); animation: fade-in 0.15s ease-out;
}
.chooser-card {
  width: min(560px, 100%); padding: 24px; display: grid; gap: 16px;
  background: var(--surface); border-radius: 18px; box-shadow: 0 24px 64px rgba(16, 42, 76, 0.25);
}
.chooser-card h2 { font-size: 1.2rem; color: var(--brand-deep); }
.chooser-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
button.chooser-option {
  display: grid; justify-items: start; align-content: start; gap: 4px; padding: 16px; min-height: 120px;
  white-space: normal; text-align: left; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 14px; font-weight: 400;
}
button.chooser-option:hover, button.chooser-option:focus-visible { background: var(--tone-soft); border-color: var(--tone); }
.chooser-option strong { font-size: 1rem; font-weight: 600; margin-top: 6px; }
.chooser-option span:last-child { font-size: 0.84rem; color: var(--text-2); }
.chooser-foot { display: flex; justify-content: flex-end; }

/* Task panel slides in from the right. */
.panel-backdrop { place-items: stretch end; padding: 0; }
.task-panel {
  width: min(520px, 100vw); height: 100vh; display: flex; flex-direction: column;
  background: var(--surface); box-shadow: -18px 0 48px rgba(16, 42, 76, 0.18);
  animation: panel-in 0.2s ease-out;
}
@keyframes panel-in { from { transform: translateX(24px); opacity: 0; } }
.task-panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
}
.task-panel-head h2 { font-size: 1.15rem; color: var(--brand-deep); }
.task-panel-head .icon-button { width: 36px; height: 36px; min-height: 0; padding: 0; font-size: 1rem; }
.task-panel-body { flex: 1; overflow-y: auto; padding: 18px 22px; display: grid; gap: 18px; align-content: start; }
.task-panel-foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 14px 22px;
  border-top: 1px solid var(--border); background: var(--surface-2);
}
.task-panel-foot .spacer { flex: 1; }
.edit-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.field { display: grid; gap: 6px; font-size: 0.85rem; font-weight: 500; color: var(--text-2); }
.field.compact input, .field.compact select { padding: 7px 10px; }
#tfTitle { font-size: 1.05rem; font-weight: 500; padding: 10px 12px; }
#tfDescription { min-height: 80px; font-size: 0.95rem; }
.field-group { border: 0; padding: 0; margin: 0; display: grid; gap: 10px; }
.field-group > legend, .field-group > summary {
  padding: 0; margin-bottom: 4px; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.02em;
  text-transform: uppercase; color: var(--muted);
}
details.field-group > summary { cursor: pointer; list-style: revert; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-row button.chip-button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.when-detail { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.more-time > summary { cursor: pointer; font-size: 0.84rem; color: var(--accent-strong); font-weight: 500; }
.more-time .field-grid { margin-top: 10px; }
.inline-fields { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--text-2); }
.inline-fields input { width: 80px; }
.inline-fields select { width: auto; }
.trigger-list { display: grid; gap: 8px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
label.check { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 0.875rem; font-weight: 400; color: var(--text); cursor: pointer; }
label.check input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }
label.check select { width: auto; padding: 4px 8px; font-size: 0.84rem; }
.priority-picker { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.prio-option {
  position: relative; display: grid; gap: 2px; padding: 10px 12px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; font-size: 0.875rem;
}
.prio-option input { position: absolute; opacity: 0; pointer-events: none; }
.prio-option .prio-dot { margin-bottom: 4px; width: 10px; height: 10px; }
.prio-option small { font-weight: 400; font-size: 0.72rem; color: var(--text-2); }
.prio-option:has(input:checked) { border-color: var(--p); background: var(--p-soft); box-shadow: inset 0 0 0 1px var(--p); }
.prio-option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.checklist-edit, .links-edit { display: grid; gap: 6px; }
.checklist-row, .link-row {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 10px; background: var(--surface-2);
}
.checklist-row .check { flex: 1; }
.checklist-row input:checked + span { text-decoration: line-through; color: var(--muted); }
.link-row a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.875rem; }
.link-row .icon { color: var(--slate); }
.extras .inline-form { margin-top: 4px; }
#tfStatus:empty { display: none; }

/* -------------------------------------------------------- task views */
.task-views-head { margin-bottom: 18px; }
.view-switch { display: flex; gap: 2px; padding: 3px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--text) 5%, transparent); }
.view-switch [role="tab"] {
  min-height: 34px; padding: 6px 14px; border-radius: 8px; background: transparent; color: var(--text-2); font-weight: 500;
}
.view-switch [role="tab"] .icon { width: 16px; height: 16px; }
.view-switch [role="tab"][aria-selected="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(16, 42, 76, 0.1); }

/* Board: horizontal columns that scroll on small screens. */
/* position: relative keeps hidden labels inside the scroller, so the page itself never widens. */
.board {
  position: relative;
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(270px, 1fr); gap: 14px;
  overflow-x: auto; padding-bottom: 12px; align-items: start; scroll-snap-type: x proximity;
}
.board-col {
  display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 16px;
  background: color-mix(in srgb, var(--tone-soft) 55%, var(--surface-2)); border: 1px solid var(--border);
  scroll-snap-align: start; min-height: 180px;
}
.board-col-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 4px; }
.board-col-head h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 0.92rem; color: var(--brand-deep); }
.col-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--tone); }
.col-count { font-size: 0.75rem; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--surface); color: var(--text-2); }
.col-tools { display: flex; gap: 10px; font-size: 0.78rem; }
.board-cards { display: grid; gap: 8px; min-height: 40px; border-radius: 12px; transition: background var(--ease); }
.board-cards.drop-target { background: color-mix(in srgb, var(--tone) 10%, transparent); outline: 2px dashed color-mix(in srgb, var(--tone) 45%, transparent); outline-offset: 2px; }
.drop-line { height: 3px; border-radius: 3px; background: var(--accent); }
.board-empty { margin: 0; padding: 14px 10px; text-align: center; font-size: 0.82rem; color: var(--muted); }
button.board-add {
  justify-content: flex-start; width: 100%; min-height: 34px; padding: 6px 10px; background: transparent;
  color: var(--text-2); border: 0; font-weight: 500; font-size: 0.85rem;
}
button.board-add:hover { background: var(--surface); color: var(--accent-strong); }
.board-new-col { background: transparent; border-style: dashed; justify-content: flex-start; min-height: 0; }
.board-new-col button { justify-content: center; }

.task-card {
  display: grid; gap: 8px; padding: 12px 12px 10px; border-radius: 12px; cursor: grab;
  background: var(--surface); border: 1px solid var(--border); box-shadow: 0 1px 2px rgba(16, 42, 76, 0.05);
  transition: box-shadow var(--ease), transform var(--ease), border-color var(--ease);
}
.task-card:hover { box-shadow: 0 6px 18px rgba(16, 42, 76, 0.1); border-color: var(--border-strong); }
.task-card:active { cursor: grabbing; }
.task-card.dragging { opacity: 0.5; transform: rotate(1deg); }
.task-card.is-overdue { border-color: color-mix(in srgb, var(--p-urgent) 45%, var(--border)); }
.task-card.is-done .card-title { color: var(--muted); text-decoration: line-through; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.done-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 0.74rem; font-weight: 600; color: var(--ok); }
.done-tag .icon { width: 14px; height: 14px; }
.card-title { margin: 0; font-size: 0.92rem; font-weight: 500; line-height: 1.4; overflow-wrap: anywhere; color: var(--text); }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.card-meta:empty { display: none; }
.meta-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 999px;
  font-size: 0.74rem; color: var(--text-2); background: var(--surface-3); font-variant-numeric: tabular-nums;
}
.meta-chip .icon { width: 13px; height: 13px; }
.meta-chip.is-overdue { background: var(--p-urgent-soft); color: var(--p-urgent-text); font-weight: 600; }
.meta-chip.is-complete { background: var(--p-low-soft); color: var(--p-low-text); }

/* ---------------------------------------------------------- calendar */
.cal-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-title { margin: 0 0 0 8px; font-size: 1.1rem; color: var(--brand-deep); }
.cal-overdue {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 12px; padding: 10px 12px;
  border-radius: 12px; background: var(--p-urgent-soft); color: var(--p-urgent-text); font-size: 0.85rem;
}
.cal-overdue .cal-chip { width: auto; max-width: 220px; }
.calendar { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-weekday { padding: 8px 10px; font-size: 0.75rem; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--border); background: var(--surface-2); }
.cal-day {
  min-height: 108px; padding: 6px; display: flex; flex-direction: column; gap: 4px;
  border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.cal-day:nth-child(7n + 7) { border-right: 0; }
.cal-day.is-outside { background: var(--surface-2); }
.cal-day.is-outside .cal-num { color: var(--muted); }
.cal-day.drop-target, .cal-col.drop-target { background: var(--tone-blue-soft); }
button.cal-num {
  align-self: flex-start; min-height: 0; width: 28px; height: 28px; padding: 0; border-radius: 50%;
  background: transparent; color: var(--text); font-size: 0.82rem; font-weight: 600; font-variant-numeric: tabular-nums;
}
button.cal-num:hover { background: var(--surface-3); }
.cal-day.is-today .cal-num { background: var(--accent); color: #fff; }
button.cal-chip {
  justify-content: flex-start; gap: 5px; width: 100%; min-height: 0; padding: 3px 6px; border-radius: 6px;
  background: var(--p-soft); color: var(--text); font-size: 0.74rem; font-weight: 500; text-align: left; cursor: grab;
}
button.cal-chip:hover { background: var(--p-soft); filter: brightness(0.97); }
.cal-chip.is-overdue { box-shadow: inset 0 0 0 1px var(--p-urgent); }
.cal-chip.is-done .cal-chip-text { text-decoration: line-through; color: var(--muted); }
.cal-chip-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-time { font-variant-numeric: tabular-nums; color: var(--text-2); }
.cal-more { font-size: 0.74rem; align-self: flex-start; }
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-day.cal-week, .cal-col { display: flex; flex-direction: column; gap: 6px; min-height: 300px; padding: 10px 8px; border-right: 1px solid var(--border); }
.cal-col:last-child { border-right: 0; }
.cal-col.is-today { background: color-mix(in srgb, var(--tone-blue-soft) 60%, var(--surface)); }
.cal-col-head { display: flex; align-items: baseline; gap: 6px; font-size: 0.8rem; color: var(--muted); }
.cal-col-head strong { font-size: 1.1rem; color: var(--brand-deep); }
.cal-col-list { display: grid; gap: 4px; align-content: start; flex: 1; }
.cal-day.cal-col { min-height: 0; }
.calendar.cal-day { display: block; }
.calendar.cal-day .cal-col { min-height: 260px; border-right: 0; }
.calendar.cal-day button.cal-chip { font-size: 0.875rem; padding: 8px 10px; }

/* ---------------------------------------------------- Home: Your tasks */
.day-progress { height: 8px; margin: -4px 0 14px; border-radius: 999px; background: var(--ring-track); overflow: hidden; }
.day-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #35b7f4, #176fe5); transition: width 0.3s ease; }
.mini-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.mini-tabs [role="tab"] {
  min-height: 30px; padding: 4px 10px; border-radius: 999px; background: transparent;
  color: var(--text-2); font-size: 0.8rem; font-weight: 500; border: 1px solid transparent;
}
.mini-tabs [role="tab"]:hover { background: var(--surface-3); }
.mini-tabs [role="tab"][aria-selected="true"] { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.mini-tabs [data-count]:not(:empty) {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 2px;
  border-radius: 999px; background: var(--surface); font-size: 0.7rem; font-variant-numeric: tabular-nums;
}
.mini-tabs [data-home-list="overdue"] [data-count]:not(:empty) { background: var(--p-urgent-soft); color: var(--p-urgent-text); }
button.focus-open {
  display: grid; justify-items: start; gap: 4px; width: 100%; min-height: 0; padding: 0; text-align: left;
  background: transparent; color: inherit; border: 0; font-weight: 400; white-space: normal;
}
button.focus-open:hover { background: transparent; }
button.focus-open:hover .focus-text { color: var(--accent-strong); }
.focus-row .task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.overdue-text { color: var(--p-urgent-text); font-weight: 600; }

/* ------------------------------------------------------ notifications */
.notif-wrap { position: relative; }
.notif-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; width: min(380px, calc(100vw - 24px));
  max-height: min(520px, 70vh); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow);
}
/* Phones: the bell is not at the right edge, so pin the panel to the screen instead of the bell. */
@media (max-width: 640px) {
  .notif-panel { position: fixed; left: 12px; right: 12px; top: 64px; width: auto; }
}
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; }
.notif-head h2 { font-size: 1rem; color: var(--brand-deep); }
.notif-list { overflow-y: auto; padding: 0 8px 8px; display: grid; gap: 2px; }
.notif-empty { padding: 12px 8px; }
button.notif-item {
  display: grid; grid-template-columns: auto 1fr auto; align-items: start; gap: 10px; width: 100%;
  min-height: 0; padding: 10px; border-radius: 12px; background: transparent; color: var(--text);
  text-align: left; white-space: normal; font-weight: 400;
}
button.notif-item:hover { background: var(--surface-3); }
.notif-item.is-unread { background: color-mix(in srgb, var(--tone-blue-soft) 70%, transparent); }
.notif-text { display: grid; gap: 2px; min-width: 0; }
.notif-text strong { font-size: 0.875rem; font-weight: 600; overflow-wrap: anywhere; }
.notif-text span, .notif-text small { font-size: 0.8rem; color: var(--text-2); }
.unread-dot { width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--accent); }
.notif-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--border); }
.notif-foot .secondary[hidden] + .link-button { margin-left: auto; }
#notifSettings .switch { margin: 6px 0; }
#notifSettings .switch input:disabled + .switch-track { opacity: 0.5; }

@media (max-width: 900px) {
  .task-panel { width: 100vw; }
  .board { grid-auto-columns: minmax(250px, 82vw); }
  .cal-day { min-height: 76px; padding: 4px; }
  button.cal-chip .cal-time { display: none; }
  .cal-week { grid-template-columns: minmax(0, 1fr); }
  .cal-col { min-height: 0; border-right: 0; border-bottom: 1px solid var(--border); }
}
@media (max-width: 640px) {
  .chooser-grid { grid-template-columns: minmax(0, 1fr); }
  button.chooser-option { min-height: 0; }
  .priority-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .task-views-head { flex-wrap: wrap; }
  .cal-weekday { padding: 6px 2px; text-align: center; font-size: 0.68rem; }
  button.cal-chip { padding: 2px 4px; }
  button.cal-chip .cal-chip-text { display: none; }
}

/* Fixes after the first visual check. */
button.focus-open { justify-content: start; justify-items: start; align-content: start; }
.board-col-head { flex-wrap: wrap; }
.col-tools { flex-basis: 100%; padding-left: 17px; }
.mini-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; }
.mini-tabs [role="tab"] { flex: none; }

/* ======================================================================
 * Taskly brand layer (brand guidelines v1.0) — light theme only.
 * Palette from the Stack & Check symbol: Focus Blue for actions, Flow Teal,
 * Sort Purple, Done Yellow for "done", Spark Orange in small doses.
 * Poppins for headings, numbers and buttons; Inter for everything else.
 * ==================================================================== */

:root {
  --focus-blue: #2C58DD;   --flow-teal: #34D0CF;   --sort-purple: #A149D4;
  --done-yellow: #FBBD08;  --spark-orange: #F47234;
  --paper: #F7F6F1; --white: #FFFFFF; --mist: #E9E8F0; --ink: #171A2B; --slate-brand: #5B6075;
  --blue-10: #EAEFFC; --teal-10: #E8FAFA; --purple-10: #F5EDFB; --yellow-10: #FFF8E1;
  --teal-text: #138C8B; --purple-text: #7D2FAE; --yellow-text: #A57800;
  --gradient-layers: linear-gradient(110deg, #2C58DD 0%, #34D0CF 45%, #A149D4 100%);
  --gradient-spark: linear-gradient(110deg, #F47234 0%, #FBBD08 100%);
  --brand-stripe: linear-gradient(90deg, #2C58DD 0 25%, #34D0CF 25% 50%, #A149D4 50% 75%, #FBBD08 75%);

  /* App tokens mapped onto the brand */
  --bg: var(--paper);
  --sidebar: var(--white);
  --surface: var(--white);
  --surface-2: #FBFAF7;
  --surface-3: #F2F1EC;
  --border: var(--mist);
  --border-strong: #C7C9D6;
  --ice: var(--blue-10);
  --text: var(--ink);
  --text-2: var(--slate-brand);
  --muted: var(--slate-brand);
  --slate: var(--slate-brand);
  --brand-deep: var(--ink);
  --accent: var(--focus-blue);
  --accent-hover: #2348BE;
  --accent-strong: var(--focus-blue);
  --accent-soft: var(--blue-10);
  --accent-text: #FFFFFF;
  --ok: var(--yellow-text);       /* "done" and "connected" use Done Yellow */
  --ok-fill: var(--done-yellow);
  --ok-soft: var(--yellow-10);
  --sky-wash: var(--blue-10);
  --ring-track: var(--mist);
  --tone-blue: var(--focus-blue);    --tone-blue-soft: var(--blue-10);
  --tone-teal: var(--teal-text);     --tone-teal-soft: var(--teal-10);
  --tone-violet: var(--purple-text); --tone-violet-soft: var(--purple-10);
  --tone-pink: var(--purple-text);   --tone-pink-soft: var(--purple-10);
  --tone-amber: var(--yellow-text);  --tone-amber-soft: var(--yellow-10);
  --tone-coral: #B8481A;             --tone-coral-soft: #FEF0E8;   /* spark orange, text-safe */
  /* Priorities keep yellow free for "done" */
  --p-urgent: #E5484D; --p-urgent-soft: #FDECEC; --p-urgent-text: #B42318;
  --p-high: var(--spark-orange); --p-high-soft: #FEF0E8; --p-high-text: #B8481A;
  --p-medium: var(--focus-blue); --p-medium-soft: var(--blue-10); --p-medium-text: var(--focus-blue);
  --p-low: var(--flow-teal);     --p-low-soft: var(--teal-10);    --p-low-text: var(--teal-text);

  --shadow: 0 4px 16px rgba(23, 26, 43, 0.06);
  --radius: 20px;
  --radius-sm: 12px;
  --display: "Poppins", var(--font);
  --ease: 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: light;
}

/* Typography: Poppins for headings, numbers and the wordmark */
h1, h2, h3, .brand-name, .hero-headline, .stat-num, .ring-num, .page-header h1 { font-family: var(--display); }
h1, h2, .page-header h1, .home-hero .hero-headline { font-weight: 700; letter-spacing: -0.02em; color: var(--ink); }
h3 { font-weight: 600; }
.brand-name { font-weight: 700; letter-spacing: -0.02em; color: var(--ink); }

/* Thin brand stripe across the very top */
.topbar::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--brand-stripe);
}
.topbar { background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(8px); }
.top-brand .brand-tagline { color: var(--slate-brand); }

/* Surfaces: white cards, mist border, soft shadow, 20px corners */
.card { border-radius: var(--radius); border-color: var(--mist); box-shadow: var(--shadow); }
.card.subtle { box-shadow: none; }

/* Buttons: pill shape, Poppins on real buttons; Focus Blue is the only primary colour */
button { border-radius: 999px; min-height: 40px; padding: 8px 18px; }
button:is(:not([class]), .secondary, .danger, .big, .small, .record) { font-family: var(--display); font-weight: 600; }
button:hover { background: var(--accent-hover); }
button.secondary { background: var(--blue-10); color: var(--focus-blue); border-color: transparent; }
button.secondary:hover { background: #DCE4FA; }
button.small { min-height: 32px; padding: 5px 14px; }
button.link-button { color: var(--focus-blue); }
/* Controls that are not "buttons" to the eye keep softer corners */
button.nav-item, button.new-capture { border-radius: 12px; min-height: 0; }
button.tile, button.stat, button.chooser-option, button.recent-row, button.focus-open,
button.notif-item, button.cal-chip, button.cal-num, button.board-add { border-radius: var(--radius-sm); }
button.icon-button { border-radius: 12px; }
button.check { border-radius: 6px; min-height: 0; padding: 0; }
.task-actions button, .note-actions button { min-height: 30px; padding: 4px 13px; }

/* Inputs: white, 12px corners, Focus Blue focus */
input[type="text"], input[type="url"], input[type="email"], input[type="search"], input[type="tel"],
input[type="datetime-local"], input[type="password"], input[type="date"], input[type="time"],
input[type="number"], input:not([type]), select, textarea { border-radius: var(--radius-sm); }
:focus-visible { outline: 3px solid rgba(44, 88, 221, 0.35); outline-offset: 2px; }
input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 3px rgba(44, 88, 221, 0.22); }

/* Navigation: active item in Focus Blue tint */
button.nav-item[aria-current="page"] { background: var(--blue-10); color: var(--focus-blue); }
button.nav-item[aria-current="page"] .icon { color: var(--focus-blue); }
button.new-capture { color: var(--focus-blue); }

/* Home hero: one highlighted phrase in Focus Blue, soft brand blobs */
.hero-highlight { color: var(--focus-blue); background: none; }
.hero-greeting { color: var(--focus-blue); }
.hero-deco {
  background:
    radial-gradient(closest-side, rgba(52, 208, 207, 0.22), transparent),
    radial-gradient(40% 60% at 30% 70%, rgba(161, 73, 212, 0.14), transparent 70%),
    radial-gradient(30% 50% at 85% 30%, rgba(251, 189, 8, 0.18), transparent 70%);
}

/* Done = Done Yellow: progress ring, completed checks, checklist ticks */
.ring {
  background:
    radial-gradient(closest-side, var(--bg) 82%, transparent 83%),
    conic-gradient(var(--done-yellow) calc(var(--pct) * 1%), var(--mist) 0);
}
.completing button.check { background: var(--done-yellow); border-color: var(--done-yellow); }
.completing button.check::after { border-color: var(--ink); }
button.check:hover { background: var(--yellow-10); border-color: var(--done-yellow); }
.checklist li.done .check-dot { background: var(--done-yellow); border-color: var(--done-yellow); color: var(--ink); }
.done-tag { color: var(--yellow-text); }

/* Status chips: "connected" in Done Yellow tint, "built-in/off" in Focus Blue tint */
.chip[data-level="live"] { background: var(--yellow-10); color: var(--yellow-text); }
.chip[data-level="builtin"] { background: var(--blue-10); color: var(--focus-blue); }

/* The one AI action ("Analyze entire inbox with AI") carries the layer gradient */
#analyzeButton { background: var(--gradient-layers); color: #fff; border: 0; }
#analyzeButton:hover { filter: brightness(0.95); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* Task list: priority buttons under Open / Completed / Archived */
.section-head[data-view-pane="list"] { flex-wrap: wrap; gap: 8px; }
.priority-pills .filter-pill { display: inline-flex; align-items: center; gap: 6px; }
.priority-pills .pcount { min-width: 18px; padding: 0 5px; border-radius: 999px; font-size: 0.72rem; font-weight: 700;
  background: color-mix(in srgb, var(--text) 8%, transparent); font-variant-numeric: tabular-nums; }
.priority-pills .pcount:empty { display: none; }
.priority-pills .filter-pill.empty-count { opacity: 0.55; }
.pdot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.pdot[data-p="urgent"] { background: var(--p-urgent, #E5484D); }
.pdot[data-p="high"] { background: var(--p-high, #F47234); }
.pdot[data-p="medium"] { background: var(--p-medium, #2C58DD); }
.pdot[data-p="low"] { background: var(--p-low, #34D0CF); }

/* ============================================================ Settings */
.settings-group { font-size: 1.05rem; margin: 22px 0 4px; color: var(--text); }
.settings-group:first-child { margin-top: 4px; }
.settings-intro { margin: 0 0 12px; font-size: 0.88rem; color: var(--muted); }
.conn-grid.one { grid-template-columns: minmax(0, 1fr); }
.apps-grid { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.app-card .card-head h2 { gap: 10px; }
svg.brand-icon { width: 26px; height: 26px; flex: none; display: inline-block; vertical-align: middle; }
svg.brand-icon.small { width: 16px; height: 16px; margin-right: 6px; vertical-align: -3px; }
.app-card .channel { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.app-card .channel h3 { display: flex; align-items: center; gap: 8px; font-size: 0.95rem; margin-bottom: 4px; }
#whatsappCard .channel h3 { display: flex; align-items: center; gap: 4px; }

/* Inbox: one row to bring messages in */
.inbox-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; margin-bottom: 10px; }
.inbox-actions-label { font-size: 0.82rem; color: var(--muted); font-weight: 600; margin-right: 2px; }
.inbox-actions button.small { display: inline-flex; align-items: center; }

/* Small page-to-page links (Weekly Review ↔ rhythm) */
.page-links { display: flex; justify-content: flex-end; margin: -4px 0 10px; }
.page-links .link-button { font-size: 0.86rem; }

/* ================================================= Connected apps cards */
/* "Connected" colours, for the light and the dark theme */
:root {
  --conn-ok: #157347; --conn-ok-dot: #22A06B; --conn-ok-bg: #E3F5EC;
  --conn-box-bg: #F1FAF4; --conn-box-border: #CDEBD8;
}
:root[data-theme="dark"] {
  --conn-ok: #74DFAA; --conn-ok-dot: #3DD68C; --conn-ok-bg: rgba(61, 214, 140, 0.14);
  --conn-box-bg: rgba(61, 214, 140, 0.07); --conn-box-border: rgba(61, 214, 140, 0.28);
}
.apps-grid { align-items: start; gap: 18px; }
.app-card { display: flex; flex-direction: column; padding: 22px; }
.app-card > .card-head { margin-bottom: 12px; }
.app-card .card-head h2 { display: flex; align-items: center; gap: 10px; font-size: 1.15rem; }
.app-card .card-head h2 .chip { margin-left: auto; }
.app-card .card-head .sub { margin-top: 6px; font-size: 0.88rem; line-height: 1.5; color: var(--text-2); }

/* status line: a quiet box, green-tinted once the app is connected */
.app-card p.hint { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-2);
  border: 1px solid var(--border); font-size: 0.82rem; line-height: 1.5; color: var(--text-2); overflow-wrap: anywhere; }
.app-card:has(> .card-head .chip[data-level="live"]) > p.hint,
.app-card .channel:has(h3 .chip[data-level="live"]) > p.hint { background: var(--conn-box-bg); border-color: var(--conn-box-border); }

/* actions sit on one row at the bottom: main button, then quiet ones, Disconnect at the far right */
.app-card > .channel-actions { margin-top: 14px; }
.app-card .channel-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.app-card .channel-actions button:not(.link-button) { min-height: 38px; padding: 8px 16px; font-size: 0.86rem; }
/* Disconnect always sits alone on a small row at the bottom right, the same in every card */
button.link-button.disconnect-link { flex: 0 0 100%; justify-content: flex-end; text-align: right; margin: 2px 0 0; padding: 4px 0; min-height: 0; font-size: 0.82rem; font-weight: 600; color: var(--muted); }
button.link-button.disconnect-link:hover { color: var(--danger, #B42318); text-decoration: underline; background: none; }

/* "Connected" reads as success (green), "Not connected / Owner only" as a neutral label */
.app-card .chip, #whatsappCard .chip { white-space: nowrap; font-size: 0.72rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.app-card .chip[data-level="live"], #whatsappCard .chip[data-level="live"] { background: var(--conn-ok-bg); color: var(--conn-ok); }
.app-card .chip[data-level="live"]::before, #whatsappCard .chip[data-level="live"]::before {
  content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--conn-ok-dot); vertical-align: 1px; }
.app-card .chip[data-level="builtin"], #whatsappCard .chip[data-level="builtin"] { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }

/* Gmail's "Email scan in chat" and Telegram's two parts: tidy sub-sections */
.app-card .conn-line { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); display: grid; gap: 6px; }
.app-card .conn-line > span { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 600; font-size: 0.9rem; }
.app-card .conn-line .hint { background: none; border: 0; padding: 0; }
.app-card .channel { margin-top: 14px; padding: 14px 0 0; border-top: 1px solid var(--border); display: grid; gap: 10px; }
.app-card .channel > .channel-actions { margin-top: 0; }
.app-card .channel .status:empty { display: none; }
.app-card .channel:first-of-type { border-top: 1px solid var(--border); }
.app-card .channel h3 { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 0.95rem; margin: 0; }
.app-card .channel .channel-actions { margin-top: 2px; }
.app-card .consent-box { font-size: 0.8rem; }

@media (max-width: 760px) {
  .app-card { padding: 18px; }
  .app-card .channel-actions button:not(.link-button) { flex: 1 1 auto; }
}
/* Task form: "Scheduled: Email at …" under "Also send to" */
#tfChannelRow .hint.ok { color: var(--conn-ok); font-weight: 600; }
