/* BRAIN aOS - Mercury Flow / Split Canvas */
:root {
  --ink: #000000;
  --carbon: #181818;
  --paper: #ffffff;
  --paper-2: #fafafa;
  --hairline: #ebebeb;
  --hairline-dark: #242424;
  --ash: #6d6d6d;
  --smoke: #9a9a9a;
  --mercury-green: #a0e0ab;
  --mercury-orange: #ffac2e;
  --mercury-red: #a52d25;
  --mercury-gradient: linear-gradient(135deg, #a0e0ab, #ffac2e, #a52d25);
  /* legacy token names kept so unswept inline styles don't break */
  --bg: var(--paper); --bg-2: var(--paper-2); --bg-3: #f4f4f4;
  --panel: var(--paper); --border: var(--hairline); --border-2: #dedede;
  --text: var(--carbon); --text-2: #333333; --muted: var(--ash); --muted-2: var(--smoke);
  --accent: var(--carbon); --accent-light: var(--paper-2); --accent-mid: var(--hairline);
  --good: var(--mercury-green); --bad: var(--mercury-red); --warn: var(--mercury-orange);
  --status-todo-bg: var(--bg-3);
  --status-todo-fg: var(--ash);
  --status-todo-border: var(--hairline);
  --status-progress-bg: rgba(255, 172, 46, 0.14);
  --status-progress-fg: var(--carbon);
  --status-progress-border: rgba(255, 172, 46, 0.38);
  --status-review-bg: var(--paper-2);
  --status-review-fg: var(--carbon);
  --status-review-border: var(--border-2);
  --status-done-bg: rgba(160, 224, 171, 0.22);
  --status-done-fg: var(--carbon);
  --status-done-border: rgba(160, 224, 171, 0.55);
  --radius: 2px; --radius-card: 4px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --shadow-sm: none;
  --shadow: none;
  --shadow-pop: 0 8px 30px rgba(0,0,0,0.12);
  /* Page vs raised panels — keeps cards and fields scannable on long views */
  --surface-page: #f3f3f3;
  --surface-raised: #ffffff;
  --border-input: #c9c9c9;
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.07), 0 0 0 1px rgba(0, 0, 0, 0.04);
  --shadow-input: 0 1px 2px rgba(0, 0, 0, 0.06);
  --focus-ring: 0 0 0 2px rgba(24, 24, 24, 0.12);
  --sidebar-w: 232px;
  font-synthesis: none;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--paper);
  color: var(--carbon);
  font: 300 14px/1.5 'Inter', -apple-system, system-ui, sans-serif;
}
a { color: var(--carbon); text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3 { font-weight: 300; letter-spacing: -0.01em; }
.mono-label, .eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ash);
}
.eyebrow { display: block; margin-bottom: 4px; }
.icon { flex-shrink: 0; stroke-width: 1.6; }

