/* Cotask for the web — flat, Linear-like chrome in the apps' indigo. Light and dark. */

:root {
  --bg: #ffffff;
  --bg-side: #f7f7f8;
  --bg-hover: #f1f1f3;
  --bg-active: #e9e9ee;
  --bg-raised: #ffffff;
  --bg-input: #ffffff;
  --border: #e6e6ea;
  --border-strong: #d6d6dc;
  --text: #1c1c1f;
  --text-2: #5f6069;
  --text-3: #8f909a;
  --accent: #5e6ad2;
  --accent-hover: #4f5bc4;
  --accent-soft: rgba(94, 106, 210, 0.1);
  --on-accent: #ffffff;
  --danger: #e5484d;
  --warn: #e0a100;
  --doing: #e8b400;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.05), 0 24px 60px rgba(0, 0, 0, 0.18);
  --radius: 8px;
  --c-gray: #8e8e93; --c-red: #ff3b30; --c-orange: #ff9500; --c-yellow: #ffcc00; --c-green: #34c759;
  --c-teal: #30b0c7; --c-blue: #007aff; --c-indigo: #5856d6; --c-purple: #af52de; --c-pink: #ff2d55;
  --grid-0: #ececf0; --grid-1: #c9cdf3; --grid-2: #9aa2e7; --grid-3: #707cdb; --grid-4: #4f5bc4;
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111113;
    --bg-side: #17171a;
    --bg-hover: #1f1f23;
    --bg-active: #26262c;
    --bg-raised: #1c1c20;
    --bg-input: #18181b;
    --border: #2a2a30;
    --border-strong: #37373f;
    --text: #ededf0;
    --text-2: #a3a4ad;
    --text-3: #6f707a;
    --accent: #6c78e0;
    --accent-hover: #7d88e6;
    --accent-soft: rgba(108, 120, 224, 0.16);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.35), 0 24px 60px rgba(0, 0, 0, 0.6);
    --c-red: #ff453a; --c-orange: #ff9f0a; --c-yellow: #ffd60a; --c-green: #30d158; --c-teal: #40c8e0;
    --c-blue: #0a84ff; --c-indigo: #5e5ce6; --c-purple: #bf5af2; --c-pink: #ff375f;
    --grid-0: #222228; --grid-1: #2f3466; --grid-2: #434c9a; --grid-3: #5a66c9; --grid-4: #7d88e6;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
