/* ============================================================
   Style "Claude warm" — cream backgrounds, serif headings, restrained palette
   ============================================================ */

:root {
  /* base palette */
  --bg: #faf9f5;
  --bg-alt: #f4f1e8;
  --surface: #ffffff;
  --surface-2: #fbfaf6;
  --border: #e8e3d6;
  --border-soft: #efeadd;
  --border-strong: #d4ccba;

  --text: #2c2a26;
  --text-2: #6b6862;
  --text-3: #95918a;
  --text-faint: #b7b3aa;

  --accent: #c96442;            /* Claude orange — used for primary actions */
  --accent-hover: #b25739;
  --accent-soft: #fbe9dd;

  /* HUMAN = orange/amber  */
  --human-fg: #b85a35;
  --human-bg: #fbe9dd;
  --human-border: #ecc0a0;
  --human-strong: #c96442;

  /* AI = sage green */
  --ai-fg: #4a7a5e;
  --ai-bg: #e1ece4;
  --ai-border: #b1c9b8;
  --ai-strong: #4a7a5e;

  --accent-edge: #b8a98a;

  /* status */
  --st-active: #4a7a5e;
  --st-active-bg: #e1ece4;
  --st-beta: #a16a1a;
  --st-beta-bg: #f7ecd5;
  --st-deprecated: #8a857d;
  --st-deprecated-bg: #ebe7dc;

  /* shadows */
  --shadow-sm: 0 1px 2px rgba(60, 50, 30, 0.04);
  --shadow-md: 0 4px 14px rgba(60, 50, 30, 0.07), 0 1px 2px rgba(60, 50, 30, 0.04);
  --shadow-lg: 0 18px 40px rgba(40, 35, 20, 0.14), 0 4px 12px rgba(40, 35, 20, 0.07);

  /* type */
  --serif: 'Source Serif 4', 'Tiempos', 'Georgia', serif;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;
}

/* Accent variant for human */
[data-human="terracotta"] {
  --human-fg: #a85333; --human-bg: #f5e2d4; --human-border: #e3b497; --human-strong: #a85333;
}
[data-human="rose"] {
  --human-fg: #b85470; --human-bg: #fbe1e5; --human-border: #ecb6c0; --human-strong: #b85470;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
body { font-size: 14px; line-height: 1.5; }

button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }

::selection { background: var(--accent-soft); }

/* ============================================================ APP SHELL */

.app { min-height: 100vh; display: flex; flex-direction: column; }
.app[data-density="compact"] .card { padding: 14px; }
.app[data-density="compact"] .grid { gap: 14px; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(250, 249, 245, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
  padding: 14px 32px;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--human-strong); color: white;
  border-radius: 10px; font-size: 22px; line-height: 1;
  font-family: var(--serif);
}
.brand-name { font-family: var(--serif); font-size: 16px; font-weight: 500; letter-spacing: -0.2px; }
.brand-tag { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }

.search-trigger {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface); color: var(--text-2);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 12px; min-width: 240px;
  font-size: 13px;
  transition: border-color .15s, background .15s;
}
.search-trigger:hover { border-color: var(--border-strong); }
.search-trigger kbd {
  margin-left: auto;
  background: var(--bg-alt); border: 1px solid var(--border);
  padding: 1px 6px; border-radius: 4px;
  font-size: 10.5px; color: var(--text-3); font-family: var(--sans);
}

.crumbs-wrap {
  position: sticky;
  top: 76px;
  z-index: 25;
  padding: 10px 32px;
  display: flex; align-items: center; gap: 16px;
  background: rgba(250, 249, 245, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
}

/* mode toggle (Organisation / Data) */
.mode-toggle {
  display: inline-flex; gap: 2px; flex-shrink: 0;
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: 9px; padding: 2px;
}
.mode-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; background: transparent;
  padding: 5px 12px; border-radius: 7px;
  font-size: 12.5px; font-weight: 500; color: var(--text-3);
  transition: all .15s;
}
.mode-btn:hover { color: var(--text); }
.mode-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.mode-data-glyph { font-size: 13px; }
.crumbs { display: flex; align-items: center; gap: 4px; font-size: 13px; flex-wrap: wrap; }
.crumb {
  background: none; border: none; padding: 4px 8px; border-radius: 6px;
  color: var(--text-2); transition: background .15s, color .15s;
  font-size: 13px;
  white-space: nowrap;
  max-width: 280px; overflow: hidden; text-overflow: ellipsis;
}
.crumb:hover { background: var(--bg-alt); color: var(--text); }
.crumb-current { color: var(--text); font-weight: 500; }
.crumb-sep { color: var(--text-faint); padding: 0 2px; }

.main { padding: 16px 32px 80px; max-width: 1320px; margin: 0 auto; width: 100%; }

/* ============================================================ HERO (home) */

.hero {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 56px;
  padding: 36px 0 28px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 28px;
}
.hero-eyebrow { font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: 1.2px; margin-bottom: 14px; }
.hero-title {
  font-family: var(--serif); font-weight: 400;
  font-size: 44px; line-height: 1.08; letter-spacing: -0.6px;
  margin: 0 0 18px;
  color: var(--text);
}
.hero-desc {
  font-size: 15.5px; line-height: 1.6; color: var(--text-2);
  max-width: 580px; text-wrap: pretty; margin: 0;
}
.hero-desc em { font-style: italic; color: var(--text); font-family: var(--serif); font-size: 1.05em; }
.hero-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-content: center; }

/* ============================================================ DETAIL HEADER */

