/* ============================================================================
   COMPONENTS v3 — single source of truth, supersedes all .btn .badge .card .form
   ----------------------------------------------------------------------------
   Load AFTER legacy-shim.css to win cascade. Uses tokens.css + v2/system_tokens.css.
   No !important. Specificity max 0,2,0 (only :hover/:focus-visible/:disabled pseudo).
   No descendant selectors (.parent .child) — only single-class rules.
   ============================================================================ */


/* ══════════════════════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════════════════════ */

.btn {
  /* Base shape */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 9px var(--space-4);
  min-height: 36px;

  /* Typography */
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.005em;
  white-space: nowrap;

  /* Surface */
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-subtle);

  /* Behavior */
  cursor: pointer;
  user-select: none;
  text-decoration: none;
  transition: var(--tr-default);
}

.btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
  filter: brightness(0.98);
}

.btn:active {
  transform: translateY(1px);
  box-shadow: none;
}

.btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Variants ─────────────────────────────────────────────────────────────── */

.btn-primary {
  background: var(--brand);
  color: var(--surface);
  border-color: var(--brand);
  box-shadow: var(--shadow-subtle);
}
.btn-primary:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
  color: var(--surface);
  filter: none;
}
.btn-primary:focus-visible {
  outline-color: var(--brand);
  box-shadow: var(--shadow-focus);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border-color: transparent;
  box-shadow: none;
}
.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: transparent;
  filter: none;
}

.btn-danger {
  background: var(--danger);
  color: var(--surface);
  border-color: var(--danger);
}
.btn-danger:hover {
  background: #B91C1C;
  border-color: #B91C1C;
  color: var(--surface);
  filter: none;
}
.btn-danger:focus-visible {
  outline-color: var(--danger);
}

.btn-success {
  background: var(--success);
  color: var(--surface);
  border-color: var(--success);
}
.btn-success:hover {
  background: #15803D;
  border-color: #15803D;
  color: var(--surface);
  filter: none;
}
.btn-success:focus-visible {
  outline-color: var(--success);
}

.btn-warning {
  background: var(--warning);
  color: var(--surface);
  border-color: var(--warning);
}
.btn-warning:hover {
  background: #C2410C;
  border-color: #C2410C;
  color: var(--surface);
  filter: none;
}

/* ── Sizes ────────────────────────────────────────────────────────────────── */

.btn-xs {
  padding: 4px var(--space-2);
  min-height: 24px;
  font-size: 11px;
  border-radius: var(--radius-xs);
  gap: 4px;
}

.btn-sm {
  padding: 6px var(--space-3);
  min-height: 30px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 12px var(--space-5);
  min-height: 44px;
  font-size: 14px;
  border-radius: var(--radius-md);
}

/* Icon-only square */
.btn-icon {
  width: 36px;
  padding: 0;
  aspect-ratio: 1;
}
.btn-icon.btn-xs { width: 24px; }
.btn-icon.btn-sm { width: 30px; }
.btn-icon.btn-lg { width: 44px; }

/* Full-width */
.btn-block {
  display: flex;
  width: 100%;
}


/* ══════════════════════════════════════════════════════════════════════════
   BADGES — pill, 11px/600, semantic variants
   ══════════════════════════════════════════════════════════════════════════ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px var(--space-2);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.005em;
  color: var(--text-2);
  background: var(--surface-soft);
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  white-space: nowrap;
  vertical-align: middle;
}

.badge-success {
  background: var(--success-bg);
  color: var(--success);
  border-color: rgba(22, 163, 74, 0.16);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: rgba(234, 88, 12, 0.16);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(220, 38, 38, 0.16);
}

.badge-info {
  background: var(--info-bg);
  color: var(--info);
  border-color: rgba(37, 99, 235, 0.16);
}

.badge-neutral {
  background: var(--surface-soft);
  color: var(--text-2);
  border-color: var(--border);
}

.badge-brand {
  background: var(--brand-fade);
  color: var(--brand);
  border-color: var(--brand-strong);
}

/* Dot accent inside badge */
.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: currentColor;
  display: inline-block;
}