#app { height: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: default; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
input, textarea, select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 9px;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
kbd {
  font: 11px var(--mono);
  color: var(--text-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 4px;
  background: var(--bg);
}
code { font: 12.5px var(--mono); background: var(--bg-hover); padding: 1px 4px; border-radius: 4px; }
.mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--text-2); }
.small { font-size: 12.5px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.spacer { flex: 1; }
.grow { flex: 1; }
.error { color: var(--danger); }
.icon { flex: none; display: block; }
.icon.flip { transform: rotate(180deg); }
.status-glyph { flex: none; color: var(--text-3); }
.status-glyph.s-doing { color: var(--doing); }
.status-glyph.s-done { color: var(--accent); }
.status-glyph.s-todo { color: var(--text-2); }
.priority-glyph { flex: none; color: var(--text-2); }
.priority-glyph.p-high { color: var(--c-red); }
.priority-glyph.p-medium { color: var(--c-orange); }
.priority-glyph.p-none { color: var(--text-3); }
.project-dot { display: inline-block; border-radius: 50%; flex: none; }

/* Buttons */
.button {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 7px; background: var(--bg-raised);
  font-weight: 500; font-size: 13px; white-space: nowrap; transition: background .12s, border-color .12s;
}
.button:hover:not(:disabled) { background: var(--bg-hover); text-decoration: none; }
.button:disabled { opacity: .5; }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.button.primary:hover:not(:disabled) { background: var(--accent-hover); }
.button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.button.danger:hover:not(:disabled) { background: #d13b40; }
.button.danger-text { color: var(--danger); }
.button.small { height: 26px; padding: 0 9px; font-size: 12.5px; }
.button.wide { width: 100%; justify-content: center; height: 36px; }
a.button { color: inherit; }
.icon-button {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; color: var(--text-2);
}
.icon-button:hover:not(:disabled) { background: var(--bg-hover); color: var(--text); }
.icon-button:disabled { opacity: .35; }
.icon-button.small { width: 22px; height: 22px; border-radius: 5px; }
.link { color: var(--accent); font-weight: 500; }
.link:hover { text-decoration: underline; }
.mini-button {
  font-size: 12px; font-weight: 500; padding: 1px 8px; border-radius: 5px; border: 1px solid var(--border);
  background: var(--bg-raised); color: var(--text-2);
}
.mini-button:hover { color: var(--text); background: var(--bg-hover); }
.mini-button.accept { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }

/* Toggle */
.toggle {
  width: 34px; height: 20px; border-radius: 10px; background: var(--border-strong); position: relative; flex: none;
  transition: background .15s;
}
.toggle span {
  position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s;
}
.toggle.on { background: var(--accent); }
.toggle.on span { transform: translateX(14px); }
.toggle:disabled { opacity: .5; }

/* Splash and auth */
.splash { height: 100%; display: grid; place-items: center; }
.splash img { border-radius: 12px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }
.auth { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; overflow: auto; height: 100%; }
.auth-card { width: min(380px, 100%); text-align: center; }
.auth-logo { border-radius: 13px; box-shadow: var(--shadow); }
.auth h1 { font-size: 22px; letter-spacing: -.01em; margin: 18px 0 6px; }
.auth-sub { color: var(--text-2); margin: 0 0 22px; }
.auth form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.auth-error { color: var(--danger); font-size: 13px; }
.auth-notice { background: var(--accent-soft); color: var(--text); border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-bottom: 14px; text-align: left; }
.auth-links { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; color: var(--text-2); font-size: 13px; }
.auth-legal { color: var(--text-3); font-size: 12px; margin-top: 32px; }
.auth-legal a { color: var(--text-2); }
.code-input { font: 20px var(--mono); letter-spacing: .3em; text-align: center; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.field > span { color: var(--text-2); font-weight: 500; }
.field input, .field select { height: 34px; }
.field.inline { flex-direction: row; align-items: center; justify-content: space-between; }
.field.inline select { height: 30px; min-width: 200px; }

/* Shell */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); height: 100%; overflow: hidden; }
.shell.with-detail { grid-template-columns: 236px minmax(0, 1fr) minmax(380px, 44%); }
.scrim { display: none; }

/* Sidebar */
.sidebar {
  min-height: 0; overscroll-behavior: contain;
  background: var(--bg-side); border-right: 1px solid var(--border); display: flex; flex-direction: column;
  padding: 10px 8px; gap: 2px; overflow-y: auto; min-width: 0;
}
.account { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 7px; margin-bottom: 8px; }
.account:hover { background: var(--bg-hover); }
.account-icon { border-radius: 6px; }
.account-name { font-weight: 600; }
.account-chevron { color: var(--text-3); margin-left: auto; }
.pro-badge, .pro-mark {
  font-size: 10px; font-weight: 600; letter-spacing: .02em; color: var(--accent); background: var(--accent-soft);
  padding: 1px 5px; border-radius: 4px;
}
.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 9px; height: 30px; padding: 0 8px; border-radius: 6px; color: var(--text-2);
  font-weight: 500; text-align: left; width: 100%; position: relative;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.selected { background: var(--bg-active); color: var(--text); }
.nav-item .count { margin-left: auto; color: var(--text-3); font-size: 12px; font-weight: 500; }
.nav-item .badge { margin-left: auto; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 600; border-radius: 9px; padding: 0 6px; line-height: 17px; }
.nav-dot { width: 16px; display: grid; place-items: center; flex: none; }
.nav-more { display: none; color: var(--text-3); border-radius: 4px; padding: 2px; }
.nav-item:hover .nav-more { display: grid; }
.nav-item:hover .count { display: none; }
.nav-more:hover { color: var(--text); background: var(--bg-active); }
.nav-section {
  display: flex; align-items: center; justify-content: space-between; padding: 16px 8px 4px; color: var(--text-3);
  font-size: 12px; font-weight: 600;
}
.nav-empty { color: var(--text-3); font-size: 13px; text-align: left; padding: 4px 8px; }
.nav-empty:hover { color: var(--accent); }
.sidebar-foot { margin-top: auto; padding-top: 12px; }
.offline { margin: 8px 4px 0; font-size: 12px; color: var(--warn); }

/* Main */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; position: relative; overflow: hidden; }
.main-head {
  display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 16px 0 22px; border-bottom: 1px solid var(--border); flex: none;
}
.title { font-size: 15px; font-weight: 600; margin: 0; display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.head-actions { display: flex; align-items: center; gap: 8px; }
.search {
  display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 6px 0 9px; border: 1px solid var(--border);
  border-radius: 7px; color: var(--text-3); width: 220px; background: var(--bg-input);
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input { border: 0; padding: 0; background: none; box-shadow: none; flex: 1; min-width: 0; color: var(--text); }
.mobile-only { display: none; }
.filter-bar {
  display: flex; align-items: center; gap: 6px; padding: 10px 22px; border-bottom: 1px solid var(--border); flex: none;
  overflow-x: auto; scrollbar-width: none;
}
.pill {
  height: 26px; padding: 0 11px; border-radius: 13px; border: 1px solid var(--border); color: var(--text-2);
  font-size: 12.5px; font-weight: 500; white-space: nowrap; display: inline-flex; align-items: center;
}
.pill:hover { color: var(--text); background: var(--bg-hover); }
.pill.selected { background: var(--text); border-color: var(--text); color: var(--bg); }
.pill.ghost { border-color: transparent; padding: 0 7px; }
.filter-count { margin-left: auto; color: var(--text-3); font-size: 12px; white-space: nowrap; }

/* List */
.list { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 0 96px; }
.group { padding-top: 6px; }
.group-head {
  display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 22px; color: var(--text-2); font-size: 12.5px;
  font-weight: 600; position: sticky; top: 0; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(6px); z-index: 1;
}
.group-count { color: var(--text-3); font-weight: 500; }
.group-add { margin-left: auto; opacity: 0; }
.group-head:hover .group-add { opacity: 1; }
.task-row {
  --depth: 0;
  display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 16px 0 calc(16px + var(--depth) * 22px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 55%, transparent); cursor: default; position: relative;
  user-select: none; outline: none;
}
.task-row:hover { background: var(--bg-hover); }
.task-row.focused { background: var(--bg-hover); box-shadow: inset 2px 0 0 var(--accent); }
.task-row.open { background: var(--accent-soft); }
.task-row.selected { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.task-row.dragging { opacity: .4; }
.task-row.is-done .task-title { color: var(--text-3); }
.chain-guide {
  position: absolute; left: calc(16px + (var(--depth) - 1) * 22px + 11px); top: 0; bottom: 50%; width: 9px;
  border-left: 1.5px solid var(--border-strong); border-bottom: 1.5px solid var(--border-strong); border-bottom-left-radius: 6px;
}
.status-button { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; flex: none; }
.status-button:hover { background: var(--bg-active); }
.status-button:hover .status-glyph.s-todo, .status-button:hover .status-glyph.s-backlog, .status-button:hover .status-glyph.s-draft { color: var(--accent); }
.task-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-meta { display: flex; align-items: center; gap: 8px; flex: none; color: var(--text-2); font-size: 12.5px; }
.meta { display: inline-flex; align-items: center; gap: 2px; }
.meta.faint { color: var(--text-3); }
.meta.blocked { color: var(--c-orange); }
.meta.urgent { color: var(--danger); }
.agent-tag {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--accent); background: var(--accent-soft);
  border-radius: 5px; padding: 1px 6px; flex: none; font-weight: 500;
}
.draft-actions { display: none; gap: 4px; }
.task-row:hover .draft-actions, .task-row.focused .draft-actions { display: inline-flex; }
.chip-sm {
  display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--border); border-radius: 10px; padding: 0 8px;
  height: 20px; font-size: 12px; color: var(--text-2); max-width: 160px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.due { font-size: 12.5px; color: var(--text-2); min-width: 0; white-space: nowrap; }
.due.today { color: var(--accent); font-weight: 500; }
.due.overdue { color: var(--danger); font-weight: 500; }
.drop-line { height: 2px; background: var(--accent); margin: -1px 16px; border-radius: 1px; position: relative; z-index: 2; }
.show-more { display: block; margin: 8px 22px; color: var(--text-2); font-size: 12.5px; }
.show-more:hover { color: var(--accent); }
.list-skeleton { padding: 12px 22px; display: flex; flex-direction: column; gap: 14px; }
.skeleton-row { height: 14px; border-radius: 4px; background: var(--bg-hover); width: 70%; animation: pulse 1.2s ease-in-out infinite; }
.skeleton-row:nth-child(2n) { width: 50%; }
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 72px 24px; color: var(--text-2); text-align: center; gap: 4px; }
.empty p { margin: 4px 0; max-width: 420px; }
.empty .button { margin-top: 10px; }
.empty-mark { color: var(--text-3); margin-bottom: 6px; }

.selection-bar {
  position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; align-items: center; gap: 6px;
  background: var(--bg-raised); border: 1px solid var(--border); border-radius: 12px; padding: 7px 8px 7px 14px;
  box-shadow: var(--shadow-lg); z-index: 5; white-space: nowrap;
}
.selection-count { font-weight: 600; font-size: 13px; margin-right: 6px; }

/* Detail */
.detail {
  min-height: 0; animation: drawer-in .16s cubic-bezier(.2, .8, .2, 1);
  border-left: 1px solid var(--border); display: flex; flex-direction: column; min-width: 0; height: 100%;
  background: var(--bg); position: relative;
}
.detail.dropping::after {
  content: "Drop to attach"; position: absolute; inset: 8px; border: 2px dashed var(--accent); border-radius: 12px;
  display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 85%, transparent); color: var(--accent);
  font-weight: 600; z-index: 4;
}
.detail-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 52px; padding: 0 10px 0 22px;
  border-bottom: 1px solid var(--border); flex: none;
}
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 12.5px; min-width: 0; }
.crumb-sep { color: var(--text-3); }
.detail-actions { display: flex; align-items: center; gap: 4px; }
.detail-scroll { overflow-y: auto; overscroll-behavior: contain; padding: 18px 22px 64px; flex: 1; min-height: 0; }
.draft-banner {
  display: flex; align-items: center; gap: 8px; background: var(--accent-soft); color: var(--text); border-radius: 9px;
  padding: 8px 10px 8px 12px; margin-bottom: 14px; font-size: 13px;
}
.draft-banner > span { flex: 1; }
.draft-banner .icon { color: var(--accent); }
.detail-title {
  width: 100%; font-size: 20px; font-weight: 600; letter-spacing: -.01em; border: 0; padding: 4px 0; resize: none;
  background: none; line-height: 1.35; overflow: hidden;
}
.detail-title:focus { box-shadow: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 16px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 7px;
  border: 1px solid var(--border); font-size: 12.5px; font-weight: 500; color: var(--text); max-width: 100%; background: var(--bg-raised);
}
.chip:hover { background: var(--bg-hover); }
.chip.unset { color: var(--text-3); border-style: dashed; }
.chip.overdue { color: var(--danger); }
.chip.urgent { color: var(--danger); }
.chip.blocked { color: var(--c-orange); }
.chip-text { max-width: 220px; }
.notes {
  border-radius: 8px; padding: 8px 10px; margin: 0 -10px; min-height: 40px; cursor: text; color: var(--text);
}
.notes:hover { background: var(--bg-hover); }
.notes.placeholder { color: var(--text-3); }
.notes-editor { width: 100%; min-height: 96px; resize: none; padding: 8px 10px; line-height: 1.55; overflow: hidden; }
.md p { margin: 0; min-height: 1.45em; white-space: pre-wrap; overflow-wrap: anywhere; }
.md ul, .md ol { margin: 2px 0; padding-left: 22px; }
.md li { margin: 1px 0; overflow-wrap: anywhere; }
.completion-note { margin-top: 16px; border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border)); border-radius: 10px; padding: 10px 14px 8px; background: color-mix(in srgb, var(--accent-soft) 50%, transparent); }
.completion-note h3 { margin: 0 0 4px; font-size: 12px; color: var(--accent); display: flex; gap: 6px; align-items: center; }
.completion-note .notes { margin: 0 -6px; padding: 4px 6px; }
.composer {
  border: 1px solid var(--border); border-radius: 12px; background: var(--bg-raised); box-shadow: var(--shadow);
  margin: 0 0 16px; animation: pop .12s ease-out;
}
.composer-body { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; }
.composer-mark { display: grid; place-items: center; height: 20px; flex: none; }
.composer-body textarea {
  flex: 1; min-width: 0; border: 0; padding: 0; background: none; resize: none; line-height: 20px; font-size: 13.5px; overflow: hidden;
}
.composer-body textarea:focus { box-shadow: none; }
.composer-bar { display: flex; align-items: center; gap: 4px; height: 40px; padding: 0 8px; border-top: 1px solid var(--border); }
.composer-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px; border-radius: 6px;
  font-size: 12.5px; font-weight: 500; color: var(--text-2); white-space: nowrap;
}
.composer-chip:hover { background: var(--bg-hover); color: var(--text); }
.composer-chip.on { color: var(--accent); background: var(--accent-soft); }
.button.ghost { border-color: transparent; background: none; color: var(--text-2); }
.button.ghost kbd { margin-right: 2px; }
.key-glyph { opacity: .6; margin-left: 4px; }
.scheduled-sends { display: flex; flex-direction: column; gap: 2px; margin: -6px 0 14px; }
.scheduled-line { font-size: 12.5px; }
.scheduled-main { display: flex; align-items: center; gap: 8px; min-height: 26px; min-width: 0; }
.scheduled-mark { display: grid; place-items: center; flex: none; }
.scheduled-text { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); min-width: 0; border-radius: 5px; padding: 2px 4px; margin: 0 -4px; }
button.scheduled-text:hover { color: var(--text); background: var(--bg-hover); }
.scheduled-text .icon { color: var(--text-3); }
.text-button { font-size: 12px; color: var(--text-3); white-space: nowrap; flex: none; }
.text-button:hover { color: var(--text); }
.text-button.accent { color: var(--accent); }
.text-button.accent:hover { color: var(--accent-hover); }
.scheduled-error { margin: 0 0 4px 22px; color: var(--text-3); font-size: 12px; overflow-wrap: anywhere; }
.send-editor .scheduled-error { margin: 0; }
.shimmer {
  background: linear-gradient(90deg, var(--text-3) 30%, var(--text) 50%, var(--text-3) 70%) 0 0 / 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 1.6s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.send-editor-pop { padding: 12px; }
.send-editor { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.send-editor-head { display: flex; align-items: flex-start; gap: 9px; min-width: 0; }
.send-editor-head .scheduled-mark { height: 19px; }
.send-editor-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.send-editor-title { font-weight: 500; font-size: 13.5px; }
.send-editor-message { width: 100%; resize: none; min-height: 34px; line-height: 1.45; font-size: 13px; overflow: hidden; }
.send-editor-times { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.send-editor-times input { height: 26px; padding: 2px 6px; font-size: 12.5px; }
.send-editor-actions { display: flex; align-items: center; gap: 6px; }
.send-editor-row { padding: 14px 0; border-bottom: 1px solid var(--border); }
.send-editor-row:last-child { border-bottom: 0; }
.detail-section { margin-top: 24px; }
.detail-section h3 { font-size: 12px; font-weight: 600; color: var(--text-2); margin: 0 0 8px; display: flex; gap: 6px; }
.attachments { display: flex; flex-direction: column; gap: 4px; }
.attachment {
  display: flex; align-items: center; gap: 4px; border: 1px solid var(--border); border-radius: 8px; padding: 4px 4px 4px 10px;
}
.attachment:hover { background: var(--bg-hover); }
.attachment-main { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; color: var(--text); height: 30px; }
.attachment-main:hover { text-decoration: none; }
.attachment-title { font-weight: 500; flex: 0 1 auto; }
.attachment-sub { color: var(--text-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1 1 0; min-width: 40px; }
.favicon { width: 16px; height: 16px; flex: none; border-radius: 3px; display: grid; place-items: center; color: var(--text-3); }
.thumb { width: 26px; height: 26px; object-fit: cover; border-radius: 5px; flex: none; }
.attachment.uploading { padding-right: 12px; height: 40px; }
.progress { width: 90px; height: 4px; border-radius: 2px; background: var(--bg-active); overflow: hidden; margin-left: auto; flex: none; }
.progress span { display: block; height: 100%; background: var(--accent); transition: width .2s; }
.add-buttons { display: flex; gap: 4px; margin-top: 6px; }
.add-row { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13px; padding: 5px 8px; border-radius: 6px; margin-left: -8px; }
.add-row:hover { color: var(--text); background: var(--bg-hover); }
.add-row + .add-row { margin-left: 0; }
.add-link { display: flex; gap: 6px; margin-top: 6px; }
.add-link input { flex: 1; height: 28px; }
.link-row { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border-radius: 6px; text-align: left; margin-left: -8px; }
.link-row:hover { background: var(--bg-hover); }
.dep-label { color: var(--text-3); font-size: 12px; width: 70px; flex: none; }
.history-line { display: flex; align-items: baseline; gap: 9px; padding: 4px 0; font-size: 12.5px; color: var(--text-2); }
.history-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); flex: none; transform: translateY(-1px); }
.history-dot.agent { background: var(--accent); }
.history-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.history-time { color: var(--text-3); font-size: 12px; white-space: nowrap; flex: none; }

/* Menu */
.menu {
  position: fixed; z-index: 50; background: var(--bg-raised); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-lg); padding: 4px; max-height: min(440px, calc(100vh - 16px)); display: flex; flex-direction: column;
  animation: pop .1s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(-3px) scale(.99); } }