.detail-head {
  display: grid; grid-template-columns: 1fr auto; gap: 28px;
  padding: 28px 0 24px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 28px;
  position: relative;
}
.detail-head-dept { padding-left: 28px; }
.detail-stripe {
  position: absolute; left: 0; top: 32px; bottom: 32px; width: 4px; border-radius: 2px;
}
.detail-head-agent { grid-template-columns: auto 1fr auto; }
.detail-eyebrow {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12px; color: var(--text-3); letter-spacing: 0.4px;
  margin-bottom: 10px;
}
.detail-title {
  font-family: var(--serif); font-weight: 400;
  font-size: 36px; line-height: 1.1; letter-spacing: -0.4px;
  margin: 0 0 8px;
  color: var(--text);
}
.detail-title-md { font-size: 28px; }
.detail-title-sm { font-size: 24px; }
.detail-subtitle { font-size: 15px; color: var(--text-2); margin-bottom: 10px; }
.detail-tagline { font-size: 15px; color: var(--text-2); max-width: 700px; text-wrap: pretty; }
.detail-desc { font-size: 14.5px; line-height: 1.6; color: var(--text-2); max-width: 760px; text-wrap: pretty; margin: 6px 0 0; }
.detail-head-side { display: flex; flex-direction: column; gap: 14px; min-width: 130px; align-content: start; }

.bc-mini {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-alt); border: 1px solid var(--border-soft);
  padding: 3px 10px 3px 4px; border-radius: 99px;
  font-size: 12px; color: var(--text);
}
.bc-mini:hover { background: var(--border-soft); }

.task-leaf-marker {
  display: inline-block; padding: 3px 10px; border-radius: 99px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 11.5px; letter-spacing: 0.4px; font-weight: 500;
}

/* SIPOC mini-grid in skill / task header */
.sipoc-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin-top: 22px;
}
.task-io-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  margin-top: 22px;
}
.sipoc-cell {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: 10px; padding: 12px 14px;
}
.sipoc-lbl {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--text-3); margin-bottom: 8px;
}
.task-io-text { font-size: 13px; color: var(--text); }
.task-io-tool { font-family: var(--mono); font-size: 12px; color: var(--text-2); }

/* ============================================================ STATS */

.stat {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: 10px; padding: 12px 14px; min-width: 110px;
}
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.7px; color: var(--text-3); margin-bottom: 4px; }
.stat-value { font-family: var(--serif); font-size: 22px; font-weight: 400; color: var(--text); line-height: 1.1; }
.stat-hint { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }

/* ============================================================ CHILDREN SECTION */

.children-section {}
.children-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.children-title {
  font-family: var(--serif); font-weight: 400;
  font-size: 22px; letter-spacing: -0.2px; margin: 0;
  color: var(--text);
  white-space: nowrap; flex-shrink: 0;
}

/* ============================================================ FILTERBAR */

.filterbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.filterbar-spacer { flex: 1; }
.filterbar-group { display: flex; align-items: center; gap: 6px; }
.fb-label {
  font-size: 11px; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.6px;
  margin-right: 2px;
}
.fb-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 99px; padding: 4px 10px;
  font-size: 12.5px; color: var(--text-2);
  transition: all .15s;
}
.fb-chip:hover { border-color: var(--border-strong); color: var(--text); }
.fb-chip-active { background: var(--bg-alt); color: var(--text); border-color: var(--border-strong); }
.fb-chip-human.fb-chip-active { background: var(--human-bg); color: var(--human-fg); border-color: var(--human-border); }
.fb-chip-ai.fb-chip-active { background: var(--ai-bg); color: var(--ai-fg); border-color: var(--ai-border); }
.fb-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; background: var(--text-faint); }
.fb-dot-human { background: var(--human-strong); }
.fb-dot-ai { background: var(--ai-strong); }

.fb-icon-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--border);
  padding: 6px 12px; border-radius: 8px;
  color: var(--text-2); font-size: 12.5px;
}
.fb-icon-btn:hover { color: var(--text); border-color: var(--border-strong); }

.seg {
  display: inline-flex; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 2px; gap: 0;
}
.seg-btn {
  border: none; background: transparent;
  padding: 5px 9px; border-radius: 6px;
  color: var(--text-3); transition: all .15s;
  display: inline-flex; align-items: center; justify-content: center;
}
.seg-btn:hover { color: var(--text); }
.seg-active { background: var(--bg-alt); color: var(--text); }

/* ============================================================ BUTTONS */

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 8px; border: 1px solid transparent;
  font-size: 13px; font-weight: 500; padding: 6px 12px;
  transition: all .15s;
}
.btn-icon { display: inline-flex; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text-2); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-alt); color: var(--text); }
.btn-sm { padding: 4px 10px; font-size: 12.5px; }

/* ============================================================ CHIPS / BADGES */

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  border-radius: 99px; padding: 2px 8px;
  font-size: 11.5px; font-weight: 500;
  border: 1px solid;
  white-space: nowrap;
}
.chip-dot { width: 6px; height: 6px; border-radius: 50%; }
.chip-human { background: var(--human-bg); color: var(--human-fg); border-color: var(--human-border); }
.chip-human .chip-dot { background: var(--human-strong); }
.chip-ai { background: var(--ai-bg); color: var(--ai-fg); border-color: var(--ai-border); }
.chip-ai .chip-dot { background: var(--ai-strong); }

.status, .autonomy, .dept-badge {
  display: inline-block; padding: 2px 9px; border-radius: 99px;
  font-size: 11px; font-weight: 500;
  border: 1px solid transparent;
  letter-spacing: 0.2px;
  white-space: nowrap;
}
.status-active { background: var(--st-active-bg); color: var(--st-active); border-color: rgba(74, 122, 94, 0.2); }
.status-beta { background: var(--st-beta-bg); color: var(--st-beta); border-color: rgba(161, 106, 26, 0.2); }
.status-deprecated { background: var(--st-deprecated-bg); color: var(--st-deprecated); border-color: rgba(138, 133, 125, 0.2); }
.autonomy { background: var(--surface); color: var(--text-2); border-color: var(--border); }
.autonomy-autonomous { background: var(--bg-alt); color: var(--text); border-color: var(--border-strong); }
.dept-badge { font-size: 11px; }