/* ══════════════════════════════════════════════════════════════════════════
   CARDS — surface, border, padded
   ══════════════════════════════════════════════════════════════════════════ */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-subtle);
  transition: var(--tr-default);
}

.card-elevated {
  box-shadow: var(--shadow-elevated);
}

.card-flat {
  border-color: transparent;
  box-shadow: none;
}

.card-soft {
  background: var(--surface-soft);
  border-color: transparent;
  box-shadow: none;
}

.card-interactive {
  cursor: pointer;
}
.card-interactive:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-elevated);
  transform: translateY(-1px);
}
.card-interactive:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.card-compact {
  padding: var(--space-4);
  border-radius: var(--radius-md);
}

.card-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--text);
  margin: 0 0 var(--space-3);
  line-height: 1.35;
}

.card-meta {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--muted);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-4);
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
  margin-top: var(--space-4);
}


/* ══════════════════════════════════════════════════════════════════════════
   FORM CONTROLS
   ══════════════════════════════════════════════════════════════════════════ */

.form-input,
.form-select,
.form-textarea {
  display: block;
  width: 100%;
  padding: 9px var(--space-3);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-subtle);
  transition: var(--tr-colors);
  appearance: none;
  -webkit-appearance: none;
}

.form-textarea {
  min-height: 96px;
  line-height: 1.6;
  resize: vertical;
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
  border-color: var(--border-strong);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--shadow-focus);
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
  background: var(--surface-soft);
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.7;
}

.form-input:invalid,
.form-select:invalid,
.form-textarea:invalid {
  border-color: var(--danger);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--muted);
  opacity: 1;
}

/* Select caret indicator */
.form-select {
  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='%23A1A1AA' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  padding-right: var(--space-7);
}

/* Sizes */
.form-input-sm,
.form-select-sm {
  padding: 6px var(--space-2);
  font-size: 13px;
  border-radius: var(--radius-sm);
}
.form-input-lg,
.form-select-lg {
  padding: 12px var(--space-4);
  font-size: 15px;
}

/* ── Form Layout Helpers ─────────────────────────────────────────────────── */

.form-group {
  display: block;
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--text-2);
  margin-bottom: 6px;
}

.form-label-required::after {
  content: '*';
  color: var(--danger);
  margin-left: 4px;
}

.form-help {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--muted);
  margin-top: 4px;
}

.form-error {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--danger);
  margin-top: 4px;
}

/* Checkbox / radio scaled */
.form-checkbox,
.form-radio {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
  cursor: pointer;
  margin: 0;
}

/* Row of paired fields */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}
.form-row-full {
  grid-template-columns: 1fr;
}

@media (max-width: 640px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}


/* ══════════════════════════════════════════════════════════════════════════
   NOTICE — semantic callout panel (info / success / warning / danger).
   Replaces inline `style="background:#f0fdf4;border:1px solid #86efac;..."`
   patterns scattered across modals and settings pages so dark-mode inherits
   automatically. Naming avoids collision with .callout-* used by the doc
   block editor in app.css.
   ══════════════════════════════════════════════════════════════════════════ */

.notice {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid;
  margin-bottom: var(--space-1);
}

.notice-info    { background: var(--info-bg);    border-color: color-mix(in srgb, var(--info)    30%, transparent); }
.notice-success { background: var(--success-bg); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.notice-warning { background: var(--warning-bg); border-color: color-mix(in srgb, var(--warning) 30%, transparent); }
.notice-danger  { background: var(--danger-bg);  border-color: color-mix(in srgb, var(--danger)  30%, transparent); }
.notice-brand   { background: var(--brand-fade); border-color: color-mix(in srgb, var(--brand)   30%, transparent); }

.notice-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
}
.notice-info    .notice-icon { background: var(--info); }
.notice-success .notice-icon { background: var(--success); }
.notice-warning .notice-icon { background: var(--warning); }
.notice-danger  .notice-icon { background: var(--danger); }
.notice-brand   .notice-icon { background: var(--brand); }