.menu-search { margin: 2px 2px 4px; height: 30px; }
.menu-items { overflow-y: auto; }
.menu-item {
  display: flex; align-items: center; gap: 9px; width: 100%; height: 30px; padding: 0 8px; border-radius: 6px; text-align: left; font-size: 13px;
}
.menu-item.active, .menu-item:hover:not(:disabled) { background: var(--bg-hover); }
.menu-item.checked { color: var(--accent); }
.menu-item.danger { color: var(--danger); }
.menu-item:disabled { opacity: .4; }
.menu-icon { width: 16px; display: grid; place-items: center; flex: none; color: var(--text-2); }
.menu-item.danger .menu-icon { color: var(--danger); }
.menu-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-hint { color: var(--text-3); font-size: 12px; white-space: nowrap; }
.menu-check { color: var(--accent); }
.menu-divider { height: 1px; background: var(--border); margin: 4px 2px; }
.menu-header { padding: 6px 8px 4px; font-size: 12px; color: var(--text-3); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-empty { padding: 8px; color: var(--text-3); font-size: 13px; }
.picker { display: flex; flex-direction: column; }
.picker-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 8px; font-size: 13px; color: var(--text-2); }
.picker-row input { height: 28px; padding: 2px 6px; }
.picker-actions { display: flex; justify-content: flex-end; gap: 6px; padding: 6px 8px 2px; }
.picker-note { margin: 4px 8px; font-size: 11.5px; color: var(--text-3); }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10, 10, 14, .32); z-index: 40; display: flex; align-items: flex-start;
  justify-content: center; padding-top: 12vh; animation: fade .12s ease-out;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--bg-raised); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg);
  max-height: 80vh; display: flex; flex-direction: column; animation: pop .14s ease-out;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 0 20px; }