/* ============================================================ CARDS / GRID */

.grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.grid-home, .grid-dept { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.grid-agent { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid-skill { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-subskill { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-compact { gap: 12px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  display: flex; flex-direction: column;
  position: relative;
  transition: border-color .15s, transform .12s, box-shadow .15s;
  cursor: pointer;
  outline: none;
}
.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.card:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.card:active { transform: translateY(1px); }

.card-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.card-head-mini { margin-bottom: 8px; }
.card-head-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-actions { margin-left: auto; }

.card-title {
  font-family: var(--serif); font-weight: 400;
  font-size: 19px; line-height: 1.2; letter-spacing: -0.15px;
  margin: 0 0 4px;
  color: var(--text);
}
.card-title-md { font-size: 18px; }
.card-title-sm { font-size: 16px; line-height: 1.25; }
.card-title-serif { font-size: 24px; }
.card-role { font-size: 12.5px; color: var(--text-3); margin-bottom: 10px; }
.card-desc {
  font-size: 13.5px; line-height: 1.5; color: var(--text-2);
  margin: 0 0 14px; flex: 1; text-wrap: pretty;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card-desc-sm { -webkit-line-clamp: 2; font-size: 13px; }
.card-foot {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding-top: 12px; border-top: 1px solid var(--border-soft);
  font-size: 12px; color: var(--text-3);
}
.card-foot-mini { gap: 12px; }
.card-children { margin-left: auto; }
.card-children strong { color: var(--text); font-weight: 600; }

/* Agent card variants */
.card-human::before {
  content: ""; position: absolute; left: 0; top: 16px; bottom: 16px;
  width: 3px; border-radius: 2px; background: var(--human-strong); opacity: 0.65;
}
.card-ai::before {
  content: ""; position: absolute; left: 0; top: 16px; bottom: 16px;
  width: 3px; border-radius: 2px; background: var(--ai-strong); opacity: 0.65;
}

/* Department card */
.card-dept { padding-top: 22px; }
.dept-stripe {
  position: absolute; top: 0; left: 18px; right: 18px;
  height: 3px; border-radius: 0 0 2px 2px;
}
.dept-stats {
  display: flex; gap: 24px; margin: 14px 0;
}
.dept-stat { display: flex; flex-direction: column; line-height: 1.1; }
.dept-stat-num { font-family: var(--serif); font-size: 24px; color: var(--text); }
.dept-stat-label { font-size: 11px; color: var(--text-3); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.5px; }
.dept-stat-ai .dept-stat-num { color: var(--ai-strong); }
.dept-avatars {
  display: flex; gap: -4px; padding-top: 14px;
  border-top: 1px solid var(--border-soft);
}
.dept-avatars > * { margin-left: -6px; }
.dept-avatars > *:first-child { margin-left: 0; }
.dept-more {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--bg-alt); color: var(--text-3); font-size: 11px;
  border: 1px solid var(--border); margin-left: -6px;
}

/* Skill card */
.card-skill-ai { background: linear-gradient(180deg, var(--ai-bg) 0%, var(--surface) 12%); }
.card-skill-human { background: linear-gradient(180deg, var(--human-bg) 0%, var(--surface) 12%); }
.skill-icon {
  width: 26px; height: 26px; border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-2);
}
.card-skill-ai .skill-icon { color: var(--ai-fg); background: var(--surface); border-color: var(--ai-border); }
.card-skill-human .skill-icon { color: var(--human-fg); background: var(--surface); border-color: var(--human-border); }
.skill-meta { display: flex; flex-wrap: wrap; gap: 5px; margin: 4px 0 12px; }

.card-skill .card-foot-mini .stat { padding: 6px 10px; min-width: 0; }
.card-skill .card-foot-mini .stat-value { font-size: 14px; }
.card-skill .card-foot-mini .stat-label { font-size: 10px; }

/* Sub-skill / Task card */
.card-sub { background: var(--surface-2); }
.card-task { background: var(--surface-2); }
.sub-marker, .task-marker {
  display: inline-block; font-family: var(--mono);
  color: var(--text-3); font-size: 14px;
}
.task-duration {
  font-family: var(--mono); font-size: 11px; color: var(--text-3);
  background: var(--bg-alt); padding: 1px 7px; border-radius: 4px;
}
.task-io {
  display: flex; flex-direction: column; gap: 5px;
  padding-top: 10px; border-top: 1px solid var(--border-soft);
}
.task-io-row { display: flex; gap: 8px; font-size: 12px; }
.task-io-lbl {
  color: var(--text-3); min-width: 38px;
  text-transform: uppercase; letter-spacing: 0.5px; font-size: 10.5px; padding-top: 2px;
}
.task-io-val { color: var(--text); }
.task-tool { font-family: var(--mono); font-size: 11.5px; color: var(--text-2); }

/* Add card */
.add-card {
  background: transparent; border: 1.5px dashed var(--border-strong);
  border-radius: 14px; padding: 22px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  color: var(--text-3); font-size: 13px; min-height: 130px;
  transition: all .15s;
}
.add-card:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

/* ============================================================ TAGS */

.tag-row { display: flex; flex-wrap: wrap; gap: 5px; }
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 5px;
  font-size: 11.5px; line-height: 1.4;
  background: var(--bg-alt); color: var(--text-2);
  border: 1px solid var(--border-soft);
  font-family: var(--mono);
}
.tag-tool { background: var(--surface); }
.tag-io { background: var(--accent-soft); color: var(--accent); border-color: transparent; font-family: var(--sans); }
.tag-dep { cursor: pointer; background: var(--ai-bg); color: var(--ai-fg); border-color: var(--ai-border); font-family: var(--sans); }
.tag-dep:hover { background: var(--ai-border); }
.tag-more { color: var(--text-3); }
.empty-inline { color: var(--text-faint); font-size: 12px; font-style: italic; }

/* ============================================================ LIST LAYOUT */

.list-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
  transition: background .12s;
}
.row:last-child { border-bottom: none; }
.row:hover { background: var(--bg-alt); }
.row:focus-visible { background: var(--bg-alt); outline: 2px solid var(--accent); outline-offset: -2px; }
.row-drag { color: var(--text-faint); cursor: grab; opacity: 0; transition: opacity .15s; }
.row:hover .row-drag { opacity: 1; }
.row-icon { flex-shrink: 0; display: flex; align-items: center; }
.row-dept-dot { width: 14px; height: 14px; border-radius: 4px; }
.row-skill-ic, .row-sub-marker, .row-task-marker {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--bg-alt); color: var(--text-2);
  font-family: var(--mono); font-size: 14px;
}
.row-main { flex: 1; min-width: 0; }
.row-title { font-size: 14px; font-weight: 500; color: var(--text); }
.row-sub { font-size: 12.5px; color: var(--text-3); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 480px; }
.row-badges { display: flex; gap: 5px; flex-shrink: 0; }
.row-meta { font-size: 12px; color: var(--text-3); min-width: 100px; text-align: right; }
.row-actions { display: flex; align-items: center; gap: 4px; }
.row-chev { color: var(--text-faint); }