.notice-icon-sm { width: 20px; height: 20px; }

.notice-body { flex: 1; min-width: 0; }

.notice-title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}
.notice-info    > .notice-body > .notice-title { color: var(--info); }
.notice-success > .notice-body > .notice-title { color: var(--success); }
.notice-warning > .notice-body > .notice-title { color: var(--warning); }
.notice-danger  > .notice-body > .notice-title { color: var(--danger); }
.notice-brand   > .notice-body > .notice-title { color: var(--brand); }

.notice-text {
  font-size: 11.5px;
  color: var(--text-2);
  margin-top: 2px;
  line-height: 1.55;
}

.notice-metric {
  margin-left: auto;
  font-size: 22px;
  font-weight: 900;
  font-family: var(--font-mono);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  align-self: center;
}
.notice-info    > .notice-metric { color: var(--info); }
.notice-success > .notice-metric { color: var(--success); }
.notice-warning > .notice-metric { color: var(--warning); }
.notice-danger  > .notice-metric { color: var(--danger); }
.notice-brand   > .notice-metric { color: var(--brand); }

.notice-sep {
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid;
  font-size: 11.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.notice-info    .notice-sep { border-top-color: color-mix(in srgb, var(--info)    24%, transparent); color: var(--info); }
.notice-success .notice-sep { border-top-color: color-mix(in srgb, var(--success) 24%, transparent); color: var(--success); }
.notice-warning .notice-sep { border-top-color: color-mix(in srgb, var(--warning) 24%, transparent); color: var(--warning); }
.notice-danger  .notice-sep { border-top-color: color-mix(in srgb, var(--danger)  24%, transparent); color: var(--danger); }
.notice-brand   .notice-sep { border-top-color: color-mix(in srgb, var(--brand)   24%, transparent); color: var(--brand); }

/* Layout modifier: title/text on the left, control (switch/metric) on the right */
.notice-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.notice-row > * { min-width: 0; }

/* Standalone result banner slot (inline-status after form submit).
   Class-only replacement for legacy inline `style="display:none;..."`. */
.notice-banner {
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  font-size: 12px;
  margin-top: 6px;
}
.notice-banner[hidden] { display: none; }
.notice-banner.notice-info    { background: var(--info-bg);    color: var(--info); }
.notice-banner.notice-success { background: var(--success-bg); color: var(--success); }
.notice-banner.notice-warning { background: var(--warning-bg); color: var(--warning); }
.notice-banner.notice-danger  { background: var(--danger-bg);  color: var(--danger); }

/* Density variant kept for grep-ability if a caller wants a labeled hook */
.notice-block { /* alias — currently no extra rules, reserved for future variants */ }

/* Inline SVG icon used when notice has no icon-square wrapper. Sized like a small chip icon. */
.notice-icon-inline {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}
.notice-info    > .notice-icon-inline { color: var(--info); }
.notice-success > .notice-icon-inline { color: var(--success); }
.notice-warning > .notice-icon-inline { color: var(--warning); }
.notice-danger  > .notice-icon-inline { color: var(--danger); }
.notice-brand   > .notice-icon-inline { color: var(--brand); }


/* ══════════════════════════════════════════════════════════════════════════
   RISK-MATRIX indicator — Probability × Impact result panel inside the
   Risk modal. Initial state is neutral (surface-soft); JS repaints the
   dot/score/border with tone colors via inline style based on RISK_MATRIX
   lookup (that JS-driven repaint is out of Day-1 scope).
   ══════════════════════════════════════════════════════════════════════════ */

.risk-matrix-box {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-1);
  transition: background var(--d-fast) var(--ease), border-color var(--d-fast) var(--ease);
}
.risk-matrix-dot {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: background var(--d-fast) var(--ease);
}
.risk-matrix-body { flex: 1; min-width: 0; }
.risk-matrix-label { font-size: 12px; font-weight: 700; color: var(--text); }
.risk-matrix-desc  { font-size: 11px; color: var(--muted); margin-top: 2px; }
.risk-matrix-score {
  margin-left: auto;
  font-size: 22px;
  font-weight: 900;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}