.modal-head h2 { font-size: 15px; margin: 0; }
.modal-body { padding: 14px 20px 18px; overflow-y: auto; }
.modal-body > p:first-child { margin-top: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 24px; height: 24px; border-radius: 50%; background: var(--swatch); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }
.swatch.selected { box-shadow: 0 0 0 2px var(--bg-raised), 0 0 0 4px var(--swatch); }
.checks { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.check input { margin: 0; accent-color: var(--accent); }
.quick-add { display: flex; flex-direction: column; gap: 4px; }
.quick-title { border: 0; font-size: 17px; font-weight: 600; padding: 4px 0; box-shadow: none !important; background: none; }
.quick-notes { border: 0; padding: 2px 0 8px; resize: none; box-shadow: none !important; background: none; color: var(--text-2); overflow: hidden; }
.quick-add .chips { margin: 4px 0 8px; }
.quick-foot { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--border); margin: 6px -20px -18px; padding: 12px 16px; }
.inline-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.shortcuts { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; align-items: center; }
.shortcuts dt { text-align: right; }
.shortcuts dd { margin: 0; color: var(--text-2); }

/* Toasts */
.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 60; align-items: center; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; background: #1c1c1f; color: #f2f2f4; border-radius: 10px;
  padding: 9px 10px 9px 14px; box-shadow: var(--shadow-lg); font-size: 13px; max-width: min(560px, calc(100vw - 32px));
  animation: rise .18s ease-out;
}
@media (prefers-color-scheme: dark) { .toast { background: #2a2a31; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.toast.error { background: #3a1517; }
.toast-action { color: #aab2ff; font-weight: 600; white-space: nowrap; }
.toast-action:hover { text-decoration: none; color: #c9cfff; }
.toast-close { color: #8f909a; display: grid; place-items: center; }
.sync-dot { position: fixed; top: 22px; right: 18px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); opacity: .6; animation: pulse .9s infinite; z-index: 3; pointer-events: none; }
.with-detail .sync-dot { display: none; }

/* Pages: history, inbox, analytics, settings */
.page { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 22px 64px; }
.history-day h3 { font-size: 12px; color: var(--text-3); font-weight: 600; margin: 18px 0 4px; }
.history-day:first-child h3 { margin-top: 0; }
.history-row { display: flex; align-items: baseline; gap: 10px; width: 100%; text-align: left; padding: 7px 8px; border-radius: 6px; margin-left: -8px; }
.history-row:hover:not(:disabled) { background: var(--bg-hover); }
.history-row:disabled { cursor: default; color: inherit; }
.history-meta { color: var(--text-3); font-size: 12px; }
.inbox-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 10px; border-radius: 8px; text-align: left; border-bottom: 1px solid var(--border); }
.inbox-row:hover:not(:disabled) { background: var(--bg-hover); }
.inbox-row:disabled { color: inherit; }
.inbox-row.unread .inbox-title { font-weight: 600; }
.inbox-row.unread .inbox-icon { color: var(--accent); }
.inbox-icon { color: var(--text-3); flex: none; }
.inbox-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.inbox-body { color: var(--text-2); font-size: 13px; }

.analytics { display: flex; flex-direction: column; gap: 16px; }
.hero-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 24px; align-items: end; }
.hero { display: flex; flex-direction: column; padding: 0 4px 4px; }
.hero-value { font-size: 54px; font-weight: 600; letter-spacing: -.03em; line-height: 1; }
.hero-caption { color: var(--text-2); font-size: 13.5px; margin-top: 6px; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.stat { border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; display: flex; flex-direction: column; cursor: default; }
.stat:hover, .share-row:hover { background: var(--bg-hover); }
.stat-label { color: var(--text-2); font-size: 12px; }
.stat-value { font-size: 24px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; }
.stat-caption { color: var(--text-3); font-size: 12px; }
.card { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; background: var(--bg); min-width: 0; }
.card h3 { font-size: 13px; margin: 0; }
.card-sub { color: var(--text-2); font-size: 12.5px; margin: 2px 0 12px; min-height: 1.4em; }
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.footnote { margin: 0 4px; }
.grid-scroll { overflow-x: auto; padding-bottom: 2px; }
.contrib { display: block; }
.contrib rect { cursor: pointer; transition: opacity .1s; }
.contrib rect:hover { stroke: var(--text-2); stroke-width: 1; }
.contrib rect.picked { stroke: var(--accent); stroke-width: 1.5; }
.contrib rect.lv0 { fill: var(--grid-0); }
.contrib rect.lv1 { fill: var(--grid-1); }
.contrib rect.lv2 { fill: var(--grid-2); }
.contrib rect.lv3 { fill: var(--grid-3); }
.contrib rect.lv4 { fill: var(--grid-4); }
.grid-label { font-size: 9px; fill: var(--text-3); }
.legend { display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--text-3); margin-top: 8px; justify-content: flex-end; }
.legend-cell { width: 10px; height: 10px; border-radius: 2.5px; display: inline-block; margin: 0 1px; }
.legend-cell.lv0 { background: var(--grid-0); } .legend-cell.lv1 { background: var(--grid-1); } .legend-cell.lv2 { background: var(--grid-2); }
.legend-cell.lv3 { background: var(--grid-3); } .legend-cell.lv4 { background: var(--grid-4); }
.legend-cell.you, .bar.you, .hbar-fill.you { background: var(--accent); }
.legend-cell.agent, .bar.agent, .hbar-fill.agent { background: var(--grid-2); }
.bar.muted-bar { background: var(--grid-1); }
.day-panel { border-top: 1px solid var(--border); margin-top: 12px; padding-top: 10px; display: flex; flex-direction: column; gap: 2px; }
.day-panel-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; font-size: 13px; }
.day-panel p { margin: 0; }
.day-item { display: flex; align-items: center; gap: 9px; padding: 5px 6px; margin: 0 -6px; border-radius: 6px; text-align: left; font-size: 13px; }
.day-item:hover:not(:disabled) { background: var(--bg-hover); }
.day-item:disabled { color: inherit; }
.day-item .truncate { flex: 1; }
.who-mark { width: 16px; height: 16px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; }
.who-mark.you { background: var(--accent); }
.who-mark.agent { background: var(--grid-3); }
.who-slot { width: 16px; display: grid; place-items: center; flex: none; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 132px; }
.bars.week { height: 132px; gap: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; gap: 4px; cursor: default; }
.bar-stack { width: 100%; max-width: 22px; display: flex; flex-direction: column; border-radius: 4px; overflow: hidden; min-height: 2px; background: var(--grid-0); transition: filter .1s; }
.bars.week .bar-stack { max-width: 34px; }
.bar-col:hover .bar-stack { filter: brightness(.92); }
.bar { display: block; min-height: 0; }
.bar-label { font-size: 10.5px; color: var(--text-3); }
.bar-label.today { color: var(--accent); font-weight: 600; }
.keys { display: flex; gap: 14px; margin-top: 10px; font-size: 12.5px; color: var(--text-2); }
.key { display: inline-flex; align-items: center; gap: 5px; }
.key strong { color: var(--text); font-weight: 600; }
.split-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 2px; }
.split-bar .bar { cursor: default; }
.share-rows { display: flex; flex-direction: column; gap: 2px; margin-top: 12px; }
.share-row { display: grid; grid-template-columns: 16px minmax(60px, 140px) 1fr 32px 36px; align-items: center; gap: 10px; padding: 5px 6px; margin: 0 -6px; border-radius: 6px; font-size: 13px; cursor: default; }
.card .share-rows .share-row:has(.who-slot) { grid-template-columns: 16px minmax(60px, 140px) 1fr 32px; }
.share-name { min-width: 0; }
.share-n { text-align: right; font-variant-numeric: tabular-nums; }
.share-pct { text-align: right; color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.hbar-track { height: 8px; background: var(--bg-hover); border-radius: 4px; overflow: hidden; }
.hbar-fill { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.chart-tip {
  position: fixed; z-index: 70; transform: translate(-50%, -100%); background: #1c1c1f; color: #f2f2f4; border-radius: 8px;
  padding: 6px 10px; font-size: 12px; line-height: 1.4; box-shadow: var(--shadow); pointer-events: none; white-space: nowrap;
  display: flex; flex-direction: column; animation: fade .08s ease-out;
}
.chart-tip.below { transform: translate(-50%, 0); }
.chart-tip strong { font-weight: 600; }
.chart-tip span { color: #c4c5cc; }
@media (prefers-color-scheme: dark) { .chart-tip { background: #2c2c33; } }

.settings { flex: 1; min-height: 0; display: grid; grid-template-columns: 200px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); overflow: hidden; }
.settings-nav { border-right: 1px solid var(--border); padding: 12px 8px; display: flex; flex-direction: column; gap: 1px; overflow-y: auto; }
.settings-body { overflow-y: auto; min-height: 0; padding: 22px 28px 64px; max-width: 760px; }
.settings-body > h2 { font-size: 18px; margin: 0 0 6px; }
.settings-body > p { margin: 0 0 16px; }
.settings-body .card { padding: 0 16px; margin-bottom: 16px; }
.section-title { font-size: 13px; margin: 24px 0 8px; }
.setting-row { display: flex; align-items: center; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.setting-row:last-child { border-bottom: 0; }
.setting-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.setting-title { font-weight: 500; }
.setting-detail { color: var(--text-2); font-size: 12.5px; overflow-wrap: anywhere; }
.setting-control { display: flex; align-items: center; gap: 8px; flex: none; }
.setting-control input { height: 28px; }
.danger-zone .setting-title { color: var(--danger); }
.filter-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.filter-row:last-child { border-bottom: 0; }
.reorder { display: flex; flex-direction: column; }
.pad { padding: 12px 0; margin: 0; }
.mono-chip { font: 12px var(--mono); background: var(--bg-hover); padding: 4px 8px; border-radius: 6px; }
.key-box { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 8px; padding: 8px 8px 8px 12px; margin: 12px 0; }
.key-box code { flex: 1; background: none; padding: 0; overflow-wrap: anywhere; font-size: 12px; }
.pro-card { padding: 16px !important; }
.pro-card.active { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.pro-head { display: flex; gap: 12px; align-items: flex-start; }
.pro-head .icon { color: var(--accent); margin-top: 2px; }
.pro-head p { margin: 2px 0 0; }
.feature-list { list-style: none; padding: 0; margin: 14px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.feature-list li { display: flex; gap: 8px; }
.feature-list .icon { color: var(--accent); margin-top: 3px; }
.feature-list div { display: flex; flex-direction: column; }
.feature-list span { color: var(--text-2); font-size: 12.5px; }

/* Narrow screens: the sidebar slides over, the detail takes the screen. */
@media (max-width: 1100px) {
  .shell.with-detail { grid-template-columns: 236px minmax(0, 1fr); }
  .shell.with-detail .detail { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); z-index: 20; box-shadow: var(--shadow-lg); }
}
@media (max-width: 760px) {
  .shell, .shell.with-detail { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: 272px; z-index: 30; transform: translateX(-100%); transition: transform .18s cubic-bezier(.2, .8, .2, 1), box-shadow .18s; box-shadow: none; }
  .sidebar-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .search kbd { display: none; }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .3); z-index: 25; opacity: 0; pointer-events: none; transition: opacity .18s ease-out; }
  .sidebar-open .scrim { opacity: 1; pointer-events: auto; }
  .mobile-only { display: inline-grid; }
  .main-head { padding: 0 10px; }
  .search { width: 140px; }
  .head-actions .button span, .hide-narrow { display: none; }
  .filter-bar { padding: 10px 14px; }
  .group-head { padding: 0 14px; }
  .task-row { padding-right: 10px; padding-left: calc(10px + var(--depth) * 18px); height: 46px; }
  .task-meta .chip-sm, .task-meta .meta.faint { display: none; }
  .shell.with-detail .detail { width: 100vw; }
  .detail-scroll, .page { padding: 14px 16px 64px; }
  .hero-row { grid-template-columns: minmax(0, 1fr); }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .settings { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .settings-nav { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: 8px; }
  .settings-nav .nav-item { width: auto; white-space: nowrap; }
  .settings-body { padding: 16px; }
  .setting-row { flex-wrap: wrap; }
  .feature-list { grid-template-columns: 1fr; }
  .selection-bar { left: 8px; right: 8px; transform: none; overflow-x: auto; }
}

/* Settings: routes, notification rules, roll-over rules */
.row-start { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.rule-options { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 8px; }
.rule-options select { height: 26px; padding: 0 6px; font-size: 12.5px; }
.rollover-rules { display: flex; flex-direction: column; gap: 10px; padding: 4px 0 14px; align-items: flex-start; }
.rule-card { width: 100%; border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px; display: flex; flex-direction: column; gap: 10px; }
.rule-head { display: flex; align-items: center; justify-content: space-between; }
.weekdays { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.setting-title .chip-sm { margin-left: 6px; vertical-align: 1px; }
.shell:has(.selection-bar) .toasts { bottom: 76px; }

/* The task panel slides in from the right — short and quick, never in the way. */
@keyframes drawer-in { from { transform: translateX(14px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .detail, .menu, .modal, .toast { animation: none !important; } .sidebar { transition: none !important; } }
.delete-warning { border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--border)); background: color-mix(in srgb, var(--danger) 6%, transparent); border-radius: 9px; padding: 10px 14px; margin-bottom: 14px; font-size: 13px; }
.delete-warning p { margin: 4px 0; }
.delete-warning ul { margin: 6px 0; padding-left: 18px; }

/* Agent brand marks (the apps' AgentLogos): templates take the text colour, like the apps' template images. */
.agent-logo { display: inline-block; flex: none; vertical-align: -3px; object-fit: contain; }
.agent-logo img { display: block; width: 100%; height: 100%; object-fit: contain; }
picture.agent-logo { line-height: 0; }
.agent-logo.template { background: currentColor; -webkit-mask-size: contain; mask-size: contain; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-position: center; mask-position: center; }
.agent-logo.fallback { display: inline-grid; place-items: center; color: var(--text-3); }
.agent-tag .agent-logo.template { color: var(--text); }
.agent-tag { gap: 5px; }
.history-agent { width: 13px; display: grid; place-items: center; flex: none; transform: translateY(2px); color: var(--text); }
.titled-mark { display: inline-flex; align-items: center; gap: 8px; }
.inbox-icon .agent-logo.template { color: var(--text); }
.draft-banner .agent-logo.template { color: var(--text); }
.logo-strip { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 16px; margin-bottom: 4px; scrollbar-width: none; }
.logo-strip-item { display: flex; flex-direction: column; align-items: center; gap: 7px; min-width: 64px; font-size: 11px; color: var(--text-2); }
.logo-strip-item .agent-logo.template { color: var(--text); }