/* ============================================================ CANVAS LAYOUT */

.canvas-wrap {
  position: relative; width: 100%;
  height: 600px; max-height: 70vh;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  overflow: hidden;
}
.canvas-edges { position: absolute; inset: 0; pointer-events: none; }
.canvas-center {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 14px; padding: 16px 22px;
  text-align: center; min-width: 160px;
  box-shadow: var(--shadow-md);
  z-index: 2;
}
.canvas-center.canvas-human { background: var(--human-bg); border-color: var(--human-border); }
.canvas-center.canvas-ai { background: var(--ai-bg); border-color: var(--ai-border); }
.canvas-center-label { font-family: var(--serif); font-size: 18px; color: var(--text); }
.canvas-center-sub { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }

.canvas-node {
  position: absolute; transform: translate(-50%, -50%);
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 99px; padding: 6px 14px 6px 8px;
  font-size: 13px; color: var(--text);
  max-width: 220px;
  box-shadow: var(--shadow-sm);
  transition: all .15s;
}
.canvas-node:hover { border-color: var(--accent); transform: translate(-50%, -50%) scale(1.04); }
.canvas-node-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.canvas-node-human { background: var(--human-bg); border-color: var(--human-border); color: var(--human-fg); }
.canvas-node-ai { background: var(--ai-bg); border-color: var(--ai-border); color: var(--ai-fg); }
.canvas-node-skill { background: var(--surface); }
.canvas-node-subskill, .canvas-node-task { background: var(--surface-2); font-size: 12px; }

/* ============================================================ EDIT INPLACE */

.edit-text {
  cursor: text; border-radius: 4px;
  padding: 1px 3px; margin: -1px -3px;
  transition: background .12s;
}
.edit-text:hover { background: var(--accent-soft); }
.edit-empty { color: var(--text-faint); font-style: italic; }
.edit-input {
  font: inherit; color: inherit;
  background: var(--surface); border: 1px solid var(--accent);
  border-radius: 6px; padding: 2px 6px; outline: none;
  width: 100%; max-width: 600px;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.edit-textarea { min-height: 60px; resize: vertical; padding: 6px 10px; line-height: 1.5; }

/* ============================================================ BOOT SCREEN */

.boot-screen {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  animation: fadein .15s;
}
.boot-card {
  text-align: center; padding: 40px 48px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow-md);
}
.boot-spinner {
  width: 28px; height: 28px; margin: 0 auto 16px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.boot-title { font-family: var(--serif); font-size: 16px; color: var(--text); margin-bottom: 6px; }
.boot-hint { color: var(--text-3); font-size: 13px; }

/* ============================================================ SYNC BANNER */

.sync-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px;
  background: var(--st-beta-bg); color: var(--st-beta);
  border-bottom: 1px solid var(--human-border);
  font-size: 13px; line-height: 1.4;
  animation: fadein .15s;
}
.sync-banner-close {
  flex-shrink: 0; background: transparent; border: none;
  color: inherit; font-size: 18px; line-height: 1; cursor: pointer;
  padding: 0 4px;
}
.sync-banner-close:hover { opacity: 0.6; }

/* ============================================================ EMPTY */

.empty {
  text-align: center; padding: 60px 20px;
  background: var(--surface); border: 1px dashed var(--border);
  border-radius: 14px;
}
.empty-title { font-family: var(--serif); font-size: 18px; color: var(--text); margin-bottom: 6px; }
.empty-hint { color: var(--text-3); font-size: 13.5px; }

/* ============================================================ MENU */

