/* =====================================================================
   TaskTracker — design system
   ===================================================================== */
:root {
  --font: 'Inter', 'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
  --mono: 'SF Mono', 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;

  --accent: #5b5bd6;
  --accent-hover: #4f4fc4;
  --accent-soft: rgba(91, 91, 214, 0.1);
  --accent-ring: rgba(91, 91, 214, 0.35);
  --danger: #e5484d;
  --danger-soft: rgba(229, 72, 77, 0.1);
  --warn: #f5a524;
  --ok: #30a46c;

  --bg: #f7f7f9;
  --bg-sidebar: #fbfbfc;
  --surface: #ffffff;
  --surface-2: #f3f3f6;
  --surface-hover: #eeeef2;
  --column-bg: #f0f0f4;
  --border: #e4e4ea;
  --border-strong: #d4d4dc;
  --text: #1a1a23;
  --text-2: #55556a;
  --text-3: #8b8ba0;
  --shadow-sm: 0 1px 2px rgba(16, 16, 40, 0.06);
  --shadow: 0 1px 2px rgba(16, 16, 40, 0.05), 0 2px 8px rgba(16, 16, 40, 0.06);
  --shadow-lg: 0 12px 40px rgba(16, 16, 40, 0.16), 0 2px 6px rgba(16, 16, 40, 0.06);
  --overlay: rgba(14, 14, 28, 0.38);

  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --sidebar-w: 248px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

[data-theme='dark'] {
  --accent: #7c7cf0;
  --accent-hover: #8e8ef5;
  --accent-soft: rgba(124, 124, 240, 0.16);
  --accent-ring: rgba(124, 124, 240, 0.45);
  --danger-soft: rgba(229, 72, 77, 0.18);
  --bg: #111116;
  --bg-sidebar: #0d0d11;
  --surface: #1a1a21;
  --surface-2: #202029;
  --surface-hover: #26262f;
  --column-bg: #16161c;
  --border: #2a2a34;
  --border-strong: #363642;
  --text: #ececf1;
  --text-2: #a8a8b8;
  --text-3: #6f6f82;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.4);
  --overlay: rgba(0, 0, 0, 0.55);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 14px/1.5 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01';
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
code, kbd, pre { font-family: var(--mono); }
code { font-size: 0.88em; background: var(--surface-2); border: 1px solid var(--border); padding: 0.05em 0.35em; border-radius: 4px; }
kbd { font-size: 11px; padding: 1px 5px; border-radius: 4px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); box-shadow: 0 1px 0 var(--border-strong); }
::selection { background: var(--accent-ring); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon { flex-shrink: 0; }
.muted { color: var(--text-3); }
.spacer { flex: 1; }
.center { text-align: center; }
.mono { font-family: var(--mono); }
.mr-auto { margin-right: auto; }
.pad { padding: 16px; }
.text-danger { color: var(--danger) !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }

.boot { height: 100vh; display: grid; place-items: center; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--accent); animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- buttons & inputs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: var(--radius); border: 1px solid transparent;
  font-weight: 500; font-size: 13.5px; cursor: pointer; white-space: nowrap; text-decoration: none !important;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, transform 0.05s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: var(--radius-sm); }
.btn-block { width: 100%; height: 40px; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(40, 40, 120, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.12); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary kbd { background: rgba(255, 255, 255, 0.18); border-color: rgba(255, 255, 255, 0.25); color: #fff; box-shadow: none; }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); }
.btn-outline { background: var(--surface); border-color: var(--border); color: var(--text); box-shadow: var(--shadow-sm); }
.btn-outline:hover:not(:disabled) { background: var(--surface-2); border-color: var(--border-strong); }
.btn-outline.is-active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.05); }
.btn-group { display: inline-flex; gap: 2px; flex-wrap: wrap; justify-content: flex-end; }
.kbd-inline { margin-left: 4px; }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; display: inline-grid; place-items: center; font-weight: 600; }

.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-sm);
  border: 0; background: transparent; color: var(--text-2); cursor: pointer; transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.icon-btn.sm { width: 26px; height: 26px; }