/* ══════════════════════════════════════════════════════════════════════════
   PREVIEW-LIST — scrollable list container used e.g. in the "Create Tasks
   from AI" modal. Token-driven surface so it inherits dark-mode correctly.
   ══════════════════════════════════════════════════════════════════════════ */

.preview-list {
  max-height: 250px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}


/* ══════════════════════════════════════════════════════════════════════════
   CHART-ICON tones — semantic tint pairs (bg + fg) for the dashboard
   chart-card icon squares. Base `.chart-icon` lives in app.css; these
   modifiers replace inline `style="background:#ede9fe;color:#7c3aed"` etc.
   ══════════════════════════════════════════════════════════════════════════ */

.chart-icon-brand   { background: var(--brand-fade);        color: var(--brand); }
.chart-icon-info    { background: var(--info-bg);           color: var(--info); }
.chart-icon-success { background: var(--success-bg);        color: var(--success); }
.chart-icon-warning { background: var(--warning-bg);        color: var(--warning); }
.chart-icon-danger  { background: var(--danger-bg);         color: var(--danger); }
.chart-icon-purple  { background: color-mix(in srgb, var(--purple) 14%, transparent); color: var(--purple); }
.chart-icon-teal    { background: color-mix(in srgb, var(--teal)   14%, transparent); color: var(--teal); }


/* ══════════════════════════════════════════════════════════════════════════
   SETTINGS-HEADER-ICON — the 46px gradient icon square that heads each
   settings pane (Email / SMTP / Schedule / Telegram / OAuth). Gradients
   are brand-specific (e.g. Telegram uses Telegram-brand blue) so they stay
   as CSS-declared constants; keeping them here means HTML carries only a
   modifier class and dark-mode does not clobber intentional brand tones.
   ══════════════════════════════════════════════════════════════════════════ */

.settings-header-icon {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand), var(--brand-hover));
  box-shadow: 0 3px 10px color-mix(in srgb, var(--brand) 30%, transparent);
}