.menu-wrap { position: relative; display: inline-block; }
.menu-trigger {
  width: 26px; height: 26px; border-radius: 6px;
  background: transparent; border: none;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-3);
}
.menu-trigger:hover { background: var(--bg-alt); color: var(--text); }
.menu-pop {
  position: absolute; top: 100%; right: 0; margin-top: 4px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: var(--shadow-md);
  min-width: 160px; z-index: 20; overflow: hidden;
  padding: 4px;
}
.menu-item {
  width: 100%; text-align: left;
  background: transparent; border: none;
  padding: 7px 10px; border-radius: 5px;
  font-size: 13px; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.menu-item:hover { background: var(--bg-alt); }
.menu-icon { color: var(--text-3); display: inline-flex; }
.menu-item-danger { color: #b04a3e; }
.menu-item-danger:hover { background: #fbe6e3; }

/* ============================================================ COMMAND PALETTE */

.cmdk-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(60, 50, 30, 0.32);
  backdrop-filter: blur(6px);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 12vh;
  animation: fadein .15s;
}
@keyframes fadein { from { opacity: 0; } }

.cmdk {
  width: 100%; max-width: 600px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: slideup .2s;
}
@keyframes slideup { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }

.cmdk-input-row {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--border-soft);
  color: var(--text-3);
}
.cmdk-input {
  flex: 1; border: none; outline: none; background: transparent;
  font-size: 15px; color: var(--text);
}
.cmdk-input::placeholder { color: var(--text-faint); }
.cmdk-kbd {
  background: var(--bg-alt); border: 1px solid var(--border);
  padding: 1px 7px; border-radius: 4px; font-size: 11px; color: var(--text-3);
  font-family: var(--sans);
}

.cmdk-list { max-height: 50vh; overflow-y: auto; padding: 6px; }
.cmdk-empty { padding: 28px; text-align: center; color: var(--text-3); font-size: 13px; }
.cmdk-item {
  display: grid; grid-template-columns: 84px 1fr auto;
  align-items: center; gap: 10px;
  width: 100%; padding: 9px 12px; border-radius: 8px;
  background: transparent; border: none; text-align: left;
}
.cmdk-item-active { background: var(--bg-alt); }
.cmdk-label { font-size: 13.5px; color: var(--text); font-weight: 500; }
.cmdk-sub { font-size: 12px; color: var(--text-3); }
.cmdk-kind {
  font-size: 10.5px; padding: 2px 8px; border-radius: 99px;
  background: var(--bg-alt); color: var(--text-2);
  text-transform: uppercase; letter-spacing: 0.5px; text-align: center;
}
.cmdk-kind-agent-human, .cmdk-kind-dept { background: var(--human-bg); color: var(--human-fg); }
.cmdk-kind-agent-ai { background: var(--ai-bg); color: var(--ai-fg); }
.cmdk-kind-skill { background: var(--accent-soft); color: var(--accent); }
.cmdk-kind-data { background: var(--data-bg); color: var(--data-fg); }
.cmdk-foot {
  display: flex; gap: 16px; padding: 10px 16px;
  border-top: 1px solid var(--border-soft);
  font-size: 11.5px; color: var(--text-3);
  background: var(--surface-2);
}
.cmdk-foot kbd {
  background: var(--surface); border: 1px solid var(--border);
  padding: 0 5px; border-radius: 3px; font-size: 10.5px;
  font-family: var(--sans); margin-right: 4px;
}

/* ============================================================ CONNECTIONS MODAL */

.conn-modal {
  width: 100%; max-width: 980px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: slideup .2s;
}
.conn-head {
  display: flex; align-items: start; justify-content: space-between;
  padding: 22px 26px 16px; border-bottom: 1px solid var(--border-soft);
}
.conn-title { font-family: var(--serif); font-size: 22px; margin: 0; font-weight: 400; }
.conn-sub { font-size: 13px; color: var(--text-3); margin: 4px 0 0; }
.conn-close {
  width: 32px; height: 32px; border-radius: 8px;
  background: transparent; border: 1px solid var(--border);
  color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center;
}
.conn-close:hover { background: var(--bg-alt); }
.conn-canvas-wrap { padding: 14px 22px; }
.conn-svg { height: 560px; }
.conn-node:hover circle { stroke-width: 2.5; }
.conn-foot {
  display: flex; gap: 22px; padding: 14px 26px;
  border-top: 1px solid var(--border-soft); background: var(--surface-2);
  font-size: 12.5px; color: var(--text-2);
}
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.conn-edge-sample {
  display: inline-block; width: 20px; height: 1.5px;
  background: var(--accent-edge); margin-right: 2px;
}

/* ============================================================ TWEAKS PANEL OVERRIDES */

.twk-panel { font-family: var(--sans) !important; }

/* ============================================================ EDITABLE CONTROLS */

.eyebrow-sep { color: var(--text-faint); }
.eyebrow-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); }
.initials-edit { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-3); margin-left: 12px; }
.stat-value-sm { font-size: 15px; }

.edit-input-num { max-width: 90px; }

