:root {
  --bg: #09090b;
  --surface: #111113;
  --surface-2: #161619;
  --surface-3: #1c1c20;
  --border: #232326;
  --border-hover: #3a3a3f;
  --text: #e8e8ea;
  --text-secondary: #8e8e96;
  --text-muted: #55555c;
  --accent: #5e6ad2;
  --accent-light: #8b93e8;
  --accent-glow: rgba(94, 106, 210, 0.08);
  --success: #34d399;
  --success-glow: rgba(52, 211, 153, 0.08);
  --warning: #fbbf24;
  --danger: #f87171;
  --danger-glow: rgba(248, 113, 113, 0.06);
  --gmail: #ea4335;
  --slack: #e01e5a;
  --whatsapp: #25d366;
  --linkedin: #0a66c2;
  --gmeet: #00897b;
  --zoom: #2d8cff;
  --outlook: #0078d4;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 5px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

svg { display: block; flex-shrink: 0; }

.btn-primary svg,
.filter-btn svg,
.draft-label svg,
.urgent-tag svg {
  display: inline-block;
  vertical-align: middle;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  letter-spacing: -0.01em;
}

#app { position: relative; width: 100%; }

/* ── Navigation ─────────────────────────────────────────────────── */

.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 52px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(9, 9, 11, 0.88);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  user-select: none;
}

.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), #7c6ee8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  color: white;
}

.brand-mark.large { width: 38px; height: 38px; border-radius: 11px; font-size: 17px; }

.brand-name { font-weight: 600; font-size: 14px; letter-spacing: -0.02em; }

.nav-links { display: flex; gap: 2px; }

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.nav-links a:hover { color: var(--text); background: var(--surface-2); }
.nav-links a.active { color: var(--text); background: var(--surface-2); }

/* Pre-login screens: nav links are not accessible */
.top-nav.pre-login .nav-links { display: none; }

.nav-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); transition: background 0.3s; }
.status-dot.ok { background: var(--success); }
.status-dot.error { background: var(--danger); }

/* ── Views ──────────────────────────────────────────────────────── */

.view {
  display: none !important;
  position: absolute;
  left: -9999px;
  width: 0;
  height: 0;
  overflow: hidden;
}

.view.active {
  display: block !important;
  position: relative;
  left: auto;
  width: 100%;
  height: auto;
  min-height: calc(100vh - 52px);
  overflow: visible;
  animation: viewIn 0.3s ease;
}

#view-permissions.active {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

@keyframes viewIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Buttons ────────────────────────────────────────────────────── */

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-primary:hover { background: var(--accent-light); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(94, 106, 210, 0.2); }

.btn-outline {
  padding: 8px 16px;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-outline:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-hover); }

/* ── Overview ───────────────────────────────────────────────────── */