.input {
  width: 100%; height: 36px; padding: 0 11px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea.input { height: auto; padding: 9px 11px; resize: vertical; line-height: 1.55; }
select.input { appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b8ba0' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.input:hover { border-color: var(--border-strong); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.input::placeholder { color: var(--text-3); }
.input-lg { height: 44px; font-size: 18px; font-weight: 600; border-color: transparent; padding-left: 2px; box-shadow: none !important; background: transparent; }
.input-lg:focus { border-color: transparent; }

.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.field > span { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.field-row { display: flex; gap: 12px; }
.field-key { flex: 0 0 110px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.hint { font-size: 12.5px; color: var(--text-3); }
.form-error { padding: 9px 12px; border-radius: var(--radius); background: var(--danger-soft); color: var(--danger); font-size: 13px; }
.row-end { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }

/* ---------------------------------------------------------------- layout */
.layout { display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: 100vh; }
.main { overflow: auto; min-width: 0; position: relative; }
.sidebar { display: flex; flex-direction: column; background: var(--bg-sidebar); border-right: 1px solid var(--border); min-height: 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, #6366f1, #8b5cf6 60%, #a855f7); position: relative; box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35); flex-shrink: 0; }
.brand-mark::before, .brand-mark::after, .brand-mark span { content: ''; position: absolute; top: 7px; width: 4px; border-radius: 2px; background: #fff; }
.brand-mark::before { left: 7px; height: 16px; }
.brand-mark span { left: 13px; height: 11px; opacity: 0.85; }
.brand-mark::after { left: 19px; height: 7px; opacity: 0.7; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 15px; letter-spacing: -0.01em; }
.brand-text small { font-size: 11.5px; color: var(--text-3); }
.brand-lg .brand-mark { width: 36px; height: 36px; }
.brand-lg .brand-text strong { font-size: 18px; }

.nav { flex: 1; overflow-y: auto; padding: 4px 10px 12px; display: flex; flex-direction: column; gap: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500; font-size: 13.5px; text-decoration: none !important; transition: background 0.12s, color 0.12s;
}
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-count { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.nav-section { display: flex; align-items: center; justify-content: space-between; margin: 18px 0 4px; padding: 0 4px 0 10px; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); }
.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-empty { font-size: 12.5px; color: var(--text-3); padding: 4px 10px; }
.board-badge {
  --hue: 240; width: 20px; height: 20px; border-radius: 5px; display: inline-grid; place-items: center; flex-shrink: 0;
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.02em; color: hsl(var(--hue) 65% 40%); background: hsl(var(--hue) 80% 92%);
}
[data-theme='dark'] .board-badge { color: hsl(var(--hue) 85% 78%); background: hsl(var(--hue) 40% 22%); }
.board-badge.lg { width: 22px; height: 22px; font-size: 10px; }

.sidebar-footer { display: flex; align-items: center; gap: 4px; padding: 10px; border-top: 1px solid var(--border); }
.user-chip { flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; padding: 6px 8px; border: 0; border-radius: var(--radius); background: transparent; cursor: pointer; text-align: left; color: var(--text-3); }
.user-chip:hover { background: var(--surface-hover); }
.user-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.user-meta strong { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta small { font-size: 11.5px; color: var(--text-3); }

/* ---------------------------------------------------------------- avatars, labels, pills */
.avatar { display: inline-grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 600; flex-shrink: 0; letter-spacing: 0.02em; box-shadow: 0 0 0 2px var(--surface); user-select: none; }
.avatar-empty { background: transparent; border: 1.5px dashed var(--border-strong); color: var(--text-3); box-shadow: none; }
.avatar-agent { background: linear-gradient(135deg, #0ea5e9, #6366f1); color: #fff; }
.label-chip {
  --label: #6366f1; display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px; border-radius: 10px;
  font-size: 11.5px; font-weight: 500; white-space: nowrap; color: var(--text-2);
  background: color-mix(in srgb, var(--label) 11%, transparent); border: 1px solid color-mix(in srgb, var(--label) 25%, transparent);
}
.label-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--label); }
.label-remove { display: inline-grid; place-items: center; border: 0; background: transparent; padding: 0; margin-right: -3px; cursor: pointer; color: var(--text-3); border-radius: 50%; }
.label-remove:hover { color: var(--text); }
.pill { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px; border-radius: 10px; font-size: 11.5px; font-weight: 500; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.pill-accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.pill-warn { background: rgba(245, 165, 36, 0.14); color: #b4710a; border-color: transparent; }
[data-theme='dark'] .pill-warn { color: #f5c063; }
.pill-agent { background: rgba(14, 165, 233, 0.12); color: #0284c7; border-color: transparent; }
[data-theme='dark'] .pill-agent { color: #7dd3fc; }
.status-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-3); }
.status-dot::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.status-dot.ok { color: var(--text-2); }
.status-dot.ok::before { background: var(--ok); }

.prio-icon { flex-shrink: 0; }
.prio-low { color: var(--text-3); }
.prio-medium { color: #8b8ba0; }
.prio-high { color: #f76b15; }
.prio-urgent { color: var(--danger); }
.prio-medium rect[opacity='1'] { fill: var(--text-2); }

.due { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-3); white-space: nowrap; }
.due-soon { color: #c27803; }
[data-theme='dark'] .due-soon { color: #f5b94a; }
.due-overdue { color: var(--danger); font-weight: 500; }
.due-done { color: var(--text-3); text-decoration: line-through; }

/* ---------------------------------------------------------------- pages */
.page { padding: 24px 32px 40px; max-width: 1600px; }
.page-board { display: flex; flex-direction: column; height: 100%; max-width: none; padding-bottom: 0; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-title h1 { font-size: 24px; letter-spacing: -0.02em; line-height: 1.25; }
.page-subtitle { margin-top: 4px; color: var(--text-2); max-width: 70ch; }
.eyebrow { font-size: 12.5px; font-weight: 500; color: var(--text-3); margin-bottom: 4px; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 12.5px; margin-bottom: 6px; }
.page-actions { display: flex; align-items: center; gap: 8px; }
.stat-pills { display: flex; gap: 6px; margin-right: 6px; }
.stat-pill { font-size: 12.5px; color: var(--text-3); padding: 3px 10px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); }
.stat-pill strong { color: var(--text); font-variant-numeric: tabular-nums; }

/* toolbar */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search-wrap { position: relative; display: flex; align-items: center; }
.search-wrap > .icon { position: absolute; left: 10px; color: var(--text-3); pointer-events: none; }
.search-input { width: 240px; height: 32px; padding-left: 32px; padding-right: 30px; font-size: 13.5px; }
.search-input::-webkit-search-cancel-button { display: none; }
.search-kbd { position: absolute; right: 8px; pointer-events: none; }
.search-input:focus + .search-kbd { display: none; }
.filter-count:empty { display: none; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }
.segmented button { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--text-2); cursor: pointer; font-size: 12.5px; font-weight: 500; }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------------------------------------------------------------- kanban */
.board-content { flex: 1; min-height: 0; margin: 0 -32px; }
.columns { display: flex; gap: 14px; height: 100%; overflow-x: auto; padding: 2px 32px 24px; align-items: flex-start; }
.column {
  flex: 0 0 300px; display: flex; flex-direction: column; max-height: 100%;
  background: var(--column-bg); border-radius: var(--radius-lg); border: 1px solid var(--border);
}
.column-header { display: flex; align-items: center; gap: 8px; padding: 10px 8px 6px 14px; }
.column-header h3 { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.column-dot { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--text-3); flex-shrink: 0; }
.column-dot.done { background: var(--ok); border-color: var(--ok); }
.column-count { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.column-count.over { color: var(--danger); font-weight: 600; }
.column-actions { margin-left: auto; display: flex; gap: 0; opacity: 0.6; transition: opacity 0.15s; }
.column:hover .column-actions { opacity: 1; }
.card-list { flex: 1; overflow-y: auto; padding: 4px 8px 4px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.column-empty { padding: 18px 8px; text-align: center; font-size: 12.5px; color: var(--text-3); border: 1.5px dashed var(--border); border-radius: var(--radius); }
.column-add { display: flex; align-items: center; gap: 6px; margin: 4px 8px 8px; height: 32px; padding: 0 8px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-3); cursor: pointer; font-size: 13px; }
.column-add:hover { background: var(--surface-hover); color: var(--text); }
.column-new {
  flex: 0 0 260px; height: 46px; display: flex; align-items: center; justify-content: center; gap: 8px;
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg); background: transparent; color: var(--text-3); cursor: pointer; font-weight: 500;
}
.column-new:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px 10px;
  box-shadow: var(--shadow-sm); cursor: pointer; display: flex; flex-direction: column; gap: 7px;
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.15s;
}
.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.card.dragging { opacity: 0.35; transform: rotate(1deg); }
.is-dragging .card:not(.dragging):hover { box-shadow: var(--shadow-sm); }
.card.is-done .card-title { color: var(--text-3); }
.card-top { display: flex; align-items: center; justify-content: space-between; }
.card-ref { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.card-title { font-size: 13.5px; font-weight: 500; line-height: 1.4; word-break: break-word; }
.card-labels { display: flex; flex-wrap: wrap; gap: 4px; }
.card-meta { display: flex; align-items: center; gap: 10px; min-height: 22px; }
.meta-item { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-3); }
.agent-tag { color: #0ea5e9; }
.drop-placeholder { border-radius: var(--radius); background: var(--accent-soft); border: 1.5px dashed var(--accent); flex-shrink: 0; }

.quick-add { background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius); box-shadow: 0 0 0 3px var(--accent-ring); }
.quick-add-input { width: 100%; border: 0; background: transparent; resize: none; padding: 10px 12px; font: inherit; font-size: 13.5px; color: var(--text); outline: none; }

.board-skeleton { display: flex; gap: 14px; padding: 2px 32px; }
.skeleton-col { flex: 0 0 300px; display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: var(--radius-lg); background: var(--column-bg); }
.sk { height: 14px; width: 40%; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2), var(--surface-hover), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.sk.card { height: 76px; width: 100%; padding: 0; border: 0; }
.sk.short { height: 52px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* list view */
.list-view { padding: 0 32px 32px; display: flex; flex-direction: column; gap: 18px; }
.list-group { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.list-group-header { display: flex; align-items: center; gap: 8px; padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.list-group-header h3 { font-size: 13px; }
.list-row {
  display: grid; grid-template-columns: 18px 72px minmax(0, 1fr) auto 90px 40px 26px; align-items: center; gap: 12px;
  padding: 0 16px; height: 44px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.1s;
}
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--surface-hover); }
.list-row.is-done .list-title { color: var(--text-3); text-decoration: line-through; }
.list-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.list-labels { display: flex; gap: 4px; overflow: hidden; }
.list-due { text-align: right; }
.list-comments { display: inline-flex; align-items: center; gap: 4px; color: var(--text-3); font-size: 12px; }

.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 48px 24px; }
.empty-state h3 { font-size: 16px; }
.empty-state .btn { margin-top: 8px; }
.empty-icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 4px; }
.empty-inline { display: flex; align-items: center; gap: 10px; padding: 18px; color: var(--text-3); border: 1.5px dashed var(--border); border-radius: var(--radius); }

/* ---------------------------------------------------------------- overlays: modal, popover, drawer, toast */
.overlay { position: fixed; inset: 0; z-index: 100; background: var(--overlay); display: grid; place-items: start center; padding: 10vh 16px 16px; overflow-y: auto; animation: fade 0.15s var(--ease); backdrop-filter: blur(2px); }
.overlay.leaving { animation: fade 0.15s reverse forwards; }
.modal { width: 100%; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); border: 1px solid var(--border); animation: pop 0.18s var(--ease); }
.modal-sm { max-width: 420px; }
.modal-md { max-width: 520px; }
.modal-lg { max-width: 680px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 4px 22px; }
.modal-header h2 { font-size: 16px; }
.modal-body { padding: 12px 22px 18px; }
.modal-footer { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } }

.popover { position: fixed; z-index: 200; min-width: 200px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 4px; animation: pop 0.12s var(--ease); }
.menu { display: flex; flex-direction: column; }
.menu-item { display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px; border: 0; background: transparent; border-radius: var(--radius-sm); cursor: pointer; text-align: left; font-size: 13px; color: var(--text); }
.menu-item .icon { color: var(--text-3); }
.menu-item:hover { background: var(--surface-hover); }
.menu-item.danger, .menu-item.danger .icon { color: var(--danger); }
.menu-item kbd { margin-left: auto; }
.menu-divider { height: 1px; background: var(--border); margin: 4px 0; }
.select-popover { display: flex; flex-direction: column; }
.popover-search { width: 100%; height: 34px; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--text); padding: 0 10px; font: inherit; outline: none; margin-bottom: 4px; }
.select-list { max-height: 280px; overflow-y: auto; display: flex; flex-direction: column; }
.select-option { display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 4px 8px; border: 0; background: transparent; border-radius: var(--radius-sm); cursor: pointer; text-align: left; font-size: 13px; color: var(--text); }
.select-option.active { background: var(--surface-hover); }
.select-check { width: 16px; display: inline-grid; place-items: center; color: var(--accent); }
.select-empty { padding: 10px; color: var(--text-3); font-size: 13px; }
.select-create { display: flex; align-items: center; gap: 8px; height: 32px; margin-top: 4px; padding: 0 8px; border: 0; border-top: 1px solid var(--border); background: transparent; color: var(--accent); cursor: pointer; font-size: 13px; text-align: left; }
.opt { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }

.drawer-overlay { position: fixed; inset: 0; z-index: 90; background: rgba(14, 14, 28, 0.18); animation: fade 0.18s; }
[data-theme='dark'] .drawer-overlay { background: rgba(0, 0, 0, 0.4); }
.drawer-overlay.leaving { animation: fade 0.2s reverse forwards; }
.drawer-overlay.leaving .drawer { animation: slide 0.2s reverse forwards; }
.drawer { position: absolute; top: 0; right: 0; bottom: 0; width: min(720px, 100vw); background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: slide 0.22s var(--ease); display: flex; }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
.drawer-body { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.drawer-loading { flex: 1; display: grid; place-items: center; }
.drawer-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 52px; padding: 0 12px 0 24px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.drawer-crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); min-width: 0; }
.crumb { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-actions { display: flex; gap: 2px; }
.drawer-scroll { flex: 1; overflow-y: auto; }
.drawer-main { padding: 20px 28px 28px; }
.title-input { width: 100%; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 22px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.3; resize: none; padding: 4px 6px; margin: 0 -6px 10px; border-radius: var(--radius-sm); overflow: hidden; }
.title-input:hover { background: var(--surface-2); }
.title-input:focus { outline: none; background: var(--surface-2); box-shadow: 0 0 0 2px var(--accent-ring); }

.props { display: grid; grid-template-columns: 120px 1fr; row-gap: 4px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.prop { display: contents; }
.prop-label { font-size: 13px; color: var(--text-3); display: flex; align-items: center; min-height: 32px; }
.prop-value { display: flex; align-items: center; min-height: 32px; min-width: 0; }
.prop-btn { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 8px; margin-left: -8px; border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; cursor: pointer; font-size: 13.5px; color: var(--text); }
.prop-btn:hover { background: var(--surface-hover); }
.prop-btn.bordered { margin-left: 0; border-color: var(--border); background: var(--surface); }
.prop-btn.bordered:hover { background: var(--surface-2); }
.prop-labels { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.prop-labels .prop-add { margin-left: 0; color: var(--text-3); height: 24px; padding: 0 6px; }
.prop-static { font-size: 13.5px; color: var(--text-2); display: inline-flex; align-items: center; gap: 4px; }
.due-wrap { display: flex; align-items: center; gap: 10px; }
.input-date { width: auto; height: 30px; margin-left: -1px; font-size: 13px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }

.section { padding-top: 20px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.section-head h3 { font-size: 13px; color: var(--text-2); }
.description-empty { width: 100%; text-align: left; padding: 12px; border: 1.5px dashed var(--border); border-radius: var(--radius); background: transparent; color: var(--text-3); cursor: pointer; }
.description-empty:hover { border-color: var(--border-strong); color: var(--text-2); }
.description-edit { display: flex; flex-direction: column; gap: 8px; }
.description-edit .hint { margin-right: auto; }
.description-input { font-size: 14px; min-height: 160px; }

.markdown { font-size: 14px; line-height: 1.65; color: var(--text); word-wrap: break-word; }
.markdown > * + * { margin-top: 0.6em; }
.markdown h3, .markdown h4, .markdown h5 { font-size: 15px; margin-top: 1em; }
.markdown ul, .markdown ol { padding-left: 1.4em; margin: 0.4em 0; }
.markdown li + li { margin-top: 0.2em; }
.markdown li.task-item { list-style: none; margin-left: -1.3em; display: flex; gap: 8px; align-items: flex-start; }
.markdown .checkbox { width: 15px; height: 15px; border: 1.5px solid var(--border-strong); border-radius: 4px; margin-top: 4px; flex-shrink: 0; }
.markdown .checkbox.checked { background: var(--accent); border-color: var(--accent); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E"); background-size: 11px; background-position: center; background-repeat: no-repeat; }
.markdown blockquote { margin: 0; padding: 2px 12px; border-left: 3px solid var(--border-strong); color: var(--text-2); }
.markdown pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; overflow-x: auto; font-size: 12.5px; }
.markdown pre code { background: none; border: 0; padding: 0; }
.mention { color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 0 3px; font-weight: 500; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; border: 0; background: transparent; color: var(--text-3); cursor: pointer; font-weight: 500; font-size: 13px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab-count { font-size: 11px; background: var(--surface-2); border-radius: 9px; padding: 0 6px; color: var(--text-3); }
.timeline-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 20px; color: var(--text-3); font-size: 13px; }

.comments { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 18px; }
.comment { display: flex; gap: 12px; }
.comment-main { flex: 1; min-width: 0; }
.comment-head { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 2px; }
.comment-head time { font-size: 12px; }
.comment-menu { margin-left: auto; opacity: 0; }
.comment:hover .comment-menu, .comment-menu:focus { opacity: 1; }
.comment-body { font-size: 13.5px; }
.comment-edit { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }

.activity { list-style: none; margin: 0; padding: 0 0 0 4px; display: flex; flex-direction: column; gap: 14px; position: relative; }
.activity::before { content: ''; position: absolute; left: 14px; top: 8px; bottom: 8px; width: 1px; background: var(--border); }
.activity-item { display: flex; gap: 12px; align-items: flex-start; font-size: 13px; color: var(--text-2); position: relative; }
.activity-item strong { color: var(--text); font-weight: 500; }
.activity-dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-3); flex-shrink: 0; }
.activity-dot.agent { color: #0ea5e9; }

.composer { display: flex; gap: 12px; align-items: flex-start; padding: 14px 24px 18px; border-top: 1px solid var(--border); background: var(--surface); flex-shrink: 0; }
.composer-box { flex: 1; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); transition: border-color 0.15s, box-shadow 0.15s; }
.composer-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.composer-input { width: 100%; border: 0; background: transparent; resize: none; padding: 10px 12px 4px; font: inherit; font-size: 13.5px; color: var(--text); outline: none; min-height: 40px; }
.composer-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 4px 6px 6px; }

#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: var(--radius); background: #1d1d27; color: #f3f3f7; font-size: 13.5px; box-shadow: var(--shadow-lg); animation: toastIn 0.22s var(--ease); pointer-events: auto; max-width: min(520px, 90vw); }
[data-theme='dark'] .toast { background: #2c2c38; border: 1px solid var(--border-strong); }
.toast .icon { color: #4ade80; }
.toast-error .icon { color: #f87171; }
.toast.leaving { animation: toastIn 0.22s reverse forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }

/* ---------------------------------------------------------------- auth */
.auth { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.auth-hero {
  position: relative; overflow: hidden; padding: 40px 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
  background: radial-gradient(1200px 600px at -10% -20%, #7c7cf0 0%, transparent 55%), radial-gradient(900px 500px at 120% 120%, #a855f7 0%, transparent 55%), linear-gradient(160deg, #262673, #13132e);
  color: #fff;
}
.auth-hero .brand { padding: 0; }
.auth-hero .brand-text strong { color: #fff; }
.auth-hero-copy h1 { font-size: clamp(28px, 3vw, 40px); line-height: 1.15; letter-spacing: -0.025em; max-width: 16ch; }
.auth-points { list-style: none; padding: 0; margin: 28px 0 0; display: flex; flex-direction: column; gap: 14px; color: rgba(255, 255, 255, 0.82); font-size: 15px; }
.auth-points li { display: flex; align-items: center; gap: 12px; }
.auth-points .icon { color: #c4b5fd; }
.auth-preview { display: flex; gap: 12px; opacity: 0.9; transform: perspective(900px) rotateX(8deg); transform-origin: bottom; }
.preview-col { flex: 1; background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; backdrop-filter: blur(6px); }
.preview-col-title { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: rgba(255, 255, 255, 0.6); }
.preview-card { background: rgba(255, 255, 255, 0.92); border-radius: 8px; padding: 9px; display: flex; flex-direction: column; gap: 6px; }
.preview-card i { display: block; height: 7px; width: var(--w); background: #c7c7d6; border-radius: 4px; }
.preview-card b { display: block; height: 6px; width: 30%; background: #c4b5fd; border-radius: 4px; }
.auth-panel { display: grid; place-items: center; padding: 40px 24px; background: var(--surface); }
.auth-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 6px; }
.auth-card h2 { font-size: 24px; letter-spacing: -0.02em; }
.auth-card > .muted { margin-bottom: 20px; }
.auth-card .hint { margin-top: 18px; }

/* ---------------------------------------------------------------- home */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { display: flex; align-items: center; gap: 14px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.stat-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--tone) 12%, transparent); color: var(--tone); }
.stat-value { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 12.5px; color: var(--text-3); }
.tone-indigo { --tone: #6366f1; } .tone-red { --tone: #e5484d; } .tone-amber { --tone: #e8920c; } .tone-rose { --tone: #e5484d; } .tone-teal { --tone: #12a594; } .tone-slate { --tone: #8b8ba0; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); gap: 20px; align-items: start; }
.home-side { display: flex; flex-direction: column; gap: 20px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.panel-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.panel-header h2 { font-size: 14px; }
.task-group + .task-group { border-top: 1px solid var(--border); }
.group-title { display: flex; align-items: center; gap: 8px; padding: 12px 18px 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); }
.group-title span { font-weight: 500; }
.group-title.tone-overdue { color: var(--danger); }
.group-title.tone-soon { color: #c27803; }
.panel .list-row { grid-template-columns: 18px 72px minmax(0, 1fr) auto auto 80px; padding: 0 18px; }
.board-tiles { display: flex; flex-direction: column; }
.board-tile { display: flex; flex-direction: column; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none !important; transition: background 0.1s; }
.board-tile:last-child { border-bottom: 0; }
.board-tile:hover { background: var(--surface-hover); }
.board-tile-top { display: flex; align-items: center; gap: 10px; }
.progress { height: 5px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #a855f7); border-radius: 3px; }
.feed { list-style: none; margin: 0; padding: 6px 0; max-height: 520px; overflow-y: auto; }
.feed-item { display: flex; gap: 11px; padding: 9px 18px; font-size: 13px; color: var(--text-2); }
.feed-text { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.feed-text strong { color: var(--text); font-weight: 600; }
.feed-link { font-family: var(--mono); font-size: 12px; }
.feed-sub { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-text time { font-size: 12px; }

/* ---------------------------------------------------------------- settings */
.page-settings { max-width: 1100px; }
.settings-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 28px; align-items: start; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; }
.settings-link { display: flex; align-items: center; gap: 9px; height: 34px; padding: 0 10px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; text-decoration: none !important; }
.settings-link:hover { background: var(--surface-hover); color: var(--text); }
.settings-link.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.settings-panel { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.card-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px 22px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card-panel > header h2 { font-size: 15px; }
.card-panel > header p { margin-top: 2px; font-size: 13px; }
.hero-panel { flex-direction: row; align-items: center; gap: 18px; background: linear-gradient(120deg, var(--accent-soft), transparent 70%), var(--surface); }
.hero-panel h2 { font-size: 16px; margin-bottom: 4px; }
.hero-icon { width: 52px; height: 52px; flex-shrink: 0; border-radius: 14px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #0ea5e9, #6366f1 60%, #a855f7); box-shadow: 0 6px 18px rgba(99, 102, 241, 0.35); }
.profile-head { display: flex; align-items: center; gap: 14px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border); cursor: pointer; }
.swatch.active { box-shadow: 0 0 0 2px var(--text); }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 500; font-size: 12px; color: var(--text-3); padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.inactive td { opacity: 0.55; }
.table td.actions { text-align: right; }
.label-list { display: flex; flex-direction: column; }
.label-row { display: flex; align-items: center; gap: 12px; padding: 8px 4px; border-bottom: 1px solid var(--border); }
.label-row:last-child { border-bottom: 0; }
.label-row .muted { font-size: 12.5px; }
.endpoints { display: flex; flex-direction: column; gap: 8px; }
.endpoint { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.endpoint-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.endpoint-url { background: none; border: 0; padding: 0; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.endpoint small { grid-column: 2 / 4; font-size: 12px; }
.snippet { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.snippet-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 4px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.code-block { margin: 0; padding: 12px 14px; background: #14141c; color: #e4e4ef; font-size: 12.5px; line-height: 1.6; overflow-x: auto; white-space: pre; border-radius: 0; }
.form > .code-block { border-radius: var(--radius); }
.code-block code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }
.callout { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius); font-size: 13px; }
.callout-warn { background: rgba(245, 165, 36, 0.12); color: #a15c07; }
[data-theme='dark'] .callout-warn { color: #f5c063; }
.key-reveal { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.key-reveal code { flex: 1; background: none; border: 0; font-size: 13px; word-break: break-all; }
.label-preview { min-height: 22px; }
.shortcuts { display: flex; flex-direction: column; gap: 10px; }
.shortcut { display: flex; align-items: center; gap: 12px; }
.shortcut kbd { min-width: 72px; text-align: center; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .home-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { flex-direction: row; overflow-x: auto; position: static; }
  .settings-link { white-space: nowrap; }
}
@media (max-width: 760px) {
  :root { --sidebar-w: 64px; }
  .brand-text, .nav-label, .nav-count, .nav-section span, .user-meta, .user-chip > .icon, .nav-empty, .sidebar-footer > .icon-btn { display: none; }
  .nav-item { justify-content: center; padding: 0; }
  .nav-section { justify-content: center; padding: 0; }
  .brand { justify-content: center; padding: 14px 0; }
  .user-chip { justify-content: center; }
  .page { padding: 16px; }
  .board-content { margin: 0 -16px; }
  .columns { padding: 2px 16px 16px; }
  .column { flex-basis: 85vw; }
  .search-input { width: 100%; }
  .list-row { grid-template-columns: 18px 64px minmax(0, 1fr) 26px; }
  .list-row .list-labels, .list-row .list-due, .list-row .list-comments, .list-row .pill { display: none; }
  .stat-pills, .kbd-inline, .search-kbd { display: none; }
  .props { grid-template-columns: 96px 1fr; }
  .drawer-main { padding: 16px; }
  .field-row { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* API & Agents: guide links */
.hero-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.guide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.guide-tile { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); text-decoration: none !important; transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s; }
.guide-tile:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); transform: translateY(-1px); }
.guide-tile strong { font-size: 13.5px; }
.guide-tile small { font-size: 12px; }
.auth-card .hint a { font-weight: 500; }

/* ---------------------------------------------------------------- v1.1: notifications, palette, mentions, checklists, webhooks */
.brand { position: relative; }
.brand .bell { margin-left: auto; position: relative; }
.bell-badge { position: absolute; top: 2px; right: 1px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--bg-sidebar); }
.sidebar-search { display: flex; align-items: center; gap: 9px; margin: 0 10px 8px; height: 34px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text-3); cursor: pointer; font-size: 13px; box-shadow: var(--shadow-sm); text-align: left; }
.sidebar-search:hover { border-color: var(--border-strong); color: var(--text-2); }
.sidebar-search .nav-label { flex: 1; }

.notif-panel { display: flex; flex-direction: column; max-height: min(560px, 75vh); }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 6px 8px 10px; border-bottom: 1px solid var(--border); }
.notif-list { overflow-y: auto; display: flex; flex-direction: column; padding: 4px 0; }
.notif { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border: 0; background: transparent; border-radius: var(--radius-sm); cursor: pointer; text-align: left; color: var(--text-2); font-size: 13px; position: relative; }
.notif:hover { background: var(--surface-hover); }
.notif.unread { background: var(--accent-soft); }
.notif.unread:hover { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.notif-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.notif-line strong { color: var(--text); }
.notif-title { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-excerpt { color: var(--text-3); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.notif time { font-size: 11.5px; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 6px; flex-shrink: 0; }
.notif-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 16px; text-align: center; color: var(--text-3); }
.notif-empty p { color: var(--text); font-weight: 500; }

.mention-menu { position: fixed; z-index: 400; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 4px; display: flex; flex-direction: column; }
.mention-option { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 8px; border: 0; background: transparent; border-radius: var(--radius-sm); cursor: pointer; text-align: left; color: var(--text); font-size: 13px; }
.mention-option.active { background: var(--surface-hover); }
.mention-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mention-handle { color: var(--text-3); font-size: 12px; font-family: var(--mono); }

.palette-overlay { position: fixed; inset: 0; z-index: 250; background: var(--overlay); display: grid; place-items: start center; padding: 12vh 16px 16px; animation: fade 0.12s; backdrop-filter: blur(2px); }
.palette { width: min(640px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; animation: pop 0.15s var(--ease); display: flex; flex-direction: column; max-height: 70vh; }
.palette-search { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--border); color: var(--text-3); }
.palette-input { flex: 1; height: 52px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 16px; outline: none; }
.palette-results { overflow-y: auto; padding: 6px; }
.palette-group { padding: 8px 10px 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); }
.palette-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; padding: 0 10px; border: 0; background: transparent; border-radius: var(--radius); cursor: pointer; text-align: left; color: var(--text); font-size: 14px; }
.palette-item .icon { color: var(--text-3); }
.palette-item.active { background: var(--accent-soft); }
.palette-item.active .icon { color: var(--accent); }
.palette-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-empty { padding: 24px; text-align: center; color: var(--text-3); }
.palette-foot { display: flex; gap: 16px; padding: 8px 14px; border-top: 1px solid var(--border); background: var(--surface-2); font-size: 12px; color: var(--text-3); }
.palette-foot kbd { margin: 0 2px; }

.markdown button.checkbox { padding: 0; cursor: pointer; background-color: var(--surface); transition: background-color 0.12s, border-color 0.12s; }
.markdown button.checkbox:hover { border-color: var(--accent); }
.markdown button.checkbox.checked { background-color: var(--accent); }
.markdown li.task-item.done > span:last-child { color: var(--text-3); text-decoration: line-through; }
.checklist-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 12.5px; color: var(--text-2); }
.checklist-bar .progress { flex: 1; max-width: 220px; }
.meta-item.complete { color: var(--ok); }

.archived-list { display: flex; flex-direction: column; max-height: 60vh; overflow-y: auto; }
.archived-row { display: grid; grid-template-columns: 18px 72px minmax(0, 1fr) auto auto auto; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--border); }
.archived-row:last-child { border-bottom: 0; }
.small { font-size: 12px; }
.block { display: block; }
.hook-url code { background: none; border: 0; padding: 0; font-size: 12.5px; word-break: break-all; }
.status-dot.warn { color: #c27803; }
.status-dot.warn::before { background: var(--warn); }
.text-ok { color: var(--ok); }
.event-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px 12px; padding: 10px 12px; margin-top: 4px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.event-grid code { font-size: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
@media (max-width: 760px) {
  .sidebar-search { justify-content: center; margin: 0 8px 8px; padding: 0; }
  .sidebar-search kbd { display: none; }
  .brand .bell { position: absolute; top: 40px; right: 6px; }
}

/* ---------------------------------------------------------------- attachments */
.attachments .section-head h3 { display: inline-flex; align-items: center; gap: 6px; }
.att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.att-tile { position: relative; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; }
.att-tile:hover, .att-tile:focus-visible { border-color: var(--border-strong); box-shadow: var(--shadow); }
.att-thumb { height: 104px; display: grid; place-items: center; background: var(--surface-2); border-bottom: 1px solid var(--border); overflow: hidden; }
.att-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.25s var(--ease); }
.att-image:hover .att-thumb img { transform: scale(1.04); }
.att-file { --ext: #8b8ba0; color: var(--ext); position: relative; background: color-mix(in srgb, var(--ext) 8%, var(--surface-2)); }
.att-ext { position: absolute; bottom: 14px; font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #fff; background: var(--ext); padding: 1px 6px; border-radius: 4px; }
.att-file .icon { margin-top: -10px; }
.att-meta { display: flex; flex-direction: column; gap: 1px; padding: 7px 30px 8px 10px; min-width: 0; }
.att-name { font-size: 12.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-sub { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-menu { position: absolute; right: 3px; bottom: 6px; opacity: 0; }
.att-tile:hover .att-menu, .att-menu:focus { opacity: 1; }
.att-uploading { cursor: default; }
.att-uploading .progress { margin-top: 6px; }
.att-uploading .progress span { transition: width 0.2s; width: 0; }
.att-empty { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px; border: 1.5px dashed var(--border); border-radius: var(--radius); background: transparent; color: var(--text-2); cursor: pointer; font-size: 13px; }
.att-empty:hover { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
.att-empty .icon { color: var(--text-3); }
.att-empty small { font-size: 11.5px; }

.drawer { position: absolute; }
.drop-hint { position: absolute; inset: 10px; z-index: 30; display: none; place-items: center; border: 2px dashed var(--accent); border-radius: var(--radius-lg); background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(3px); pointer-events: none; }
.drop-hint > div { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--accent); }
.drop-hint small { color: var(--text-3); }
.drawer.dragging-files .drop-hint { display: grid; }

.markdown img.md-img { display: block; max-width: 100%; max-height: 420px; margin: 6px 0; border-radius: var(--radius); border: 1px solid var(--border); cursor: zoom-in; background: var(--surface-2); }

.pending-files { display: flex; flex-wrap: wrap; gap: 6px; }
.pending-files:empty { display: none; }
.pending-file { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 6px 0 9px; border: 1px solid var(--border); border-radius: 13px; font-size: 12.5px; background: var(--surface-2); max-width: 260px; }

.lightbox { position: fixed; inset: 0; z-index: 500; background: rgba(8, 8, 14, 0.92); display: grid; grid-template-rows: auto 1fr auto; animation: fade 0.15s; color: #f1f1f6; }
.lb-top { display: flex; align-items: center; gap: 8px; padding: 10px 14px; }
.lb-count { font-size: 13px; color: #b5b5c6; font-variant-numeric: tabular-nums; }
.lb-btn { color: #e9e9f2 !important; }
.lb-btn:hover { background: rgba(255, 255, 255, 0.1) !important; }
.lb-stage { display: grid; place-items: center; min-height: 0; padding: 0 64px; }
.lb-img { max-width: 100%; max-height: calc(100vh - 120px); object-fit: contain; border-radius: 6px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); animation: pop 0.18s var(--ease); }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.1); color: #fff; display: grid; place-items: center; cursor: pointer; }
.lb-nav:hover { background: rgba(255, 255, 255, 0.2); }
.lb-prev { left: 14px; }
.lb-next { right: 14px; }
.lb-caption { text-align: center; padding: 10px 16px 16px; font-size: 13px; color: #b5b5c6; }