/* editable tags */
.tag-editable { display: inline-flex; align-items: center; gap: 4px; padding-right: 4px; }
.tag-x {
  border: none; background: transparent; cursor: pointer;
  color: var(--text-3); font-size: 14px; line-height: 1;
  padding: 0 2px; border-radius: 3px;
}
.tag-x:hover { background: rgba(176,74,62,0.12); color: #b04a3e; }
.tag-add {
  border: 1px dashed var(--border-strong); background: transparent;
  color: var(--text-3); font-size: 11.5px; padding: 1px 8px;
  border-radius: 5px; cursor: pointer; font-family: var(--sans);
}
.tag-add:hover { border-color: var(--accent); color: var(--accent); }
.tag-input {
  border: 1px solid var(--accent); border-radius: 5px;
  padding: 1px 6px; font-size: 11.5px; outline: none;
  width: 130px; box-shadow: 0 0 0 3px var(--accent-soft);
}

/* editable pill (status / autonomy / kind select) */
.epill-wrap { position: relative; display: inline-flex; }
.epill-trigger {
  display: inline-flex; align-items: center; gap: 3px;
  background: transparent; border: none; padding: 0; cursor: pointer;
  border-radius: 99px;
}
.epill-trigger:hover { opacity: 0.82; }
.epill-caret { font-size: 9px; color: var(--text-faint); }
.epill-label { font-size: 12px; color: var(--text-2); }
.epill-pop {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 40;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: var(--shadow-md);
  padding: 4px; min-width: 150px;
}
.epill-opt {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; text-align: left; background: transparent; border: none;
  padding: 7px 10px; border-radius: 5px; font-size: 13px; color: var(--text); cursor: pointer;
}
.epill-opt:hover { background: var(--bg-alt); }
.epill-opt-active { color: var(--accent); font-weight: 500; }
.epill-check { color: var(--accent); }

/* color picker */
.ecolor-wrap { position: relative; display: inline-flex; }
.ecolor-trigger { width: 16px; height: 16px; border-radius: 5px; border: 1px solid var(--border-strong); cursor: pointer; }
.ecolor-pop {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 40;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow-md);
  padding: 8px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
}
.ecolor-swatch { width: 24px; height: 24px; border-radius: 6px; border: 2px solid transparent; cursor: pointer; }
.ecolor-active { border-color: var(--text); }

/* nav chips (clickable to navigate) */
.nav-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: none; cursor: pointer;
  padding: 0; border-radius: 99px;
}
.nav-chip:hover { opacity: 0.78; }
.owner-row { display: inline-flex; align-items: center; gap: 6px; }
.owner-chip {
  font-size: 13px; color: var(--text);
  background: var(--bg-alt); border: 1px solid var(--border-soft);
  padding: 3px 10px 3px 4px; border-radius: 99px;
}
.owner-chip:hover { background: var(--border-soft); opacity: 1; }
.owner-reassign .epill-trigger { width: 22px; height: 22px; border-radius: 6px; justify-content: center; background: var(--bg-alt); border: 1px solid var(--border-soft); }
.owner-reassign .epill-trigger:hover { border-color: var(--accent); }
.owner-reassign .epill-caret { display: none; }
.reassign-ic { font-size: 12px; color: var(--text-2); }

.dept-card-actions { position: absolute; top: 14px; right: 14px; }

/* ============================================================ ENTITY CONNECTIONS */

.conns-section {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 28px;
}
.conns-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.conns-title {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--serif); font-weight: 400; font-size: 17px; margin: 0; color: var(--text);
}
.conns-title svg { color: var(--text-3); }
.conns-count {
  font-family: var(--sans); font-size: 11px; font-weight: 600;
  background: var(--bg-alt); color: var(--text-2);
  border-radius: 99px; padding: 1px 8px; min-width: 20px; text-align: center;
}
.conns-empty { font-size: 13px; color: var(--text-3); margin: 0; line-height: 1.5; text-wrap: pretty; max-width: 720px; }
.conns-list { display: flex; flex-wrap: wrap; gap: 8px; }
.conn-pill {
  display: inline-flex; align-items: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 99px; overflow: hidden;
  transition: border-color .15s;
}
.conn-pill:hover { border-color: var(--border-strong); }
.conn-pill-main {
  display: inline-flex; align-items: center; gap: 7px;
  background: transparent; border: none; cursor: pointer;
  padding: 6px 10px 6px 12px; font-size: 13px; color: var(--text);
}
.conn-pill-main:hover { background: var(--bg-alt); }
.conn-pill-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); flex-shrink: 0; }
.conn-dot-human { background: var(--human-strong); }
.conn-dot-ai, .conn-dot-skill { background: var(--ai-strong); }
.conn-dot-dept { background: var(--accent); }
.conn-dot-subskill { background: #a87a3a; }
.conn-dot-task { background: var(--text-3); }
.conn-pill-level { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-3); }
.conn-pill-label { font-weight: 500; }
.conn-pill-rel { color: var(--text-3); font-style: italic; }
.conn-pill-x {
  border: none; background: transparent; cursor: pointer;
  color: var(--text-faint); padding: 6px 10px 6px 6px;
  display: inline-flex; align-items: center; border-left: 1px solid var(--border-soft);
}
.conn-pill-x:hover { color: #b04a3e; background: #fbe6e3; }

/* picker modal */
.picker .cmdk-list { max-height: 38vh; }
.picker-item .cmdk-kind { display: inline-flex; align-items: center; gap: 5px; }
.picker-foot {
  display: flex; gap: 10px; align-items: center;
  padding: 12px 16px; border-top: 1px solid var(--border-soft);
  background: var(--surface-2);
}
.picker-label-input {
  flex: 1; border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; font-size: 13px; outline: none; background: var(--surface);
}
.picker-label-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.btn-disabled { opacity: 0.5; pointer-events: none; }

/* ============================================================ DATA CATALOG */

:root {
  --data-fg: #4a6b8c;
  --data-bg: #e4ebf2;
  --data-border: #b3c5d6;
  --data-strong: #4a6b8c;
}

.data-glyph, .data-section .data-glyph { color: var(--data-strong); }

.hero-data-link {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 22px;
  background: var(--data-bg); border: 1px solid var(--data-border);
  color: var(--data-fg); border-radius: 99px;
  padding: 8px 16px; font-size: 13.5px; font-weight: 500;
  transition: all .15s;
}
.hero-data-link:hover { background: var(--data-border); }
.hero-data-link .data-glyph { color: var(--data-fg); font-size: 15px; }

/* dataset card */
.grid-data { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.card-data { background: linear-gradient(180deg, var(--data-bg) 0%, var(--surface) 14%); }
.card-data::before {
  content: ""; position: absolute; left: 0; top: 16px; bottom: 16px;
  width: 3px; border-radius: 2px; background: var(--data-strong); opacity: 0.6;
}
.data-card-glyph {
  width: 26px; height: 26px; border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--data-border);
  color: var(--data-fg); font-size: 14px;
}
.data-card-type { font-size: 11.5px; color: var(--data-fg); font-weight: 500; letter-spacing: 0.3px; }
.data-card-system { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); margin: 2px 0 12px; }
.data-card-owner { display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); }