.overview-bg {
  min-height: calc(100vh - 52px);
  background:
    radial-gradient(ellipse 55% 40% at 12% 18%, rgba(238, 224, 178, 0.50) 0%, transparent 60%),
    radial-gradient(ellipse 45% 38% at 88% 12%, rgba(244, 236, 208, 0.42) 0%, transparent 60%),
    radial-gradient(ellipse 65% 48% at 75% 82%, rgba(236, 221, 172, 0.45) 0%, transparent 62%),
    radial-gradient(ellipse 55% 45% at 20% 78%, rgba(246, 240, 218, 0.38) 0%, transparent 60%),
    radial-gradient(ellipse 40% 30% at 50% 45%, rgba(250, 246, 230, 0.25) 0%, transparent 60%),
    linear-gradient(160deg, #7e9bc2 0%, #89a5c7 45%, #92adca 100%);
  padding: 3rem 2rem 4rem;
  display: flex;
  justify-content: center;
}

.overview-container {
  width: 100%;
  max-width: 620px;
  min-width: 0; /* allow shrink below min-content on phones */
}

/* ── Soothing light theme scoped to Overview ─────────────────────────────── */
.overview-bg .notif-card-wrap {
  background: #ffffff;
  border: 1px solid rgba(20, 30, 50, 0.1);
  box-shadow:
    0 24px 70px rgba(45, 65, 105, 0.25),
    0 4px 12px rgba(45, 65, 105, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.overview-bg .notif-card-title h1 { color: #0f1116; font-weight: 700; letter-spacing: -0.02em; }
.overview-bg .notif-card-count,
.overview-bg .notif-card-meta { color: #6b7280; }
.overview-bg .notif-pill { border-color: #e4e6ea; color: #6b7280; background: transparent; }
.overview-bg .notif-pill:hover { color: #33363c; border-color: #d0d4da; }
.overview-bg .notif-pill.active { background: #eef0f3; color: #17181c; border-color: #d5d9de; }
.overview-bg .notif-row { border-bottom-color: #eef0f2; }
.overview-bg .notif-row:hover { background: rgba(20, 30, 50, 0.025); }
.overview-bg .notif-row-source { color: #9aa0a8; }
.overview-bg .notif-row-source .src-name { color: #3a3f47; font-weight: 600; }
.overview-bg .notif-row-time { color: #9aa0a8; }
.overview-bg .notif-row-title { color: #111318; font-weight: 650; }
.overview-bg .notif-row-desc { color: #4a4f57; }
.overview-bg .notif-row-quote { color: #8a8f98; }
.overview-bg .notif-empty h3 { color: #17181c; }
.overview-bg .notif-empty p { color: #8a8f98; }
/* Overview buttons: light-theme overrides */
.overview-bg .btn-outline { border-color: #c8cdd4; color: #4a5060; }
.overview-bg .btn-outline:hover { border-color: var(--accent); color: var(--accent); background: rgba(94, 106, 210, 0.06); }
.overview-bg .notif-card-header { color: #111318; }
.overview-bg .notif-draft-inner {
  background: #e9f2fc;
  border: 1px solid #cfe1f5;
}
.overview-bg .draft-label { color: #3b6ea5; }
.overview-bg .draft-edit-hint { color: #7d94ad; }
.overview-bg .draft-text {
  background: #ffffff; color: #26282d; border-color: #d7e5f4;
}
.overview-bg .draft-text:hover { background: #f4f9ff; }
.overview-bg .draft-text:focus { border-color: #9cc3ec; background: #ffffff; }
.overview-bg .action-btn.send { background: var(--accent); color: #fff; }
.overview-bg .action-btn.send:hover { background: var(--accent-light); }
.overview-bg .action-btn.dismiss { background: transparent; color: #5a6472; border: 1px solid #cfd8e3; }
.overview-bg .action-btn.dismiss:hover { background: #e3ecf7; color: #33363c; }

/* Notification Card */
.notif-card-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.03);
}

/* Briefing Widget */
.briefing-widget {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 16px 24px;
  color: #fff;
}

.briefing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.briefing-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
}

.briefing-title svg {
  opacity: 0.7;
}

.briefing-refresh {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 6px;
  padding: 6px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.7);
  transition: all 0.2s;
}

.briefing-refresh:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.briefing-content {
  font-size: 0.82rem;
  line-height: 1.6;
}

.briefing-section {
  margin-bottom: 12px;
}

.briefing-section-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 6px;
  font-weight: 600;
}

.briefing-away-note {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.55);
  background: rgba(124, 192, 255, 0.08);
  border: 1px solid rgba(124, 192, 255, 0.18);
  border-radius: 8px;
  padding: 8px 10px;
  margin: 4px 0 10px;
  line-height: 1.45;
}

.briefing-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  color: rgba(255, 255, 255, 0.85);
}

.briefing-item svg {
  opacity: 0.6;
  flex-shrink: 0;
}

.briefing-item.urgent {
  color: #ff6b6b;
}

.briefing-item.urgent svg {
  opacity: 1;
}

.briefing-empty {
  color: rgba(255, 255, 255, 0.5);
  font-style: italic;
  padding: 8px 0;
}

.notif-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 20px 24px 0;
}

.notif-card-title { display: flex; align-items: baseline; gap: 12px; }
.notif-card-title h1 { font-size: 1.2rem; font-weight: 700; letter-spacing: -0.02em; }
.notif-card-count { font-size: 0.78rem; color: var(--text-muted); font-weight: 400; }
.notif-card-meta { font-size: 0.72rem; color: var(--text-muted); }

/* Filter Pills */
.notif-filters {
  display: flex;
  gap: 6px;
  padding: 16px 24px 0;
  flex-wrap: wrap;
}

.notif-pill {
  padding: 5px 14px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.notif-pill:hover { color: var(--text-secondary); border-color: var(--border-hover); }
.notif-pill.active { background: var(--accent-glow); color: var(--accent-light); border-color: rgba(94, 106, 210, 0.3); }

/* Notification List */
.notif-list { padding: 4px 0 0; }

.notif-row {
  border-bottom: 1px solid rgba(35, 35, 38, 0.6);
  transition: background 0.12s;
  cursor: pointer;
}

.notif-row:last-child { border-bottom: none; }
.notif-row:hover { background: rgba(255, 255, 255, 0.015); }
.notif-row.resolved { opacity: 0.3; pointer-events: none; }

.notif-row-main {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 24px;
}

.notif-row-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.notif-row-icon.gmail { background: rgba(234, 67, 53, 0.08); color: var(--gmail); }
.notif-row-icon.slack { background: rgba(224, 30, 90, 0.08); color: var(--slack); }
.notif-row-icon.whatsapp { background: rgba(37, 211, 102, 0.08); color: var(--whatsapp); }
.notif-row-icon.linkedin { background: rgba(10, 102, 194, 0.08); color: var(--linkedin); }
.notif-row-icon.audio { background: rgba(124, 110, 232, 0.08); color: var(--accent-light); }
.notif-row-icon.file { background: rgba(148, 163, 184, 0.08); color: var(--text-secondary); }

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

.notif-row-source {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.notif-row-source .src-name { font-weight: 600; color: var(--text-secondary); }

.notif-row-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.notif-row-time { font-size: 0.72rem; color: var(--text-muted); }

.notif-row-title {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.notif-row-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 4px;
}

.notif-row-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--danger);
  background: var(--danger-glow);
  padding: 2px 6px;
  border-radius: 3px;
}

/* Row Actions (hover reveal) */
.notif-row-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}

.notif-row:hover .notif-row-actions { opacity: 1; }

.action-btn {
  padding: 5px 12px;
  border-radius: var(--radius-xs);
  border: none;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.action-btn.send { background: var(--accent); color: white; }
.action-btn.send:hover { background: var(--accent-light); }
.action-btn.dismiss { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.action-btn.dismiss:hover { background: var(--surface-3); color: var(--text); }

/* Expandable Draft */
.notif-draft {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.notif-row.expanded .notif-draft { max-height: 560px; }

.notif-draft-inner {
  margin: 0 24px 16px;
  padding: 14px 16px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.draft-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-light);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.draft-edit-hint {
  font-size: 9px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-muted);
  margin-left: auto;
}

.draft-text {
  font-size: 0.83rem;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 12px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: border-color 0.15s, background 0.15s;
  outline: none;
  /* Cap long drafts (email replies run 4-5 paragraphs) with an internal scroll
     so the Regenerate / Dismiss / Approve & Send row below always stays visible
     instead of being clipped by the panel's max-height. */
  max-height: 260px;
  overflow-y: auto;
}

.draft-text:hover { background: rgba(255, 255, 255, 0.02); }
.draft-text:focus { border-color: var(--accent); background: rgba(94, 106, 210, 0.04); }

/* E2: draft verification warnings (unsupported dates / names / sensitive info) */
.draft-warnings {
  margin: -6px 0 12px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(217, 119, 6, 0.35);
  background: rgba(217, 119, 6, 0.08);
}

.draft-warning-item {
  font-size: 0.78rem;
  line-height: 1.5;
  color: #d97706;
}

.draft-warning-item + .draft-warning-item { margin-top: 4px; }

.overview-bg .draft-warnings { background: #fff7ed; border-color: #fdba74; }
.overview-bg .draft-warning-item { color: #9a3412; }

.draft-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* Empty Overview */
.notif-empty {
  padding: 3rem 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Cold-start demo CTA (shown when the inbox is empty) */
.demo-cta {
  padding: 2.5rem 2rem;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  margin: 0.5rem 0;
}
.demo-cta h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}
.demo-cta p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  max-width: 420px;
  margin: 0 auto 16px;
}
.demo-cta .btn-primary { padding: 9px 22px; font-size: 0.82rem; }
/* Light overview theme */
.overview-bg .demo-cta {
  border: 1px solid rgba(20, 30, 50, 0.1);
  background: #ffffff;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  border-radius: 12px;
}
.overview-bg .demo-cta h3 { color: #111318; font-size: 1.05rem; }
.overview-bg .demo-cta p { color: #5a6070; }

/* ── Intelligence (Inbox) ───────────────────────────────────────── */

.inbox-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 2rem 2rem 1.25rem;
  max-width: 680px;
  margin: 0 auto;
  flex-wrap: wrap;
  gap: 1rem;
}

.inbox-header h1 { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.025em; }
.inbox-summary { color: var(--text-secondary); font-size: 0.82rem; margin-top: 4px; }

.inbox-filters { display: flex; gap: 4px; flex-wrap: wrap; }

.filter-btn {
  padding: 6px 11px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.filter-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-hover); }
.filter-btn.active { background: var(--accent-glow); color: var(--accent-light); border-color: var(--accent); }
.filter-btn.urgent-filter.active { background: var(--danger-glow); color: var(--danger); border-color: var(--danger); }

/* Inbox List */
.inbox-list {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 2rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.inbox-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s;
}

.inbox-item:hover { border-color: var(--border-hover); }
.inbox-item.urgent-item { border-left: 2px solid var(--danger); }
.inbox-item.resolved { opacity: 0.35; pointer-events: none; }

.inbox-item-main {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  align-items: flex-start;
}

.source-badge {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.source-badge svg { width: 18px !important; height: 18px !important; }
.source-badge.gmail { background: rgba(234, 67, 53, 0.1); color: var(--gmail); }
.source-badge.gcalendar { background: rgba(94, 106, 210, 0.12); color: var(--primary); }
.source-badge.slack { background: rgba(224, 30, 90, 0.1); color: var(--slack); }
.source-badge.whatsapp { background: rgba(37, 211, 102, 0.1); color: var(--whatsapp); }
.source-badge.linkedin { background: rgba(10, 102, 194, 0.1); color: var(--linkedin); }

.inbox-content { flex: 1; min-width: 0; }

.inbox-title {
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 3px;
  line-height: 1.35;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.urgent-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--danger);
  background: var(--danger-glow);
  padding: 2px 6px;
  border-radius: 4px;
}

.dir-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: auto;
}

.dir-sent {
  color: var(--gmail);
  background: rgba(234, 67, 53, 0.08);
}

.dir-received {
  color: var(--primary);
  background: rgba(94, 106, 210, 0.08);
}

.thread-count {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 6px;
}

.inbox-item.in-thread .inbox-item-main { border-left: 3px solid var(--primary); }

.inbox-preview {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 5px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.inbox-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.inbox-meta .person { font-weight: 600; color: var(--text-secondary); }
.inbox-meta .role { color: var(--text-muted); font-weight: 400; }

/* Inbox Actions */
.inbox-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
  flex-shrink: 0;
  align-self: center;
}

.inbox-item:hover .inbox-actions { opacity: 1; }

.action-btn {
  padding: 5px 12px;
  border-radius: var(--radius-xs);
  border: none;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.action-btn.send { background: var(--accent); color: white; }
.action-btn.send:hover { background: var(--accent-light); }
.action-btn.dismiss { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.action-btn.dismiss:hover { background: var(--surface-3); color: var(--text); }

/* Draft (expandable) */
.inbox-draft {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.inbox-item.expanded .inbox-draft { max-height: 560px; }

.draft-inner {
  margin: 0 16px 14px;
  padding: 14px 16px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.draft-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-light);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.draft-text { font-size: 0.83rem; color: var(--text); line-height: 1.6; margin-bottom: 12px; }

.draft-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* Empty State */
.inbox-empty {
  max-width: 680px;
  margin: 0 auto;
  padding: 4rem 2rem;
  text-align: center;
}

.empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  color: var(--text-muted);
}

.inbox-empty h3 { font-size: 1rem; font-weight: 600; margin-bottom: 4px; }
.inbox-empty p { color: var(--text-secondary); font-size: 0.82rem; }

/* ── Settings ───────────────────────────────────────────────────── */

/* ── Settings soothing background ─────────────────────────────────────── */
.settings-bg,
.auth-bg {
  min-height: calc(100vh - 52px);
  background:
    radial-gradient(ellipse 55% 40% at 12% 18%, rgba(238, 224, 178, 0.50) 0%, transparent 60%),
    radial-gradient(ellipse 45% 38% at 88% 12%, rgba(244, 236, 208, 0.42) 0%, transparent 60%),
    radial-gradient(ellipse 65% 48% at 75% 82%, rgba(236, 221, 172, 0.45) 0%, transparent 62%),
    radial-gradient(ellipse 55% 45% at 20% 78%, rgba(246, 240, 218, 0.38) 0%, transparent 60%),
    radial-gradient(ellipse 40% 30% at 50% 45%, rgba(250, 246, 230, 0.25) 0%, transparent 60%),
    linear-gradient(160deg, #7e9bc2 0%, #89a5c7 45%, #92adca 100%);
  padding: 3rem 2rem 4rem;
  display: flex;
  justify-content: center;
}

/* ── Auth/Permissions light theme overrides ──────────────────────────── */
.auth-bg .perm-header h1 { color: #17181c; }
.auth-bg .perm-subtitle { color: #6b7280; }
.auth-bg .perm-content h3 { color: #17181c; }
.auth-bg .perm-content p { color: #6b7280; }
.auth-bg .perm-note { color: #9ca3af; }
.auth-bg .auth-card {
  background: #fdfdfb;
  border-color: rgba(20, 30, 50, 0.08);
  box-shadow: 0 24px 70px rgba(45, 65, 105, 0.28);
}
.auth-bg .auth-tabs { background: #fff; border-color: #d0d4da; }
.auth-bg .auth-tab { color: #6b7280; }
.auth-bg .auth-tab.active { background: #e9f2fc; color: #3b6ea5; }
.auth-bg .auth-field label { color: #6b7280; }
.auth-bg .auth-field input { background: #fff; border-color: #d0d4da; color: #17181c; }
.auth-bg .auth-field input:focus { border-color: #3b6ea5; }
.auth-bg .btn-primary { background: #3b6ea5; color: #fff; }
.auth-bg .btn-primary:hover { background: #2d5a8a; }
.auth-bg .btn-primary:disabled { background: #9ca3af; }
.auth-bg .perm-grant-btn { border-color: #d0d4da; color: #5a6472; }
.auth-bg .perm-grant-btn:hover { border-color: #3b6ea5; color: #3b6ea5; }
.auth-bg .perm-grant-btn.granted { background: #e6f7ef; border-color: rgba(52, 211, 153, 0.4); color: #1a9d5e; }

.auth-bg .perm-item {
  background: #fdfdfb;
  border-color: rgba(20, 30, 50, 0.08);
}
.auth-bg .perm-item:hover { border-color: rgba(20, 30, 50, 0.18); }
.auth-bg .perm-item.granted { border-color: rgba(52, 211, 153, 0.3); background: #e6f7ef; }

.auth-bg .perm-icon-wrap {
  background: #f3f4f6;
  color: #6b7280;
}
.auth-bg .perm-item.granted .perm-icon-wrap { background: #d1fae5; color: #1a9d5e; }

.auth-bg .perm-content h3 { color: #17181c; }
.auth-bg .perm-content p { color: #6b7280; }

.auth-bg .perm-header h1 { color: #17181c; }
.auth-bg .perm-subtitle { color: #6b7280; }

.auth-bg .perm-note { color: #9ca3af; }

.auth-bg .perm-continue-btn {
  background: #3b6ea5;
  color: #fff;
  border: none;
}
.auth-bg .perm-continue-btn:hover { background: #2d5a8a; }
.auth-bg .perm-continue-btn:disabled { background: #d0d4da; color: #9ca3af; cursor: not-allowed; }

.settings-container {
  width: 100%;
  min-width: 0;
  max-width: 680px;
  margin: 0 auto;
  padding: 2.5rem 2rem 4rem;
}

/* ── Settings light theme overrides ──────────────────────────────────── */
.settings-bg .settings-header h1 { color: #17181c; }
.settings-bg .settings-sub { color: #6b7280; }
.settings-bg .settings-section-title { color: #6b7280; }

.settings-bg .account-card,
.settings-bg .integration-card,
.settings-bg .pref-row,
.settings-bg .sig-card,
.settings-bg .history-list,
.settings-bg .profile-card,
.settings-bg .dreaming-card {
  background: #fdfdfb;
  border-color: rgba(20, 30, 50, 0.08);
}
.settings-bg .integration-card:hover { border-color: rgba(20, 30, 50, 0.18); }

.settings-bg .profile-title,
.settings-bg .dreaming-title { color: #17181c; }
.settings-bg .profile-section-title,
.settings-bg .dreaming-empty { color: #6b7280; }
.settings-bg .profile-section-content { color: #6b7280; }
.settings-bg .profile-contact-name { color: #17181c; }
.settings-bg .profile-contact-count { color: #6b7280; }
.settings-bg .profile-confidence { color: #6b7280; border-color: rgba(20, 30, 50, 0.08); }
.settings-bg .profile-tag { background: #f3f4f6; border-color: rgba(20, 30, 50, 0.08); color: #6b7280; }
.settings-bg .profile-hour { background: #f3f4f6; border-color: rgba(20, 30, 50, 0.08); color: #6b7280; }

.settings-bg .dreaming-row { background: #f9fafb; border-color: rgba(20, 30, 50, 0.08); }
.settings-bg .dreaming-row-title { color: #17181c; }
.settings-bg .dreaming-row-meta { color: #6b7280; }
.settings-bg .dreaming-refresh { border-color: #d0d4da; color: #5a6472; }
.settings-bg .dreaming-refresh:hover { border-color: #3b6ea5; color: #3b6ea5; background: rgba(59, 110, 165, 0.06); }
.settings-bg .profile-refresh { border-color: #d0d4da; color: #5a6472; }
.settings-bg .profile-refresh:hover { border-color: #3b6ea5; color: #3b6ea5; background: rgba(59, 110, 165, 0.06); }

.settings-bg .account-name { color: #17181c; }
.settings-bg .account-email { color: #6b7280; }
.settings-bg .account-avatar { background: #e9f2fc; color: #3b6ea5; }

.settings-bg .integration-name { color: #17181c; }
.settings-bg .integration-desc { color: #6b7280; }

.settings-bg .connect-btn { border-color: #d0d4da; color: #5a6472; }
.settings-bg .connect-btn:hover { border-color: #3b6ea5; color: #3b6ea5; }
.settings-bg .connect-btn.connected { background: #e6f7ef; border-color: rgba(52, 211, 153, 0.4); color: #1a9d5e; }
.settings-bg .connect-btn.connected:hover { background: #fde8e8; border-color: rgba(248, 113, 113, 0.4); color: #dc2626; }
.settings-bg .disconnect-btn { border-color: rgba(248, 113, 113, 0.3); color: #dc2626; }
.settings-bg .disconnect-btn:hover { background: #fde8e8; border-color: rgba(248, 113, 113, 0.5); }

.settings-bg .pref-name { color: #17181c; }
.settings-bg .pref-desc { color: #6b7280; }
.settings-bg .pref-select { background: #fff; border-color: #d0d4da; color: #17181c; }
.settings-bg .pref-select:focus { border-color: #3b6ea5; }

.settings-bg .toggle-slider { background: #e5e7eb; border-color: #d0d4da; }
.settings-bg .toggle-slider::before { background: #9ca3af; }
.settings-bg .toggle input:checked + .toggle-slider { background: #dbeafe; border-color: #3b6ea5; }
.settings-bg .toggle input:checked + .toggle-slider::before { background: #3b6ea5; }

.settings-bg .sig-label { color: #6b7280; }
.settings-bg .sig-textarea { background: #fff; border-color: #d0d4da; color: #17181c; }
.settings-bg .sig-textarea:focus { border-color: #3b6ea5; }
.settings-bg .sig-textarea::placeholder { color: #9ca3af; }
.settings-bg .sig-hint { color: #9ca3af; }

.settings-bg .history-row { border-bottom-color: #eef0f2; }
.settings-bg .history-row-title { color: #17181c; }
.settings-bg .history-row-meta { color: #6b7280; }
.settings-bg .history-row-time { color: #9ca3af; }
.settings-bg .history-row-icon.sent { background: #e6f7ef; color: #1a9d5e; }
.settings-bg .history-row-icon.dismissed { background: #f3f4f6; color: #9ca3af; }
.settings-bg .history-empty { color: #9ca3af; }

.settings-bg .btn-outline { border-color: #d0d4da; color: #5a6472; }
.settings-bg .btn-outline:hover { border-color: #3b6ea5; color: #3b6ea5; }
.settings-bg .link-btn { color: #3b6ea5; }

/* History modal light theme */
#historyModal .modal-card {
  background: #fdfdfb;
  border-color: rgba(20, 30, 50, 0.08);
  box-shadow: 0 24px 70px rgba(45, 65, 105, 0.28);
}
#historyModal .modal-header h2 { color: #17181c; }
#historyModal .modal-close { color: #6b7280; }
#historyModal .modal-close:hover { color: #17181c; }
#historyModal .history-list {
  background: #fff;
  border-color: #e4e6ea;
}
#historyModal .history-row { border-bottom-color: #eef0f2; }
#historyModal .history-row-title { color: #17181c; }
#historyModal .history-row-meta { color: #6b7280; }
#historyModal .history-row-time { color: #9ca3af; }
#historyModal .history-row-icon.sent { background: #e6f7ef; color: #1a9d5e; }
#historyModal .history-row-icon.dismissed { background: #f3f4f6; color: #9ca3af; }
#historyModal .history-empty { color: #9ca3af; }
#historyDetailModal .modal-card {
  background: #fdfdfb;
  border-color: rgba(20, 30, 50, 0.08);
  box-shadow: 0 24px 70px rgba(45, 65, 105, 0.28);
}
#historyDetailModal .modal-header h2 { color: #17181c; }
#historyDetailModal .modal-close { color: #6b7280; }
#historyDetailModal .modal-close:hover { color: #17181c; }
#historyDetailModal .history-detail-meta { border-bottom-color: #eef0f2; }
#historyDetailModal .history-detail-key { color: #9ca3af; }
#historyDetailModal .history-detail-val { color: #17181c; }
#historyDetailModal .history-detail-body { color: #17181c; }
#historyDetailModal .history-detail-note { background: #f3f4f6; color: #6b7280; }
#historyDetailModal .history-row.clickable:hover { background: #f6f7f9; }
#historyModal .history-page-info { color: #6b7280; }
#historyModal .btn-outline { border-color: #d0d4da; color: #5a6472; }
#historyModal .btn-outline:hover:not(:disabled) { border-color: #3b6ea5; color: #3b6ea5; }

/* Connector modal light theme */
#connectorModal .modal-card {
  background: #fdfdfb;
  border-color: rgba(20, 30, 50, 0.08);
  box-shadow: 0 24px 70px rgba(45, 65, 105, 0.28);
}
#connectorModal .modal-header h2 { color: #17181c; }
#connectorModal .modal-close { color: #6b7280; }
#connectorModal .modal-close:hover { color: #17181c; }
#connectorModal .auth-field label { color: #6b7280; }
#connectorModal .auth-field input { background: #fff; border-color: #d0d4da; color: #17181c; }
#connectorModal .auth-field input:focus { border-color: #3b6ea5; }
#connectorModal .modal-hint { color: #9ca3af; }
#connectorModal .modal-hint code { color: #6b7280; background: #f3f4f6; }
#connectorModal .modal-link { color: #3b6ea5; text-decoration: none; font-weight: 500; }
#connectorModal .modal-link:hover { text-decoration: underline; }
#connectorModal .btn-primary { background: #3b6ea5; color: #fff; }
#connectorModal .btn-primary:hover { background: #2d5a8a; }

.conn-error {
  background: #fde8e8;
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: #dc2626;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  padding: 10px 14px;
  margin-bottom: 1rem;
  line-height: 1.4;
}

.settings-header { margin-bottom: 2rem; }
.settings-header h1 { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.025em; }
.settings-sub { color: var(--text-secondary); font-size: 0.85rem; margin-top: 4px; }

.settings-section { margin-bottom: 2.5rem; }

.settings-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* ── Settings tabs ──────────────────────────────────────────────── */

.settings-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 1.75rem;
}

.stab-btn {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid #d0d4da;
  background: #fff;
  color: #5a6472;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.stab-btn:hover { border-color: #3b6ea5; color: #3b6ea5; }
.stab-btn.active { background: #e9f2fc; color: #3b6ea5; border-color: #bcd6ee; }

/* Only the active tab's sections are visible */
.settings-section[data-stab] { display: none; }
.settings-section[data-stab].stab-active { display: block; }

/* Account Card */
.account-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.account-info { display: flex; align-items: center; gap: 12px; }

.account-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--accent-glow);
  color: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}

.account-name { font-size: 0.9rem; font-weight: 600; }
.account-email { font-size: 0.78rem; color: var(--text-secondary); margin-top: 1px; }

/* Profile Card */
.profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}

.profile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.profile-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.profile-title svg {
  opacity: 0.7;
}

.profile-refresh {
  background: rgba(94, 106, 210, 0.1);
  border: 1px solid rgba(94, 106, 210, 0.2);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--accent-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s;
}

.profile-refresh:hover {
  background: rgba(94, 106, 210, 0.15);
  border-color: rgba(94, 106, 210, 0.3);
}

.profile-refresh svg {
  opacity: 0.7;
}

.profile-content {
  font-size: 0.82rem;
  line-height: 1.6;
}

.profile-empty {
  color: var(--text-muted);
  font-style: italic;
  padding: 0.5rem 0;
}

.profile-section {
  margin-bottom: 0.75rem;
}

.profile-section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  font-weight: 600;
}

.profile-section-content {
  color: var(--text-secondary);
}

.profile-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.profile-tag {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 2px 10px;
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.profile-contacts {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-contact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 0;
}

.profile-contact-name {
  color: var(--text);
  font-weight: 500;
}

.profile-contact-count {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.profile-hours {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.profile-hour {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.profile-confidence {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Dreaming Card */
.dreaming-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}

.dreaming-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.dreaming-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.dreaming-title svg {
  opacity: 0.7;
}

.dreaming-refresh {
  background: rgba(94, 106, 210, 0.1);
  border: 1px solid rgba(94, 106, 210, 0.2);
  border-radius: 6px;
  padding: 5px;
  cursor: pointer;
  color: var(--accent-light);
  display: flex;
  align-items: center;
  transition: all 0.15s;
}

.dreaming-refresh:hover {
  background: rgba(94, 106, 210, 0.15);
  border-color: rgba(94, 106, 210, 0.3);
}

.dreaming-refresh svg {
  opacity: 0.7;
}

.dreaming-status {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dreaming-empty {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.82rem;
  padding: 0.5rem 0;
}

.dreaming-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.8rem;
}

.dreaming-row-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.dreaming-done .dreaming-row-icon { color: #34d399; }
.dreaming-error .dreaming-row-icon { color: #f87171; }
.dreaming-active .dreaming-row-icon { color: var(--accent-light); }

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

.dreaming-row-title {
  color: var(--text);
  font-weight: 500;
  font-size: 0.8rem;
}

.dreaming-row-meta {
  color: var(--text-muted);
  font-size: 0.7rem;
  margin-top: 1px;
}

.dreaming-row-status {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 8px;
  border-radius: 100px;
  flex-shrink: 0;
}

.dreaming-done .dreaming-row-status {
  background: rgba(52, 211, 153, 0.12);
  color: #34d399;
}

.dreaming-error .dreaming-row-status {
  background: rgba(248, 113, 113, 0.12);
  color: #f87171;
}

.dreaming-active .dreaming-row-status {
  background: rgba(94, 106, 210, 0.12);
  color: var(--accent-light);
}

/* Integration Cards */
.integration-list { display: flex; flex-direction: column; gap: 6px; }

.integration-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: border-color 0.15s;
}

.integration-card:hover { border-color: var(--border-hover); }

.integration-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.integration-icon.gmail { background: rgba(234, 67, 53, 0.1); color: var(--gmail); }
.integration-icon.slack { background: rgba(224, 30, 90, 0.1); color: var(--slack); }
.integration-icon.whatsapp { background: rgba(37, 211, 102, 0.1); color: var(--whatsapp); }
.integration-icon.linkedin { background: rgba(10, 102, 194, 0.1); color: var(--linkedin); }
.integration-icon.gmeet { background: rgba(0, 137, 123, 0.1); color: var(--gmeet); }
.integration-icon.zoom { background: rgba(45, 140, 255, 0.1); color: var(--zoom); }
.integration-icon.outlook { background: rgba(0, 120, 212, 0.1); color: var(--outlook); }

/* Catalog-rendered cards carry no brand SVG — a quiet monogram tile keeps the
   grid uniform without shipping approximate third-party logos. */
.integration-icon.mono {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: var(--accent-glow);
  color: var(--text-secondary);
}

/* Auth-requirement hint: "API token" vs "OAuth sign-in" vs "On this device". */
.integration-kind {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-secondary);
  opacity: 0.7;
  margin-top: 4px;
}

/* Outlook device-code sign-in step */
.outlook-step {
  margin-top: 14px;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: rgba(0, 120, 212, 0.06);
  border: 1px solid rgba(0, 120, 212, 0.25);
  text-align: center;
}
.outlook-step-label { font-size: 0.78rem; color: #6b7280; margin-bottom: 8px; }
.outlook-code {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--outlook);
  font-family: 'SF Mono', ui-monospace, monospace;
  margin-bottom: 8px;
}
.outlook-status { font-size: 0.8rem; color: #6b7280; }
.settings-bg .outlook-step { background: rgba(0, 120, 212, 0.05); border-color: rgba(0, 120, 212, 0.25); }

.integration-info { flex: 1; min-width: 0; }
.integration-name { font-size: 0.88rem; font-weight: 600; }
.integration-desc { font-size: 0.75rem; color: var(--text-secondary); margin-top: 2px; line-height: 1.35; }

.integration-status {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* "Coming soon" badge for integrations without a live connector */
.coming-soon-badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--accent-glow);
  padding: 4px 10px;
  border-radius: 12px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* "Cloud only" — the connector exists but the desktop agent refuses it
   (LOCAL_ALLOWED_CONNECTOR_TYPES in oryne-api routes/connectors.rs). Dim the
   identity of the card but keep its description readable, so it is clear the
   integration is real rather than missing. */
.cloud-only-badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--accent-glow);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 12px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: help;
}

.integration-card.cloud-only .integration-icon { opacity: 0.55; }
.integration-card.cloud-only .integration-name { color: var(--text-secondary); }

/* "Open cloud console" link — gives cloud-only connector cards a path forward
   instead of a dead end. Only shown when a cloud URL is configured. */
.cloud-console-link {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent, #5e6ad2);
  text-decoration: none;
  padding: 6px 12px;
  border: 1px solid rgba(94, 106, 210, 0.30);
  border-radius: 6px;
  transition: background 0.15s ease;
  white-space: nowrap;
}
.cloud-console-link:hover {
  background: rgba(94, 106, 210, 0.08);
}

/* Connect Button */
.connect-btn {
  padding: 7px 16px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 100px;
  text-align: center;
  flex-shrink: 0;
}

.connect-btn:hover { border-color: var(--accent); color: var(--accent-light); }

.connect-btn.connected {
  background: var(--success-glow);
  border-color: rgba(52, 211, 153, 0.3);
  color: var(--success);
}

.connect-btn.connected:hover {
  background: var(--danger-glow);
  border-color: rgba(248, 113, 113, 0.3);
  color: var(--danger);
}

.disconnect-btn {
  padding: 7px 16px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(248, 113, 113, 0.3);
  background: transparent;
  color: var(--danger);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 100px;
  text-align: center;
  flex-shrink: 0;
  margin-left: 8px;
}

.disconnect-btn:hover {
  background: var(--danger-glow);
  border-color: rgba(248, 113, 113, 0.5);
}

/* Preferences */
.pref-list { display: flex; flex-direction: column; gap: 2px; }

.pref-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.pref-row + .pref-row { margin-top: -1px; border-radius: 0; }
.pref-row:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.pref-row:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.pref-row:only-child { border-radius: var(--radius); }

.pref-name { font-size: 0.85rem; font-weight: 500; }
.pref-desc { font-size: 0.75rem; color: var(--text-secondary); margin-top: 2px; }

.pref-select {
  padding: 6px 10px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
}

.pref-select:focus { border-color: var(--accent); }

/* Toggle Switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 11px;
  cursor: pointer;
  transition: all 0.2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  top: 2px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all 0.2s;
}

.toggle input:checked + .toggle-slider { background: var(--accent-glow); border-color: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); background: var(--accent-light); }

/* Signature */
.sig-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.sig-label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 500;
}

.sig-textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.83rem;
  line-height: 1.5;
  padding: 10px 12px;
  resize: vertical;
  transition: border-color 0.15s;
}

.sig-textarea:focus { outline: none; border-color: var(--accent); }
.sig-textarea::placeholder { color: var(--text-muted); opacity: 0.6; }

.sig-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 8px;
  font-style: italic;
}

.sig-logo-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  cursor: pointer;
  user-select: none;
}

.sig-logo-row input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

.sig-logo-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.settings-bg .sig-logo-label { color: #6b7280; }

/* History */
.history-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  max-height: 320px;
  overflow-y: auto;
}

.history-empty {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.history-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(35, 35, 38, 0.5);
  font-size: 0.8rem;
}

.history-row:last-child { border-bottom: none; }

.history-row-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 12px;
}

.history-row-icon.sent { background: var(--success-glow); color: var(--success); }
.history-row-icon.dismissed { background: var(--surface-3); color: var(--text-muted); }

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

.history-row-title {
  font-weight: 600;
  font-size: 0.8rem;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-row-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.history-row-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Clickable history rows + full-message detail modal */
.history-row.clickable { cursor: pointer; transition: background 0.12s ease; }
.history-row.clickable:hover { background: var(--surface-2); }
.history-row.clickable:focus-visible { outline: 2px solid var(--accent-light); outline-offset: -2px; }
.history-row-open { color: var(--text-muted); flex-shrink: 0; opacity: 0.55; }
.history-row.clickable:hover .history-row-open { opacity: 1; }

.history-detail-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 24px 14px;
  border-bottom: 1px solid rgba(35, 35, 38, 0.5);
  margin-bottom: 14px;
}
.history-detail-row { display: flex; gap: 10px; font-size: 0.75rem; }
.history-detail-key {
  width: 44px;
  flex-shrink: 0;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  line-height: 1.6;
}
.history-detail-val { color: var(--text); word-break: break-word; }
.history-detail-body {
  padding: 0 24px 8px;
  font-size: 0.8rem;
  line-height: 1.65;
  white-space: pre-wrap;
  max-height: 44vh;
  overflow-y: auto;
  color: var(--text);
}
.history-detail-note {
  margin: 12px 24px 20px;
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--surface-2);
  border-radius: 8px;
  padding: 8px 12px;
}

/* Section header with action link */
.settings-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent-light);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
}
.link-btn:hover { text-decoration: underline; }

/* History modal (paginated) */
.history-modal-card { width: 560px; max-width: 92vw; }
.history-modal-list {
  max-height: 52vh;
  overflow-y: auto;
  margin-top: 4px;
}
.history-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}
.history-page-info { font-size: 0.75rem; color: var(--text-muted); }
.history-pagination .btn-outline:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Permissions ────────────────────────────────────────────────── */

.permissions-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 3rem 2rem;
  width: 100%;
}

.perm-header { text-align: center; margin-bottom: 2.5rem; }

.perm-brand { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 1.5rem; }

.perm-header h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 8px; letter-spacing: -0.02em; }
.perm-subtitle { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.5; }

.perm-list { width: 100%; max-width: 480px; display: flex; flex-direction: column; gap: 10px; margin-bottom: 2.5rem; }

.perm-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.2s;
}

.perm-item:hover { border-color: var(--border-hover); transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04); }
.perm-item.granted { border-color: rgba(52, 211, 153, 0.3); background: var(--success-glow); }

.perm-icon-wrap {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: all 0.2s;
}

.perm-item.granted .perm-icon-wrap { background: var(--success-glow); color: var(--success); }
.perm-svg { width: 18px !important; height: 18px !important; }

.perm-content { flex: 1; min-width: 0; }
.perm-content h3 { font-size: 0.85rem; font-weight: 600; margin-bottom: 2px; }
.perm-content p { font-size: 0.75rem; color: var(--text-secondary); line-height: 1.35; }

.perm-grant-btn {
  padding: 7px 16px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  min-width: 80px;
}

.perm-grant-btn:hover { border-color: var(--accent); color: var(--accent-light); background: rgba(59, 110, 165, 0.05); }
.perm-item.granted .perm-grant-btn { border-color: transparent; background: var(--success); color: #000; cursor: pointer; }
.perm-item.granted .perm-grant-btn:hover { background: var(--success); }
.perm-btn-check { display: inline-flex; align-items: center; }

.perm-footer { text-align: center; }
.perm-continue-btn { margin-bottom: 12px; padding: 10px 24px; font-size: 13px; }
.perm-note { font-size: 0.75rem; color: var(--text-muted); line-height: 1.5; }

/* ── Auth trust strip (privacy / local AI) ─────────────────────────── */
.auth-trust { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 20px; margin: 20px 0 18px; }
.auth-trust-item { display: flex; align-items: center; gap: 7px; font-size: 0.78rem; color: var(--text-secondary); }
.auth-trust-item svg { color: var(--accent); flex-shrink: 0; }
.auth-bg .auth-trust-item { color: #6b7280; }
.auth-bg .auth-trust-item svg { color: #3b6ea5; }

/* ── System Permissions card (Settings) ──────────────────────────── */

.perm-settings-list { display: flex; flex-direction: column; gap: 10px; }

.perm-status-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
}
.perm-status-badge.on { background: var(--success-glow); color: var(--success); }
.perm-status-badge.app-off { background: var(--surface-3); color: var(--text-secondary); }
.perm-status-badge.off { background: rgba(248, 113, 113, 0.12); color: var(--danger); }

.perm-settings-actions { gap: 8px; }
.perm-revoke-btn { border-color: rgba(248, 113, 113, 0.3); color: var(--danger); }
.perm-revoke-btn:hover { background: rgba(248, 113, 113, 0.08); }

.perm-settings-note { margin-top: 10px; font-size: 12px; color: var(--text-muted); line-height: 1.5; }

/* Natural-language automations (Settings → Extend, spec §23) */
.automation-form-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  padding: 14px 16px;
}
.automation-form-card textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-1, transparent);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 8px 10px;
  margin-top: 6px;
}
.automation-form-actions { display: flex; gap: 10px; margin-top: 10px; }
.automation-preview { margin-top: 12px; font-size: 12.5px; }
.automation-preview-rule {
  border: 1px dashed rgba(94, 106, 210, 0.45);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(94, 106, 210, 0.05);
}
.automation-preview-engine { color: var(--text-muted); font-size: 11px; margin-left: 6px; }
.automation-preview-err { color: var(--danger); display: inline-block; margin-top: 2px; font-size: 12.5px; }
.automation-preview-pending { color: var(--text-muted); font-size: 12.5px; }
.automation-list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.automation-row {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  padding: 12px 14px;
}
.automation-row.paused { opacity: 0.65; }
.automation-row-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.automation-name { font-weight: 600; font-size: 13px; color: var(--text); }
.automation-status-chip {
  margin-left: auto;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e6f7ef;
  color: #15803d;
}
.automation-row.paused .automation-status-chip { background: #f3f4f6; color: #6b7280; }
.automation-row-meta { font-size: 12.5px; color: var(--text-muted); line-height: 1.7; }
.automation-cond, .automation-act {
  display: inline-block;
  font-size: 11.5px;
  padding: 1px 8px;
  border-radius: 999px;
  margin: 0 4px 2px 0;
}
.automation-cond { background: rgba(245, 158, 11, 0.1); color: #b45309; border: 1px solid rgba(245, 158, 11, 0.25); }
.automation-act { background: rgba(94, 106, 210, 0.08); color: #5e6ad2; border: 1px solid rgba(94, 106, 210, 0.2); }
.automation-row-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* Privacy Center (Settings → Permissions, spec §24) */
.privacy-center {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  padding: 6px 14px;
  margin-bottom: 16px;
}
.privacy-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}
.privacy-row:last-child { border-bottom: none; }
.privacy-key { color: var(--text-secondary); font-weight: 600; white-space: nowrap; }
.privacy-val { color: var(--text-muted); text-align: right; line-height: 1.45; }
.settings-bg .privacy-center { background: #fff; border-color: #e5e7eb; }
.settings-bg .privacy-row { border-color: #f3f4f6; }
.settings-bg .privacy-key { color: #374151; }
.settings-bg .privacy-val { color: #6b7280; }

/* AI Action Permissions rows (Settings → Permissions, spec §22) */
.action-perm-select {
  background: var(--surface-2);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
}
.action-perm-select option:disabled { color: var(--text-muted); opacity: 0.5; }
.action-perm-granted {
  margin-left: 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--success);
  background: var(--success-glow);
  padding: 2px 8px;
  border-radius: 999px;
  vertical-align: middle;
}
.settings-bg .action-perm-select { background: #fff; color: #111827; border-color: #e5e7eb; }
.settings-bg .action-perm-granted { background: #d1fae5; color: #1a9d5e; }

/* Light-theme overrides inside Settings */
.settings-bg .perm-icon-wrap { background: #f3f4f6; color: #6b7280; }
.settings-bg .perm-status-badge.on { background: #d1fae5; color: #1a9d5e; }
.settings-bg .perm-status-badge.app-off { background: #f3f4f6; color: #6b7280; }
.settings-bg .perm-status-badge.off { background: #fee2e2; color: #dc2626; }
.settings-bg .perm-revoke-btn { border-color: rgba(248, 113, 113, 0.3); color: #dc2626; }
.settings-bg .perm-revoke-btn:hover { background: #fde8e8; }
.settings-bg .perm-settings-note { color: #6b7280; }

/* ── Auth (Login / Signup) ────────────────────────────────────────── */

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 0 auto;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: 1.25rem;
}

.auth-tab {
  flex: 1;
  padding: 7px 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.auth-tab.active { background: var(--surface-3); color: var(--text); }

.auth-error {
  background: var(--danger-glow);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  padding: 8px 12px;
  margin-bottom: 1rem;
}

.auth-field { margin-bottom: 1rem; }
.auth-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.auth-field input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.85rem;
  padding: 9px 12px;
  transition: border-color 0.15s;
}

.auth-field input:focus { outline: none; border-color: var(--accent); }
.auth-field input::placeholder { color: var(--text-muted); opacity: 0.5; }

.auth-submit { width: 100%; margin-top: 4px; }

/* ── Connector Modal ────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: viewIn 0.2s ease;
}

.modal-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.modal-header h2 { font-size: 1.05rem; font-weight: 700; }

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
}

.modal-close:hover { color: var(--text); }

.modal-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1rem;
}

.modal-hint code {
  background: var(--surface-3);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 0.68rem;
}

/* ── Audio Capture Button ───────────────────────────────────────── */

.audio-capture-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.audio-capture-btn:hover { border-color: var(--accent); color: var(--accent-light); }

.audio-capture-btn.recording {
  background: var(--danger-glow);
  border-color: rgba(248, 113, 113, 0.4);
  color: var(--danger);
}

/* ── AI Engine Status Chip (Overview top: Cloud AI / Local LLM) ─────────────── */
.engine-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 13px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-secondary);
  margin-bottom: 14px;
}
.engine-status-chip .engine-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
}
.engine-status-chip.engine-cloud { color: #7dd3fc; border-color: rgba(125, 211, 252, 0.35); }
.engine-status-chip.engine-cloud .engine-dot { background: #38bdf8; box-shadow: 0 0 8px rgba(56, 189, 248, 0.8); }
.engine-status-chip.engine-local { color: var(--accent-light); border-color: rgba(139, 147, 232, 0.4); }
.engine-status-chip.engine-local .engine-dot { background: var(--accent); box-shadow: 0 0 8px rgba(94, 106, 210, 0.9); }
.engine-status-chip.engine-none { opacity: 0.75; }

/* AI response still generating — shimmer placeholder in the draft box */
.draft-text.draft-pending {
  color: var(--text-muted);
  font-style: italic;
  cursor: default;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: draft-shimmer 1.4s infinite;
}
.draft-pending-hint { color: var(--text-muted); font-weight: 500; }
@keyframes draft-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.audio-capture-btn.perm-off {
  opacity: 0.45;
  cursor: not-allowed;
}
.audio-capture-btn.perm-off:hover { border-color: var(--border); color: var(--text-dim); }

.rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  animation: recPulse 1s infinite;
}

@keyframes recPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.mic-meter {
  display: inline-block;
  width: 46px;
  height: 6px;
  margin-left: 8px;
  vertical-align: middle;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 3px;
  overflow: hidden;
}
.mic-meter span {
  display: block;
  height: 100%;
  width: 0%;
  background: #4ade80;
  transition: width 0.08s linear;
}

/* ── Toast ──────────────────────────────────────────────────────── */

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  animation: toastIn 0.3s ease;
}

.toast.success { border-left: 2px solid var(--success); }
.toast.dismiss { border-left: 2px solid var(--text-muted); }
.toast-icon { display: flex; align-items: center; color: var(--success); }
.toast.dismiss .toast-icon { color: var(--text-muted); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(4px); }
}

/* ── Local AI & Models Settings ────────────────────────────────────── */

.hardware-card {
  background: #fff;
  border: 1px solid rgba(20, 30, 50, 0.08);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-top: 0.75rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.hardware-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
}

.hw-item {
  display: flex;
  flex-direction: column;
}

.hw-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  margin-bottom: 4px;
}

.hw-val {
  font-size: 1.05rem;
  font-weight: 700;
  color: #17181c;
  line-height: 1.3;
}

.hw-sub {
  font-size: 0.8rem;
  color: #6b7280;
  margin-top: 2px;
}

.hw-meter {
  height: 6px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 6px;
}

.hw-meter-bar {
  height: 100%;
  background: #3b6ea5;
  border-radius: 999px;
  transition: width 0.4s ease;
}

.hw-badge-wrap {
  margin-top: 6px;
}

.hw-accel-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e9f2fc;
  color: #2d5a8a;
  border: 1px solid rgba(59, 110, 165, 0.2);
}

.hw-advice-box {
  margin-top: 1.25rem;
  padding: 12px 16px;
  background: #f0f6fc;
  border: 1px solid #d0e1f4;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.hw-advice-icon {
  color: #2b6cb0;
  flex-shrink: 0;
  margin-top: 1px;
}

.hw-advice-text {
  font-size: 0.85rem;
  color: #1e3a5f;
  line-height: 1.45;
  font-weight: 500;
}

/* Model Recommendation Cards */
.model-rec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 0.75rem;
}

.model-card {
  background: #fff;
  border: 1px solid rgba(20, 30, 50, 0.08);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
  position: relative;
}

.model-card:hover {
  border-color: rgba(59, 110, 165, 0.35);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.model-card.optimal {
  border: 1.5px solid #3b6ea5;
  background: #fafcff;
}

.model-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.model-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #17181c;
}

.model-family {
  font-size: 0.75rem;
  color: #6b7280;
}

.model-suitability-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.badge-optimal {
  background: #e0edfb;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.badge-success {
  background: #e6f7ef;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.badge-warning {
  background: #fef9c3;
  color: #854d0e;
  border: 1px solid #fef08a;
}

.badge-danger {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.model-specs-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}

.model-spec-chip {
  font-size: 0.75rem;
  background: #f3f4f6;
  color: #4b5563;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
}

.model-desc {
  font-size: 0.8rem;
  color: #6b7280;
  line-height: 1.4;
  margin-bottom: 12px;
}

.model-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid #f3f4f6;
}

.model-cli-cmd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.72rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 4px 8px;
  border-radius: 4px;
  color: #334155;
  cursor: pointer;
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-cli-cmd:hover {
  background: #e2e8f0;
}

.model-select-btn {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  background: #3b6ea5;
  color: #fff;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.model-select-btn:hover {
  background: #2d5a8a;
}

/* Provider Card */
.local-provider-card {
  background: #fff;
  border: 1px solid rgba(20, 30, 50, 0.08);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-top: 0.75rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.provider-preset-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 1.25rem;
}

.provider-preset-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #17181c;
}

.provider-presets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.preset-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  color: #4b5563;
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-btn:hover {
  background: #e5e7eb;
  color: #17181c;
}

.preset-btn.active {
  background: #e9f2fc;
  border-color: #3b6ea5;
  color: #2d5a8a;
}

.provider-fields-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.field-tip {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-top: 4px;
  display: block;
}

.provider-action-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.conn-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
}

.conn-status-chip.success {
  background: #e6f7ef;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.conn-status-chip.error {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.conn-status-chip.checking {
  background: #f3f4f6;
  color: #6b7280;
  border: 1px solid #e5e7eb;
}

.conn-status-chip .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.param-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.param-item label {
  font-size: 0.8rem;
  font-weight: 500;
  color: #6b7280;
  display: block;
  margin-bottom: 6px;
}

.param-item input[type="range"] {
  width: 100%;
  accent-color: #3b6ea5;
}

/* Test Playground */
.test-playground-card {
  background: #fff;
  border: 1px solid rgba(20, 30, 50, 0.08);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-top: 0.75rem;
}

.test-prompt-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.test-prompt-input {
  flex: 1;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid #d0d4da;
  font-size: 0.85rem;
  color: #17181c;
  background: #fff;
}

.test-prompt-input:focus {
  outline: none;
  border-color: #3b6ea5;
}

.test-result-box {
  margin-top: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 12px;
}

.test-result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.test-result-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
}

.test-result-meta {
  font-size: 0.75rem;
  font-weight: 600;
  color: #3b6ea5;
  background: #e9f2fc;
  padding: 2px 6px;
  border-radius: 4px;
}

.test-result-content {
  font-size: 0.85rem;
  color: #1e293b;
  line-height: 1.5;
  white-space: pre-wrap;
}

/* Reference Matrix Table */
.matrix-table-wrap {
  margin-top: 0.75rem;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid rgba(20, 30, 50, 0.08);
  background: #fff;
}

.matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  text-align: left;
}

.matrix-table th {
  background: #f8fafc;
  padding: 10px 14px;
  font-weight: 600;
  color: #475569;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}

.matrix-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
  line-height: 1.4;
}

.matrix-table tr:last-child td {
  border-bottom: none;
}

.matrix-table tr:hover td {
  background: #fafbfc;
}

/* ── Local AI engine chooser ────────────────────────────────────── */

.engine-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
  margin-top: 0.75rem;
}

.engine-card {
  background: #fff;
  border: 1px solid rgba(20, 30, 50, 0.08);
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.engine-card.running { border-color: #bbf7d0; }
.engine-card.installed { border-color: #fde68a; }

.engine-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.engine-title { font-size: 0.9rem; font-weight: 700; color: #17181c; }

.engine-badge {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.engine-badge.running { background: #e6f7ef; color: #15803d; }
.engine-badge.installed { background: #fef3c7; color: #b45309; }
.engine-badge.missing { background: #f3f4f6; color: #6b7280; }

.engine-tagline { font-size: 0.78rem; color: #4b5563; line-height: 1.45; }
.engine-note { font-size: 0.72rem; color: #9ca3af; line-height: 1.45; }

.engine-actions { margin-top: auto; padding-top: 8px; display: flex; gap: 8px; }

.engine-btn { font-size: 0.75rem !important; padding: 5px 12px !important; }
.engine-btn.danger { color: #b91c1c !important; border-color: #fecaca !important; background: #fff !important; }
.engine-btn.danger:hover { background: #fee2e2 !important; }

.title-sub {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: #9ca3af;
  font-size: 0.72rem;
  margin-left: 6px;
}

/* ── Oryne managed models ────────────────────────────────────────── */

.managed-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 0.75rem;
}

.managed-row {
  background: #fff;
  border: 1px solid rgba(20, 30, 50, 0.08);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}
.managed-row-installed {
  background: rgba(59, 110, 165, 0.03);
  border-color: rgba(59, 110, 165, 0.15);
}
.managed-disk-hint {
  font-size: 0.68rem;
  color: #3b6ea5;
  font-weight: 500;
}

.managed-info { min-width: 200px; }
.managed-name { font-size: 0.88rem; font-weight: 600; color: #17181c; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.managed-meta { font-size: 0.72rem; color: #9ca3af; margin-top: 2px; }
.managed-desc { font-size: 0.76rem; color: #6b7280; margin-top: 6px; line-height: 1.4; }
.managed-use-cases { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.managed-advice-banner {
  background: rgba(59, 110, 165, 0.06);
  border: 1px solid rgba(59, 110, 165, 0.15);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 0.78rem;
  color: #3b6ea5;
  line-height: 1.5;
  margin-bottom: 10px;
}
.rec-suitability-badge {
  display: inline-block;
  font-size: 0.62rem;
  padding: 1px 7px;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
  vertical-align: middle;
}
.rec-suitability-badge.badge-optimal { background: #dcfce7; color: #166534; }
.rec-suitability-badge.badge-success { background: #dbeafe; color: #1e40af; }
.rec-suitability-badge.badge-warning { background: #fef3c7; color: #92400e; }
.rec-suitability-badge.badge-danger { background: #fee2e2; color: #991b1b; }
.use-case-chip {
  display: inline-block;
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(59, 110, 165, 0.08);
  color: #3b6ea5;
  font-weight: 500;
  white-space: nowrap;
}
.managed-meta-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.managed-meta-chip {
  display: inline-block;
  font-size: 0.62rem;
  padding: 1px 7px;
  border-radius: 4px;
  background: rgba(20, 30, 50, 0.05);
  color: #6b7280;
  font-family: monospace;
  white-space: nowrap;
}

.managed-body {
  flex: 1;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}

.managed-actions { display: flex; gap: 8px; align-items: center; }

.dl-progress {
  width: 100%;
  max-width: 320px;
  height: 6px;
  background: #eef1f5;
  border-radius: 999px;
  overflow: hidden;
}

.dl-progress-bar {
  height: 100%;
  background: #3b6ea5;
  border-radius: 999px;
  transition: width 0.6s ease;
}

.dl-meta { font-size: 0.72rem; color: #6b7280; }
.dl-meta.error { color: #b91c1c; }

/* ── Relationships View ─────────────────────────────────────────── */

.relationships-container {
  width: 100%;
  max-width: 900px;
}

.relationships-header h1 {
  color: #17181c;
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0 0 4px;
}

.relationships-sub {
  color: rgba(23, 24, 28, 0.65);
  font-size: 0.9rem;
  margin: 0 0 1.5rem;
}

.gone-quiet-strip {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 1.25rem;
}

.gone-quiet-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #9a3412;
  margin-bottom: 8px;
}

.gone-quiet-list { display: flex; flex-wrap: wrap; gap: 6px; }

.gone-quiet-chip {
  background: #ffedd5;
  color: #7c2d12;
  font-size: 0.74rem;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 999px;
}

.relationships-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.rel-card {
  display: flex;
  gap: 12px;
  background: #fdfdfb;
  border: 1px solid rgba(20, 30, 50, 0.06);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(45, 65, 105, 0.08);
}

.rel-card.quiet { border-color: #fed7aa; }

.rel-avatar {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7e9bc2, #92adca);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.rel-name-row { display: flex; align-items: center; gap: 8px; }
.rel-name { font-size: 0.92rem; font-weight: 600; color: #17181c; }
.rel-email {
  font-size: 0.72rem;
  color: #9aa0a8;
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gone-quiet-badge {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #9a3412;
  background: #ffedd5;
  border-radius: 999px;
  padding: 2px 7px;
  white-space: nowrap;
}

.rel-health { display: flex; align-items: center; gap: 8px; margin-top: 8px; }

.rel-health-bar {
  flex: 1;
  height: 5px;
  background: #eef1f5;
  border-radius: 999px;
  overflow: hidden;
}

.rel-health-fill { height: 100%; border-radius: 999px; transition: width 0.5s ease; }
.rel-health-bar.good .rel-health-fill { background: #22a06b; }
.rel-health-bar.warn .rel-health-fill { background: #d97706; }
.rel-health-bar.cold .rel-health-fill { background: #c2554f; }

.rel-health-num { font-size: 0.7rem; font-weight: 600; color: #6b7280; min-width: 20px; text-align: right; }

.rel-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.72rem;
  color: #8a8f98;
  margin-top: 8px;
}

.rel-open { color: #b45309; font-weight: 600; }

.rel-channels {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  color: #9aa0a8;
}

.rel-channels svg { width: 14px; height: 14px; }

/* ── Commitments Board ──────────────────────────────────────────── */

.commitments-container {
  width: 100%;
  max-width: 1180px;
}

.commitments-header h1 {
  color: #17181c;
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0 0 4px;
}

.commitments-sub {
  color: rgba(23, 24, 28, 0.65);
  font-size: 0.9rem;
  margin: 0 0 1.5rem;
}

/* ── Executive ROI & SLA Moat Banner ────────────────────────────── */
.commitments-roi-banner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(248, 250, 252, 0.9));
  border: 1px solid rgba(59, 110, 165, 0.15);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 20px;
}

.roi-metric-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.roi-metric-val {
  font-size: 1.45rem;
  font-weight: 700;
  color: #17181c;
  letter-spacing: -0.02em;
}

.roi-metric-val.highlight {
  color: #16a34a;
}

.roi-metric-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
}

.health-export-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(59, 110, 165, 0.08);
  color: #1e3a8a;
  border: 1px solid rgba(59, 110, 165, 0.2);
  font-weight: 600;
}

.health-export-btn:hover {
  background: rgba(59, 110, 165, 0.14);
}

.board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  align-items: start;
}

.board-col {
  background: rgba(253, 253, 251, 0.65);
  border: 1px solid rgba(20, 30, 50, 0.06);
  border-radius: 14px;
  padding: 12px;
}

.board-col-header {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 10px;
}

.board-col-header.overdue { color: #b91c1c; }
.board-col-header.due-soon { color: #b45309; }
.board-col-header.pending { color: #3b6ea5; }
.board-col-header.completed { color: #22a06b; }

.board-count {
  background: rgba(20, 30, 50, 0.06);
  color: #565b63;
  font-size: 0.68rem;
  border-radius: 999px;
  padding: 1px 8px;
}

.board-col-body { display: flex; flex-direction: column; gap: 10px; }

.board-empty {
  font-size: 0.76rem;
  color: #9aa0a8;
  text-align: center;
  padding: 18px 8px;
}

.board-card {
  background: #fdfdfb;
  border: 1px solid rgba(20, 30, 50, 0.08);
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 2px 6px rgba(45, 65, 105, 0.08);
}

.board-card.updating { opacity: 0.5; }

.board-card-title {
  font-size: 0.84rem;
  font-weight: 600;
  color: #17181c;
  line-height: 1.35;
}

.board-card-desc {
  font-size: 0.72rem;
  color: #6b7280;
  margin-top: 4px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.board-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.board-due { font-size: 0.7rem; font-weight: 600; color: #b45309; }
.board-due.overdue { color: #b91c1c; }

.board-source { color: #9aa0a8; display: inline-flex; }
.board-source svg { width: 13px; height: 13px; }

.board-card-actions { display: flex; gap: 6px; margin-top: 10px; }

.board-action {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 7px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.board-action.complete { background: #22a06b; color: #fff; }
.board-action.complete:hover { background: #1d8a5c; }
.board-action.dismiss { background: transparent; color: #6b7280; border-color: #d5d9de; }
.board-action.dismiss:hover { background: #eef0f3; color: #33363c; }
.board-action.reopen { background: transparent; color: #3b6ea5; border-color: #c3d2e4; }
.board-action.reopen:hover { background: #e8eef6; }

/* ── Connector sync state (Integrations tab) ────────────────────── */

.connector-sync-state {
  font-size: 0.72rem;
  color: #22a06b;
  margin-top: 3px;
}

.connector-sync-state.has-error { color: #b91c1c; }

/* ── Oryne Core Models (preinstalled + auto-installed) ──────────── */

.core-models-block {
  background: #fdfdfb;
  border: 1px solid rgba(20, 30, 50, 0.08);
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem 1.1rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.core-models-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 0.75rem;
}

.core-model-row {
  background: #fff;
  border: 1px solid rgba(20, 30, 50, 0.08);
  border-radius: var(--radius-md);
  padding: 0.8rem 1rem;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.core-model-icon {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 9px;
  background: #eef3f9;
  color: #3b6ea5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.core-model-info { flex: 1; min-width: 0; }
.core-model-name { font-size: 0.86rem; font-weight: 600; color: #17181c; }
.core-model-meta { font-size: 0.72rem; color: #9ca3af; margin-top: 2px; }

.core-model-status {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 150px;
  justify-content: flex-end;
}

.core-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}

.core-badge.bundled { background: #e6f7ef; color: #15803d; }
.core-badge.installed { background: #e6f7ef; color: #15803d; }

.core-note { font-size: 0.72rem; color: #9ca3af; text-align: right; }

.core-progress {
  flex: 1;
  max-width: 160px;
  height: 6px;
  background: #eef1f5;
  border-radius: 999px;
  overflow: hidden;
}

.core-progress-bar {
  height: 100%;
  background: #3b6ea5;
  border-radius: 999px;
  transition: width 0.6s ease;
}

.core-pct { font-size: 0.72rem; font-weight: 600; color: #3b6ea5; min-width: 34px; text-align: right; }

/* ── Plan cards (Usage & Billing) ───────────────────────────────── */

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.plan-card {
  background: #fafbfc;
  border: 1px solid rgba(20, 30, 50, 0.1);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.plan-card-current {
  border-color: var(--accent, #5e6ad2);
  box-shadow: 0 0 0 1px var(--accent, #5e6ad2);
  background: #fff;
}

.plan-name {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #374151;
}

.plan-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: #111827;
}

.plan-per {
  font-size: 0.75rem;
  font-weight: 500;
  color: #6b7280;
  margin-left: 2px;
}

.plan-limit {
  font-size: 0.75rem;
  color: #6b7280;
  min-height: 2.1em;
}

.plan-action { margin-top: auto; }

.plan-current-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent, #5e6ad2);
  border: 1px solid var(--accent, #5e6ad2);
  border-radius: 999px;
  padding: 3px 10px;
}

/* ── Recurrence (Rhythms) — Network-effect moat ───────────────────── */

.recurrence-widget {
  background: #ffffff;
  border: 1px solid rgba(20, 30, 50, 0.12);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.04);
}
.recurrence-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.recurrence-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.92rem;
  color: #17181c;
}
.recurrence-count {
  background: #eef1f5;
  color: #6b7280;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}
.recurrence-actions { display: flex; gap: 8px; }
.recurrence-sub {
  font-size: 0.78rem;
  color: #6b7280;
  margin: 6px 0 12px;
  line-height: 1.4;
}
.recurrence-list { display: flex; flex-direction: column; gap: 8px; }
.recurrence-empty { font-size: 0.82rem; color: #9aa0a8; text-align: center; padding: 12px; }
.recurrence-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(20,30,50,0.08);
  border-radius: 10px;
  background: #fff;
}
.recurrence-info { flex: 1; min-width: 0; }
.recurrence-topic { font-weight: 600; font-size: 0.86rem; color: #17181c; }
.recurrence-meta { font-size: 0.72rem; color: #6b7280; margin-top: 2px; }
.recurrence-meta span { margin-right: 8px; }
.recurrence-row-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ── Plugins (Ecosystem moat) ───────────────────────────────────── */

.plugins-toolbar { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 12px; }
.plugins-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.plugin-card {
  background: #fff;
  border: 1px solid rgba(20,30,50,0.08);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.plugin-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.plugin-name { font-weight: 700; font-size: 0.88rem; color: #17181c; }
.plugin-ver { font-size: 0.68rem; color: #9aa0a8; background: #f3f4f6; padding: 2px 6px; border-radius: 6px; }
.plugin-desc { font-size: 0.78rem; color: #6b7280; line-height: 1.4; }
.plugin-meta { font-size: 0.72rem; color: #9aa0a8; }
.plugin-actions { display: flex; gap: 8px; margin-top: 4px; }

/* ── Webhooks (Platform moat) ───────────────────────────────────── */

.webhook-form-card {
  background: #fff;
  border: 1px solid rgba(20,30,50,0.08);
  border-radius: 12px;
  padding: 16px;
}
.webhook-events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 6px 12px;
  margin-top: 4px;
}
.webhook-events-grid label { font-size: 0.78rem; color: #4b5563; display: flex; gap: 6px; align-items: center; }
.webhook-list { display: flex; flex-direction: column; gap: 10px; }
.webhook-row {
  background: #fff;
  border: 1px solid rgba(20,30,50,0.08);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.webhook-row-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.webhook-url { font-family: ui-monospace, SFMono-Regular, monospace; font-size: 0.78rem; color: #1e293b; word-break: break-all; }
.webhook-events { display: flex; flex-wrap: wrap; gap: 4px; }
.webhook-event-chip { font-size: 0.65rem; font-weight: 600; background: #eef1f5; color: #3b6ea5; padding: 2px 6px; border-radius: 6px; }
.webhook-row-meta { font-size: 0.72rem; color: #9aa0a8; }
.webhook-row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.webhook-deliveries-card { background: #fff; border: 1px solid rgba(20,30,50,0.08); border-radius: 12px; padding: 14px; }
.webhook-deliveries { display: flex; flex-direction: column; gap: 6px; max-height: 360px; overflow-y: auto; }
.webhook-delivery { display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px; border: 1px solid #f1f5f9; border-radius: 8px; font-size: 0.76rem; }
.webhook-delivery.ok { border-color: rgba(52,211,153,0.3); background: rgba(52,211,153,0.06); }
.webhook-delivery.fail { border-color: rgba(248,113,113,0.3); background: rgba(248,113,113,0.06); }

/* ── Responsive ────────────────────────────────────────────────── */

@media (max-width: 980px) {
  .board { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .overview-grid { grid-template-columns: 1fr; }
  .summary-row { gap: 1rem; }
  .overview-cta { flex-direction: column; text-align: center; }
  .inbox-header { flex-direction: column; align-items: flex-start; }
  .inbox-actions { opacity: 1; }
  .nav-links { display: none; }
  .hardware-grid { grid-template-columns: 1fr; }
  .test-prompt-row { flex-direction: column; }
  .board { grid-template-columns: 1fr; }
  .relationships-grid { grid-template-columns: 1fr; }
}

/* ── Documents (Parsing & OCR RAG) ─────────────────────────────────── */

.docs-container {
  width: 100%;
  max-width: 1180px;
}

.docs-header h1 {
  color: #17181c;
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0 0 4px;
}

.docs-sub {
  color: rgba(23, 24, 28, 0.65);
  font-size: 0.9rem;
  margin: 0 0 0.4rem;
}

.docs-ocr-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 1.2rem;
  background: rgba(248, 113, 113, 0.10);
  color: #b4544f;
  border: 1px solid rgba(248, 113, 113, 0.25);
}

.docs-ocr-badge.on {
  background: rgba(52, 211, 153, 0.10);
  color: #1d7a58;
  border-color: rgba(52, 211, 153, 0.30);
}

.docs-upload {
  background: rgba(253, 253, 251, 0.65);
  border: 1px solid rgba(20, 30, 50, 0.06);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 16px;
}

.docs-upload-inner {
  border: 1.5px dashed rgba(23, 24, 28, 0.22);
  border-radius: 10px;
  padding: 26px 18px;
  text-align: center;
  cursor: pointer;
  color: #4a4c55;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: border-color 0.15s, background 0.15s;
}

.docs-upload-inner:hover,
.docs-upload.dragover .docs-upload-inner {
  border-color: var(--accent);
  background: rgba(94, 106, 210, 0.05);
}

.docs-upload-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: #17181c;
}

.docs-upload-hint {
  font-size: 0.76rem;
  color: rgba(23, 24, 28, 0.55);
}

.docs-upload-status {
  margin-top: 10px;
  font-size: 0.8rem;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(94, 106, 210, 0.08);
  color: #3f4a9e;
}

.docs-upload-status.ok {
  background: rgba(52, 211, 153, 0.10);
  color: #1d7a58;
}

.docs-upload-status.err {
  background: rgba(248, 113, 113, 0.10);
  color: #b4544f;
}

.docs-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 16px;
  align-items: start;
}

.docs-list-pane {
  background: rgba(253, 253, 251, 0.65);
  border: 1px solid rgba(20, 30, 50, 0.06);
  border-radius: 14px;
  padding: 10px;
  max-height: 640px;
  overflow-y: auto;
}

.docs-empty-list {
  padding: 28px 14px;
  text-align: center;
  font-size: 0.82rem;
  color: rgba(23, 24, 28, 0.5);
}

.docs-card {
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.12s, border-color 0.12s;
}

.docs-card:hover { background: rgba(20, 30, 50, 0.04); }

.docs-card.active {
  background: rgba(94, 106, 210, 0.09);
  border-color: rgba(94, 106, 210, 0.30);
}

.docs-card-title {
  font-size: 0.86rem;
  font-weight: 600;
  color: #17181c;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.docs-card-meta {
  font-size: 0.72rem;
  color: rgba(23, 24, 28, 0.55);
  margin-top: 3px;
}

.docs-detail-pane {
  background: rgba(253, 253, 251, 0.92);
  border: 1px solid rgba(20, 30, 50, 0.06);
  border-radius: 14px;
  padding: 18px;
  min-height: 300px;
}

.docs-detail-empty {
  padding: 60px 20px;
  text-align: center;
  color: rgba(23, 24, 28, 0.45);
  font-size: 0.86rem;
}

.docs-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.docs-detail-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #17181c;
  word-break: break-word;
}

.docs-detail-meta {
  font-size: 0.75rem;
  color: rgba(23, 24, 28, 0.55);
  margin-top: 4px;
}

.docs-detail-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.docs-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(20, 30, 50, 0.14);
  background: #fff;
  color: #17181c;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.docs-btn:hover { border-color: rgba(20, 30, 50, 0.32); }
.docs-btn:disabled { opacity: 0.55; cursor: default; }

.docs-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.docs-btn.primary:hover { background: #4f5bc0; }

.docs-btn.danger { color: #b4544f; }
.docs-btn.danger:hover { border-color: rgba(248, 113, 113, 0.5); }

.docs-ask {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  margin-bottom: 14px;
}

.docs-ask textarea {
  flex: 1;
  resize: vertical;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(20, 30, 50, 0.14);
  background: #fff;
  font-family: inherit;
  font-size: 0.86rem;
  color: #17181c;
  outline: none;
}

.docs-ask textarea:focus { border-color: var(--accent); }

.docs-answer {
  border: 1px solid rgba(20, 30, 50, 0.08);
  border-radius: 10px;
  background: #fff;
  padding: 14px 16px;
  margin-bottom: 12px;
}

.docs-answer-head {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(23, 24, 28, 0.55);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.docs-answer-engine {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(94, 106, 210, 0.10);
  color: #3f4a9e;
}

.docs-answer-body {
  font-size: 0.88rem;
  line-height: 1.6;
  color: #26272c;
}

.docs-answer-body p { margin-bottom: 8px; }
.docs-answer-body h3, .docs-answer-body h4 { margin: 10px 0 6px; color: #17181c; }
.docs-answer-body ul { margin: 6px 0 8px 20px; }
.docs-answer-body code {
  background: rgba(20, 30, 50, 0.06);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.82em;
}

.docs-answer-thinking, .docs-answer-err {
  font-size: 0.84rem;
  color: rgba(23, 24, 28, 0.55);
}

.docs-answer-err { color: #b4544f; }

.docs-cite {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  color: #3f4a9e;
  background: rgba(94, 106, 210, 0.12);
  border-radius: 4px;
  padding: 0 4px;
  margin: 0 1px;
  vertical-align: super;
}

.docs-sources-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(23, 24, 28, 0.55);
  margin-bottom: 8px;
}

.docs-source {
  border: 1px solid rgba(20, 30, 50, 0.08);
  border-radius: 8px;
  background: rgba(20, 30, 50, 0.02);
  padding: 10px 12px;
  margin-bottom: 8px;
}

.docs-source-meta {
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(23, 24, 28, 0.5);
  margin-bottom: 4px;
}

.docs-source-text {
  font-size: 0.78rem;
  line-height: 1.5;
  color: #3a3b41;
  white-space: pre-wrap;
}

@media (max-width: 900px) {
  .docs-layout { grid-template-columns: 1fr; }
}


/* ── Documents chat thread (persisted Q&A history) ─────────────────── */

.docs-chat-thread {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 420px;
  overflow-y: auto;
  border: 1px solid rgba(20, 30, 50, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.55);
  padding: 14px;
  margin-bottom: 12px;
}

.docs-chat-empty {
  color: rgba(23, 24, 28, 0.55);
  font-size: 0.85rem;
  text-align: center;
  padding: 18px 8px;
}

.docs-msg {
  display: flex;
}

.docs-msg.user { justify-content: flex-end; }
.docs-msg.assistant { justify-content: flex-start; }

.docs-bubble {
  max-width: 85%;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.88rem;
  line-height: 1.5;
}

.docs-bubble.user {
  background: #2f6df6;
  color: #fff;
  border-bottom-right-radius: 4px;
  white-space: pre-wrap;
}

.docs-bubble.assistant {
  background: #fff;
  border: 1px solid rgba(20, 30, 50, 0.08);
  border-bottom-left-radius: 4px;
  color: #17181c;
}

.docs-bubble .docs-answer-body p:first-child { margin-top: 0; }
.docs-bubble .docs-answer-body p:last-child { margin-bottom: 0; }

.docs-msg-sources {
  margin-top: 8px;
  border-top: 1px solid rgba(20, 30, 50, 0.08);
  padding-top: 6px;
}

.docs-msg-sources summary {
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(23, 24, 28, 0.65);
}

.docs-msg-sources .docs-source { margin-top: 8px; }

/* ── Documents: Project Deliverables ──────────────────────────────────────── */
/* All new class names (.deliv-*) so the documents view's computed backgrounds
   stay byte-identical for the UI regression suite. */

.deliv-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid rgba(20, 30, 50, 0.10);
  margin-bottom: 18px;
}

.deliv-tab {
  padding: 8px 16px;
  border: none;
  background: none;
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(23, 24, 28, 0.50);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.deliv-tab:hover { color: rgba(23, 24, 28, 0.80); }

.deliv-tab.active {
  color: #3f4a9e;
  border-bottom-color: #3f4a9e;
}

.deliv-pane { display: none; }
.deliv-pane.deliv-active { display: block; }

.deliv-status {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.80rem;
  margin-bottom: 14px;
  display: none;
}

.deliv-status.ok {
  display: block;
  background: rgba(52, 211, 153, 0.10);
  color: #0d7a5f;
  border: 1px solid rgba(52, 211, 153, 0.25);
}

.deliv-status.err {
  display: block;
  background: rgba(248, 113, 113, 0.10);
  color: #b4544f;
  border: 1px solid rgba(248, 113, 113, 0.25);
}

.deliv-status.loading {
  display: block;
  background: rgba(94, 106, 210, 0.08);
  color: #3f4a9e;
  border: 1px solid rgba(94, 106, 210, 0.20);
}

.deliv-section {
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(20, 30, 50, 0.06);
}

.deliv-section:last-child { border-bottom: none; }

.deliv-section-head h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #17181c;
  margin: 0 0 6px 0;
}

.deliv-hint {
  font-size: 0.76rem;
  color: rgba(23, 24, 28, 0.50);
  margin: 0 0 12px 0;
  line-height: 1.5;
}

.deliv-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 0.70rem;
  font-weight: 600;
  margin: 0 2px;
}

.deliv-badge-stated {
  background: rgba(52, 211, 153, 0.12);
  color: #0d7a5f;
}

.deliv-badge-inferred {
  background: rgba(251, 191, 36, 0.12);
  color: #92600a;
}

.deliv-badge-missing {
  background: rgba(248, 113, 113, 0.10);
  color: #b4544f;
}

.deliv-coverage {
  display: flex;
  gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.deliv-coverage-item {
  font-size: 0.76rem;
  color: rgba(23, 24, 28, 0.60);
}

.deliv-coverage-item strong {
  color: #17181c;
  font-weight: 700;
}

.deliv-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.deliv-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.deliv-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.deliv-field-label {
  font-size: 0.74rem;
  font-weight: 600;
  color: rgba(23, 24, 28, 0.65);
  display: flex;
  align-items: center;
  gap: 6px;
}

.deliv-field-input,
.deliv-field-textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid rgba(20, 30, 50, 0.14);
  border-radius: 6px;
  font-size: 0.82rem;
  font-family: inherit;
  color: #17181c;
  background: #fff;
  transition: border-color 0.15s ease;
}

.deliv-field-input:focus,
.deliv-field-textarea:focus {
  outline: none;
  border-color: #5e6ad2;
}

.deliv-field-textarea {
  resize: vertical;
  min-height: 56px;
}

.deliv-field-provenance {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
}

.deliv-field-provenance.stated {
  background: rgba(52, 211, 153, 0.12);
  color: #0d7a5f;
}

.deliv-field-provenance.inferred {
  background: rgba(251, 191, 36, 0.12);
  color: #92600a;
}

.deliv-field-provenance.missing {
  background: rgba(248, 113, 113, 0.10);
  color: #b4544f;
}

/* ── Structured grid editor ─────────────────────────────────────────────── */
.deliv-grid-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.deliv-grid-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.deliv-grid-row.deliv-grid-head {
  padding-bottom: 2px;
  border-bottom: 1px solid rgba(20, 30, 50, 0.08);
}

.deliv-grid-input {
  flex: 1 1 0;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid rgba(20, 30, 50, 0.14);
  border-radius: 6px;
  font-size: 0.8rem;
  font-family: inherit;
  color: #17181c;
  background: #fff;
  transition: border-color 0.15s ease;
}

.deliv-grid-input:focus {
  outline: none;
  border-color: #5e6ad2;
}

.deliv-grid-col-label {
  flex: 1 1 0;
  min-width: 0;
  font-size: 0.64rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: rgba(23, 24, 28, 0.45);
}

.deliv-grid-del {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 6px;
  background: rgba(248, 113, 113, 0.10);
  color: #b4544f;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease;
}

.deliv-grid-del:hover { background: rgba(248, 113, 113, 0.22); }

.deliv-grid-del-spacer { flex: 0 0 24px; }

.deliv-grid-move {
  flex: 0 0 46px;
  display: flex;
  gap: 2px;
}

.deliv-grid-move button {
  width: 22px;
  height: 24px;
  border: 1px solid rgba(20, 30, 50, 0.12);
  border-radius: 5px;
  background: #fff;
  color: rgba(23, 24, 28, 0.6);
  font-size: 0.72rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.deliv-grid-move button:hover:not(:disabled) { background: rgba(94, 106, 210, 0.10); color: #5e6ad2; }
.deliv-grid-move button:disabled { opacity: 0.35; cursor: default; }

.deliv-grid-move-spacer { flex: 0 0 46px; }

.deliv-grid-add {
  align-self: flex-start;
  margin-top: 2px;
  padding: 5px 10px;
  border: 1px dashed rgba(94, 106, 210, 0.5);
  border-radius: 6px;
  background: rgba(94, 106, 210, 0.04);
  color: #5e6ad2;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.deliv-grid-add:hover { background: rgba(94, 106, 210, 0.12); }

.deliv-grid-empty {
  font-size: 0.76rem;
  color: rgba(23, 24, 28, 0.4);
  font-style: italic;
  padding: 2px 0;
}

.deliv-field-flash {
  animation: delivFlash 1.6s ease;
  border-radius: 8px;
}

@keyframes delivFlash {
  0% { background: rgba(94, 106, 210, 0.22); }
  100% { background: transparent; }
}

/* ── Live preview of the generated draft ────────────────────────────────── */
.deliv-preview-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.deliv-preview-heading { flex: 1 1 260px; }

.deliv-preview-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  background: rgba(20, 30, 50, 0.05);
  border-radius: 8px;
}

.deliv-preview-tab {
  padding: 5px 14px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: rgba(23, 24, 28, 0.6);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.deliv-preview-tab:hover { color: #17181c; }

.deliv-preview-tab.active {
  background: #fff;
  color: #5e6ad2;
  box-shadow: 0 1px 2px rgba(20, 30, 50, 0.12);
}

.deliv-preview-stale {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 9px 12px;
  border: 1px solid rgba(251, 191, 36, 0.4);
  border-radius: 8px;
  background: rgba(251, 191, 36, 0.10);
  color: #92600a;
  font-size: 0.78rem;
}

.deliv-preview-body { min-height: 40px; }

.deliv-preview-loading,
.deliv-preview-error {
  font-size: 0.8rem;
  padding: 16px;
  border-radius: 8px;
}

.deliv-preview-loading { color: rgba(23, 24, 28, 0.5); }
.deliv-preview-error { background: rgba(248, 113, 113, 0.08); color: #b4544f; }

.deliv-pv-doc {
  border: 1px solid rgba(20, 30, 50, 0.10);
  border-radius: 10px;
  background: #fff;
  padding: 20px 22px;
  max-height: 640px;
  overflow-y: auto;
}

.deliv-pv-dochead {
  font-size: 0.96rem;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid rgba(20, 30, 50, 0.08);
}

.deliv-pv-section { margin-bottom: 16px; }

.deliv-pv-section h4,
.deliv-pv-sheet h4,
.deliv-pv-slide h4 {
  font-size: 0.82rem;
  font-weight: 700;
  color: #17181c;
  margin: 0 0 8px;
}

.deliv-pv-block { margin-bottom: 10px; }

.deliv-pv-prose .deliv-pv-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: rgba(23, 24, 28, 0.45);
  margin-bottom: 2px;
}

.deliv-pv-text { font-size: 0.82rem; line-height: 1.5; color: #17181c; }

.deliv-pv-text.tbc,
.deliv-pv-bullets .tbc,
.deliv-pv-list .tbc { color: #92600a; font-style: italic; }

.deliv-pv-bullets ul,
.deliv-pv-list {
  margin: 0;
  padding-left: 18px;
  font-size: 0.82rem;
  line-height: 1.5;
}

.deliv-pv-edit {
  float: right;
  margin-left: 8px;
  padding: 2px 8px;
  border: 1px solid rgba(94, 106, 210, 0.35);
  border-radius: 5px;
  background: rgba(94, 106, 210, 0.05);
  color: #5e6ad2;
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.deliv-pv-edit:hover { background: rgba(94, 106, 210, 0.14); }

.deliv-pv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.76rem;
  margin-top: 2px;
}

.deliv-pv-table th,
.deliv-pv-table td {
  border: 1px solid rgba(20, 30, 50, 0.10);
  padding: 5px 8px;
  text-align: left;
  vertical-align: top;
}

.deliv-pv-table th {
  background: rgba(20, 30, 50, 0.04);
  font-weight: 600;
  color: rgba(23, 24, 28, 0.65);
}

.deliv-pv-sheet { margin-bottom: 20px; }

.deliv-pv-sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.deliv-pv-note,
.deliv-pv-deps {
  font-size: 0.72rem;
  color: rgba(23, 24, 28, 0.55);
  margin: 4px 0 8px;
  font-style: italic;
}

.deliv-pv-deps { font-style: normal; }

.deliv-pv-slide {
  border: 1px solid rgba(20, 30, 50, 0.10);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 12px;
  position: relative;
  background: linear-gradient(180deg, #fff, #fbfbfd);
}

.deliv-pv-slide-num {
  position: absolute;
  top: 12px;
  right: 14px;
  font-size: 0.66rem;
  font-weight: 700;
  color: rgba(23, 24, 28, 0.3);
}

.deliv-pv-labeled { font-size: 0.8rem; margin-bottom: 6px; }
.deliv-pv-labeled span { font-weight: 600; color: rgba(23, 24, 28, 0.6); }

.deliv-pv-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  font-size: 0.78rem;
  margin-bottom: 6px;
}

.deliv-pv-timeline { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }

.deliv-pv-tl {
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(94, 106, 210, 0.08);
  color: #17181c;
}

.deliv-generate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.deliv-gen-card {
  border: 1px solid rgba(20, 30, 50, 0.10);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
  background: #fff;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.deliv-gen-card:hover {
  border-color: rgba(94, 106, 210, 0.35);
  box-shadow: 0 2px 8px rgba(94, 106, 210, 0.08);
}

.deliv-gen-icon {
  color: #3f4a9e;
  margin-bottom: 2px;
}

.deliv-gen-name {
  font-size: 0.86rem;
  font-weight: 700;
  color: #17181c;
}

.deliv-gen-desc {
  font-size: 0.74rem;
  color: rgba(23, 24, 28, 0.50);
  flex: 1;
}

.deliv-artifacts {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.deliv-artifact {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(20, 30, 50, 0.08);
  border-radius: 8px;
  background: #fff;
}

.deliv-artifact-icon {
  color: #3f4a9e;
  flex-shrink: 0;
}

.deliv-artifact-info {
  flex: 1;
  min-width: 0;
}

.deliv-artifact-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: #17181c;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.deliv-artifact-meta {
  font-size: 0.72rem;
  color: rgba(23, 24, 28, 0.45);
}

.deliv-artifact-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.deliv-artifact-actions .docs-btn {
  padding: 5px 10px;
  font-size: 0.74rem;
}

/* ── Projects View ────────────────────────────────────────────────────────── */

.projects-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px;
}

.projects-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.projects-title-area h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #17181c;
  margin: 0 0 4px;
}

.projects-sub {
  font-size: 0.85rem;
  color: rgba(23, 24, 28, 0.6);
  margin: 0;
}

.projects-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 16px;
  align-items: start;
}

.projects-list-pane {
  background: rgba(253, 253, 251, 0.65);
  border: 1px solid rgba(20, 30, 50, 0.06);
  border-radius: 14px;
  padding: 12px;
  max-height: 720px;
  overflow-y: auto;
}

.projects-pane-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 6px 12px;
  border-bottom: 1px solid rgba(20, 30, 50, 0.06);
  margin-bottom: 10px;
}

.projects-pane-header h3 {
  font-size: 0.88rem;
  font-weight: 600;
  color: #17181c;
  margin: 0;
}

.projects-count-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(20, 30, 50, 0.06);
  color: rgba(23, 24, 28, 0.6);
}

.projects-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.projects-card {
  padding: 12px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
  background: #fff;
  transition: background 0.12s, border-color 0.12s;
}

.projects-card:hover {
  background: rgba(20, 30, 50, 0.04);
}

.projects-card.active {
  background: rgba(94, 106, 210, 0.09);
  border-color: rgba(94, 106, 210, 0.30);
}

.projects-card-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: #17181c;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.projects-card-meta {
  font-size: 0.73rem;
  color: rgba(23, 24, 28, 0.55);
  margin-top: 4px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.projects-card-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(94, 106, 210, 0.12);
  color: #3f4a9e;
}

/* ── Enterprise projects (Track B): governance bar, chips, history ───────── */
.proj-gov {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
  border: 1px solid rgba(20, 30, 50, 0.08);
  border-radius: 10px;
  background: rgba(253, 253, 251, 0.75);
}

.proj-gov-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.proj-gov-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.proj-gov-actions .docs-btn { font-size: 0.74rem; padding: 6px 10px; }

.proj-gov-version {
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(23, 24, 28, 0.55);
  font-variant-numeric: tabular-nums;
}

.proj-chip {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(20, 30, 50, 0.06);
  color: rgba(23, 24, 28, 0.62);
  white-space: nowrap;
}

.proj-chip-lc.lc-draft { background: rgba(20, 30, 50, 0.08); color: rgba(23, 24, 28, 0.7); }
.proj-chip-lc.lc-in_review { background: rgba(234, 179, 8, 0.18); color: #8a6a04; }
.proj-chip-lc.lc-approved { background: rgba(52, 211, 153, 0.16); color: #0d7a5f; }
.proj-chip-lc.lc-rejected { background: rgba(180, 84, 79, 0.14); color: #96393a; }
.proj-chip-lc.lc-archived { background: rgba(20, 30, 50, 0.10); color: rgba(23, 24, 28, 0.5); }

.proj-chip-vis { background: rgba(94, 106, 210, 0.12); color: #3f4a9e; }
.proj-chip-own { background: rgba(20, 30, 50, 0.05); color: rgba(23, 24, 28, 0.55); }
.proj-chip-peer { background: rgba(148, 116, 222, 0.14); color: #5c3d94; }

/* Why Approve/Reject are absent for this viewer — an explanation, not a status. */
.proj-chip-review {
  font-style: italic;
  white-space: normal;
  background: rgba(20, 30, 50, 0.04);
  color: rgba(23, 24, 28, 0.5);
}

.proj-readonly {
  padding: 10px 14px;
  margin-bottom: 14px;
  border-radius: 8px;
  font-size: 0.78rem;
  line-height: 1.45;
  background: rgba(94, 106, 210, 0.07);
  border: 1px solid rgba(94, 106, 210, 0.18);
  color: #33405f;
}

/* Read-only mirror of the backend's owner-scoped writes: fields stay legible
   but inert, and every edit affordance disappears. `proj-locked` is applied to
   the field container and to the preview section. */
.deliv-fields.proj-locked input,
.deliv-fields.proj-locked textarea,
.deliv-section.proj-locked input {
  pointer-events: none;
  background: rgba(20, 30, 50, 0.02);
  color: rgba(23, 24, 28, 0.6);
}

.proj-locked .deliv-grid-add,
.proj-locked .deliv-grid-del,
.proj-locked .deliv-grid-move,
.proj-locked .deliv-grid-del-spacer,
.proj-locked .deliv-grid-move-spacer,
.proj-locked .deliv-pv-edit {
  display: none;
}

.proj-history {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.proj-history-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border: 1px solid rgba(20, 30, 50, 0.06);
  border-radius: 8px;
  background: rgba(253, 253, 251, 0.7);
}

.proj-history-row.current {
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.06);
}

.proj-history-ver {
  font-size: 0.78rem;
  font-weight: 700;
  color: #17181c;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 92px;
  font-variant-numeric: tabular-nums;
}

.proj-history-meta {
  flex: 1;
  font-size: 0.72rem;
  color: rgba(23, 24, 28, 0.55);
  line-height: 1.4;
}

.proj-history-actions .docs-btn { font-size: 0.72rem; padding: 5px 10px; }

.projects-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 12px 10px;
}

.projects-filter-btn {
  font-size: 0.70rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(20, 30, 50, 0.10);
  background: rgba(253, 253, 251, 0.7);
  color: rgba(23, 24, 28, 0.58);
  cursor: pointer;
}

.projects-filter-btn.active {
  background: rgba(94, 106, 210, 0.14);
  border-color: rgba(94, 106, 210, 0.32);
  color: #3f4a9e;
}

.proj-privnote {
  font-size: 0.78rem;
  line-height: 1.5;
  color: #33405f;
  background: rgba(94, 106, 210, 0.07);
  border: 1px solid rgba(94, 106, 210, 0.18);
  border-radius: 8px;
  padding: 10px 12px;
  margin: -4px 0 16px;
}

.projects-detail-pane {
  background: rgba(253, 253, 251, 0.92);
  border: 1px solid rgba(20, 30, 50, 0.06);
  border-radius: 14px;
  padding: 20px;
  min-height: 400px;
}

.projects-detail-empty {
  padding: 60px 20px;
  text-align: center;
  color: rgba(23, 24, 28, 0.45);
}

.projects-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(20, 30, 50, 0.08);
}

.projects-detail-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #17181c;
}

.projects-detail-meta {
  font-size: 0.76rem;
  color: rgba(23, 24, 28, 0.55);
  margin-top: 4px;
}

.projects-detail-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.deliv-empty {
  padding: 24px;
  text-align: center;
  color: rgba(23, 24, 28, 0.40);
  font-size: 0.82rem;
}

/* ── Memory Graph View ──────────────────────────────────────────────────── */

/* Full-viewport layout — no page scroll */
.graph-view {
  display: none;
  position: relative;
  width: 100%;
  height: calc(100vh - 52px);
  overflow: hidden;
  background: var(--bg);
}
.graph-view.active { display: block; }

/* ── Memory view (Graph + Memories + Health sub-tabs) ────────────────────── */
.memory-view { display: none; position: relative; width: 100%; }
.memory-view.active {
  display: flex !important;
  flex-direction: column;
  height: calc(100vh - 52px);
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse 55% 40% at 12% 18%, rgba(238, 224, 178, 0.50) 0%, transparent 60%),
    radial-gradient(ellipse 45% 38% at 88% 12%, rgba(244, 236, 208, 0.42) 0%, transparent 60%),
    radial-gradient(ellipse 65% 48% at 75% 82%, rgba(236, 221, 172, 0.45) 0%, transparent 62%),
    radial-gradient(ellipse 55% 45% at 20% 78%, rgba(246, 240, 218, 0.38) 0%, transparent 60%),
    radial-gradient(ellipse 40% 30% at 50% 45%, rgba(250, 246, 230, 0.25) 0%, transparent 60%),
    linear-gradient(160deg, #7e9bc2 0%, #89a5c7 45%, #92adca 100%);
}

/* ── Projects: multi-tab workspace (Overview / Plan / Resources / Schedule / Deliverables) ── */

.projects-subtabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 4px 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(20, 30, 50, 0.10);
}

.proj-pane { display: none; }
.proj-pane.active { display: block; }

/* Overview KPI strip */
.proj-kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.proj-kpi {
  background: var(--surface, #fff);
  border: 1px solid rgba(20, 30, 50, 0.10);
  border-radius: 10px;
  padding: 12px 14px;
}
.proj-kpi-value { font-size: 1.35rem; font-weight: 700; color: #17181c; line-height: 1.1; }
.proj-kpi-label { font-size: 0.72rem; color: rgba(23, 24, 28, 0.55); margin-top: 3px; text-transform: uppercase; letter-spacing: 0.04em; }
.proj-kpi-accent .proj-kpi-value { color: #3b6ea5; }
.proj-kpi-ok .proj-kpi-value { color: #2e7d54; }
.proj-kpi-warn .proj-kpi-value { color: #c26a1b; }
.proj-kpi-next .proj-kpi-value { font-size: 1.05rem; }

/* Plan head + toolbar */
.proj-plan-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.proj-plan-actions { display: flex; gap: 8px; flex-shrink: 0; }
.wbs-toolbar { display: flex; gap: 16px; flex-wrap: wrap; margin: 8px 0 12px; }
.wbs-legend { display: inline-flex; align-items: center; gap: 6px; font-size: 0.74rem; color: rgba(23, 24, 28, 0.6); }
.wbs-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.wbs-dot-phase { background: #3b6ea5; }
.wbs-dot-deliverable { background: #7e57c2; }
.wbs-dot-milestone { background: #c26a1b; }
.wbs-dot-task { background: #2e7d54; }

/* WBS table */
.wbs-tree { overflow-x: auto; }
.wbs-empty { padding: 24px; text-align: center; color: rgba(23, 24, 28, 0.5); font-size: 0.85rem; }
.wbs-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; min-width: 900px; }
.wbs-table th {
  text-align: left; padding: 8px 8px; font-weight: 600; font-size: 0.68rem;
  text-transform: uppercase; letter-spacing: 0.04em; color: rgba(23, 24, 28, 0.5);
  border-bottom: 1px solid rgba(20, 30, 50, 0.14); white-space: nowrap;
}
.wbs-row { border-bottom: 1px solid rgba(20, 30, 50, 0.06); }
.wbs-row:hover { background: rgba(59, 110, 165, 0.04); }
.wbs-row td { padding: 5px 8px; vertical-align: middle; }
.wbs-label-cell { display: flex; align-items: center; gap: 6px; min-width: 240px; }
.wbs-indent { display: inline-block; flex-shrink: 0; }
.wbs-kind {
  font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
  padding: 2px 6px; border-radius: 5px; color: #fff; flex-shrink: 0;
}
.wbs-kind-phase { background: #3b6ea5; }
.wbs-kind-deliverable { background: #7e57c2; }
.wbs-kind-milestone { background: #c26a1b; }
.wbs-kind-task { background: #2e7d54; }
.wbs-label { flex: 1; min-width: 120px; border: 1px solid transparent; background: transparent; font: inherit; color: #17181c; padding: 3px 6px; border-radius: 6px; }
.wbs-label:hover:not(:disabled) { border-color: rgba(20, 30, 50, 0.14); background: #fff; }
.wbs-label:focus { border-color: #3b6ea5; background: #fff; outline: none; }
.wbs-select, .wbs-date, .wbs-num {
  border: 1px solid rgba(20, 30, 50, 0.14); border-radius: 6px; background: #fff;
  font: inherit; padding: 3px 6px; color: #17181c;
}
.wbs-select { min-width: 120px; max-width: 160px; }
.wbs-date { font-size: 0.74rem; }
.wbs-num { width: 56px; }
.wbs-select:disabled, .wbs-date:disabled, .wbs-num:disabled, .wbs-label:disabled { opacity: 0.65; background: rgba(20, 30, 50, 0.03); }
.wbs-actions { text-align: right; }
.wbs-del {
  border: none; background: transparent; color: #b0342c; font-size: 1.1rem; line-height: 1;
  cursor: pointer; padding: 2px 8px; border-radius: 6px;
}
.wbs-del:hover { background: rgba(176, 52, 44, 0.1); }

/* Resources: team load */
.proj-resources { display: flex; flex-direction: column; gap: 8px; }
.proj-resources-empty { padding: 20px; text-align: center; color: rgba(23, 24, 28, 0.5); font-size: 0.85rem; }
.res-summary { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 0.8rem; color: rgba(23, 24, 28, 0.7); padding: 6px 0 10px; border-bottom: 1px solid rgba(20, 30, 50, 0.08); }
.res-row { display: grid; grid-template-columns: 180px 1fr 200px; gap: 12px; align-items: center; }
.res-name { font-size: 0.82rem; font-weight: 600; color: #17181c; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-bar { height: 10px; border-radius: 6px; background: rgba(20, 30, 50, 0.08); overflow: hidden; }
.res-bar-done { display: block; height: 100%; background: #2e7d54; }
.res-nums { font-size: 0.75rem; color: rgba(23, 24, 28, 0.6); text-align: right; }

/* Schedule: Gantt + variance */
.proj-gantt { margin-bottom: 20px; }
.gantt-wrap { min-width: 500px; }
.gantt-row { display: flex; align-items: center; gap: 10px; height: 26px; }
.gantt-name { width: 220px; flex-shrink: 0; font-size: 0.78rem; color: #17181c; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gantt-track { position: relative; flex: 1; height: 14px; background: rgba(20, 30, 50, 0.05); border-radius: 7px; }
.gantt-bar { position: absolute; top: 0; height: 100%; border-radius: 7px; min-width: 4px; }
.gantt-not_started { background: #9aa7b8; }
.gantt-in_progress { background: #3b6ea5; }
.gantt-blocked { background: #b0342c; }
.gantt-done { background: #2e7d54; }
.gantt-milestone { position: absolute; top: 3px; width: 10px; height: 10px; background: #c26a1b; transform: rotate(45deg); }
.proj-variance h4 { font-size: 0.82rem; margin: 12px 0 6px; color: #17181c; }
.variance-empty { padding: 16px; text-align: center; color: rgba(46, 125, 84, 0.8); font-size: 0.82rem; }
.variance-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.variance-table td { padding: 5px 8px; border-bottom: 1px solid rgba(20, 30, 50, 0.06); }
.var-late { color: #b0342c; font-weight: 600; }
.var-early { color: #2e7d54; font-weight: 600; }

@media (max-width: 800px) {
  .res-row { grid-template-columns: 1fr; gap: 4px; }
  .res-nums { text-align: left; }
  .gantt-name { width: 120px; }
}

.memory-subtabs {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  padding: 12px 20px;
  background: transparent;
  border-bottom: 1px solid rgba(20, 30, 50, 0.12);
}

.memory-pane[data-mtab] { display: none; }
.memory-pane.active[data-mtab] { display: block; }

.memory-pane[data-mtab="graph"] {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Memory list sub-tab */
.memory-list-pane {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px 28px 40px;
  max-width: 980px;
}
.memory-list-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.memory-list-header h1 { margin: 0 0 4px; font-size: 24px; color: #17181c; }
.memory-list-sub { margin: 0; color: #6b7280; font-size: 13px; }
.memory-list-search {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(20, 30, 50, 0.14);
  border-radius: 10px;
  padding: 8px 12px;
  background: #fdfdfb;
  min-width: 240px;
}
.memory-list-search input {
  border: none;
  outline: none;
  background: transparent;
  color: #17181c;
  font-size: 13px;
  width: 100%;
}
.memory-list-meta { color: #6b7280; font-size: 12.5px; margin-bottom: 14px; }

.memory-list { display: flex; flex-direction: column; gap: 10px; }
.memory-list-empty { color: #6b7280; padding: 24px 0; text-align: center; font-size: 13.5px; }

.memory-card {
  background: #fdfdfb;
  border: 1px solid rgba(20, 30, 50, 0.08);
  border-radius: 12px;
  padding: 14px 16px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.memory-card:hover { border-color: rgba(20, 30, 50, 0.18); box-shadow: 0 2px 12px rgba(20, 30, 50, 0.06); }
.memory-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 12px; color: #6b7280; }
.memory-type-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.memory-type-dot.semantic  { background: #5e6ad2; }
.memory-type-dot.episodic  { background: #10b981; }
.memory-type-dot.working   { background: #f59e0b; }
.memory-type-dot.factual   { background: #8b5cf6; }
.memory-type-dot.procedural{ background: #f97316; }
.memory-type { text-transform: capitalize; font-weight: 600; }
.memory-conf { margin-left: 2px; }
.memory-imp { color: #f59e0b; letter-spacing: 1px; }
.memory-date { margin-left: auto; }
.memory-content { font-size: 13.5px; line-height: 1.55; color: #17181c; white-space: pre-wrap; word-break: break-word; }
.memory-people { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.memory-tag {
  background: rgba(94,106,210,0.08);
  border: 1px solid rgba(94,106,210,0.2);
  color: #5e6ad2;
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 999px;
}
.memory-card-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }

/* What Oryne Knows — transparency mode + correction (spec §25) */
.transparency-toggle { white-space: nowrap; padding: 4px 10px; font-size: 12px; }
.transparency-toggle.active {
  background: #5e6ad2;
  border-color: #5e6ad2;
  color: #fff;
}
.memory-card.transparency { border-left: 3px solid #5e6ad2; }
.memory-sources {
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(94, 106, 210, 0.05);
  border: 1px solid rgba(94, 106, 210, 0.12);
  border-radius: 8px;
  font-size: 12px;
  color: #6b7280;
}
.memory-sources-head { font-weight: 600; margin-bottom: 4px; color: #5e6ad2; }
.memory-source-line { padding: 2px 0; line-height: 1.45; }
.memory-source-type { text-transform: capitalize; font-weight: 600; }
.memory-source-date { color: #9ca3af; font-size: 11px; }
.correct-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 20, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 120;
  padding: 20px;
}
.correct-box {
  background: #fdfdfb;
  border: 1px solid rgba(20, 30, 50, 0.14);
  border-radius: 14px;
  padding: 20px 22px;
  max-width: 520px;
  width: 100%;
  box-shadow: 0 16px 48px rgba(10, 12, 20, 0.25);
}
.correct-title { font-size: 15px; font-weight: 700; color: #17181c; margin-bottom: 6px; }
.correct-sub { font-size: 12.5px; color: #6b7280; line-height: 1.5; margin: 0 0 12px; }
.correct-box textarea {
  width: 100%;
  border: 1px solid rgba(20, 30, 50, 0.16);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  color: #17181c;
  background: #fff;
  resize: vertical;
  outline: none;
}
.correct-box textarea:focus { border-color: #5e6ad2; }
.correct-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }

/* Extend (Plugins + Developers) nested sub-tabs */
.extend-tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.extend-pane[data-xtab] { display: none; }
.extend-pane.active[data-xtab] { display: block; }

/* Health sub-tab inside the Memory view */
.memory-pane[data-mtab="health"] {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: none;
}
.memory-pane[data-mtab="health"].active { display: flex; }
.memory-pane[data-mtab="health"] .overview-bg {
  min-height: 100%;
  width: 100%;
  flex: 1;
  background: transparent;
}

/* SVG canvas fills entire area */
.graph-canvas-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.graph-svg {
  width: 100%;
  height: 100%;
  cursor: grab;
}
.graph-svg:active { cursor: grabbing; }

/* ── Floating Toolbar ─────────────────────────────────────────────────── */

.graph-toolbar {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(17, 17, 19, 0.82);
  border: 1px solid var(--border);
  border-radius: 40px;
  padding: 8px 16px;
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  box-shadow: 0 4px 24px rgba(0,0,0,0.4), 0 1px 0 rgba(255,255,255,0.04) inset;
  white-space: nowrap;
  max-width: calc(100vw - 64px);
  overflow-x: auto;
}

.graph-toolbar-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.graph-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.graph-count {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

.graph-toolbar-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  flex-shrink: 0;
}

.graph-toolbar-center { display: flex; align-items: center; }

.graph-search-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 10px;
  transition: border-color 0.15s;
}
.graph-search-wrap:focus-within { border-color: var(--accent); }

.graph-search-input {
  background: none;
  border: none;
  outline: none;
  font-size: 0.75rem;
  color: var(--text);
  width: 140px;
  font-family: inherit;
}
.graph-search-input::placeholder { color: var(--text-muted); }

.graph-toolbar-right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.graph-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-right: 2px;
}

.graph-filt {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: 1px solid transparent;
  border-radius: 20px;
  padding: 3px 9px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.graph-filt:hover {
  background: var(--surface-3);
  color: var(--text);
}
.graph-filt.active {
  background: var(--surface-3);
  border-color: var(--border-hover);
  color: var(--text);
}

.gfilt-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.gfilt-dot.relates    { background: #55555c; }
.gfilt-dot.supports   { background: #34d399; }
.gfilt-dot.contradicts{ background: #f87171; }
.gfilt-dot.derived    { background: #5e6ad2; }

.graph-toolbar-actions { display: flex; align-items: center; gap: 2px; }

.graph-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: none;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}
.graph-icon-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}

/* ── Empty + Loading States ───────────────────────────────────────────── */

.graph-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  pointer-events: none;
}
.graph-empty-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.graph-empty-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  max-width: 300px;
  line-height: 1.5;
}

.graph-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.graph-spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: graphSpin 0.8s linear infinite;
}
@keyframes graphSpin { to { transform: rotate(360deg); } }
.graph-loading-text {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ── Legend ───────────────────────────────────────────────────────────── */

.graph-legend {
  position: absolute;
  bottom: 20px;
  left: 20px;
  background: rgba(17, 17, 19, 0.82);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 20;
}
.graph-legend-title {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.graph-legend-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 5px;
}
.graph-legend-row:last-child { margin-bottom: 0; }

.graph-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.graph-legend-dot.semantic  { background: #5e6ad2; }
.graph-legend-dot.episodic  { background: #34d399; }
.graph-legend-dot.working   { background: #fbbf24; }
.graph-legend-dot.factual   { background: #8b5cf6; }

/* ── Slide-in Detail Panel ────────────────────────────────────────────── */

.graph-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 340px;
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 40;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: -8px 0 32px rgba(0,0,0,0.3);
}
.graph-panel.open { transform: translateX(0); }

.graph-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.graph-panel-type {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-light);
  background: var(--accent-glow);
  border: 1px solid rgba(94,106,210,0.2);
  border-radius: 4px;
  padding: 2px 7px;
}

.graph-panel-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}
.graph-panel-close:hover {
  background: var(--surface-3);
  color: var(--text);
}

.graph-panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.graph-panel-content::-webkit-scrollbar { width: 4px; }
.graph-panel-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.graph-panel-text {
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.graph-panel-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.graph-meta-chip {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
}
.graph-meta-chip.hi {
  color: var(--text-secondary);
  background: var(--surface-3);
}

.graph-panel-people { display: flex; flex-wrap: wrap; gap: 6px; }
.graph-person-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
}
.graph-person-chip::before {
  content: '';
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent-glow);
  border: 1px solid rgba(94,106,210,0.3);
  display: inline-block;
}

.graph-panel-connections {}
.graph-connections-title {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.graph-conn-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  margin-bottom: 5px;
  cursor: pointer;
  transition: background 0.15s;
  border: 1px solid var(--border);
}
.graph-conn-item:hover { background: var(--surface-3); }
.graph-conn-rel {
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 5px;
  border-radius: 3px;
  flex-shrink: 0;
  margin-top: 1px;
}
.graph-conn-rel.relates_to    { background: rgba(85,85,92,0.3);  color: #8e8e96; }
.graph-conn-rel.supports      { background: rgba(52,211,153,0.12); color: #34d399; }
.graph-conn-rel.contradicts   { background: rgba(248,113,113,0.12); color: #f87171; }
.graph-conn-rel.derived_from  { background: rgba(94,106,210,0.12); color: var(--accent-light); }
.graph-conn-text {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.graph-panel-actions { padding-top: 4px; }
.graph-panel-btn {
  width: 100%;
  padding: 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.graph-panel-btn:hover {
  background: var(--surface-3);
  color: var(--text);
  border-color: var(--border-hover);
}

/* ── SVG node & edge styles (applied via D3 attr) ────────────────────── */

/* Node pulse animation for selected node */
@keyframes graphPulse {
  0%, 100% { r: 0; opacity: 0.6; }
  50%       { r: 18px; opacity: 0; }
}

/* Tooltip */
.graph-tooltip {
  position: absolute;
  pointer-events: none;
  z-index: 50;
  background: rgba(17,17,19,0.92);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-xs);
  padding: 7px 10px;
  font-size: 0.75rem;
  color: var(--text);
  line-height: 1.45;
  max-width: 220px;
  word-break: break-word;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 0.12s;
}
.graph-tooltip.visible { opacity: 1; }
.graph-tooltip-type {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 3px;
}

/* ── Memory Health & Eval View ──────────────────────────────────────────── */

.health-container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 2.2rem 1.5rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.health-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.health-header h1 {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.health-sub {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.45;
  max-width: 620px;
}

.health-header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.health-refresh-btn,
.health-run-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

/* ── Hero Score Grid ────────────────────────────────────────────────────── */

.health-hero-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 1.25rem;
}

@media (max-width: 900px) {
  .health-hero-grid {
    grid-template-columns: 1fr;
  }
}

.health-score-card {
  background: linear-gradient(145deg, rgba(22, 22, 25, 0.95), rgba(17, 17, 19, 0.8));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.health-score-card::before {
  content: '';
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 140px;
  background: radial-gradient(circle, rgba(94, 106, 210, 0.22) 0%, rgba(94, 106, 210, 0) 70%);
  pointer-events: none;
}

.health-radial-wrap {
  position: relative;
  width: 160px;
  height: 160px;
  margin-bottom: 1.25rem;
}

.health-radial-svg {
  transform: rotate(-90deg);
}

.health-radial-bg {
  stroke: rgba(255, 255, 255, 0.05);
}

.health-radial-fill {
  stroke: var(--accent);
  stroke-linecap: round;
  transition: stroke-dashoffset 0.85s cubic-bezier(0.16, 1, 0.3, 1), stroke 0.3s;
}

.health-radial-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.health-score-num {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
  line-height: 1;
}

.health-score-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 0.25rem;
}

.health-score-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.health-grade-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.health-grade-badge {
  font-size: 0.85rem;
  font-weight: 800;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  background: var(--accent-glow);
  border: 1px solid rgba(94, 106, 210, 0.3);
  color: var(--accent-light);
  letter-spacing: 0.02em;
}

.health-grade-badge.grade-a {
  background: rgba(52, 211, 153, 0.15);
  border-color: rgba(52, 211, 153, 0.4);
  color: #34d399;
}

.health-grade-badge.grade-b {
  background: rgba(94, 106, 210, 0.15);
  border-color: rgba(94, 106, 210, 0.4);
  color: #8b93e8;
}

.health-grade-badge.grade-c {
  background: rgba(251, 191, 36, 0.15);
  border-color: rgba(251, 191, 36, 0.4);
  color: #fbbf24;
}

.health-percentile-pill {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--surface-3);
  border: 1px solid var(--border);
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
}

.health-score-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.health-score-desc {
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.45;
  max-width: 290px;
}

/* ── 4 Dimension Cards ─────────────────────────────────────────────────── */

.health-dimensions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

@media (max-width: 600px) {
  .health-dimensions-grid {
    grid-template-columns: 1fr;
  }
}

.health-dim-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.85rem;
  transition: border-color 0.15s, transform 0.15s;
}

.health-dim-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.health-dim-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.health-dim-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.2rem;
}

.health-dim-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.health-dim-score {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-light);
  letter-spacing: -0.02em;
}

.health-dim-score span {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
}

.health-dim-meter {
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.health-dim-bar {
  height: 100%;
  border-radius: 4px;
  background: var(--accent);
  transition: width 0.6s ease;
}

.health-dim-bar.good { background: var(--success); }
.health-dim-bar.warn { background: var(--warning); }

.health-dim-detail {
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ── Tips Card ─────────────────────────────────────────────────────────── */

.health-tips-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}

.health-tips-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.85rem;
}

.health-tips-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.health-tip-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.health-tip-item::before {
  content: '→';
  color: var(--accent-light);
  font-weight: 700;
}

/* ── Store Composition & Governance ────────────────────────────────────── */

.health-store-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}

.health-store-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.health-store-head h2 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.health-store-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.health-store-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

@media (max-width: 1000px) {
  .health-store-grid { grid-template-columns: 1fr; }
}

.health-store-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.health-store-bars {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.health-store-bar-row {
  display: grid;
  grid-template-columns: 92px 1fr auto;
  align-items: center;
  gap: 0.5rem;
}

.health-store-bar-label {
  font-size: 0.74rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.health-store-bar-track {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.health-store-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.health-store-bar-fill.good { background: var(--success, #34d399); }
.health-store-bar-fill.warn { background: var(--warning, #fbbf24); }

.health-store-bar-count {
  font-size: 0.72rem;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.health-store-bar-count em {
  color: var(--text-muted);
  font-style: normal;
}

.health-store-facts {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.health-store-fact {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px dashed var(--border);
  padding-bottom: 0.35rem;
}

.health-store-fact:last-child { border-bottom: none; }

.health-store-fact-label {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.health-store-fact-value {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.health-store-fact-value.warn { color: var(--danger, #f87171); }

.health-store-empty {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.health-report-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ── Live Benchmark Platform ───────────────────────────────────────────── */

.health-bench-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.health-bench-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.health-bench-head h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.health-bench-head p {
  font-size: 0.78rem;
  color: var(--text-secondary);
  max-width: 540px;
}

.health-bench-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  max-width: 440px;
}

.bench-query-input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.8rem;
  font-size: 0.78rem;
  color: var(--text);
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s;
}

.bench-query-input:focus {
  border-color: var(--accent);
}

.health-metrics-ribbon {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
}

@media (max-width: 768px) {
  .health-metrics-ribbon {
    grid-template-columns: repeat(2, 1fr);
  }
}

.bm-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.bm-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.bm-value {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.bm-sub {
  font-size: 0.68rem;
  color: var(--text-secondary);
}

.bench-results-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow-x: auto;
}

.bench-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  text-align: left;
}

.bench-table th {
  background: var(--surface-2);
  padding: 0.65rem 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.bench-table td {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text);
  vertical-align: middle;
}

.bench-table tr:last-child td {
  border-bottom: none;
}

.bench-empty-row {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem !important;
}

.badge-pill {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.badge-pill.good {
  background: rgba(52, 211, 153, 0.12);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.badge-pill.neutral {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.badge-pill.warn {
  background: rgba(248, 113, 113, 0.12);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.3);
}

/* ══════════════════════════════════════════════════════════════════════════════
   ENHANCEMENTS — Premium polish layer
   ══════════════════════════════════════════════════════════════════════════════ */

/* ── Overview Inbox: better item depth + hover lift ──────────────────────── */

.overview-bg .notif-row {
  border-bottom: 1px solid rgba(20, 30, 50, 0.05);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 10px;
  margin: 2px 8px;
  padding-right: 8px;
  animation: rowFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes rowFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.overview-bg .notif-row.urgent-row {
  border-left: 3px solid var(--danger);
  background: rgba(248, 113, 113, 0.02);
}

.overview-bg .notif-row.urgent-row:hover {
  background: rgba(248, 113, 113, 0.05);
}

.overview-bg .notif-row:hover {
  background: rgba(94, 106, 210, 0.04);
  transform: translateX(2px);
  box-shadow: 0 2px 12px rgba(45, 65, 105, 0.06);
}

.overview-bg .notif-row-icon {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.overview-bg .notif-row:hover .notif-row-icon {
  transform: scale(1.05);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);
}

.overview-bg .notif-row-title {
  font-weight: 650;
  letter-spacing: -0.015em;
}

.overview-bg .notif-row-desc {
  line-height: 1.5;
}

/* Urgent badge pulse */
.overview-bg .notif-row-badge {
  animation: urgentPulse 2s ease-in-out infinite;
}

@keyframes urgentPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ── Briefing Widget: softer gradient + better spacing ───────────────────── */

.overview-bg .briefing-widget {
  background: linear-gradient(135deg, #1a2744 0%, #162040 50%, #141d3a 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px 14px 0 0;
  margin: 0 1px;
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.04);
}

.overview-bg .briefing-item {
  padding: 5px 0;
  border-radius: 6px;
  transition: background 0.15s;
  padding-left: 4px;
  margin-left: -4px;
}

.overview-bg .briefing-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

/* ── Notification Card: refined shadow + border ──────────────────────────── */

.overview-bg .notif-card-wrap {
  border-radius: 16px;
  box-shadow:
    0 24px 70px rgba(45, 65, 105, 0.22),
    0 2px 8px rgba(45, 65, 105, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* ── Filter Pills: softer transitions ────────────────────────────────────── */

.overview-bg .notif-pill {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.overview-bg .notif-pill:active {
  transform: scale(0.96);
}

.overview-bg .notif-pill.active {
  box-shadow: 0 1px 6px rgba(94, 106, 210, 0.12);
}

/* ── Memory View: card hierarchy + hover effects ─────────────────────────── */

.memory-list .memory-card,
.memory-list .mem-row {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 10px;
  animation: cardFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.memory-list .memory-card:hover,
.memory-list .mem-row:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* Memory type dot — animated glow */
.memory-type-dot {
  transition: all 0.2s ease;
}

.memory-card:hover .memory-type-dot {
  box-shadow: 0 0 8px currentColor;
}

/* Memory confidence — color-coded */
.memory-conf {
  font-weight: 600;
  font-size: 0.7rem;
}

/* Memory stars — better visibility */
.memory-imp {
  letter-spacing: 1px;
  font-size: 0.68rem;
  color: var(--warning);
}

/* Memory type badges — richer colors */
.mem-type-badge {
  transition: all 0.15s ease;
}

.mem-type-badge:hover {
  transform: scale(1.05);
}

/* ── Relationships View: better card depth ───────────────────────────────── */

.relationships-grid .rel-card,
.relationships-grid .person-card {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 12px;
}

.relationships-grid .rel-card:hover,
.relationships-grid .person-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* Gone-quiet strip: warning emphasis */
.gone-quiet-strip {
  border-left: 3px solid var(--warning);
  background: rgba(251, 191, 36, 0.04);
  border-radius: 0 10px 10px 0;
}

.gone-quiet-title {
  font-weight: 600;
  color: var(--warning);
}

/* ── Commitments Board: better column cards ──────────────────────────────── */

.board-col {
  transition: all 0.2s ease;
}

.board-col:hover {
  transform: translateY(-1px);
}

.board-col-header {
  border-radius: 10px 10px 0 0;
  font-weight: 650;
  letter-spacing: -0.01em;
  padding: 12px 14px;
}

.board-col-body .task-card,
.board-col-body .commitment-card {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 8px;
}

.board-col-body .task-card:hover,
.board-col-body .commitment-card:hover {
  transform: translateX(2px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* ── Documents View: upload zone + file cards ────────────────────────────── */

.docs-upload-inner {
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 14px;
}

.docs-upload-inner:hover {
  border-color: var(--accent);
  background: rgba(94, 106, 210, 0.03);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(94, 106, 210, 0.08);
}

.docs-upload-inner.dragover {
  border-color: var(--accent);
  background: rgba(94, 106, 210, 0.06);
  box-shadow: 0 0 0 3px rgba(94, 106, 210, 0.12);
}

.docs-list .doc-item,
.docs-list .doc-card {
  transition: all 0.15s ease;
  border-radius: 8px;
}

.docs-list .doc-item:hover,
.docs-list .doc-card:hover {
  background: var(--surface-2);
  transform: translateX(1px);
}

/* ── Settings View: integration cards hover ──────────────────────────────── */

.integration-card {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.integration-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

/* Connect button glow */
.connect-btn.disconnected {
  transition: all 0.2s ease;
}

.connect-btn.disconnected:hover {
  box-shadow: 0 0 0 2px rgba(94, 106, 210, 0.15);
}

/* ── Global: smoother view transitions ───────────────────────────────────── */

.view.active {
  animation: viewIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Global: subtle focus rings ──────────────────────────────────────────── */

input:focus,
textarea:focus,
button:focus-visible {
  outline: 2px solid rgba(94, 106, 210, 0.4);
  outline-offset: 1px;
}

/* ── Global: better scrollbar ────────────────────────────────────────────── */

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.18); }

/* ── Engine status chip: better positioning ──────────────────────────────── */

.engine-status-chip {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 50;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.engine-status-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}

.engine-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  animation: dotPulse 2s ease-in-out infinite;
}

@keyframes dotPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.3); }
  50% { opacity: 0.8; box-shadow: 0 0 0 4px rgba(52, 211, 153, 0); }
}

/* ── Auth View: card entrance animation ──────────────────────────────────── */

.auth-card {
  animation: cardSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cardSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-trust-item {
  transition: all 0.2s ease;
}

.auth-trust-item:hover {
  color: var(--text);
  transform: translateX(2px);
}

/* ── Recurrence Widget: better card feel ─────────────────────────────────── */

.recurrence-widget {
  border-radius: 12px !important;
  border: 1px solid rgba(20, 30, 50, 0.12) !important;
  background: #ffffff !important;
  transition: all 0.2s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.04) !important;
  color: #17181c !important;
}

.recurrence-widget:hover {
  border-color: var(--border-hover);
}

.recurrence-item {
  transition: all 0.15s ease;
  border-radius: 8px;
}

.recurrence-item:hover {
  background: var(--surface-2);
}

/* ── Graph Panel: smoother slide-in ──────────────────────────────────────── */

.graph-panel {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.graph-panel-btn {
  transition: all 0.15s ease;
}

.graph-panel-btn:hover {
  transform: translateY(-1px);
}

/* ── Health View: score card glow ────────────────────────────────────────── */

.health-score-card {
  border-radius: 16px;
  transition: all 0.2s ease;
}

.health-dim-card {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 12px;
}

.health-dim-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* ── Empty states: better visual weight ──────────────────────────────────── */

.graph-empty,
.docs-detail-empty,
.profile-empty,
.memory-list-empty {
  color: var(--text-muted);
  text-align: center;
  padding: 3rem 2rem;
}

.graph-empty svg,
.docs-detail-empty svg {
  opacity: 0.3;
  margin-bottom: 12px;
}

/* ── Toast notifications: entrance animation ─────────────────────────────── */

.toast {
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Loading states: skeleton shimmer ────────────────────────────────────── */

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 8px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}




/* ── Compose (Tone-aware post generation) ─────────────────────────── */

.compose-body {
  display: grid;
  grid-template-columns: minmax(300px, 420px) 1fr;
  gap: 16px;
  align-items: start;
}

.compose-form {
  background: rgba(253, 253, 251, 0.65);
  border: 1px solid rgba(20, 30, 50, 0.06);
  border-radius: 14px;
  padding: 14px;
}

.compose-label {
  display: block;
  color: rgba(23, 24, 28, 0.75);
  font-size: 0.78rem;
  font-weight: 600;
  margin: 12px 0 5px;
}

.compose-optional {
  color: rgba(23, 24, 28, 0.45);
  font-weight: 500;
}

.compose-form textarea,
.compose-form input,
.compose-form select {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(20, 30, 50, 0.14);
  border-radius: 8px;
  background: #fff;
  color: #17181c;
  font-size: 0.85rem;
  padding: 8px 10px;
}

.compose-form textarea { resize: vertical; font-family: inherit; }

.compose-tones {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.compose-tone {
  padding: 5px 10px;
  border-radius: 20px;
  border: 1px solid rgba(20, 30, 50, 0.14);
  background: #fff;
  color: #17181c;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.compose-tone:hover { border-color: rgba(20, 30, 50, 0.32); }

.compose-tone.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.compose-generate {
  width: 100%;
  justify-content: center;
  margin-top: 16px;
}

.compose-result {
  background: rgba(253, 253, 251, 0.65);
  border: 1px solid rgba(20, 30, 50, 0.06);
  border-radius: 14px;
  padding: 14px;
  min-height: 320px;
}

.compose-result-empty {
  color: rgba(23, 24, 28, 0.45);
  font-size: 0.85rem;
  text-align: center;
  padding: 90px 20px;
}

.compose-result-meta {
  color: rgba(23, 24, 28, 0.6);
  font-size: 0.76rem;
  margin-bottom: 10px;
}

.compose-result-post {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.92rem;
  line-height: 1.55;
  color: #17181c;
  background: #fff;
  border: 1px solid rgba(20, 30, 50, 0.08);
  border-radius: 10px;
  padding: 14px;
  min-height: 180px;
}

.compose-result-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.compose-history {
  margin-top: 22px;
  background: rgba(253, 253, 251, 0.65);
  border: 1px solid rgba(20, 30, 50, 0.06);
  border-radius: 14px;
  padding: 14px 16px;
}

.compose-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.compose-history-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #17181c;
  margin: 0;
}

.compose-history-list {
  display: flex;
  flex-direction: column;
}

.compose-history-row {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(20, 30, 50, 0.06);
  cursor: pointer;
  border-radius: 8px;
}

.compose-history-row:last-child { border-bottom: none; }

.compose-history-row:hover,
.compose-history-row:focus-visible {
  background: rgba(94, 106, 210, 0.06);
  outline: none;
}

.compose-history-topic {
  font-size: 0.88rem;
  font-weight: 600;
  color: #17181c;
  margin-bottom: 2px;
}

.compose-history-snippet {
  font-size: 0.82rem;
  color: rgba(23, 24, 28, 0.7);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compose-history-meta {
  font-size: 0.74rem;
  color: rgba(23, 24, 28, 0.5);
  margin-top: 3px;
}

@media (max-width: 900px) {
  .compose-body { grid-template-columns: 1fr; }
}


/* ── Meetings (Ambient Meeting Copilot) ──────────────────────────── */

.meet-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.meet-tab {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid rgba(20, 30, 50, 0.14);
  background: #fff;
  color: #17181c;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.meet-tab:hover { border-color: rgba(20, 30, 50, 0.32); }

.meet-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.meet-upcoming-empty {
  color: rgba(23, 24, 28, 0.45);
  font-size: 0.85rem;
  text-align: center;
  padding: 40px 14px;
}

.meet-upcoming-list { display: flex; flex-direction: column; gap: 8px; }

.meet-upcoming-item {
  padding: 10px 12px;
  border: 1px solid rgba(20, 30, 50, 0.1);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}

.meet-upcoming-item:hover { border-color: rgba(20, 30, 50, 0.28); }

.meet-upcoming-item.active {
  border-color: var(--accent);
  background: rgba(94, 106, 210, 0.06);
}

.meet-upcoming-title { font-size: 0.85rem; font-weight: 600; color: #17181c; }

.meet-upcoming-meta { font-size: 0.74rem; color: rgba(23, 24, 28, 0.55); margin-top: 3px; }

.meet-card-head { margin-bottom: 12px; }

.meet-card-title { font-size: 1.1rem; font-weight: 700; color: #17181c; }

.meet-card-meta { font-size: 0.76rem; color: rgba(23, 24, 28, 0.55); margin-top: 3px; }

.meet-card-section { margin-top: 14px; }

.meet-card-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(23, 24, 28, 0.5);
  margin-bottom: 6px;
}

.meet-attendees { display: flex; flex-direction: column; gap: 8px; }

.meet-attendee {
  background: #fff;
  border: 1px solid rgba(20, 30, 50, 0.08);
  border-radius: 10px;
  padding: 10px 12px;
}

.meet-attendee-name { font-size: 0.85rem; font-weight: 600; color: #17181c; }

.meet-attendee-role { color: rgba(23, 24, 28, 0.5); font-weight: 500; }

.meet-attendee-note { font-size: 0.78rem; color: rgba(23, 24, 28, 0.6); line-height: 1.45; margin-top: 4px; }

.meet-attendee-commit { font-size: 0.74rem; color: var(--accent); margin-top: 5px; font-weight: 600; }

.meet-context { display: flex; flex-direction: column; gap: 6px; }

.meet-context-item {
  background: #fff;
  border: 1px solid rgba(20, 30, 50, 0.08);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.8rem;
  line-height: 1.45;
  color: #17181c;
}

.meet-agenda { font-size: 0.85rem; line-height: 1.55; color: #17181c; }

.meet-agenda-text { white-space: pre-wrap; }

.meet-fact-btn { width: 100%; justify-content: center; margin-top: 14px; }

.meet-fact-hint {
  font-size: 0.74rem;
  color: rgba(23, 24, 28, 0.5);
  margin-top: 10px;
  line-height: 1.45;
}

.meet-fact-card {
  background: #fff;
  border: 1px solid rgba(20, 30, 50, 0.08);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
}

.meet-fact-snippet { font-size: 0.86rem; color: #17181c; line-height: 1.5; }

.meet-fact-meta { font-size: 0.72rem; color: rgba(23, 24, 28, 0.55); margin-top: 6px; }

.meet-fact-latency { font-size: 0.74rem; color: rgba(23, 24, 28, 0.5); margin-top: 8px; }

.meet-email {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.86rem;
  line-height: 1.55;
  color: #17181c;
  background: #fff;
  border: 1px solid rgba(20, 30, 50, 0.08);
  border-radius: 10px;
  padding: 14px;
}

/* ── Mobile bottom tab bar (phone only, see @media below) ───────────── */
.mobile-tabbar { display: none; }

/* ── On-Device Whisper (mobile Local AI panel) ─────────────────────── */
.ondevice-panel { display: none; margin-bottom: 8px; }
/* In the native app the Local AI tab shows ONLY the on-device panel */
.settings-section[data-stab="models"].ondevice-mode > *:not(.ondevice-panel) { display: none !important; }
.settings-section[data-stab="models"].ondevice-mode .ondevice-panel { display: block; }
.ondevice-meta { font-size: 0.74rem; color: var(--text-muted); margin-top: 8px; }
.ondevice-progress {
  height: 6px;
  background: #eef1f5;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 12px;
  display: none;
}
.ondevice-progress.active { display: block; }
.ondevice-progress-bar {
  height: 100%;
  width: 0%;
  background: #3b6ea5;
  border-radius: 4px;
  transition: width 0.25s ease;
}
.ondevice-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }


/* ── Phone layout fixes (Capacitor WebView, ≤640px) ────────────────── */
@media (max-width: 640px) {
  .overview-bg,
  .settings-bg,
  .auth-bg { padding: 1.25rem 0.75rem 3rem; }
  .overview-container { max-width: 100%; }
  .notif-card-header { padding: 16px 16px 0; }
  .notif-filters { padding: 12px 16px 0; }
  .notif-card-title { flex-wrap: wrap; gap: 6px; }
  .recurrence-widget { padding: 14px; }
  .health-container { padding: 1.5rem 1rem 3rem; }
  .settings-container { padding: 1.5rem 1rem 3rem; }

  /* iOS zooms the WebView when a focused control is <16px — force it */
  input, textarea, select { font-size: 16px !important; }

  /* Bottom tab bar replaces the hidden top nav links */
  .mobile-tabbar {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 200;
    background: rgba(9, 9, 11, 0.92);
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    border-top: 1px solid var(--border);
    padding: 2px 4px calc(2px + env(safe-area-inset-bottom));
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .mobile-tabbar::-webkit-scrollbar { display: none; }
  .mtab {
    flex: 1 0 auto;
    min-width: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 7px 6px 5px;
    background: none;
    border: none;
    border-radius: 10px;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .mtab svg { width: 19px; height: 19px; }
  .mtab.active { color: var(--accent-light); background: var(--surface-2); }
  /* Login / onboarding screens: no navigation available yet */
  .top-nav.pre-login ~ .mobile-tabbar { display: none; }
  /* Keep page content clear of the fixed bar */
  .view { padding-bottom: 68px; }
  .overview-bg, .settings-bg, .auth-bg { min-height: calc(100vh - 52px); padding-bottom: 5.5rem; }
  .toast-container { bottom: calc(70px + env(safe-area-inset-bottom)); }
}

/* ══════════════════════════════════════════════════════════════════════════
   Enterprise: auth help · Company admin · Platform console · Audit · Lock
   ══════════════════════════════════════════════════════════════════════════ */

.auth-help {
  margin-top: 0.85rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.auth-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.auth-link:hover { text-decoration: underline; }

/* Unverified email banner */
.verify-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  background: rgba(251, 191, 36, 0.12);
  border-bottom: 1px solid rgba(251, 191, 36, 0.3);
  color: #b45309;
  font-size: 0.82rem;
  font-weight: 500;
}
.verify-banner .btn-small {
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  border-radius: 4px;
  border: 1px solid rgba(251, 191, 36, 0.5);
  background: rgba(251, 191, 36, 0.15);
  color: #92400e;
  cursor: pointer;
}
.verify-banner .btn-small:hover {
  background: rgba(251, 191, 36, 0.25);
}

/* Badge variant used by Disabled / COMPROMISED / Error */
.badge-pill.bad {
  background: rgba(248, 113, 113, 0.12);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.3);
}

/* Section head with a right-aligned action button */
.co-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 1.4rem 0 0.6rem;
}

/* Generic enterprise card */
.co-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin-bottom: 0.9rem;
}
.co-card-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.co-kicker { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 2px; }
.co-name { font-size: 1.05rem; font-weight: 700; color: var(--text); }
.co-domain-wrap { display: flex; align-items: center; gap: 8px; }
.co-domain { font-family: 'SF Mono', ui-monospace, Menlo, monospace; font-size: 0.85rem; color: var(--text-secondary); }
.co-rename { display: flex; align-items: center; gap: 8px; width: 100%; }
.co-rename input { flex: 1; }

.co-add-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
  align-items: end;
}
.co-add-action { display: flex; }
.co-add-action .btn-primary { width: 100%; }
.co-user-input { display: flex; align-items: center; gap: 6px; }
.co-user-input input { flex: 1; }
.co-user-domain { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; }
.co-add-grid select {
  width: 100%;
  background: var(--surface-3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.7rem;
  font-size: 0.85rem;
}
@media (max-width: 860px) { .co-add-grid { grid-template-columns: 1fr 1fr; } }

/* Credential callout (shown once) */
.cred-box {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--accent-glow);
  border: 1px solid rgba(94, 106, 210, 0.3);
}
.cred-title { font-size: 0.78rem; font-weight: 600; color: var(--accent-light); margin-bottom: 0.5rem; }
.cred-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 0.85rem; color: var(--text); }
.cred-line code { font-family: 'SF Mono', ui-monospace, Menlo, monospace; background: var(--surface-3); padding: 2px 8px; border-radius: 4px; }
.cred-actions { display: flex; align-items: center; gap: 12px; margin-top: 0.7rem; flex-wrap: wrap; }
.cred-note { font-size: 0.74rem; color: var(--text-muted); }

/* Tables */
.co-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 0.5rem;
}
.co-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.co-table thead th {
  text-align: left;
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--surface-2);
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
}
.co-table tbody td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.co-table tbody tr:last-child td { border-bottom: none; }
.co-table tbody tr:hover { background: var(--surface-2); }
.co-actions-col, .co-actions-td { text-align: right; }
.co-member-name { font-weight: 600; color: var(--text); }
.co-member-email { font-size: 0.76rem; color: var(--text-muted); margin-top: 1px; }
.co-row-actions { display: inline-flex; gap: 14px; justify-content: flex-end; }
.co-empty { text-align: center; color: var(--text-muted); padding: 1.2rem 0; }
.co-muted { color: var(--text-muted); }
.co-mono { font-family: 'SF Mono', ui-monospace, Menlo, monospace; font-size: 0.78rem; color: var(--text-secondary); }
.co-res { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.co-role-select {
  background: var(--surface-3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 0.3rem 0.5rem;
  font-size: 0.78rem;
}
.btn-link {
  background: none;
  border: none;
  color: var(--accent-light);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0;
}
.btn-link:hover { text-decoration: underline; }

/* Role badges */
.role-badge { display: inline-block; font-size: 0.7rem; font-weight: 600; padding: 2px 8px; border-radius: 4px; border: 1px solid var(--border); color: var(--text-secondary); background: var(--surface-3); }
.role-badge.rb-owner { color: #c8a2ff; border-color: rgba(180, 120, 255, 0.3); }
.role-badge.rb-admin { color: var(--accent-light); border-color: rgba(94, 106, 210, 0.35); }
.role-badge.rb-member { color: #7fd1b9; border-color: rgba(52, 211, 153, 0.25); }
.role-badge.rb-viewer { color: var(--text-muted); }

/* Audit */
.co-audit-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 0.7rem; flex-wrap: wrap; }
.co-action-tag { font-family: 'SF Mono', ui-monospace, Menlo, monospace; font-size: 0.76rem; color: var(--text); }
.co-modal-card { max-width: 720px; }
.co-audit-table tbody td { padding: 0.55rem 1rem; }

/* First-login forced change lock */
.lock-overlay { z-index: 11000; background: rgba(0, 0, 0, 0.82); }
.lock-card { max-width: 420px; }
.lock-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 1.25rem; }
.lock-icon { flex-shrink: 0; width: 42px; height: 42px; border-radius: 10px; background: var(--accent-glow); border: 1px solid rgba(94, 106, 210, 0.3); color: var(--accent-light); display: flex; align-items: center; justify-content: center; }
.lock-head h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: 4px; }
.lock-head p { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.45; }
.lock-signout { width: 100%; margin-top: 0.75rem; }

/* Password strength meter */
.pw-meter { height: 4px; border-radius: 3px; background: var(--surface-3); overflow: hidden; margin-top: 8px; }
.pw-meter-bar { height: 100%; width: 0; background: var(--danger); transition: width 0.2s ease, background 0.2s ease; }
.pw-meter-bar.low { background: var(--warning); }
.pw-meter-bar.ok { background: var(--success); }
.pw-hint { font-size: 0.73rem; color: var(--text-muted); margin-top: 6px; }

/* ── IAM Users console (master–detail) ── */
.iam-users-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 0 8px; }
.iam-users-grid { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
.iam-user-list { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); max-height: 560px; overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.iam-user-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 9px 10px; border: none; border-radius: var(--radius-xs); background: transparent; color: var(--text); cursor: pointer; font: inherit; }
.iam-user-item:hover { background: var(--surface-2); }
.iam-user-item.active { background: var(--accent-glow); box-shadow: inset 2px 0 0 var(--accent-light); }
.iam-user-item-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.iam-user-item-name { font-weight: 600; font-size: 0.86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iam-user-item-email { font-size: 0.74rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iam-avatar { flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--surface-3); color: var(--text-secondary); font-weight: 700; font-size: 0.85rem; }
.iam-avatar-lg { width: 46px; height: 46px; font-size: 1.1rem; }
.iam-me-tag { display: inline-block; margin-left: 6px; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent-light); background: var(--accent-glow); border-radius: 4px; padding: 1px 5px; vertical-align: middle; }
.iam-user-detail { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 18px 20px; min-height: 120px; }
.iam-detail-head { display: flex; align-items: center; gap: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.iam-detail-id { flex: 1; min-width: 0; }
.iam-detail-name { font-weight: 700; font-size: 1.02rem; }
.iam-detail-email { font-size: 0.8rem; color: var(--text-muted); }
.iam-detail-badges { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.iam-subhead { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted); margin: 16px 0 8px; }
.iam-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.iam-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-3); border: 1px solid var(--border); border-radius: 6px; padding: 3px 8px; font-size: 0.78rem; color: var(--text); }
.iam-chip-x { border: none; background: none; color: var(--text-muted); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0; }
.iam-chip-x:hover { color: var(--danger); }
.iam-inline { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.iam-inline select { background: var(--surface-3); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-xs); padding: 0.4rem 0.6rem; font-size: 0.82rem; max-width: 320px; }
.iam-pol-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.iam-pol-row:last-child { border-bottom: none; }
.iam-pol-name { font-weight: 500; font-size: 0.86rem; }
.iam-my-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.iam-my-email { font-size: 0.82rem; }
.iam-my-spacer { flex: 1; }

/* ── IAM policy builder — pick actions instead of typing JSON ── */
.iam-subtabs { align-items: center; margin: 2px 0 14px; }
.iam-builder-summary { font-size: 0.74rem; white-space: nowrap; }
.iam-builder { display: flex; flex-direction: column; gap: 14px; }
.iam-builder > .co-row-actions { justify-content: flex-start; }
.iam-builder-bar input { width: 100%; box-sizing: border-box; }
/* The catalog is long by design; keep one statement on screen while its actions
   scroll, so adding a second statement does not push the page off the viewport. */
.iam-acts { max-height: 380px; overflow-y: auto; padding-right: 4px; }
.iam-stmt { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); padding: 14px 16px; }
.iam-stmt-deny { border-color: rgba(248, 113, 113, 0.45); }
.iam-stmt-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.iam-stmt-title { font-weight: 700; font-size: 0.86rem; }
.iam-effect-lbl { font-size: 0.76rem; color: var(--text-muted); }
.iam-stmt-head select { background: var(--surface-3); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-xs); padding: 0.35rem 0.5rem; font-size: 0.82rem; }
.iam-fam { border-top: 1px solid var(--border); padding: 10px 0 4px; }
.iam-acts > .iam-fam:first-child { border-top: none; padding-top: 0; }
.iam-fam-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; position: sticky; top: 0; background: var(--surface-2); padding: 4px 0; }
.iam-fam-head > span:first-child { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-muted); }
.iam-fam-count { font-size: 0.7rem; color: var(--text-muted); background: var(--surface-3); border-radius: 999px; padding: 1px 7px; }
.iam-fam-head .btn-link { margin-left: auto; }
.iam-act-row { display: grid; grid-template-columns: auto minmax(140px, 1.1fr) minmax(0, 1fr) minmax(0, 1.2fr); align-items: center; gap: 10px; padding: 5px 6px; border-radius: var(--radius-xs); cursor: pointer; font-size: 0.82rem; }
.iam-act-row:hover { background: var(--surface-3); }
.iam-act-row input[type="checkbox"] { margin: 0; }
.iam-act-label { font-weight: 500; }
.iam-act-id { font-size: 0.76rem; color: var(--text-secondary); }
.iam-act-route { font-size: 0.72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iam-res { border-top: 1px solid var(--border); margin-top: 10px; padding-top: 10px; }
.iam-res-modes { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 0.82rem; }
.iam-res-modes label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.iam-res-input { min-width: 190px; border: none; background: transparent; color: inherit; font-size: 0.78rem; padding: 0; outline: none; }
.iam-chip:focus-within { border-color: var(--accent-light); }
.iam-res-warn { color: var(--danger); }
.iam-sugg { border: 1px dashed var(--border); background: var(--surface-3); color: var(--text-secondary); border-radius: 6px; font-size: 0.74rem; padding: 2px 7px; cursor: pointer; font-family: inherit; }
.iam-sugg:hover { border-style: solid; color: var(--accent-light); }
.iam-preview-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; font-size: 0.8rem; }
.iam-preview { margin-top: 8px; }
.iam-preview-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.iam-preview-res { font-size: 0.74rem; color: var(--text-muted); }
.iam-after-save { border-top: 1px solid var(--border); margin-top: 12px; padding-top: 4px; }

@media (max-width: 640px) {
  .co-card-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .co-add-grid { grid-template-columns: 1fr; }
  .iam-users-grid { grid-template-columns: 1fr; }
  .iam-user-list { max-height: 260px; }
  .iam-act-row { grid-template-columns: auto 1fr 1fr; }
  .iam-act-id { grid-column: 2 / 4; font-size: 0.72rem; }
}

/* ── Settings light-theme overrides for enterprise + IAM components ──
   The Company and Access (IAM) tabs reuse dark-themed co-*, cred-*, iam-*
   components; the Settings surface is a light background, so re-skin them. */
.settings-bg .co-card { background: #fdfdfb; border-color: rgba(20, 30, 50, 0.08); box-shadow: 0 1px 2px rgba(20, 30, 50, 0.04); color: #17181c; }
.settings-bg .co-kicker, .settings-bg .co-muted, .settings-bg .co-member-email,
.settings-bg .co-empty, .settings-bg .cred-note, .settings-bg .co-user-domain,
.settings-bg .iam-user-item-email, .settings-bg .iam-detail-email { color: #6b7280; }
.settings-bg .co-name, .settings-bg .co-member-name, .settings-bg .cred-line,
.settings-bg .iam-detail-name, .settings-bg .iam-user-item-name, .settings-bg .iam-pol-name { color: #17181c; }
.settings-bg .co-domain, .settings-bg .co-mono { color: #5a6472; }
.settings-bg .co-table-wrap { border-color: rgba(20, 30, 50, 0.10); background: #fff; }
.settings-bg .co-table thead th { background: #f3f4f6; color: #6b7280; border-bottom-color: rgba(20, 30, 50, 0.08); }
.settings-bg .co-table tbody td { border-bottom-color: rgba(20, 30, 50, 0.06); color: #17181c; }
.settings-bg .co-table tbody tr:hover { background: #f6f8fb; }
.settings-bg .co-add-grid select, .settings-bg .co-role-select, .settings-bg .iam-inline select { background: #fff; color: #17181c; border-color: #d0d4da; }
.settings-bg .cred-box { background: #eef4fb; border-color: rgba(59, 110, 165, 0.25); }
.settings-bg .cred-title { color: #2d5a8a; }
.settings-bg .cred-line code { background: #eef1f5; color: #17181c; }
.settings-bg .co-card input, .settings-bg .co-card textarea,
.settings-bg .iam-user-detail input, .settings-bg .iam-inline select { background: #fff; color: #17181c; border: 1px solid #d0d4da; border-radius: var(--radius-xs); }
.settings-bg textarea.co-mono { background: #fbfbf9; color: #17181c; border: 1px solid #d0d4da; line-height: 1.5; }
.settings-bg .auth-field label { color: #6b7280; }
.settings-bg .badge-pill { background: #eef1f5; color: #5a6472; border-color: rgba(20, 30, 50, 0.10); }
.settings-bg .badge-pill.good { background: #e6f7ef; color: #15803d; border-color: rgba(52, 211, 153, 0.35); }
.settings-bg .badge-pill.bad { background: #fdecec; color: #dc2626; border-color: rgba(248, 113, 113, 0.35); }
.settings-bg .badge-pill.warn { background: #fef3c7; color: #b45309; border-color: rgba(245, 158, 11, 0.35); }
.settings-bg .role-badge { background: #f3f4f6; color: #5a6472; border-color: rgba(20, 30, 50, 0.10); }
.settings-bg .role-badge.rb-admin { color: #3b6ea5; border-color: rgba(59, 110, 165, 0.30); }
.settings-bg .role-badge.rb-owner { color: #7c3aed; border-color: rgba(124, 58, 237, 0.25); }
.settings-bg .role-badge.rb-member { color: #0f766e; border-color: rgba(15, 118, 110, 0.25); }
.settings-bg .btn-primary { background: #3b6ea5; color: #fff; border: none; }
.settings-bg .btn-primary:hover { background: #2d5a8a; }
.settings-bg .btn-primary:disabled { background: #9ca3af; }
.settings-bg .btn-link { color: #3b6ea5; }
.settings-bg .iam-user-list { background: #fff; border-color: rgba(20, 30, 50, 0.10); }
.settings-bg .iam-user-item { color: #17181c; }
.settings-bg .iam-user-item:hover { background: #f6f8fb; }
.settings-bg .iam-user-item.active { background: #e9f2fc; box-shadow: inset 2px 0 0 #3b6ea5; }
.settings-bg .iam-avatar { background: #e9f2fc; color: #3b6ea5; }
.settings-bg .iam-user-detail { background: #fdfdfb; border-color: rgba(20, 30, 50, 0.10); }
.settings-bg .iam-detail-head { border-bottom-color: rgba(20, 30, 50, 0.08); }
.settings-bg .iam-subhead { color: #6b7280; }
.settings-bg .iam-chip { background: #f3f4f6; border-color: rgba(20, 30, 50, 0.10); color: #17181c; }
.settings-bg .iam-chip-x { color: #9ca3af; }
.settings-bg .iam-chip-x:hover { color: #dc2626; }
.settings-bg .iam-pol-row { border-bottom-color: rgba(20, 30, 50, 0.06); }
.settings-bg .iam-me-tag { background: #e9f2fc; color: #3b6ea5; }
.settings-bg .field-tip { color: #6b7280; }
.settings-bg .iam-legacy-note { font-size: 0.78rem; line-height: 1.5; color: #92400e; background: #fef3c7; border: 1px solid rgba(245, 158, 11, 0.35); border-radius: var(--radius-xs); padding: 0.6rem 0.75rem; margin-bottom: 0.85rem; }

/* Policy builder on the light Settings surface. */
.settings-bg .iam-stmt { background: #fff; border-color: rgba(20, 30, 50, 0.10); color: #17181c; }
.settings-bg .iam-stmt-deny { border-color: rgba(220, 38, 38, 0.35); }
.settings-bg .iam-stmt-head select { background: #fff; color: #17181c; border-color: #d0d4da; }
.settings-bg .iam-builder-bar input { background: #fff; color: #17181c; border: 1px solid #d0d4da; border-radius: var(--radius-xs); padding: 0.45rem 0.6rem; font-size: 0.82rem; }
.settings-bg .iam-fam { border-top-color: rgba(20, 30, 50, 0.08); }
.settings-bg .iam-fam-head { background: #fff; }
.settings-bg .iam-fam-head > span:first-child { color: #6b7280; }
.settings-bg .iam-fam-count { background: #eef1f5; color: #5a6472; }
.settings-bg .iam-act-row { color: #17181c; }
.settings-bg .iam-act-row:hover { background: #f6f8fb; }
.settings-bg .iam-act-id { color: #5a6472; }
.settings-bg .iam-res { border-top-color: rgba(20, 30, 50, 0.08); }
.settings-bg .iam-res-warn { color: #dc2626; }
.settings-bg .iam-sugg { background: #f3f4f6; border-color: rgba(20, 30, 50, 0.14); color: #3b6ea5; }
.settings-bg .iam-preview-row select { background: #fff; color: #17181c; border: 1px solid #d0d4da; border-radius: var(--radius-xs); padding: 0.35rem 0.55rem; font-size: 0.8rem; }
.settings-bg .iam-preview-res { color: #6b7280; }
.settings-bg .iam-after-save { border-top-color: rgba(20, 30, 50, 0.08); }
/* The chip holds a bare input; the blanket co-card input skin would box it twice. */
.settings-bg .co-card .iam-res-input { border: none; background: transparent; }
.settings-bg .iam-act-row input[type="checkbox"],
.settings-bg .iam-res-modes input[type="radio"] { accent-color: #3b6ea5; width: 15px; height: 15px; }

/* Sticky top nav overlaps scroll-anchored targets without this. */
html { scroll-padding-top: 68px; }

/* Audit-log action tag + full-width monospace JSON editors on the light surface. */
.settings-bg .co-action-tag { color: #17181c; }
.settings-bg .co-card textarea, .settings-bg .iam-user-detail textarea { width: 100%; box-sizing: border-box; resize: vertical; }

/* ── Electron desktop enhancement ──────────────────────────────────────────
   Keep all rules scoped. Existing page/panel background recipes are protected.
   Browser console and Capacitor continue using the rules above unchanged. */
html.desktop-ui { --desktop-rail: 224px; --desktop-header: 56px; scroll-padding-top: 80px; }
html.desktop-ui body { font-size: 14px; line-height: 1.5; }
html.desktop-ui #app { padding-left: var(--desktop-rail); padding-top: var(--desktop-header); }
html.desktop-ui .mobile-tabbar { display: none !important; }
html.desktop-ui [hidden] { display: none !important; }
html.desktop-ui #navConsole,
html.desktop-ui .settings-tabs > [data-stab="console"] { display: none !important; }
html.desktop-ui .top-nav {
  position: fixed; inset: 0 auto 0 0; width: var(--desktop-rail); height: 100dvh;
  padding: 24px 12px; flex-direction: column; align-items: stretch;
  justify-content: flex-start; border-bottom: 0; border-right: 1px solid var(--border);
  overflow-y: auto; overflow-x: hidden; z-index: 110;
}
html.desktop-ui.desktop-mac .top-nav { padding-top: 48px; }
html.desktop-ui .top-nav .nav-brand { min-height: 40px; margin: 0 12px 24px; gap: 12px; }
html.desktop-ui .top-nav .brand-name { font-size: 17px; }
html.desktop-ui .nav-links { flex-direction: column; gap: 24px; }
html.desktop-ui .desktop-nav-group { display: flex; flex-direction: column; gap: 4px; }
html.desktop-ui .desktop-nav-label { padding: 0 12px 4px; color: #96969f; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; }
html.desktop-ui .nav-links a { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 8px 12px; border-radius: 8px; color: #aaaab4; }
html.desktop-ui .nav-links a.active { color: var(--text); box-shadow: inset 2px 0 var(--accent); }
html.desktop-ui .nav-links a.active svg { color: var(--accent-light); }
html.desktop-ui #desktopHeader {
  position: fixed; top: 0; right: 0; left: var(--desktop-rail); height: var(--desktop-header);
  display: flex; align-items: center; gap: 16px; padding: 0 24px;
  background: rgba(9, 9, 11, 0.88); border-bottom: 1px solid var(--border); z-index: 100;
  backdrop-filter: blur(16px); -webkit-app-region: drag;
}
html.desktop-ui #desktopHeader :is(button, a) { -webkit-app-region: no-drag; }
html.desktop-ui .desktop-context { display: flex; align-items: center; gap: 12px; font-size: 12px; }
html.desktop-ui #desktopSection { color: #96969f; }
html.desktop-ui #desktopPageTitle { font-weight: 600; color: var(--text); }
html.desktop-ui #desktopPageTitle::before { content: '/'; color: #757580; margin-right: 12px; font-weight: 400; }
html.desktop-ui .desktop-account,
html.desktop-ui #desktopMenu { border: 1px solid var(--border-hover); border-radius: 6px; background: var(--surface); color: var(--text); padding: 6px 12px; font: inherit; font-size: 12px; cursor: pointer; }
html.desktop-ui .desktop-account { margin-left: auto; }
html.desktop-ui #desktopMenu { display: none; }
html.desktop-ui .desktop-skip { position: absolute; left: 16px; top: -100px; color: var(--text); background: var(--surface); padding: 8px 12px; border-radius: 6px; }
html.desktop-ui .desktop-skip:focus { top: 8px; }
html.desktop-ui #desktopTitlebar { display: none; }
html.desktop-ui.desktop-mac #desktopTitlebar { display: block; position: fixed; top: 0; left: 0; width: var(--desktop-rail); height: 32px; -webkit-app-region: drag; z-index: 120; }
html.desktop-ui.desktop-access #app { padding: 0; }
html.desktop-ui.desktop-access .top-nav { display: none; }
html.desktop-ui.desktop-access #desktopTitlebar { width: 100%; }
html.desktop-ui .view.active { min-height: calc(100dvh - var(--desktop-header)); animation: none; }
html.desktop-ui .view:focus { outline: none; }
html.desktop-ui .view:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
html.desktop-ui .verify-banner { margin: 0; }
html.desktop-ui :is(button, input, select, textarea) { font-family: inherit; }
html.desktop-ui :is(button, a, input, select, textarea):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
html.desktop-ui :is(.btn-primary, .btn-outline, .btn-small, .btn-secondary, .action-btn, .connect-btn, .perm-grant-btn) {
  min-height: 34px; border-radius: 6px; font-size: 12px; font-weight: 600;
  transition: color 150ms ease, border-color 150ms ease, background-color 150ms ease;
}
html.desktop-ui :is(button, .notif-row, .rel-card, .commitment-card, .memory-card, .auth-trust-item):hover { transform: none; }
html.desktop-ui :is(.urgent-tag, .notif-row, .auth-card, .engine-dot) { animation: none; }
html.desktop-ui .btn-primary:hover { box-shadow: none; }
html.desktop-ui :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea) { max-width: 100%; min-width: 0; font-size: 13px; border-radius: 6px; }
html.desktop-ui :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select) { min-height: 36px; }
html.desktop-ui textarea { line-height: 1.6; }
html.desktop-ui :is(h1, h2, h3) { text-wrap: balance; }
html.desktop-ui h1 { font-size: 24px; line-height: 1.3; letter-spacing: -.025em; }
html.desktop-ui :is(code, .badge-pill, .notif-card-count, .co-table, .health-score-num) { font-variant-numeric: tabular-nums; }
html.desktop-ui .auth-bg { width: 100%; min-height: 100dvh; padding: 56px 24px 32px; }
html.desktop-ui .permissions-screen { max-width: 440px; padding: 0; margin: auto; }
html.desktop-ui .perm-header { margin-bottom: 24px; }
html.desktop-ui .perm-header h1 { font-size: 24px; }
html.desktop-ui .perm-brand { margin-bottom: 24px; }
html.desktop-ui .perm-subtitle { font-size: 13px; line-height: 1.6; }
html.desktop-ui .auth-card { max-width: 440px; padding: 24px; box-shadow: 0 8px 24px rgba(45, 65, 105, .14); }
html.desktop-ui .auth-field { margin-bottom: 16px; }
html.desktop-ui .auth-field label { font-size: 12px; font-weight: 600; margin-bottom: 6px; }
html.desktop-ui .auth-submit { min-height: 40px; justify-content: center; }
html.desktop-ui .auth-help { font-size: 12px; line-height: 1.6; }
html.desktop-ui .auth-trust { gap: 8px; margin-top: 24px; }
html.desktop-ui .auth-trust-item { font-size: 12px; color: #404b5b; }
html.desktop-ui .auth-bg :is(.perm-subtitle, .perm-note) { color: #404b5b; }
html.desktop-ui .auth-bg .perm-note { font-size: 12px; line-height: 1.6; }
html.desktop-ui .perm-list { margin-bottom: 24px; gap: 12px; }
html.desktop-ui .perm-item { padding: 16px; border-radius: 8px; gap: 12px; }
html.desktop-ui .perm-content h3 { font-size: 13px; }
html.desktop-ui .perm-content p { font-size: 12px; line-height: 1.5; }
html.desktop-ui .perm-footer { width: 100%; margin-top: 24px; }
html.desktop-ui .perm-continue-btn { width: 100%; justify-content: center; }

/* ── Phase 2: desktop work screens (backgrounds untouched) ───────────────── */
html.desktop-ui .overview-container { max-width: 1120px; display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
html.desktop-ui .overview-container #engineStatusChip { grid-column: 1 / -1; justify-self: start; }
html.desktop-ui .overview-container .notif-card-wrap { grid-column: 1; min-width: 0; }
html.desktop-ui .overview-rail { grid-column: 2; display: flex; flex-direction: column; gap: 20px; position: sticky; top: 76px; min-width: 0; }
html.desktop-ui .notif-card-header { padding: 24px 24px 0; }
html.desktop-ui .notif-filters { padding: 16px 24px; }
html.desktop-ui .notif-list { padding: 0 12px 12px; }
html.desktop-ui .notif-row { padding: 14px 12px; }
html.desktop-ui .relationships-container,
html.desktop-ui .commitments-container,
html.desktop-ui .docs-container { max-width: 1180px; }
html.desktop-ui .relationships-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
html.desktop-ui .rel-card { border-radius: 12px; padding: 16px; }
html.desktop-ui .board { gap: 16px; }
html.desktop-ui .board-col { border-radius: 12px; }
html.desktop-ui .memory-list-pane { max-width: 1040px; padding: 24px 32px 48px; }
html.desktop-ui .memory-list-header { padding-bottom: 16px; border-bottom: 1px solid rgba(20, 30, 50, 0.08); }
html.desktop-ui .memory-card { border-radius: 12px; }
html.desktop-ui .memory-imp { letter-spacing: 1px; color: #a8a29a; font-size: 11px; font-variant-numeric: tabular-nums; }
html.desktop-ui .docs-layout { grid-template-columns: 320px minmax(0, 1fr); gap: 20px; }
html.desktop-ui .compose-body { grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 20px; }
html.desktop-ui .docs-detail-pane { min-height: 360px; }
html.desktop-ui .meet-tabs { gap: 8px; margin-bottom: 20px; }

/* ── Phase 3: desktop settings + tenant administration (light area kept) ─── */
html.desktop-ui .settings-container { max-width: 1080px; display: grid; grid-template-columns: 192px minmax(0, 1fr); gap: 32px; align-items: start; }
html.desktop-ui .settings-container > .settings-header { grid-column: 1 / -1; }
html.desktop-ui .settings-container > .settings-tabs { grid-column: 1; flex-direction: column; align-items: stretch; gap: 2px; margin-bottom: 0; position: sticky; top: 76px; }
html.desktop-ui .settings-container > .settings-tabs > .stab-btn { border: 0; border-radius: 8px; background: transparent; color: #5a6472; text-align: left; padding: 8px 12px; font-size: 13px; }
html.desktop-ui .settings-container > .settings-tabs > .stab-btn:hover { background: rgba(20, 30, 50, 0.05); color: #17181c; border-color: transparent; }
html.desktop-ui .settings-container > .settings-tabs > .stab-btn.active { background: #e9f2fc; color: #3b6ea5; border-color: transparent; box-shadow: inset 2px 0 #3b6ea5; }
html.desktop-ui .settings-section { grid-column: 2; min-width: 0; }
html.desktop-ui .settings-section-title { margin: 24px 0 12px; }
html.desktop-ui .settings-section > .settings-section-title:first-child { margin-top: 0; }
html.desktop-ui :is(.account-card, .integration-card, .pref-row, .sig-card, .profile-card, .dreaming-card, .co-card, .iam-user-detail, .history-list) { border-radius: 12px; }
html.desktop-ui :is(.co-table, .audit-table, .iam-user-list, table) { font-variant-numeric: tabular-nums; }
html.desktop-ui .modal-card { border-radius: 12px; }

@media (min-width: 800px) and (max-width: 1099px) {
  html.desktop-ui { --desktop-rail: 64px; }
  html.desktop-ui .top-nav { padding-inline: 8px; }
  html.desktop-ui .top-nav .nav-brand { margin: 0 auto 24px; }
  html.desktop-ui .top-nav .brand-name,
  html.desktop-ui .desktop-nav-text,
  html.desktop-ui .desktop-nav-label { display: none; }
  html.desktop-ui .nav-links a { justify-content: center; padding: 12px; }
  html.desktop-ui .desktop-nav-group + .desktop-nav-group { border-top: 1px solid var(--border); padding-top: 12px; }
  html.desktop-ui .nav-links { gap: 12px; }
  html.desktop-ui.desktop-mac .top-nav { padding-top: 72px; }
  html.desktop-ui.desktop-mac #desktopHeader { padding-left: 32px; }
  html.desktop-ui.desktop-mac #desktopTitlebar { width: 80px; }
  html.desktop-ui .overview-container { grid-template-columns: minmax(0, 1fr); }
  html.desktop-ui .overview-rail { position: static; grid-column: 1; }
  html.desktop-ui .settings-container { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  html.desktop-ui .settings-container > .settings-tabs { flex-direction: row; flex-wrap: wrap; position: static; gap: 6px; }
  html.desktop-ui .settings-container > .settings-tabs > .stab-btn { text-align: center; border: 1px solid #d0d4da; border-radius: 999px; padding: 7px 14px; }
  html.desktop-ui .settings-container > .settings-tabs > .stab-btn.active { box-shadow: none; }
  html.desktop-ui .settings-section { grid-column: 1; }
}
@media (max-width: 799px) {
  html.desktop-ui { --desktop-rail: 0px; }
  html.desktop-ui #desktopHeader { padding-inline: 16px; }
  html.desktop-ui.desktop-mac #desktopHeader { padding-left: 88px; }
  html.desktop-ui #desktopMenu { display: block; }
  html.desktop-ui .top-nav { display: none; width: 224px; top: 56px; height: calc(100dvh - 56px); padding-top: 16px; }
  html.desktop-ui.desktop-menu-open .top-nav { display: flex; }
  html.desktop-ui #desktopSection { display: none; }
  html.desktop-ui #desktopPageTitle::before { content: none; }
  html.desktop-ui.desktop-mac #desktopTitlebar { width: 80px; }
}
@media (prefers-reduced-motion: reduce) {
  html.desktop-ui *, html.desktop-ui *::before, html.desktop-ui *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
/* ── End desktop enhancement ────────────────────────────────────────────── */

/* ── Agents view (agent governance console) ───────────────────────────────── */
.agents-container { max-width: 1100px; margin: 0 auto; padding: 28px 24px 64px; }
.agents-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.agents-header h1 { font-size: 1.45rem; margin: 0 0 6px; }
.agents-sub { color: var(--text-muted); font-size: 0.86rem; max-width: 62ch; margin: 0; line-height: 1.5; }
.agents-header-actions { display: flex; gap: 8px; flex-shrink: 0; }

.agents-tier-legend { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 18px; }
.agents-tier-legend-title { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 10px; }
.agents-tier-legend-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px 18px; }
.agents-tier-legend-grid > div { display: flex; align-items: center; gap: 8px; font-size: 0.78rem; color: var(--text-secondary); }

.agent-tier { display: inline-flex; align-items: center; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 2px 7px; border-radius: 4px; white-space: nowrap; }
.tier-observe { color: var(--text-muted); background: rgba(255,255,255,0.06); }
.tier-advise { color: #fbbf24; background: rgba(251,191,36,0.12); }
.tier-approved { color: #38bdf8; background: rgba(56,189,248,0.12); }
.tier-auto { color: #34d399; background: rgba(52,211,153,0.12); }

.agent-status { display: inline-flex; align-items: center; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 2px 7px; border-radius: 4px; }
.agent-status.active { color: #34d399; background: rgba(52,211,153,0.12); }
.agent-status.paused { color: #fbbf24; background: rgba(251,191,36,0.12); }
.agent-status.retired { color: var(--text-muted); background: rgba(255,255,255,0.06); }

.agents-list-meta { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 10px; }
.agents-list { display: flex; flex-direction: column; gap: 10px; }
.agent-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.agent-card:hover { border-color: var(--border-hover); }
.agent-card-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; font-size: 0.9rem; }
.agent-card-desc { color: var(--text-secondary); font-size: 0.8rem; margin-top: 4px; line-height: 1.45; }
.agent-card-meta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 7px; font-size: 0.74rem; color: var(--text-muted); }
.agent-meta-item code { background: rgba(255,255,255,0.06); padding: 1px 5px; border-radius: 4px; font-size: 0.72rem; }
.agent-card-actions { flex-shrink: 0; }
.agent-empty { color: var(--text-muted); text-align: center; padding: 28px 12px; font-size: 0.84rem; line-height: 1.6; }

.agent-detail-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.62); display: flex; align-items: center; justify-content: center; z-index: 1200; padding: 20px; }
.agent-detail-box { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; max-width: 640px; width: 100%; max-height: 80vh; overflow: auto; }
.agent-detail-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.agent-detail-title { font-weight: 600; font-size: 0.95rem; }
.agent-detail-name { display: flex; align-items: center; gap: 8px; font-size: 1rem; font-weight: 600; margin-bottom: 4px; }
.agent-detail-desc { color: var(--text-secondary); font-size: 0.84rem; line-height: 1.5; }
.agent-detail-tier-note { font-size: 0.78rem; color: var(--text-muted); margin: 10px 0 14px; padding: 8px 10px; border-left: 2px solid var(--accent); background: rgba(255,255,255,0.03); }
.agent-detail-grid { display: grid; grid-template-columns: 150px 1fr; gap: 7px 14px; font-size: 0.8rem; }
.agent-detail-grid .k { color: var(--text-muted); }
.agent-detail-grid .v { color: var(--text); word-break: break-word; }

/* ── Agent trajectories & fleet posture ─────────────────────────────────── */
.agents-posture { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; font-size: 0.78rem; color: var(--text-muted); margin-bottom: 12px; }
.agents-posture strong { color: var(--text); font-weight: 600; }
.agent-posture-alert strong { color: #fbbf24; }

.agent-detail-section-title { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); margin: 16px 0 8px; }
.agent-runs { display: flex; flex-direction: column; gap: 6px; }
.agent-run { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: rgba(255,255,255,0.02); border: 1px solid var(--border); border-radius: 7px; padding: 7px 10px; color: var(--text-secondary); font-size: 0.76rem; cursor: pointer; }
.agent-run:hover { border-color: var(--border-hover); }
.agent-run-status { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.agent-run-status.completed { color: #34d399; }
.agent-run-status.blocked { color: #fbbf24; }
.agent-run-status.failed { color: #f87171; }
.agent-run-status.running { color: #38bdf8; }
.agent-run-trigger { color: var(--text); font-weight: 500; }
.agent-run-time { color: var(--text-muted); }
.agent-run-events { margin-left: auto; color: var(--text-muted); }

.agent-trajectory-head { display: flex; align-items: center; gap: 10px; font-size: 0.76rem; color: var(--text-muted); margin-bottom: 6px; }
.agent-event { display: flex; align-items: center; gap: 9px; padding: 5px 9px; border-left: 2px solid var(--border); font-size: 0.74rem; color: var(--text-secondary); }
.agent-event-seq { color: var(--text-muted); min-width: 20px; font-variant-numeric: tabular-nums; }
.agent-event-kind { font-weight: 600; text-transform: uppercase; font-size: 10px; letter-spacing: 0.04em; }
.agent-event-tool { color: var(--text); }
.agent-event-decision { font-weight: 600; }
.agent-event-decision.allow, .agent-event-decision.approved { color: #34d399; }
.agent-event-decision.deny, .agent-event-decision.blocked { color: #f87171; }
.agent-event-decision.ask { color: #fbbf24; }
.agent-event-reason { color: var(--text-muted); }
.agent-event-intent { border-left-color: var(--accent); }
.agent-event-tool { border-left-color: #38bdf8; }
.agent-event-blocked { border-left-color: #f87171; }
.agent-event-decision { border-left-color: #fbbf24; }
.agent-event-output { border-left-color: #34d399; }