.settings-header-icon-email {
  background: linear-gradient(135deg, #0EA5E9, #6366F1);
  box-shadow: 0 3px 10px rgba(14, 165, 233, 0.30);
}
.settings-header-icon-smtp {
  background: linear-gradient(135deg, #F59E0B, #EF4444);
  box-shadow: 0 3px 10px rgba(245, 158, 11, 0.30);
}
.settings-header-icon-schedule {
  background: linear-gradient(135deg, #8B5CF6, #6366F1);
  box-shadow: 0 3px 10px rgba(139, 92, 246, 0.30);
}
.settings-header-icon-telegram {
  background: linear-gradient(135deg, #0088CC, #229ED9);
  box-shadow: 0 3px 10px rgba(0, 136, 204, 0.30);
}

/* Row-wrapper for the "Enable X" toggle rows that sit inside a settings pane */
.settings-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
}
.settings-toggle-row-title { font-size: 13px; font-weight: 700; }
.settings-toggle-row-sub   { font-size: 11.5px; color: var(--muted); margin-top: 2px; }


/* ══════════════════════════════════════════════════════════════════════════
   KB-GRAPH LEGEND tones — colored pills next to the knowledge-graph canvas.
   Palette is intentionally hardcoded because it MUST match the node/edge
   colors rendered by the canvas JS (kb-graph.js) — dark mode gracefully
   flattens these via the existing `[data-theme="dark"] .kb-graph-legend-chip`
   rule in app.css so the tones don't glare on dark canvas.
   ══════════════════════════════════════════════════════════════════════════ */

.kb-legend-meeting   { background: rgba(124, 58, 237, 0.10); color: #7C3AED; border-color: rgba(124, 58, 237, 0.20); }
.kb-legend-decision  { background: rgba(217, 119, 6,  0.10); color: #D97706; border-color: rgba(217, 119, 6,  0.20); }
.kb-legend-technical { background: rgba(2,  132, 199, 0.10); color: #0284C7; border-color: rgba(2,  132, 199, 0.20); }
.kb-legend-general   { background: rgba(16, 185, 129, 0.10); color: #10B981; border-color: rgba(16, 185, 129, 0.20); }
.kb-legend-wiki      { background: rgba(99, 102, 241, 0.08); color: #6366F1; border-color: rgba(99, 102, 241, 0.15); }
.kb-legend-tag       { background: rgba(16, 185, 129, 0.08); color: #10B981; border-color: rgba(16, 185, 129, 0.15); }
.kb-legend-ai        { background: rgba(245, 158, 11, 0.08); color: #F59E0B; border-color: rgba(245, 158, 11, 0.15); }
.kb-legend-manual    { background: rgba(139, 92,  246, 0.08); color: #8B5CF6; border-color: rgba(139, 92,  246, 0.15); }

.kb-legend-dot-meeting   { background: #7C3AED; }
.kb-legend-dot-decision  { background: #D97706; }
.kb-legend-dot-technical { background: #0284C7; }
.kb-legend-dot-general   { background: #10B981; }

.kb-legend-line { width: 10px; height: 2px; display: inline-block; vertical-align: middle; margin-right: 1px; }
.kb-legend-line-wiki   { background: #6366F1; }
.kb-legend-line-tag    { background: repeating-linear-gradient(90deg, #10B981 0 3px, transparent 3px 5px); height: 2px; }
.kb-legend-line-ai     { background: repeating-linear-gradient(90deg, #F59E0B 0 2px, transparent 2px 4px); height: 2px; }
.kb-legend-line-manual { background: #8B5CF6; }

.kb-legend-divider {
  width: 1px;
  height: 10px;
  background: var(--border);
  margin: 0 2px;
  align-self: center;
  opacity: .5;
}

.kb-legend-eyebrow {
  font-size: 8px;
  font-weight: 700;
  color: var(--muted);
  margin-right: 1px;
  letter-spacing: .05em;
  opacity: .7;
}

/* Force fixed dot size for kb-graph legend context (base .kb-graph-dot is 9px). */
.kb-graph-legend .kb-graph-dot { width: 6px; height: 6px; }


/* ══════════════════════════════════════════════════════════════════════════
   CHAT INPUT SURFACES — AI panel input bar + attached-file chip.
   Replaces inline `background:#fff` / `background:#f8fafc` / hex-tinted
   success-chip attachments in the chat input row.
   ══════════════════════════════════════════════════════════════════════════ */

.chat-input-row-stack {
  flex-direction: column;
  gap: 0;
  padding: 0;
}

.chat-attach-bar {
  padding: 6px 14px 0;
  background: var(--surface);
}
.chat-attach-bar[hidden] { display: none; }

.chat-attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--success-bg);
  border: 1px solid color-mix(in srgb, var(--success) 30%, transparent);
  border-radius: 7px;
  padding: 4px 9px;
  font-size: 11px;
  color: var(--success);
  font-weight: 500;
}
.chat-attach-chip-size {
  color: color-mix(in srgb, var(--success) 70%, var(--muted));
  font-size: 10px;
}

.chat-input-bar {
  display: flex;
  gap: 9px;
  padding: 12px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.ai-prompt-form {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-soft);
  flex-shrink: 0;
}
.ai-prompt-form[hidden] { display: none; }


/* ══════════════════════════════════════════════════════════════════════════
   KR-CHECKIN SPARKLINE — inline bar visualization in the Key Result modal.
   ══════════════════════════════════════════════════════════════════════════ */

.kr-checkin-sparkline {
  margin: 8px 0 14px;
  height: 46px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  display: flex;
  align-items: flex-end;
  gap: 3px;
}


/* ══════════════════════════════════════════════════════════════════════════
   MSG-AVATAR-BRAND — Nexora AI assistant avatar in the chat bubble. SVG mark
   embeds intentional brand indigo (#5046E5) so it stays recognizable across
   themes; wrapper background/border are tokenised so light/dark inherit.
   TODO(Day 2): replace inline SVG with <use href="/favicon.svg#logo-nexora">.
   ══════════════════════════════════════════════════════════════════════════ */

.msg-avatar-brand {
  background: var(--brand);
  border-color: var(--brand);
  padding: 0;
  overflow: hidden;
}
.msg-avatar-svg { width: 100%; height: 100%; display: block; }


/* ══════════════════════════════════════════════════════════════════════════
   LOGO-MARK — canonical Nexora mark rendered via <use href="#logo-nexora"/>.
   Base size 32px; -sm 30px, -lg naturally sized by parent (login logo).
   ══════════════════════════════════════════════════════════════════════════ */

.logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}
.logo-mark-sm { width: 30px; height: 30px; border-radius: 8px; }
.logo-mark-lg { width: 100%; height: 100%; border-radius: 16px; }


/* ══════════════════════════════════════════════════════════════════════════
   AI-PANEL header cluster — logo + title + model badge. Replaces the
   inline `style="display:flex;…"` group at the top of `.ai-panel > .ai-header`.
   ══════════════════════════════════════════════════════════════════════════ */

.ai-header-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}

.ai-header-title-wrap {
  margin-left: 9px;
  min-width: 0;
}
.ai-header-title {
  font-size: 13px;
  font-weight: 600;
}

.ai-model-badge {
  font-size: 10px;
  color: var(--muted);
  background: var(--border);
  padding: 1px 7px;
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  flex-shrink: 0;
}


/* ══════════════════════════════════════════════════════════════════════════
   TODAY-HERO — editorial landing on the Today page.
   Fraunces display face, clamp() responsive size (40–64px), tight negative
   tracking. The greeter word ("Good morning,") uses coral for a warm accent
   against the mono-indigo brand. This is the one place in the app where the
   typography investment (Fraunces optical-size 9–144) actually sings.
   ══════════════════════════════════════════════════════════════════════════ */

.today-hero {
  padding: var(--space-7) 0 var(--space-6);
  margin-bottom: var(--space-6);
  border-bottom: 1px solid var(--border-soft);
}

.today-hero-eyebrow {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 var(--space-2);
}

.today-hero-title {
  font-family: var(--font-display);
  font-feature-settings: 'ss01', 'ss02';
  font-size: clamp(40px, 6vw, 64px);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.030em;
  color: var(--text);
  margin: 0 0 var(--space-3);
}

.today-hero-greeter {
  color: var(--accent-coral);
  font-style: italic;
}

.today-hero-summary {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-2);
  max-width: 62ch;
  margin: 0;
}

@media (max-width: 640px) {
  .today-hero { padding: var(--space-5) 0 var(--space-4); }
  .today-hero-title { font-size: clamp(32px, 8vw, 48px); }
}


/* ══════════════════════════════════════════════════════════════════════════
   NOTIF-BADGE — count pill on the notification bell in the topbar.
   Intentionally CORAL (not danger red): unread notifications are an
   "attention" signal, not an error. Red is reserved for actual errors
   (validation, failed API, overdue) so that when danger DOES appear,
   users register it as significant.
   ══════════════════════════════════════════════════════════════════════════ */

.notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  background: var(--accent-coral);
  color: #fff;
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
  border-radius: 7px;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 1px 3px color-mix(in srgb, var(--accent-coral) 35%, transparent);
}
.notif-badge[hidden] { display: none; }


/* ══════════════════════════════════════════════════════════════════════════
   BTN-CORAL — secondary CTA that lives outside the mono-indigo brand ladder.
   Use for onboarding "Try this" cues, secondary upgrade prompts, and
   empty-state primary actions — places where "brand primary" would feel
   too heavy but a ghost button would feel invisible. Sparingly.
   ══════════════════════════════════════════════════════════════════════════ */

/* Specificity 0,2,0 chain is necessary — v2/legacy_buttons_forms.css defines
   a `button.btn` selector (0,1,1) that would otherwise reset `.btn-coral`
   (0,1,0) to `background: var(--surface)`. Using `.btn.btn-coral` bumps us
   above the legacy shim without needing `!important`. */
.btn.btn-coral {
  background: var(--accent-coral);
  color: #fff;
  border-color: var(--accent-coral);
  --ring-color: color-mix(in srgb, var(--accent-coral) 40%, transparent);
}
.btn.btn-coral:hover {
  background: color-mix(in srgb, var(--accent-coral) 88%, #000);
  border-color: color-mix(in srgb, var(--accent-coral) 88%, #000);
  color: #fff;
  filter: none;
}

.btn.btn-coral-soft {
  background: var(--accent-coral-fade);
  color: var(--accent-coral);
  border-color: transparent;
  box-shadow: none;
}
.btn.btn-coral-soft:hover {
  background: color-mix(in srgb, var(--accent-coral-fade) 60%, var(--accent-coral) 40%);
  filter: none;
}


/* ══════════════════════════════════════════════════════════════════════════
   EMPTY-STATE-CORAL — accent stroke/tint helper for empty-state illustrations.
   Apply to the outermost SVG or the highlight <path>/<line> to give the
   otherwise mono-indigo palette a warm hint. Optional, additive.
   ══════════════════════════════════════════════════════════════════════════ */

.empty-state-accent { color: var(--accent-coral); }
.empty-state-accent-soft { color: color-mix(in srgb, var(--accent-coral) 60%, var(--muted)); }


/* ══════════════════════════════════════════════════════════════════════════
   TAG-CHIP — tiny uppercase label chip used inline in form labels
   (EPIC / SPRINT / OKR markers). Replaces inline pill styles in
   partials/modals/task.html and similar.
   ══════════════════════════════════════════════════════════════════════════ */

.tag-chip {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.4;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  border: 1px solid;
  text-transform: uppercase;
}
.tag-chip-info    { background: var(--info-bg);    color: var(--info);    border-color: color-mix(in srgb, var(--info)    30%, transparent); }
.tag-chip-success { background: var(--success-bg); color: var(--success); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.tag-chip-warning { background: var(--warning-bg); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 30%, transparent); }
.tag-chip-danger  { background: var(--danger-bg);  color: var(--danger);  border-color: color-mix(in srgb, var(--danger)  30%, transparent); }
.tag-chip-brand   { background: var(--brand-fade); color: var(--brand);   border-color: color-mix(in srgb, var(--brand)   30%, transparent); }
.tag-chip-purple  { background: color-mix(in srgb, var(--purple) 12%, transparent); color: var(--purple); border-color: color-mix(in srgb, var(--purple) 30%, transparent); }


/* ══════════════════════════════════════════════════════════════════════════
   DOT — inline colored dot used in type-tab labels (Task/Epic/Subtask ●).
   Replaces `<span style="color:#3b82f6;font-size:8px;line-height:1">●</span>`.
   ══════════════════════════════════════════════════════════════════════════ */

.dot {
  font-size: 8px;
  line-height: 1;
  display: inline-block;
}
.dot-info    { color: var(--info); }
.dot-success { color: var(--success); }
.dot-warning { color: var(--warning); }
.dot-danger  { color: var(--danger); }
.dot-brand   { color: var(--brand); }
.dot-purple  { color: var(--purple); }


/* ══════════════════════════════════════════════════════════════════════════
   WIRE-UP INSTRUCTIONS:
   Add to static/index.html inside <head>, AFTER legacy-shim.css so this
   file wins the cascade (override priority):

     <link rel="stylesheet" href="/css/v3/components.css?v=1">

   Recommended placement order (top -> bottom in <head>):
     1. tokens.css
     2. v2/system_tokens.css
     3. (all other v2/*.css and app.css)
     4. v2/legacy-shim.css
     5. v3/components.css         <-- here
     6. v3/modal.css
     7. v3/table.css
   ══════════════════════════════════════════════════════════════════════════ */