/* sensitivity pills */
.sens-pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 10.5px; font-weight: 500; border: 1px solid transparent; white-space: nowrap; }
.sens-public { background: #e6efe6; color: #4a7a5e; }
.sens-interne { background: var(--bg-alt); color: var(--text-2); border-color: var(--border); }
.sens-confidentiel { background: #f6e9d6; color: #9a6a1a; border-color: #e6cf9e; }
.sens-pii { background: #f7e0e0; color: #a8453e; border-color: #e8bdb8; }

/* data detail header */
.detail-head-data { grid-template-columns: auto 1fr auto; }
.data-head-icon {
  width: 64px; height: 64px; border-radius: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--data-bg); border: 1px solid var(--data-border);
  color: var(--data-fg); font-size: 30px;
}
.data-kind-badge {
  background: var(--data-bg); color: var(--data-fg);
  border: 1px solid var(--data-border);
  font-size: 11px; font-weight: 500; padding: 2px 9px; border-radius: 99px;
}
.data-type-pill { font-size: 12px; color: var(--text-2); display: inline-flex; align-items: center; gap: 4px; }

/* data section variant */
.data-section { border-color: var(--data-border); background: linear-gradient(180deg, rgba(228,235,242,0.5) 0%, var(--surface) 60%); }
.data-glyph { font-size: 15px; }
.data-type-glyph {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; color: var(--data-fg); font-size: 13px;
}
.conn-pill-data { border-color: var(--data-border); }
.conn-pill-data .conn-pill-main:hover { background: var(--data-bg); }

/* ============================================================ ORG SWITCHER */

.org-switcher { position: relative; }
.org-trigger {
  display: flex; align-items: center; gap: 12px;
  background: transparent; border: 1px solid transparent;
  border-radius: 10px; padding: 4px 12px 4px 4px;
  transition: background .12s, border-color .12s;
}
.org-trigger:hover { background: var(--bg-alt); border-color: var(--border-soft); }
.brand-meta { text-align: left; }
.org-chev { color: var(--text-3); margin-left: 4px; display: inline-flex; }

.org-pop {
  position: absolute; top: calc(100% + 6px); left: 0;
  width: 380px; max-width: calc(100vw - 32px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 50;
  overflow: hidden;
}
.org-pop-head {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--text-3); padding: 12px 16px 6px;
}
.org-pop-list { max-height: 340px; overflow-y: auto; padding: 0 6px 6px; }
.org-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 9px 12px; border-radius: 8px;
  background: transparent; border: none; text-align: left;
  cursor: pointer;
}
.org-item:hover { background: var(--bg-alt); }
.org-item-current { background: var(--accent-soft); }
.org-item-current:hover { background: var(--accent-soft); }
.org-item-mark {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--human-strong); color: white;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 16px; font-weight: 500;
  flex-shrink: 0;
}
.org-item-mark-lg { width: 44px; height: 44px; font-size: 22px; border-radius: 10px; }
.org-item-meta { flex: 1; min-width: 0; }
.org-item-name { font-size: 14px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.org-item-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.org-item-check { color: var(--accent); font-weight: 600; }
.org-pop-foot {
  display: flex; flex-direction: column; gap: 1px;
  padding: 4px;
  border-top: 1px solid var(--border-soft);
  background: var(--surface-2);
}
.org-pop-action {
  display: flex; align-items: center; gap: 8px;
  width: 100%; text-align: left;
  background: transparent; border: none;
  padding: 9px 12px; border-radius: 6px;
  font-size: 13px; color: var(--text);
}
.org-pop-action:hover { background: var(--bg-alt); }
.org-pop-action svg { color: var(--text-3); }

/* ============================================================ ORGS MODAL */

.orgs-modal {
  width: 100%; max-width: 1080px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  max-height: 88vh;
  display: flex; flex-direction: column;
  animation: slideup .2s;
}
.orgs-modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 24px 28px 18px;
  border-bottom: 1px solid var(--border-soft);
}
.orgs-head-actions { display: flex; align-items: center; gap: 10px; }
.orgs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  padding: 22px 28px 28px;
  overflow-y: auto;
}
.org-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  display: flex; flex-direction: column;
  position: relative;
  transition: all .15s;
}
.org-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.org-card-current {
  border-color: var(--human-border);
  background: linear-gradient(180deg, var(--human-bg) 0%, var(--surface) 30%);
}
.org-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.org-current-badge {
  background: var(--human-strong); color: white;
  font-size: 10.5px; font-weight: 600;
  padding: 2px 9px; border-radius: 99px;
  letter-spacing: 0.3px;
}
.org-card-menu { margin-left: auto; }
.org-card-title {
  font-family: var(--serif); font-size: 20px; font-weight: 400;
  margin: 0 0 6px; line-height: 1.2;
}
.org-card-tag { font-size: 13px; color: var(--text-2); margin: 0 0 16px; line-height: 1.45; flex: 1; }
.org-card-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  padding: 12px 0; border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 14px;
}
.org-card-stats > div { display: flex; flex-direction: column; align-items: center; line-height: 1.1; gap: 3px; }
.org-card-stats strong { font-family: var(--serif); font-size: 20px; font-weight: 400; color: var(--text); }
.org-card-stats span { font-size: 10.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.4px; }
.num-human { color: var(--human-strong) !important; }
.num-ai { color: var(--ai-strong) !important; }
.org-card-foot { display: flex; justify-content: flex-end; }
.org-card-current-label { font-size: 12px; color: var(--text-3); font-style: italic; }