/* ── Layout ── */
#root { height: 100%; }
.app-shell { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ── */
.sidebar { width: var(--sidebar-w); flex-shrink: 0; background: var(--ink); border-right: none; display: flex; flex-direction: column; overflow: hidden; }
.sidebar-header { padding: 20px 16px 16px; border-bottom: 1px solid var(--hairline-dark); flex-shrink: 0; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; letter-spacing: 0.1em; color: #fff; }
.brand .aos { font-weight: 400; }
.brand-icon { width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sidebar-workspace { margin-top: 8px; min-width: 0; }
.workspace-name { font-family: var(--mono); font-size: 9px; letter-spacing: 0.15em; text-transform: uppercase; color: var(--ash); margin-top: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.workspace-company { font-size: 11px; color: var(--smoke); margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar .company-switcher {
  margin-top: 6px;
  width: 100%;
  font-size: 12px;
  font-weight: 400;
  padding: 6px 26px 6px 8px;
  border-radius: 2px;
  border: 1px solid var(--hairline-dark);
  background: var(--carbon) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a8a29e' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 7px center;
  color: #fff;
  cursor: pointer;
  appearance: none;
}
.sidebar .company-switcher:hover { border-color: var(--ash); background-color: rgba(255,255,255,0.06); }
.sidebar .company-switcher:focus { outline: 1px solid var(--mercury-orange); outline-offset: 0; }
.sidebar .company-switcher:disabled { opacity: 0.55; cursor: wait; }
.sidebar .company-switcher option { background: var(--ink); color: #fff; }
.company-switcher { width: 100%; font-size: 13px; font-weight: 500; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-2); color: var(--text); cursor: pointer; }
.company-switcher:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.company-badge { display: inline-block; font-size: 10px; font-weight: 600; color: var(--muted); margin-right: 4px; padding: 1px 5px; border-radius: 4px; background: var(--paper-2); vertical-align: middle; }
.settings-team-card-muted { opacity: 0.72; }
.nav { padding: 10px 8px; flex: 1; overflow-y: auto; }
.nav-section { margin-bottom: 22px; }
.nav-label { font-family: var(--mono); font-size: 9px; font-weight: 400; color: var(--ash); letter-spacing: 0.2em; text-transform: uppercase; padding: 0 8px; margin-bottom: 6px; }
.nav-item { display: flex; align-items: center; gap: 9px; padding: 6px 10px; border-left: 2px solid transparent; border-radius: 0; font-size: 13px; font-weight: 300; color: var(--smoke); cursor: pointer; user-select: none; transition: color 0.1s, background 0.1s; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,0.04); }
.nav-item.active { background: var(--carbon); border-left-color: var(--mercury-orange); color: #fff; font-weight: 400; }
.nav-item .ic { width: 18px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.nav-badge { margin-left: auto; font-family: var(--mono); font-size: 9px; font-weight: 400; padding: 1px 6px; border-radius: 2px; background: var(--mercury-orange); color: var(--ink); }
.connector-dot { width: 6px; height: 6px; border-radius: 50%; margin-left: auto; flex-shrink: 0; }
.connector-dot.connected { background: var(--mercury-green); }
.connector-dot.disconnected { background: transparent; border: 1px solid var(--ash); }
.sidebar-footer { border-top: 1px solid var(--hairline-dark); padding: 12px; flex-shrink: 0; }
.sidebar-footer .member-name { color: #fff; }
.sidebar-footer .member-role { font-family: var(--mono); font-size: 9px; letter-spacing: 0.15em; text-transform: uppercase; color: var(--ash); }
.sidebar-footer .avatar { background: var(--carbon); color: #fff; border: 1px solid var(--hairline-dark); border-radius: 2px; }
.sidebar-footer .btn-ghost { color: var(--smoke); border-color: var(--hairline-dark); }

.member-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; }
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.avatar.sm { width: 22px; height: 22px; font-size: 9px; }
.avatar.lg { width: 36px; height: 36px; font-size: 14px; }
.member-info { flex: 1; min-width: 0; }
.member-name { font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-role { font-size: 10px; color: var(--muted); }

/* ── Main area ── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; background: var(--paper); }
.topbar {
  box-sizing: border-box;
  min-height: 56px;
  height: auto;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-end;
  padding: 6px 20px 14px;
  gap: 12px;
  flex-shrink: 0;
  background: var(--bg);
}
.page-title { font-size: 24px; font-weight: 300; letter-spacing: -0.01em; flex: 1; }
.topbar-title-group {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  flex: 1;
  gap: 3px;
  min-width: 0;
}
.topbar .page-title,
.topbar-title-group .page-title {
  flex: 0 0 auto;
  line-height: 1.2;
  margin: 0;
  padding: 0;
}
.topbar .eyebrow { margin-bottom: 0; }
.content { flex: 1; overflow-y: auto; padding: 20px; background: var(--surface-page); }

/* ── Buttons ── */
.btn {
  font: inherit;
  cursor: pointer;
  border-radius: 2px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.12s;
  border: 1px solid transparent;
}
.btn-primary { background: var(--carbon); color: #fff; }
.btn-primary:hover { background: #000; }
.btn-ghost { background: transparent; color: var(--carbon); border-color: var(--border-2); }
.btn-ghost:hover { border-color: var(--carbon); background: var(--bg-3); }
.btn-danger { background: #d63b30; color: #fff; border-color: transparent; }
.btn-danger:hover { background: #c42f25; filter: none; }
.btn-danger-soft { background: rgba(214,59,48,0.08); color: #c42f25; border-color: rgba(214,59,48,0.35); }
.btn-danger-soft:hover { background: #d63b30; color: #fff; border-color: transparent; }
.btn-warn { background: rgba(255,172,46,0.14); color: #a86a00; border-color: rgba(255,172,46,0.5); }
.btn-warn:hover { background: #ffac2e; color: var(--carbon); border-color: transparent; }
.btn-info { background: rgba(74,127,201,0.1); color: #2a5da8; border-color: rgba(74,127,201,0.4); }
.btn-info:hover { background: #4a7fc9; color: #fff; border-color: transparent; }
.btn-good { background: #5dd879; color: var(--carbon); border-color: transparent; }
.btn-good:hover { background: #4ecf6e; filter: none; }
.btn-sm { padding: 4px 9px; font-size: 12px; }

/* ── Form elements ── */
input, select, textarea {
  font: inherit;
  font-weight: 300;
  background: var(--surface-raised);
  border: 1px solid var(--border-input);
  color: var(--text);
  padding: 8px 11px;
  border-radius: 3px;
  width: 100%;
  transition: border-color 0.12s, box-shadow 0.12s;
  box-shadow: var(--shadow-input);
}
input::placeholder, textarea::placeholder {
  color: var(--ash);
  opacity: 1;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--carbon);
  box-shadow: var(--shadow-input), var(--focus-ring);
}
input[type="checkbox"], input[type="radio"] { width: auto; padding: 0; margin: 0; flex-shrink: 0; accent-color: var(--carbon); }
label { font-size: 12px; font-weight: 500; color: var(--text-2); display: block; margin-bottom: 4px; }
.form-group { margin-bottom: 14px; }

/* ── Cards ── */
.card {
  background: var(--surface-raised);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 16px;
}
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }

/* ── Project detail ── */
.proj-detail-wrap { max-width: none; width: 100%; }
.proj-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 16px;
  align-items: start;
  margin-top: 4px;
}
.proj-detail-main { min-width: 0; }
.proj-detail-tasks {
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding: 14px 14px 12px;
  margin-bottom: 0;
}
.proj-detail-tasks-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
}
.proj-detail-tasks-count {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  font-family: var(--mono);
}
.proj-detail-tasks-empty,
.proj-detail-tasks-loading {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
  margin: 0 0 8px;
}
.proj-detail-tasks .kanban-board-stack {
  flex-direction: column;
  overflow-x: visible;
  gap: 10px;
  padding-bottom: 0;
}
.proj-detail-tasks .kanban-board-stack .kanban-col {
  min-width: 0;
  width: 100%;
  flex: none;
}
@media (max-width: 960px) {
  .proj-detail-layout { grid-template-columns: 1fr; }
  .proj-detail-tasks {
    position: static;
    max-height: none;
  }
}
.proj-overview-shell { max-width: 100%; width: 100%; margin-bottom: 16px; }
.proj-overview-card { padding: 16px 20px; }
.proj-overview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.proj-overview-title { min-width: 0; flex: 1 1 180px; }
.proj-overview-name { font-size: 18px; font-weight: 700; line-height: 1.25; }
.proj-overview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
  max-width: 100%;
}
.proj-overview-goal { margin-bottom: 14px; }
.proj-overview-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.proj-overview-goal-text { font-size: 13px; color: var(--text-2); line-height: 1.45; }
.proj-overview-section { margin-bottom: 14px; }
.proj-teams-section { margin-bottom: 16px; }
.proj-teams-split {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(280px, 1.15fr);
  gap: 20px 28px;
  align-items: start;
}
@media (max-width: 680px) {
  .proj-teams-split { grid-template-columns: 1fr; }
}
.proj-teams-left { min-width: 0; }
.proj-teams-right { min-width: 0; }
.proj-teams-members-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.proj-teams-members-head .proj-overview-label { margin-bottom: 0; }
.proj-teams-members-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: var(--bg-2);
  border-radius: 10px;
  padding: 2px 8px;
}
.proj-teams-members {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 12px;
  max-height: 300px;
  overflow-y: auto;
  min-height: 72px;
  background: var(--paper-2);
}
.proj-teams-members .proj-item:last-child,
.proj-teams-members [data-proj-person-row]:last-child { border-bottom: none; }
.proj-teams-members-empty { font-size: 12px; color: var(--muted); padding: 14px 0; text-align: center; }
.proj-overview-hint { font-size: 11px; color: var(--muted); margin: 0 0 8px; line-height: 1.45; }
.proj-teams-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.proj-teams-empty { font-size: 12px; color: var(--muted); }
.proj-team-add {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
  width: 100%;
}
.proj-team-assign-row,
.proj-person-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.proj-team-assign-row select,
.proj-person-search-row .proj-person-search {
  flex: 1;
  min-width: 0;
  height: 36px;
  box-sizing: border-box;
}
.proj-team-assign-row select {
  font-size: 12px;
}
.proj-person-add-section {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
}
.proj-team-field {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.proj-team-field select {
  flex: 1;
  min-width: 0;
  font-size: 12px;
}
.proj-team-action {
  min-width: 72px;
  width: 72px;
  height: 36px;
  flex-shrink: 0;
  justify-content: center;
  align-self: stretch;
  padding: 0 8px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  box-sizing: border-box;
}
.proj-person-search {
  width: 100%;
  max-width: none;
  font-size: 12px;
  margin: 0;
}
.proj-person-picker-list {
  margin-top: 8px;
  min-height: 220px;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--paper-2);
  padding: 6px;
  width: 100%;
}
.proj-person-picker-idle,
.proj-person-picker-list .settings-team-picker-empty {
  font-size: 12px;
  color: var(--muted);
  padding: 24px 12px;
  text-align: center;
}
.proj-person-picker-list .msp-pick {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  text-align: left;
  margin: 2px 0;
  padding: 8px 10px;
  border-radius: 4px;
  height: auto;
}
.proj-person-picker-list .msp-pick.selected {
  background: var(--bg-2);
  outline: 1px solid var(--accent);
}
.msp-pick-role { font-size: 11px; color: var(--muted); font-weight: 400; }
.proj-person-filter {
  width: 100%;
  max-width: none;
  font-size: 12px;
  margin: 0 0 8px;
}
.proj-teams-right .proj-person-filter { margin-bottom: 8px; }
.proj-overview-progress { margin-bottom: 4px; }
.proj-overview-progress-head {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}
.proj-overview-meta { margin-top: 10px; font-size: 11px; color: var(--muted); }

/* ── Progress bar ── */
.progress { height: 2px; background: var(--hairline); border-radius: 2px; margin-top: 6px; }
.progress-fill { height: 100%; border-radius: 2px; background: var(--carbon); transition: width 0.3s; }
.progress-indeterminate {
  width: 40% !important;
  animation: progress-indeterminate 1.4s ease-in-out infinite;
}
@keyframes progress-indeterminate {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}
.ui-spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: ui-spin 0.7s linear infinite;
  flex-shrink: 0;
}
.ui-spinner-sm { width: 14px; height: 14px; border-width: 2px; }
@keyframes ui-spin { to { transform: rotate(360deg); } }
.ui-loading-block {
  display: flex; align-items: center; gap: 12px;
  padding: 28px 16px; font-size: 13px; color: var(--muted);
}
.page-loading-host { padding: 8px 0; }
.sync-progress-banner {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.sync-progress-inner {
  display: flex; align-items: flex-start; gap: 14px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-card); padding: 20px 22px; max-width: 420px; width: 100%;
  box-shadow: var(--shadow-pop);
}
.sync-progress-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.sync-progress-detail { font-size: 12px; color: var(--muted); line-height: 1.45; margin-bottom: 10px; }
.sync-progress-bar { margin-top: 4px; height: 5px; overflow: hidden; }

/* ── Tags / chips ── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 2px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid var(--hairline);
  color: var(--ash);
}
.chip.accent { color: var(--carbon); border-color: var(--border-2); }
.chip.good { color: var(--mercury-green); border-color: var(--hairline); }
.chip.warn { color: var(--mercury-orange); border-color: var(--hairline); }
.chip.bad { color: var(--mercury-red); border-color: var(--hairline); }

/* ── Auth screen ── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  padding: 24px;
}
.auth-box {
  position: relative;
  background: var(--carbon);
  border: 1px solid var(--hairline-dark);
  border-radius: var(--radius-card);
  padding: 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-pop);
  color: #fff;
  overflow: hidden;
}
.auth-box::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--mercury-gradient);
}
.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  text-align: center;
}
.auth-brand-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-brand-title { font-size: 16px; font-weight: 600; letter-spacing: 0.1em; color: #fff; }
.auth-brand-title .aos { font-weight: 400; }
.auth-brand-sub {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--smoke);
}
.auth-tabs { display: flex; border-bottom: 1px solid var(--hairline-dark); margin-bottom: 20px; }
.auth-tab {
  flex: 1;
  padding: 8px;
  text-align: center;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ash);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.auth-tab.active { color: #fff; border-bottom-color: var(--mercury-orange); }
.auth-box input, .auth-box select, .auth-box textarea {
  background: #101010;
  border: 1px solid var(--hairline-dark);
  color: #fff;
}
.auth-box input:focus, .auth-box select:focus, .auth-box textarea:focus {
  border-color: var(--smoke);
}
.auth-box label { color: var(--smoke); }
.auth-box .btn-primary { background: #fff; color: var(--ink); }
.auth-box .btn-primary:hover { background: var(--mercury-orange); color: var(--ink); }
.auth-box .btn-ghost { color: var(--smoke); border-color: var(--hairline-dark); }
.auth-box .btn-ghost:hover { color: #fff; border-color: var(--smoke); background: rgba(255,255,255,0.04); }
.auth-box .card { background: #101010; border-color: var(--hairline-dark); color: #fff; }
.auth-error { background: rgba(165,45,37,0.12); border: 1px solid var(--mercury-red); color: var(--mercury-red); border-radius: 2px; padding: 8px 12px; font-size: 12px; margin-bottom: 12px; }

/* ── Knowledge graph page ── */
.graph-page { flex: 1; display: flex; overflow: hidden; position: relative; }
.graph-canvas { flex: 1; background: var(--bg-2); position: relative; overflow: hidden; }
.graph-legend {
  position: absolute;
  bottom: 14px;
  left: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 10px 12px;
  box-shadow: var(--shadow-sm);
  z-index: 10;
}
.legend-row { display: flex; align-items: center; gap: 6px; font-size: 10px; color: var(--muted); margin-bottom: 4px; }
.legend-row:last-child { margin-bottom: 0; }

/* Detail panel (graph) */
.detail-panel {
  width: 290px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.detail-panel-header { padding: 16px; border-bottom: 1px solid var(--border); }
.detail-type {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.6px;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.detail-title { font-size: 15px; font-weight: 600; }
.detail-body { flex: 1; overflow-y: auto; padding: 14px 16px; }
.detail-section { margin-bottom: 16px; }
.detail-section-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted-2);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.detail-text { font-size: 12px; color: var(--text-2); line-height: 1.5; }

/* ── Brain chat ── */
.chat-page { flex: 1; display: flex; overflow: hidden; }
.chat-sidebar {
  width: 210px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-2);
}
.chat-sidebar-header { padding: 12px; border-bottom: 1px solid var(--border); }
.chat-sessions { flex: 1; overflow-y: auto; padding: 6px; }
.chat-session-item {
  padding: 7px 9px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-session-item:hover { background: var(--bg-3); }
.chat-session-item.active { background: var(--accent-light); color: var(--accent); }
.chat-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 18px; }
.msg { display: flex; gap: 10px; max-width: 82%; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg-av {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  background: var(--accent-light);
  border: 1px solid var(--accent-mid);
}
.msg-av.user { background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; border: none; }
.msg-bubble {
  padding: 10px 14px;
  font-size: 13.5px;
  line-height: 1.55;
  border-radius: 4px;
  background: var(--paper);
  border: 1px solid var(--border);
  color: var(--text-2);
}
.msg.user .msg-bubble {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 4px;
}
.msg-bubble.chat-answer .chat-p { margin: 0 0 8px; }
.msg-bubble.chat-answer .chat-p:last-child { margin-bottom: 0; }
.msg-bubble.chat-answer .chat-h { font-weight: 600; color: var(--text); margin: 10px 0 6px; }
.msg-bubble.chat-answer .chat-ol,
.msg-bubble.chat-answer .chat-ul { margin: 6px 0 8px 1.25em; padding: 0; }
.msg-bubble.chat-answer .chat-ol > li,
.msg-bubble.chat-answer .chat-ul > li { margin: 5px 0; line-height: 1.5; }
.msg-bubble.chat-answer .chat-ol .chat-ul { margin: 4px 0 2px 1em; }
.msg-bubble.chat-answer .cite-ref { font-size: 10px; color: var(--accent); font-weight: 600; margin-left: 2px; }
.chat-callout { font-size: 12px; line-height: 1.45; margin-top: 8px; padding: 8px 10px; border-radius: 6px; border: 1px solid var(--border); background: var(--paper-2); color: var(--text); }
.chat-callout-warn { border-color: rgba(165, 45, 37, 0.25); background: rgba(165, 45, 37, 0.06); color: var(--text); }
.conclusion-card .chat-p,
.conclusion-card .chat-ol,
.conclusion-card .chat-ul { font-size: 13px; }
.citations { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.citation-chip { background: transparent; border: 1px solid var(--hairline); color: var(--ash); font-family: var(--mono); font-size: 9px; font-weight: 400; letter-spacing: 0.1em; text-transform: uppercase; padding: 2px 7px; border-radius: 2px; }
.citation-link { cursor: pointer; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 2px; }
.citation-link:hover { filter: brightness(0.92); }

/* What-if structured breakdown (feature 10.3) */
.wa-summary { font-weight: 500; }
.wa-assumptions { font-size: 11px; color: var(--muted); margin-top: 6px; }
.wa-section { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
.wa-section-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 6px; }
.wa-subtitle { font-size: 11px; font-weight: 600; color: var(--muted); margin: 6px 0 2px; }
.wa-note { font-size: 11px; color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: 0; }
.wa-effects { margin: 0; padding-left: 18px; font-size: 13px; }
.wa-effects li { margin: 3px 0; }
.wa-via { font-size: 11px; color: var(--muted); }
.wa-scenarios { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.wa-scenario { border: 1px solid var(--border); border-radius: var(--radius-card); padding: 8px 10px; font-size: 12.5px; background: var(--bg-2); }
.wa-scenario-head { font-weight: 600; font-size: 12px; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.wa-chip { font-family: var(--mono); font-size: 9px; font-weight: 400; letter-spacing: 0.1em; padding: 1px 7px; border-radius: 2px; text-transform: uppercase; background: transparent; border: 1px solid var(--hairline); }
.wa-low { color: var(--mercury-green); }
.wa-medium { color: var(--mercury-orange); }
.wa-high { color: var(--mercury-red); }
.wa-table { border-collapse: collapse; width: 100%; font-size: 12px; }
.wa-table th { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--border); color: var(--muted); font-weight: 600; }
.wa-table td { padding: 5px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.wa-delta { font-weight: 600; white-space: nowrap; }
.wa-down { color: var(--mercury-red); }
.wa-up { color: var(--mercury-green); }
.wa-risk { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; margin: 5px 0; }
.wa-risk .wa-chip { margin-top: 2px; flex-shrink: 0; }
.wa-uncertainty { margin-top: 10px; font-size: 12px; color: var(--muted); font-style: italic; }
.chat-input-area { border-top: 1px solid var(--border); padding: 14px 20px; }
.chat-input-row {
  display: flex;
  align-items: center;
  background: var(--surface-raised);
  border: 1px solid var(--border-input);
  border-radius: 24px;
  padding: 5px 5px 5px 16px;
  gap: 8px;
  transition: border-color 0.12s, box-shadow 0.12s;
  box-shadow: var(--shadow-input);
}
.chat-input-row:focus-within { border-color: var(--carbon); box-shadow: var(--shadow-input), var(--focus-ring); }
.chat-input-row input { flex: 1; border: none; background: transparent; color: var(--text); outline: none; font-size: 13.5px; padding: 4px 0; width: auto; box-shadow: none; }
.chat-input-row input:focus { box-shadow: none; }
.chat-input-row input::placeholder { color: var(--ash); }
.send-btn {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background 0.12s;
}
.send-btn:hover { background: #000; }

/* ── Reasoning chain (Brain Chat Chain / What-If modes) ── */
.chat-mode { display: flex; gap: 6px; margin-bottom: 10px; }
.chat-mode-btn {
  font-size: 11px; font-weight: 500; padding: 4px 10px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg-2); color: var(--muted); cursor: pointer;
}
.chat-mode-btn:hover { border-color: var(--border-2); color: var(--text-2); }
.chat-mode-btn.active { background: var(--accent-light); border-color: var(--accent-mid); color: var(--accent); }
.chain-wrap { margin-bottom: 10px; display: flex; flex-direction: column; }
.chain-step {
  border-left: 3px solid var(--accent-mid); background: var(--bg-2);
  border-radius: 0 var(--radius-card) var(--radius-card) 0; padding: 8px 12px;
  animation: chainStepIn .35s ease both;
}
@keyframes chainStepIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.chain-badge { font-weight: 600; font-size: 11px; color: var(--accent); }
.chain-reason { color: var(--text-2); font-size: 12.5px; margin-top: 4px; line-height: 1.5; }
.chain-results { margin: 6px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 3px; }
.chain-results li { font-size: 12px; color: var(--text-2); }
.chain-type {
  display: inline-block; font-size: 10px; font-weight: 600; color: var(--accent);
  background: var(--accent-light); padding: 1px 5px; border-radius: 3px; margin-right: 5px;
}
.chain-meta { color: var(--muted); font-size: 11px; margin-left: 5px; }
.chain-arrow {
  text-align: center; color: var(--muted-2); font-size: 14px; line-height: 1; margin: 3px 0;
  animation: chainArrowPulse 1.4s ease-in-out infinite;
}
@keyframes chainArrowPulse { 0%, 100% { opacity: .35; transform: translateY(0); } 50% { opacity: 1; transform: translateY(2px); } }
.chain-graph-mini {
  width: 100%; height: 200px; margin: 8px 0; background: var(--paper);
  border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden;
}
.conclusion-card {
  background: var(--accent-light); border: 1px solid var(--accent-mid); border-radius: var(--radius-card);
  padding: 12px 14px; font-size: 13.5px; line-height: 1.55; color: var(--text);
}
.synth-warn {
  background: var(--paper-2); border: 1px solid var(--hairline); border-radius: var(--radius); color: var(--mercury-orange);
  font-size: 12px; padding: 6px 10px; margin-bottom: 10px;
}
.confidence-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.confidence-label { font-size: 11px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.confidence-bar { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.confidence-fill { height: 100%; background: linear-gradient(90deg, var(--mercury-red), var(--mercury-orange), var(--mercury-green)); border-radius: 3px; transition: width .6s ease; }

/* ── Tasks ── */
.tasks-page { width: 100%; }
.tasks-toolbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 12px 14px;
  background: var(--surface-raised);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}
.tasks-toolbar-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  width: 100%;
}
.tasks-search {
  width: 100%;
  max-width: none;
  margin-bottom: 0;
}
.tasks-filter-tabs,
.tasks-view-tabs { margin-bottom: 0; flex: 1; min-width: 0; }
.tasks-view-tabs { justify-content: flex-end; }
.tasks-sections { display: flex; flex-direction: column; gap: 22px; }
.tasks-section-head {
  display: flex;
  align-items: center;
  padding: 0 2px 10px;
  margin-bottom: 4px;
}
.task-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: 0;
  text-transform: none;
}
.task-status-badge[data-status="todo"] {
  background: var(--status-todo-bg);
  color: var(--status-todo-fg);
  border-color: var(--status-todo-border);
}
.task-status-badge[data-status="in_progress"] {
  background: var(--status-progress-bg);
  color: var(--status-progress-fg);
  border-color: var(--status-progress-border);
}
.task-status-badge[data-status="in_review"] {
  background: var(--status-review-bg);
  color: var(--status-review-fg);
  border-color: var(--status-review-border);
}
.task-status-badge[data-status="done"] {
  background: var(--status-done-bg);
  color: var(--status-done-fg);
  border-color: var(--status-done-border);
}
.task-status-badge-count {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.06em;
  opacity: 0.9;
  font-variant-numeric: tabular-nums;
}
.tasks-section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 20px;
}
.tasks-section-empty {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--muted);
  padding: 6px 2px;
}
.tasks-section[data-task-section="done"] .tasks-section-grid { opacity: 0.92; }
@media (max-width: 900px) {
  .tasks-section-grid { grid-template-columns: 1fr; }
}
.tasks-list {
  border-top: 1px solid var(--hairline);
}
.tasks-section.drag-over .tasks-section-grid {
  outline: 2px dashed var(--carbon);
  outline-offset: 2px;
  border-radius: var(--radius);
  min-height: 44px;
}
.task-item[draggable="true"] { cursor: grab; }
.task-item[draggable="true"]:active { cursor: grabbing; }
.task-item.dragging { opacity: 0.45; }

.task-item {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) minmax(64px, 88px) 52px 50px 22px;
  align-items: center;
  column-gap: 8px;
  padding: 2px 0;
  min-height: 28px;
  border-bottom: 1px solid var(--bg-3);
  overflow: hidden;
}
.task-item:last-child { border-bottom: none; }
.task-item.is-done { opacity: 0.7; }
.task-col { min-width: 0; display: flex; align-items: center; }
.task-col-status { justify-content: flex-start; }
.task-col-title {
  justify-content: flex-start;
  overflow: hidden;
}
.task-col-project {
  justify-content: flex-start;
  overflow: hidden;
}
.task-col-due {
  justify-content: flex-start;
  white-space: nowrap;
  flex-shrink: 0;
}
.task-col-link {
  justify-content: flex-end;
  flex-shrink: 0;
}
.task-col-assignee {
  justify-content: flex-end;
  flex-shrink: 0;
}
.tasks-section-grid .task-col-link .github-open-link {
  font-size: 10px;
  padding: 1px 5px;
  white-space: nowrap;
}
.task-status-select {
  width: 100%;
  max-width: 108px;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 6px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  flex-shrink: 0;
  cursor: pointer;
}
.task-status-select[data-status="todo"] {
  background: var(--status-todo-bg);
  color: var(--status-todo-fg);
  border-color: var(--status-todo-border);
}
.task-status-select[data-status="in_progress"] {
  background: var(--status-progress-bg);
  color: var(--status-progress-fg);
  border-color: var(--status-progress-border);
}
.task-status-select[data-status="in_review"] {
  background: var(--status-review-bg);
  color: var(--status-review-fg);
  border-color: var(--status-review-border);
}
.task-status-select[data-status="done"] {
  background: var(--status-done-bg);
  color: var(--status-done-fg);
  border-color: var(--status-done-border);
}
.task-status-select.task-status-compact { max-width: 108px; }
.task-title-inner {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  width: 100%;
}
.task-jira-key {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--carbon);
  flex-shrink: 0;
}
.task-text {
  flex: 1;
  font-size: 12px;
  line-height: 1.25;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.task-text.done { color: var(--muted); text-decoration: line-through; }
.task-meta { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.task-project {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ash);
  background: transparent;
  border: 1px solid var(--hairline);
  padding: 1px 4px;
  border-radius: 2px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.task-due { font-size: 9px; color: var(--bad); font-weight: 500; white-space: nowrap; display: block; }
.task-due.ok { color: var(--muted); }
.tasks-list .avatar.sm,
.tasks-section-grid .avatar.sm { width: 18px; height: 18px; font-size: 8px; }
.tasks-page .kanban-board { margin-top: 4px; }
.tasks-page .kanban-col { min-width: 200px; }
.tasks-page .kanban-col-head-badge {
  margin-bottom: 10px;
  padding: 0;
}
.tasks-page .kanban-col-head-badge .task-status-badge { width: 100%; justify-content: space-between; }

/* ── Kanban (project tasks) ── */
.kanban-board { display: flex; gap: 10px; align-items: flex-start; overflow-x: auto; padding-bottom: 4px; }
.kanban-col { flex: 1; min-width: 170px; background: var(--surface-raised); border: 1px solid var(--border-2); border-radius: var(--radius-card); padding: 8px; box-shadow: var(--shadow-input); }
.kanban-col.drag-over { border-color: var(--carbon); background: var(--paper-2); }
.kanban-col-head { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; padding: 0 2px; }
.kanban-col-body { display: flex; flex-direction: column; gap: 6px; min-height: 36px; }
.kanban-card { background: var(--surface-raised); border: 1px solid var(--border-2); border-radius: var(--radius-card); padding: 8px 10px; cursor: pointer; box-shadow: var(--shadow-input); }
.kanban-card:hover { border-color: var(--carbon); }
.kanban-card[draggable="true"] { cursor: grab; }
.kanban-card.dragging { opacity: 0.45; }
.kanban-card-title { font-size: 12px; font-weight: 500; margin-bottom: 6px; word-break: break-word; }
.kanban-card-title code { font-size: 10px; color: var(--accent); }
.kanban-card-meta { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.kanban-unassigned { opacity: 0.6; font-style: italic; }

/* ── Tabs ── */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--hairline); padding-bottom: 2px; }
.tab-btn { font-size: 12px; padding: 6px 12px 12px; border-radius: 0; background: transparent; color: var(--smoke); cursor: pointer; border: none; border-bottom: 2px solid transparent; font-weight: 400; margin-bottom: -1px; }
.tab-btn:hover { color: var(--carbon); }
.tab-btn.active { background: transparent; color: var(--carbon); border-bottom-color: var(--carbon); font-weight: 400; }

/* ── Settings ── */
.settings-panel { margin-top: 4px; }
.settings-tabs { flex-wrap: wrap; }
.settings-section { margin-bottom: 28px; }
.settings-section-title { font-size: 14px; font-weight: 600; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.settings-section-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.settings-section-title-row .settings-input { max-width: 220px; margin: 0; flex: 1 1 160px; }
.settings-input {
  display: block; width: 100%; max-width: 360px;
  margin-bottom: 8px; padding: 8px 10px;
  border: 1px solid var(--border-input); border-radius: 3px;
  font-size: 13px; background: var(--surface-raised); color: var(--text);
  box-shadow: var(--shadow-input);
}
.settings-form-err { font-size: 12px; color: var(--bad); min-height: 18px; margin-bottom: 8px; }
.codeblock { font-family: var(--mono); font-size: 12px; background: var(--paper-2); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 10px 12px; overflow-x: auto; color: var(--carbon); }

/* ── Modals ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(0, 0, 0, 0.45);
}
.modal-panel {
  background: var(--surface-raised);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-pop);
  max-width: 720px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-pop);
}
.modal-panel-narrow { max-width: 480px; }
.modal-panel-wide { max-width: 820px; width: min(96vw, 820px); }
.modal-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 18px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.modal-title { margin: 0; font-size: 16px; font-weight: 600; }
.modal-subtitle { margin: 4px 0 0; font-size: 12px; color: var(--muted); line-height: 1.45; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; min-height: 0; }
.modal-footer {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 14px 20px; border-top: 1px solid var(--border); background: var(--bg-2); flex-shrink: 0;
}
.modal-section { margin-bottom: 20px; }
.modal-section:last-child { margin-bottom: 0; }
.modal-section-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted); margin-bottom: 10px;
}
.modal-form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.profile-edit-form .form-group { margin-bottom: 12px; }
.profile-edit-form .form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
}
.profile-edit-form textarea { min-height: 96px; resize: vertical; }
.profile-edit-summary {
  padding: 12px 14px;
  margin-bottom: 18px;
  background: var(--bg-2);
}
.profile-edit-summary-name { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.profile-edit-summary-meta { font-size: 12px; color: var(--muted); }
.modal-seats-banner {
  font-size: 12px; color: var(--text-2);
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-card); padding: 8px 12px; margin-bottom: 16px;
}
.modal-readonly { background: var(--bg-2); color: var(--muted); cursor: default; }
.modal-team-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; min-height: 24px; }
.modal-team-empty { font-size: 12px; color: var(--muted); }
.modal-actions-inline { display: flex; gap: 8px; flex-wrap: wrap; }
.modal-member-list { max-height: 220px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-card); }
.modal-member-row {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13px;
}
.modal-member-row:last-child { border-bottom: none; }
.modal-member-info { flex: 1; min-width: 0; }
.modal-member-name { font-size: 13px; font-weight: 500; }
.modal-member-role {
  font-size: 11px; color: var(--muted); flex-shrink: 0;
  text-align: right; min-width: 96px; max-width: 42%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.modal-member-row .mtmb-rm { flex-shrink: 0; }
.team-manage-section { margin-bottom: 0; }
.team-manage-section.team-manage-add {
  margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border);
}
.team-manage-label { font-size: 12px; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.team-manage-search { width: 100%; max-width: none; margin-bottom: 0; box-sizing: border-box; }
.connector-svc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.connector-svc-option {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-card);
  font-size: 13px; cursor: pointer; background: var(--panel); margin: 0;
}
.connector-svc-option input { margin: 0; flex-shrink: 0; width: 16px; height: 16px; align-self: center; }
.connector-brand-img { object-fit: contain; display: block; flex-shrink: 0; align-self: center; border-radius: 6px; }
.connector-brand-img--wide { width: auto; max-width: 88px; height: 26px; }
.connector-svc-option svg { flex-shrink: 0; display: block; align-self: center; }
.connector-svc-option .connector-brand-img { width: 28px; height: 28px; }
.connector-icon .connector-brand-img { width: 36px; height: 36px; max-width: 36px; max-height: 36px; }
.connector-icon .connector-brand-img--wide { width: auto; max-width: 88px; height: 32px; max-height: 32px; }
.doc-source-badge .connector-brand-img { width: 14px; height: 14px; display: inline-block; vertical-align: middle; }
.doc-source-badge .connector-brand-img--wide { width: auto; max-height: 14px; max-width: 48px; display: inline-block; vertical-align: middle; }
.connector-svc-option span { line-height: 1.4; flex: 1; min-width: 0; }
.connector-scope-section { margin-top: 16px; padding-top: 4px; }
.connector-scope-hint { font-size: 12px; color: var(--muted); margin: 0 0 12px; line-height: 1.5; }
.connector-browse-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.connector-browse-path { flex: 1; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drive-browser, .connector-browse-list { border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; }
.drive-browser-toolbar {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  background: var(--bg-2); border-bottom: 1px solid var(--border); font-size: 12px;
}
.connector-browse-list { max-height: 240px; overflow-y: auto; background: var(--panel); }
.connector-browse-item {
  display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13px; min-height: 44px;
}
.connector-browse-item--dual-action { grid-template-columns: 32px minmax(0, 1fr) auto auto; }
.connector-browse-item:last-child { border-bottom: none; }
.connector-browse-icon { text-align: center; flex-shrink: 0; font-size: 16px; line-height: 1; }
.connector-browse-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.connector-browse-meta { min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.connector-browse-sub { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.connector-browse-item .btn { min-width: 64px; height: 28px; padding: 0 10px; justify-self: end; }
.connector-browse-empty, .connector-added-empty { padding: 16px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.connector-browse-error { padding: 16px; color: var(--bad); font-size: 12px; line-height: 1.5; background: rgba(165,45,37,0.08); border-radius: var(--radius); margin: 8px; }
.connector-added-table-wrap { margin-top: 12px; }
.connector-added-subtitle { margin-top: 14px; font-size: 13px; }
.connector-added-table { border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; }
.connector-added-head {
  display: grid; grid-template-columns: minmax(0, 1.5fr) 80px minmax(0, 1.15fr) minmax(0, 1.15fr) 76px;
  gap: 10px; align-items: center; padding: 8px 12px; font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); background: var(--bg-2);
  border-bottom: 1px solid var(--border);
}
.connector-added-body .connector-added-row {
  display: grid; grid-template-columns: minmax(0, 1.5fr) 80px minmax(0, 1.15fr) minmax(0, 1.15fr) 76px;
  gap: 10px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 12px;
  min-height: 52px;
}
.connector-added-body .connector-added-row:last-child { border-bottom: none; }
.connector-added-name { display: flex; align-items: center; gap: 8px; min-width: 0; height: 100%; }
.connector-added-icon { flex-shrink: 0; font-size: 16px; line-height: 1; }
.connector-added-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.connector-added-access { display: flex; flex-direction: column; gap: 4px; min-width: 0; justify-content: center; }
.connector-added-project { display: flex; align-items: center; min-width: 0; }
.connector-added-row > .chip {
  justify-self: start; height: 24px; display: inline-flex; align-items: center; white-space: nowrap;
}
.connector-added-row > .btn { justify-self: end; min-width: 72px; height: 28px; }
.connector-picker-select,
.connector-added-access .cp-audience,
.connector-added-access .cp-target,
.connector-added-project .cp-project {
  width: 100%; font-size: 12px; height: 32px; padding: 0 8px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--paper-2);
  box-sizing: border-box; color: var(--text);
}
.connector-added-access .cp-target { margin-top: 4px; }
.connector-added-access .cp-target.is-hidden { display: none; }
.upload-access-section { margin-bottom: 16px; }
.upload-access-hint { font-size: 12px; color: var(--muted); margin: 0 0 12px; line-height: 1.5; max-width: none; }
.upload-access-fields { display: flex; flex-direction: column; gap: 8px; }
.upload-access-fields .connector-picker-select { width: 100%; }
@media (min-width: 900px) {
  .upload-access-fields {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px;
  }
  .upload-access-fields .connector-picker-select { flex: 1 1 220px; width: auto; }
  .upload-access-fields .upload-person-picker { flex: 1 1 100%; }
}
.upload-access-fields .settings-input,
.upload-person-picker .settings-input {
  width: 100%; max-width: none; margin-bottom: 0; box-sizing: border-box;
  height: 32px; padding: 0 8px; font-size: 12px; border-radius: var(--radius);
}
.upload-access-fields .is-hidden { display: none; }
.upload-person-picker { display: flex; flex-direction: column; gap: 6px; }
.upload-person-picker .settings-team-picker-list { max-height: 180px; overflow-y: auto; }
.content.content-upload {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}
.upload-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, min(32vw, 440px));
  gap: 20px;
  align-items: start;
  width: 100%;
  max-width: none;
}
@media (max-width: 860px) {
  .upload-layout { grid-template-columns: 1fr; }
}
.upload-main .card,
.upload-aside .card {
  width: 100%;
  box-sizing: border-box;
}
.upload-dropzone {
  border: 2px dashed var(--border-2);
  border-radius: var(--radius-card);
  padding: 36px 28px;
  text-align: center;
  background: var(--surface-page);
  margin-bottom: 14px;
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
}
.upload-dropzone:hover,
.upload-dropzone.is-dragover {
  border-color: var(--accent, #2563eb);
  background: var(--surface-raised);
}
.upload-dropzone-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}
.upload-dropzone-hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 12px;
}
.upload-dropzone-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.upload-formats {
  font-size: 11px;
  color: var(--muted);
  margin-top: 10px;
  line-height: 1.45;
}
.upload-aside-card {
  margin-bottom: 0;
}
.upload-stat {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
  line-height: 1.45;
}
.upload-recent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.upload-recent-title {
  font-size: 13px;
  font-weight: 600;
}
.upload-recent-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: min(70vh, 780px);
  overflow-y: auto;
}
.upload-recent-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  text-align: left;
  font: inherit;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
}
.upload-recent-row:hover {
  background: var(--surface-page);
}
.upload-recent-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upload-recent-meta {
  font-size: 10px;
  color: var(--muted);
  flex-shrink: 0;
}
.upload-sync-card {
  margin-top: 14px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.upload-sync-card .btn { margin-top: 10px; }
.connector-added-access .cp-target[multiple] { min-height: 72px; }
.connector-added-project .cp-projects { min-height: 72px; }
.connector-required { color: var(--bad); font-weight: 700; }
.connector-rule-row {
  padding: 12px; margin-bottom: 8px; font-size: 12px;
  border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--panel);
}
.connector-rule-row-top, .connector-rule-row-mid {
  display: grid; gap: 10px; margin-bottom: 10px;
}
.connector-rule-row-top { grid-template-columns: 1fr 1fr; }
.connector-rule-row-mid { grid-template-columns: 1fr 1fr auto; align-items: end; }
.connector-rule-label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; font-weight: 600; color: var(--muted); }
.connector-rule-label select { font-weight: 400; color: var(--text); font-size: 12px; width: 100%; }
.connector-rule-project { margin-top: 0; }
@media (max-width: 720px) {
  .connector-added-head { display: none; }
  .connector-added-body .connector-added-row { grid-template-columns: 1fr; gap: 8px; min-height: 0; }
  .connector-browse-item,
  .connector-browse-item--dual-action { grid-template-columns: 32px 1fr auto; }
}
.copy-secret-card { background: var(--bg-2); border: 1px solid var(--good); margin-bottom: 0; padding: 14px; border-radius: var(--radius-card); }
.copy-secret-title { font-size: 12px; font-weight: 600; margin-bottom: 6px; color: var(--good); }
.copy-secret-hint { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.wa-chat-list { border: 1px solid var(--hairline); border-radius: 2px; max-height: 220px; overflow: auto; margin-bottom: 14px; }
.wa-chat-row { display: flex; align-items: center; gap: 10px; padding: 7px 10px; margin: 0; font-size: 13px; font-weight: 300; color: var(--text); cursor: pointer; }
.wa-chat-row + .wa-chat-row { border-top: 1px solid var(--hairline); }
.wa-chat-row:hover { background: var(--bg-3); }
.wa-chip-x { cursor: pointer; margin-left: 4px; opacity: 0.6; }
.wa-chip-x:hover { opacity: 1; }
.settings-account-card { margin-bottom: 16px; padding: 16px; }
.settings-account-row { display: flex; gap: 12px; font-size: 13px; margin-bottom: 8px; }
.settings-account-label { width: 110px; color: var(--muted); flex-shrink: 0; }
.settings-users-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.settings-users-title { display: flex; align-items: center; gap: 10px; }
.settings-users-actions { display: flex; gap: 8px; }
.settings-users-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
  padding: 12px 14px;
  background: var(--surface-raised);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}
.settings-search,
.tasks-search,
.people-search,
.ui-search {
  flex: 1;
  min-width: 200px;
  padding: 9px 12px;
  border: 1px solid var(--border-input);
  border-radius: 3px;
  font-size: 13px;
  font-weight: 400;
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: var(--shadow-input);
}
.settings-search:focus,
.tasks-search:focus,
.people-search:focus,
.ui-search:focus {
  border-color: var(--carbon);
  box-shadow: var(--shadow-input), var(--focus-ring);
}
.ui-search-inline {
  width: 200px;
  max-width: min(200px, 40vw);
  padding: 7px 10px;
  font-size: 13px;
}
.settings-role-filters { display: flex; gap: 4px; flex-wrap: wrap; }
.settings-users-table { padding: 0; overflow: hidden; max-height: 62vh; overflow-y: auto; }
.settings-users-head {
  display: grid; grid-template-columns: 1fr 120px 90px 180px; gap: 8px;
  padding: 10px 14px; font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted); background: var(--bg-2);
  border-bottom: 1px solid var(--border);
}
.settings-users-row {
  display: grid; grid-template-columns: 1fr 120px 90px 180px; gap: 8px; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 12px;
}
.settings-users-row:last-child { border-bottom: none; }
.settings-users-member { display: flex; align-items: center; gap: 10px; min-width: 0; }
.settings-users-name { font-size: 13px; font-weight: 500; }
.settings-users-email, .settings-users-meta { font-size: 11px; color: var(--muted); }
.settings-users-login { font-size: 11px; color: var(--muted); }
.settings-users-btns { display: flex; gap: 4px; flex-wrap: wrap; }
.settings-users-btns .btn { padding: 3px 8px; font-size: 11px; }

/* Settings → Teams */
.settings-teams-intro {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
  max-width: 520px;
}
.settings-teams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.settings-teams-empty {
  grid-column: 1 / -1;
  padding: 28px 20px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}
.settings-team-card {
  display: flex;
  flex-direction: column;
  min-height: 148px;
  background: var(--surface-raised);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.settings-team-card:hover { border-color: var(--carbon); box-shadow: var(--shadow-card), 0 4px 14px rgba(0, 0, 0, 0.08); }
.settings-team-card-open {
  flex: 1;
  display: block;
  width: 100%;
  padding: 16px 16px 10px;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.settings-team-card-open:hover { background: var(--bg-2); }
.settings-team-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.settings-team-card-desc {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.settings-team-card-meta {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}
.settings-team-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
}
.settings-team-card-foot .btn { font-size: 12px; flex-shrink: 0; }
.settings-team-back { margin-bottom: 12px; }
.settings-team-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.settings-team-detail-name { margin: 0; font-size: 20px; font-weight: 600; }
.settings-team-detail-meta { margin: 6px 0 0; font-size: 12px; color: var(--muted); line-height: 1.45; }
.settings-team-detail-actions { display: flex; gap: 6px; flex-shrink: 0; }
.settings-team-members { padding: 0; overflow: hidden; }
.settings-team-members-head {
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
}
.settings-team-member-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.settings-team-member-row:last-child { border-bottom: none; }
.settings-team-member-info { flex: 1; min-width: 0; cursor: pointer; }
.settings-team-member-info:hover .settings-team-member-name { color: var(--accent); }
.settings-team-member-name { font-size: 13px; font-weight: 500; }
.settings-team-member-role {
  font-size: 11px; color: var(--muted); flex-shrink: 0;
  text-align: right; min-width: 96px; max-width: 42%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.settings-team-members-empty {
  padding: 24px 16px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}
.settings-team-members-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
}
.settings-team-members-foot .btn { flex-shrink: 0; }
.settings-team-projects { margin-top: 20px; }
.settings-team-project-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.settings-team-picker-list { margin-top: 8px; max-height: 220px; overflow-y: auto; }
.settings-team-picker-list .msp-pick {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  text-align: left;
  margin: 4px 0;
  padding: 8px 10px;
  border-radius: 6px;
  height: auto;
}
.msp-pick-name { font-size: 13px; font-weight: 500; }
.msp-pick-email { font-size: 11px; color: var(--muted); font-weight: 400; }
.settings-team-picker-empty { font-size: 12px; color: var(--muted); padding: 8px 4px; }

.task-assign-search { width: 100%; margin-bottom: 0; }
.task-assign-picker-list { margin-top: 8px; }
.task-assign-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
}
.task-assign-row:last-child { border-bottom: none; }
.task-assign-row-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.task-assign-row-name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-assign-row-sub { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-assign-row-rec { background: var(--surface-2, rgba(255,255,255,0.03)); border-radius: 6px; margin-bottom: 6px; border-bottom: none; }
.su-rsel { width: 100%; font-size: 12px; padding: 4px 6px; border-radius: 2px; border: 1px solid var(--border); background: var(--paper-2); }
.settings-paged-more { margin-top: 10px; text-align: center; }
.settings-billing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.settings-billing-plan-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.settings-billing-plan-name { font-size: 18px; font-weight: 600; }
.settings-billing-cost { font-size: 14px; margin-bottom: 4px; }
.settings-billing-plan { font-size: 14px; margin-bottom: 6px; }
.settings-billing-meta { font-size: 12px; color: var(--muted); margin-top: 6px; }
.settings-usage-stats { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.settings-usage-stat { min-width: 72px; }
.settings-usage-stat-val { font-size: 20px; font-weight: 600; line-height: 1.2; }
.settings-usage-stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.settings-usage-table { width: 100%; font-size: 12px; border-collapse: collapse; }
.settings-usage-table th, .settings-usage-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.settings-usage-table { width: 100%; font-size: 12px; border-collapse: collapse; }
.settings-usage-table th, .settings-usage-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.settings-usage-raw { font-size: 11px; overflow: auto; max-height: 220px; margin: 0; }
.log-row:hover { background: var(--bg-2); }

/* ── Platform admin (/admin) ── */
.platform-admin-page {
  min-height: 100vh;
  background: var(--bg-2);
  padding: 24px 28px;
  max-width: 1200px;
  margin: 0 auto;
  color: var(--text);
}
.platform-admin-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.platform-admin-title { margin: 0; font-size: 22px; font-weight: 600; }
.platform-admin-sub { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.platform-admin-head-actions { display: flex; gap: 8px; }
.platform-admin-create { padding: 16px; margin-bottom: 20px; }
.platform-admin-section-title { margin: 0 0 14px; font-size: 15px; font-weight: 600; }
.platform-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.platform-admin-grid .form-group { margin-bottom: 0; }
.platform-admin-table-card { padding: 0; overflow: hidden; }
.platform-admin-table-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 14px;
}
.platform-admin-table-wrap { overflow-x: auto; }
.platform-admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.platform-admin-table thead { background: var(--bg-2); text-align: left; }
.platform-admin-table th,
.platform-admin-table td {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  vertical-align: top;
}
.platform-admin-table thead th { border-top: none; }
.platform-admin-muted { color: var(--muted); font-size: 11px; }
.platform-admin-actions { white-space: nowrap; }
.platform-admin-actions .btn { margin: 2px 4px 2px 0; }
.platform-admin-delete { color: var(--bad) !important; }
.platform-admin-empty { padding: 16px; color: var(--muted); }

@media (max-width: 520px) {
  .modal-form-row-2 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .settings-users-head { display: none; }
  .settings-users-row { grid-template-columns: 1fr; gap: 6px; }
  .settings-users-btns { justify-content: flex-start; }
}
.connector-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--bg-3); }
.connector-row:last-child { border-bottom: none; }
.connector-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
@media (max-width: 1280px) {
  .connector-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .connector-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .connector-grid { grid-template-columns: 1fr; }
}
.connector-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  height: 100%;
  padding: 14px 14px 12px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-card);
  background: var(--surface-raised);
  box-shadow: var(--shadow-card);
}
.connector-card.is-connected { border-color: rgba(160, 224, 171, 0.85); box-shadow: var(--shadow-card), 0 0 0 1px rgba(160, 224, 171, 0.35); }
.connector-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
}
.connector-card-head .connector-name { flex: 1; min-width: 0; margin: 0; }
.connector-live-badge {
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--carbon);
  background: rgba(160, 224, 171, 0.45);
  border: 1px solid rgba(160, 224, 171, 0.7);
  padding: 2px 6px;
  border-radius: 2px;
}
.connector-icon {
  font-size: 28px; line-height: 1; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
}
.connector-icon svg { display: block; max-width: 36px; max-height: 36px; }
.connector-pagination {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  margin-top: 8px; padding-top: 4px;
}
.connector-page-label { font-size: 12px; color: var(--muted); }
.doc-source-badge { display: inline-flex; align-items: center; gap: 4px; vertical-align: middle; }
.doc-source-badge svg { display: block; flex-shrink: 0; }
.connector-info { flex: 1; min-width: 0; }
.connector-name { font-size: 14px; font-weight: 600; line-height: 1.25; }
.connector-blurb {
  font-size: 12px; color: var(--text-2); line-height: 1.45;
}
.connector-benefits {
  margin: 8px 0 0;
  padding: 0 0 0 16px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
}
.connector-benefits li { margin: 0 0 4px; }
.connector-benefits li:last-child { margin-bottom: 0; }
.connector-status { font-size: 11px; color: var(--muted); margin-top: 8px; line-height: 1.35; }
.connector-status.err { color: var(--bad); }
.connector-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  flex-shrink: 0;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.connector-actions > .btn { width: auto; flex: 0 0 auto; align-self: flex-start; min-width: 88px; }
.connector-actions-secondary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.connector-actions-secondary .btn {
  width: auto;
  flex: 0 0 auto;
  min-width: 0;
  padding: 4px 8px;
  font-size: 11px;
}
.connector-actions-secondary .connector-chip {
  font-size: 10px;
  max-width: 100%;
}
.connector-btn-disconnect { color: var(--muted) !important; }
.connector-btn-disconnect:hover { color: var(--bad) !important; border-color: rgba(165, 45, 37, 0.35) !important; }
.settings-integrations-intro { font-size: 13px; color: var(--muted); margin: 0; line-height: 1.5; max-width: 640px; flex: 1; min-width: 0; }
.settings-integrations-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; margin-bottom: 16px;
}
.settings-integrations-head .btn { flex-shrink: 0; }
.member-list-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.member-list-item:last-child { border-bottom: none; }
.people-list-item { align-items: center; padding: 12px 0; }
.people-list-item .avatar { flex-shrink: 0; cursor: pointer; }
.people-list-body { flex: 1; min-width: 0; cursor: pointer; }
.people-list-top {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
}
.people-list-text { flex: 1; min-width: 0; }
.people-list-name { font-size: 13px; font-weight: 500; line-height: 1.3; }
.people-list-meta { font-size: 11px; color: var(--muted); line-height: 1.35; margin-top: 2px; }
.people-list-badges {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  align-self: center;
  gap: 6px;
  flex-shrink: 0;
  min-width: 108px;
  min-height: 24px;
}
.people-list-badge-empty { display: block; width: 100%; }
.people-chip-contact,
.people-chip-uncat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
}
.people-chip-uncat { background: var(--mercury-orange); color: var(--carbon); }
.people-list-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.people-skill-chip { font-size: 10px; padding: 1px 6px; }
.people-list-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  align-self: center;
}
.people-list-action-spacer {
  display: inline-block;
  width: 52px;
  flex-shrink: 0;
}
.people-admin-card {
  margin-bottom: 14px;
}
.people-admin-head {
  margin-bottom: 12px;
}
.people-admin-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}
.people-admin-hint {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
  line-height: 1.45;
}
.people-domains-row {
  margin-bottom: 12px;
}
.people-domains-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.people-domains-inputs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.people-domains-inputs .settings-search {
  flex: 1;
  min-width: 200px;
}
.people-toolbar {
  margin-bottom: 14px;
  padding: 12px 14px;
  background: var(--surface-raised);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}
.people-tabs { margin-bottom: 10px; }
.people-search {
  width: 100%;
  max-width: none;
  margin-bottom: 0;
}

/* ── Utility ── */
.spin {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; font-size: 13px; }

/* ── Executive Dashboard & Superpowers ── */
.executive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.metric-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.metric-card-value {
  font-size: 28px;
  font-weight: 300;
  color: var(--accent);
  margin-top: 4px;
}
.metric-card-label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ash);
}
.metric-impact-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px;
  border-radius: 2px;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  background: transparent;
  border: 1px solid var(--hairline);
}
.metric-impact-badge.positive { color: var(--mercury-green); }
.metric-impact-badge.negative { color: var(--mercury-red); }
.metric-impact-badge.neutral { color: var(--ash); }

/* Onboarding Path Learning Timeline */
.onboarding-timeline {
  position: relative;
  padding-left: 20px;
  border-left: 2px solid var(--border);
  margin-left: 10px;
}
.onboarding-step {
  position: relative;
  margin-bottom: 24px;
}
.onboarding-step:last-child {
  margin-bottom: 0;
}
.onboarding-step-marker {
  position: absolute;
  left: -27px;
  top: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
}
.onboarding-step-marker.completed {
  background: var(--good);
}
.onboarding-step-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}
.onboarding-step-desc {
  font-size: 12px;
  color: var(--text-2);
}

/* Chat Prompt Chips */
.chat-prompt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.chat-prompt-chip {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.12s;
  user-select: none;
}
.chat-prompt-chip:hover {
  background: var(--accent-light);
  border-color: var(--accent-mid);
  color: var(--accent);
}

/* ── Executive Center ── */
.exec { max-width: 1080px; margin: 0 auto; }
.exec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.exec-head h2 { margin: 0; font-size: 23px; letter-spacing: -0.02em; }
.exec-week { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.exec-eyebrow { font-family: var(--mono); font-size: 10px; font-weight: 400; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ash); margin: 26px 0 11px; }

/* Signature: the triage strip */
.attn { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.attn-item { display: flex; align-items: center; gap: 13px; padding: 15px 16px; border-radius: var(--radius-card); border: 1px solid var(--border); background: var(--panel); box-shadow: var(--shadow-sm); }
.attn-item .ic { font-size: 19px; line-height: 1; }
.attn-item .n { font-size: 25px; font-weight: 300; font-variant-numeric: tabular-nums; line-height: 1; }
.attn-item .l { font-size: 12px; font-weight: 600; color: var(--text-2); }
.attn-item .sub { font-size: 11px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 210px; }
.attn-item.warn { border-color: var(--mercury-orange); background: var(--panel); }
.attn-item.bad { border-color: var(--mercury-red); background: var(--panel); }
.attn-item.warn .n { color: var(--mercury-orange); } .attn-item.bad .n { color: var(--mercury-red); }
.attn-clear { display: flex; align-items: center; gap: 11px; padding: 17px 19px; border-radius: var(--radius-card); background: var(--panel); border: 1px solid var(--mercury-green); color: var(--mercury-green); font-size: 14px; font-weight: 400; }
.contra-card { border: 1px solid var(--border); border-radius: var(--radius-card); padding: 12px 14px; margin-bottom: 10px; }
.contra-card:last-child { margin-bottom: 0; }
.contra-field { font-family: var(--mono); font-size: 9px; font-weight: 400; letter-spacing: 0.15em; text-transform: uppercase; color: var(--ash); }
.contra-sides { font-size: 13px; color: var(--text-2); margin: 6px 0 10px; display: flex; flex-direction: column; gap: 3px; }
.contra-src { color: var(--muted); }
.contra-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.contra-err { font-size: 12px; color: var(--bad); margin-top: 8px; }

/* KPI vitals band - hairline-separated, tabular numerals */
.kpi-band { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; }
.kpi { background: var(--panel); padding: 15px 17px; }
.kpi .l { font-family: var(--mono); font-size: 9px; font-weight: 400; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ash); }
.kpi .n { font-size: 27px; font-weight: 300; letter-spacing: -0.025em; font-variant-numeric: tabular-nums; margin-top: 7px; line-height: 1; color: var(--text); }
.kpi .d { font-size: 11px; color: var(--muted); margin-top: 5px; }

.exec-cols { display: grid; grid-template-columns: 1.25fr 1fr; gap: 16px; align-items: start; }
.exec-card-title { font-size: 13px; font-weight: 700; margin-bottom: 12px; letter-spacing: -0.01em; }
.earned-period-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.earned-period-btn {
  border: 1px solid var(--border); background: var(--bg-2); color: var(--muted);
  font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 999px; cursor: pointer;
}
.earned-period-btn:hover { color: var(--text); border-color: var(--accent); }
.earned-period-btn.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Pipeline stage distribution */
.stage-bar { display: flex; height: 13px; border-radius: 7px; overflow: hidden; background: var(--bg-3); }
.stage-seg { height: 100%; min-width: 2px; }
.stage-legend { display: flex; flex-wrap: wrap; gap: 12px 16px; margin: 11px 0 16px; }
.stage-leg { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.stage-dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }

.deal-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--bg-3); cursor: pointer; }
.deal-row:last-child { border-bottom: none; }
.deal-row:hover .deal-name { color: var(--accent); }
.deal-name { flex: 1; font-size: 13px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deal-val { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.win-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* This-week pulse */
.pulse-counts { display: flex; gap: 18px; flex-wrap: wrap; padding-bottom: 13px; margin-bottom: 11px; border-bottom: 1px solid var(--bg-3); }
.pulse-count .n { font-size: 21px; font-weight: 300; font-variant-numeric: tabular-nums; line-height: 1; }
.pulse-count .l { font-size: 11px; color: var(--muted); margin-top: 3px; }
.pulse-group + .pulse-group { margin-top: 13px; }
.pulse-group .h { font-family: var(--mono); font-size: 9px; font-weight: 400; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ash); margin-bottom: 5px; }
.pulse-item { font-size: 12.5px; color: var(--text-2); padding: 4px 0; display: flex; gap: 8px; align-items: baseline; }
.pulse-item .tag { font-family: var(--mono); font-size: 9px; font-weight: 400; text-transform: uppercase; letter-spacing: 0.15em; color: var(--ash); flex-shrink: 0; width: 62px; }
@media (max-width: 820px) { .exec-cols { grid-template-columns: 1fr; } }

/* Coefficient explaining tables */
.coeff-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.coeff-table th, .coeff-table td {
  padding: 4px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.coeff-table th {
  font-weight: 600;
  color: var(--muted);
}

/* Premium Brief Pulse Indicator */
.pulse-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  background-color: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(24, 24, 24, 0.4);
  animation: brief-pulse 2s infinite;
}

@keyframes brief-pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(24, 24, 24, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(24, 24, 24, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(24, 24, 24, 0);
  }
}

/* Live change-feed toasts (SSE) */
#toasts { position: fixed; bottom: 20px; right: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--carbon); color: #fff; padding: 10px 16px; border-radius: var(--radius); font-size: 13px; font-weight: 300; box-shadow: var(--shadow-pop); border-left: 2px solid var(--mercury-green); opacity: 1; transition: opacity .3s; max-width: 320px; }
.toast-warn { background: var(--carbon); border-left-color: var(--mercury-orange); }
.toast-error { border-left-color: var(--mercury-red); }