.org-card-new {
  border: 1.5px dashed var(--border-strong);
  background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  color: var(--text-3); padding: 32px 22px; text-align: center;
  min-height: 240px;
}
.org-card-new:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.org-card-new svg { width: 22px; height: 22px; }
.org-card-new > span:first-of-type { font-family: var(--serif); font-size: 16px; }
.org-card-new-hint { font-size: 12px; line-height: 1.5; max-width: 220px; color: var(--text-3); }
.org-card-new:hover .org-card-new-hint { color: var(--accent); opacity: 0.75; }

/* ============================================================ AUTH SCREEN */

.auth-screen {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  animation: fadein .15s;
  padding: 20px;
}
.auth-card {
  width: 100%; max-width: 400px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow-lg);
  padding: 36px 32px;
  animation: slideup .2s;
}
.auth-brand {
  font-family: var(--serif); font-size: 15px; color: var(--accent);
  letter-spacing: 0.3px; margin-bottom: 20px;
}
.auth-title { font-family: var(--serif); font-size: 24px; font-weight: 400; margin: 0 0 6px; color: var(--text); }
.auth-sub { font-size: 13px; color: var(--text-3); margin: 0 0 22px; line-height: 1.5; }
.auth-error {
  background: #fbe6e3; color: #b04a3e;
  border-radius: 8px; padding: 10px 14px;
  font-size: 13px; line-height: 1.4;
  margin-bottom: 16px;
}
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-switch {
  margin-top: 20px; text-align: center;
  font-size: 13px; color: var(--text-3);
}
.auth-switch button {
  background: none; border: none; padding: 0; margin-left: 4px;
  color: var(--accent); cursor: pointer; font: inherit; text-decoration: underline;
}
.auth-switch button:hover { color: var(--accent-hover); }

/* ============================================================ FORM FIELDS */

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.field-required { color: var(--accent); margin-left: 2px; }
.field-input {
  font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 12px; outline: none;
  width: 100%; box-sizing: border-box;
  transition: border-color .12s, box-shadow .12s;
}
.field-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field-textarea { min-height: 70px; resize: vertical; line-height: 1.5; font-family: var(--sans); }
.field-select { appearance: none; cursor: pointer; }
.field-password-wrap { position: relative; display: flex; }
.field-password-wrap .field-input { padding-right: 38px; }
.field-password-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; border-radius: 6px;
  background: transparent; border: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-3); font-size: 13px;
}
.field-password-toggle:hover { background: var(--bg-alt); color: var(--text); }
.field-error { border-color: #b04a3e; }
.field-error:focus { box-shadow: 0 0 0 3px #fbe6e3; }
.field-error-msg { font-size: 12px; color: #b04a3e; }

/* ============================================================ FORM MODAL */

.form-modal {
  width: 100%; max-width: 520px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow-lg);
  overflow: hidden; max-height: 88vh;
  display: flex; flex-direction: column;
  animation: slideup .2s;
}
.form-modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 22px 26px 16px; border-bottom: 1px solid var(--border-soft);
}
.form-modal-body {
  display: flex; flex-direction: column; gap: 16px;
  padding: 22px 26px; overflow-y: auto;
}
.form-modal-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  margin-top: 4px;
}

/* ============================================================ USER MENU */

.user-menu { position: relative; }
.user-trigger {
  display: flex; align-items: center; gap: 8px;
  background: transparent; border: 1px solid transparent;
  border-radius: 99px; padding: 4px 10px 4px 4px;
  color: var(--text);
}
.user-trigger:hover { background: var(--bg-alt); border-color: var(--border); }
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.3px;
  flex-shrink: 0;
}
.user-name {
  font-size: 13px; font-weight: 500;
  max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-pop {
  position: absolute; top: 100%; right: 0; margin-top: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow-md);
  min-width: 200px; z-index: 30; overflow: hidden; padding: 4px;
  animation: slideup .15s;
}
.user-pop-item {
  width: 100%; text-align: left;
  background: transparent; border: none;
  padding: 8px 10px; border-radius: 6px;
  font-size: 13px; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.user-pop-item:hover { background: var(--bg-alt); }
.user-pop-divider { height: 1px; background: var(--border-soft); margin: 4px 2px; }

/* ============================================================ MEMBERS MODAL */

.members-modal {
  width: 100%; max-width: 560px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow-lg);
  overflow: hidden; max-height: 88vh;
  display: flex; flex-direction: column;
  animation: slideup .2s;
}
.members-modal > .auth-error { margin: 14px 28px 0; }
.members-list {
  display: flex; flex-direction: column;
  padding: 8px 28px; overflow-y: auto;
}
.member-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
}
.member-row:last-child { border-bottom: none; }
.member-meta { flex: 1; min-width: 0; }
.member-name { font-size: 13.5px; font-weight: 500; color: var(--text); }
.member-email { font-size: 12px; color: var(--text-3); }
.member-role-badge {
  font-size: 11px; font-weight: 500; padding: 3px 10px; border-radius: 99px;
  text-transform: uppercase; letter-spacing: 0.4px; flex-shrink: 0;
}
.member-role-ADMIN { background: var(--accent-soft); color: var(--accent); }
.member-role-MEMBER { background: var(--bg-alt); color: var(--text-2); }
.member-row .field-input.field-select { width: auto; padding: 6px 10px; font-size: 12.5px; }
.invite-form {
  display: flex; align-items: flex-end; gap: 10px;
  padding: 16px 28px 24px; border-top: 1px solid var(--border-soft);
}
.invite-form .field { flex: 1; }
