/* ─── TOKENS ───────────────────────────── */
:root {
  --ink: #1a1814;
  --ink-soft: #4a4640;
  --ink-mute: #8a857d;
  --paper: #faf7f0;
  --paper-warm: #f3eee2;
  --paper-deep: #ebe5d3;
  --line: #d8d0bb;
  --line-soft: #e6dfcb;
  --accent: #b4391f;
  --accent-soft: #f0d9d0;
  --teal: #1d6e56;
  --teal-soft: #d4e8df;
  --gold: #b8852a;
  --gold-soft: #f0e0bd;
  --violet: #5a4cb7;
  --violet-soft: #ddd9f0;
  --cobalt: #1e6fa8;
  --bronze: #8a6020;
  --magenta: #b8377a;
  --slate: #5a5550;

  --t1: #d9a04a; --t2: #8a7dd4; --t3: #4a4640; --t4: #c75a30;
  --t5: #3a9b7a; --t6: #1d6e56; --t7: #b8852a; --t8: #b4391f; --t9: #a83a6f;

  --display: 'Fraunces', Georgia, serif;
  --body: 'Inter Tight', system-ui, sans-serif;
  --mono: 'JetBrains Mono', monospace;
}

/* ─── LIGHT (WHITE) THEME — Claude-style white with a faint warm cast ─── */
body.theme-light {
  --paper: #ffffff;
  --paper-warm: #faf9f6;
  --paper-deep: #f1efe9;
  --line: #e7e3d9;
  --line-soft: #f1eee7;
  --ink: #1d1b16;
  --ink-soft: #514c43;
  --ink-mute: #8d877c;
}
body.theme-light {
  background-image: radial-gradient(circle at 1px 1px, rgba(26,24,20,0.03) 1px, transparent 0);
}

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

html, body {
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

body {
  background-image: radial-gradient(circle at 1px 1px, rgba(26,24,20,0.04) 1px, transparent 0);
  background-size: 24px 24px;
}

/* ─── HEADER ───────────────────────────── */
header {
  height: 64px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-warm);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 14px;
  position: relative;
  z-index: 30;
}

.logo {
  font-family: var(--display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.01em;
  font-style: normal;
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo::before {
  content: none;
}

.brand {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}
.logo-tag {
  margin-left: 0;
  align-self: flex-start;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent-soft);
  background: var(--accent-soft);
  border-radius: 4px;
  padding: 1px 6px;
  line-height: 1.4;
}

.subtitle {
  font-size: 12px;
  color: var(--ink-mute);
  border-left: 1px solid var(--line);
  padding-left: 14px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* Save indicator */
.save-indicator {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--teal);
  padding: 4px 10px;
  background: var(--teal-soft);
  border-radius: 4px;
  letter-spacing: 0.04em;
  transition: all 0.25s;
  white-space: nowrap;
  flex-shrink: 0;
}
.save-indicator.flash {
  background: var(--teal);
  color: white;
}

/* Team switcher */
.team-switcher {
  position: relative;
  border-left: 1px solid var(--line);
  padding-left: 14px;
  margin-left: 4px;
  min-width: 0;
  flex: 0 1 auto;
  max-width: 260px;
}
.team-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--body);
  font-size: 13px;
  color: var(--ink);
  transition: all 0.15s;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.team-trigger:hover { background: var(--paper-deep); border-color: var(--ink-mute); }
.team-trigger .team-name {
  flex: 1;
  min-width: 0;
  text-align: left;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.team-trigger .team-count {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-mute);
  background: var(--paper-warm);
  padding: 2px 6px;
  border-radius: 3px;
}
.team-trigger .caret { color: var(--ink-mute); font-size: 9px; transform: translateY(1px); }

.team-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 14px;
  min-width: 260px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(26,24,20,0.18);
  padding: 6px;
  display: none;
  z-index: 100;
}
.team-menu.show { display: block; }
.team-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
}
.team-menu-item:hover { background: var(--paper-warm); }
.team-menu-item.active { background: var(--paper-deep); }
.team-menu-item .tm-name { flex: 1; font-weight: 500; display: flex; flex-direction: column; gap: 1px; }
.team-menu-item .tm-import { font-family: var(--mono); font-size: 9px; font-weight: 400; color: var(--ink-mute); letter-spacing: 0.02em; }
.team-menu-item .tm-meta { font-family: var(--mono); font-size: 10px; color: var(--ink-mute); }
.team-menu-item .tm-check { color: var(--accent); font-size: 12px; opacity: 0; }
.team-menu-item.active .tm-check { opacity: 1; }
.team-menu-actions {
  border-top: 1px solid var(--line-soft);
  margin-top: 4px;
  padding-top: 4px;
  display: flex;
  flex-direction: column;
}
.team-menu-actions button {
  width: 100%;
  justify-content: flex-start;
  border: none;
  border-radius: 5px;
  background: transparent;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--ink-soft);
}
.team-menu-actions button:hover { background: var(--paper-warm); color: var(--ink); }

/* View toggle */
.view-toggle {
  display: flex;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px;
  gap: 2px;
}
.view-toggle button {
  border: none;
  background: transparent;
  padding: 5px 11px;
  font-size: 12px;
  border-radius: 4px;
  color: var(--ink-soft);
  font-family: var(--body);
  cursor: pointer;
  font-weight: 500;
}
.view-toggle button.active { background: var(--ink); color: var(--paper); }
.view-toggle button:not(.active):hover { background: var(--paper-deep); color: var(--ink); }

.header-spacer { flex: 1; }
.header-actions { display: flex; gap: 8px; align-items: center; }

/* Save button doubles as the save-state indicator: plain gray "Save" by default,
   teal "✓ Saved" briefly after a save (set by views.renderSaveIndicator). */
#btn-save { min-width: 78px; justify-content: center; }
#btn-save.is-saved {
  background: var(--teal-soft);
  border-color: var(--teal-soft);
  color: var(--teal);
}
#btn-save.is-saved:hover {
  background: var(--teal-soft);
  border-color: var(--teal);
}
#btn-save .save-tick { font-size: 12px; line-height: 1; }

/* Import LOS: never wrap; collapse to "⤓ LOS" when the header is tight */
#btn-import-los { white-space: nowrap; }

/* Header overflow (kebab) menu */
.overflow-menu-wrap { position: relative; }
.overflow-trigger {
  padding: 8px 12px;
  font-size: 18px;
  line-height: 1;
  letter-spacing: 1px;
  color: var(--ink-soft);
}
.overflow-trigger.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.overflow-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 210px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(26,24,20,0.18);
  padding: 6px;
  display: none;
  flex-direction: column;
  z-index: 100;
}
.overflow-menu.show { display: flex; }
.overflow-menu button {
  width: 100%;
  justify-content: flex-start;
  border: none;
  border-radius: 5px;
  background: transparent;
  padding: 9px 10px;
  font-size: 13px;
  color: var(--ink-soft);
}
.overflow-menu button:hover { background: var(--paper-warm); color: var(--ink); border-color: transparent; }
.overflow-menu button.danger { color: var(--accent); }
.overflow-menu button.danger:hover { background: var(--accent-soft); }
.overflow-divider { height: 1px; background: var(--line-soft); margin: 4px 2px; }

/* Mobile chrome — hidden on desktop, surfaced in the mobile media query */
.mobile-only { display: none; }
.m-iconbtn {
  position: relative;
  padding: 8px 11px;
  font-size: 18px;
  line-height: 1;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.m-iconbtn .m-glance-ic { font-size: 17px; }
.m-glance-badge {
  position: absolute; top: -6px; right: -6px;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--accent); color: #fff;
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  border-radius: 9px; display: flex; align-items: center; justify-content: center;
}
.m-glance-badge[data-zero="1"] { display: none; }
.mobile-tabs {
  display: none;
  height: 48px;
  background: var(--paper-warm);
  border-bottom: 1px solid var(--line);
  padding: 6px;
  gap: 6px;
}
.mobile-tabs button {
  flex: 1;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  font-family: var(--body);
}
.mobile-tabs button.active { background: var(--ink); color: var(--paper); }

/* Mobile top-menu sheet */
.m-menu-overlay {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(26,24,20,0.42);
  display: none;
}
.m-menu-overlay.show { display: block; }
.m-menu-sheet {
  position: absolute; top: 0; right: 0;
  width: min(86vw, 340px); height: 100%;
  background: var(--paper);
  border-left: 1px solid var(--line);
  box-shadow: -12px 0 32px rgba(26,24,20,0.18);
  padding: 14px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
}
.m-menu-head {
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--display); font-style: italic; font-size: 19px; font-weight: 500;
  margin-bottom: 8px;
}
.m-menu-head button { border: none; background: transparent; font-size: 24px; color: var(--ink-mute); padding: 2px 8px; }
.m-menu-grouplabel {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-mute); margin: 12px 4px 4px;
}
.m-menu-views { display: flex; gap: 6px; background: var(--paper-warm); border: 1px solid var(--line); border-radius: 8px; padding: 4px; }
.m-menu-views button { flex: 1; border: none; background: transparent; border-radius: 5px; padding: 9px; font-size: 13px; font-weight: 500; color: var(--ink-soft); }
.m-menu-views button.active { background: var(--ink); color: var(--paper); }
.m-menu-item {
  width: 100%; justify-content: flex-start;
  border: 1px solid transparent; background: transparent;
  border-radius: 6px; padding: 12px 12px; font-size: 14px; color: var(--ink);
}
.m-menu-item:hover { background: var(--paper-warm); }
.m-menu-item.danger { color: var(--accent); }

/* Mobile panel close header (At a glance overlay) */
.m-panel-head {
  align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  background: var(--paper-warm); position: sticky; top: 0; z-index: 2;
  font-family: var(--display); font-style: italic; font-size: 18px; font-weight: 500;
}
.m-panel-head button { border: none; background: transparent; font-size: 24px; color: var(--ink-mute); padding: 2px 8px; }

/* Gestures: let JS own canvas touch interactions */
#canvas { touch-action: none; }
.node { touch-action: none; }

/* "Old partnerships" — floating history-icon toggle, bottom-left of the canvas */
.archive-fab {
  position: absolute;
  bottom: 16px;
  left: 16px;
  z-index: 5;
  display: none; /* shown by renderHeader once something is archived */
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--paper-warm);
  border: 1px solid var(--line);
  box-shadow: 0 2px 10px rgba(26,24,20,0.10);
  font-size: 15px;
  line-height: 1;
}
.archive-fab:hover { background: var(--paper-deep); border-color: var(--ink-mute); }
.archive-fab .archive-fab-ic { font-size: 15px; filter: grayscale(0.2); }
.archive-fab .arch-count {
  background: var(--paper-deep);
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 3px;
}
.archive-fab.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.archive-fab.active .arch-count { background: rgba(255,255,255,0.2); color: var(--paper); }

/* ─── GOALS ───────────────────────────── */
.goals-intro { font-size: 11px; color: var(--ink-mute); line-height: 1.55; margin-bottom: 10px; }
.goal-card {
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-left: 3px solid #b8852a;
  border-radius: 4px;
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.goal-card:hover { background: var(--paper-warm); border-left-color: #8a6020; }
.goal-head { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
.goal-name { font-weight: 600; font-size: 13px; color: var(--ink); }
.goal-body { font-size: 12px; color: var(--ink-soft); line-height: 1.55; }
.goal-body b { color: var(--ink); font-weight: 600; }

/* ─── BUTTONS ───────────────────────────── */
button {
  font-family: var(--body);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
}
button:hover { background: var(--paper-warm); border-color: var(--ink-mute); }
button:active { transform: translateY(1px); }
button.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
button.primary:hover { background: var(--ink-soft); }
button.accent { background: var(--accent); color: var(--paper); border-color: var(--accent); }
button.accent:hover { background: #9a2f17; }
button.danger { color: var(--accent); border-color: var(--accent-soft); }
button.danger:hover { background: var(--accent-soft); }
button.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
button.ghost { border-color: transparent; }
button.ghost:hover { border-color: var(--line); }

/* ─── LAYOUT ───────────────────────────── */
.app {
  display: grid;
  grid-template-columns: 280px 1fr 340px;
  height: calc(100vh - 64px);
  position: relative;
}

.panel {
  overflow-y: auto;
  background: var(--paper-warm);
  border-right: 1px solid var(--line);
}
.panel.right { border-right: none; border-left: 1px solid var(--line); }

.panel-section {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line-soft);
}
.panel-section:last-child { border-bottom: none; }

.section-label {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-mute);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.section-label .count {
  background: var(--paper-deep);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--ink-soft);
}

.empty-soft {
  font-size: 12px;
  color: var(--ink-mute);
  font-style: italic;
  font-family: var(--display);
}

/* ─── ROSTER ───────────────────────────── */
.roster { display: flex; flex-direction: column; gap: 4px; }
.roster-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s;
  position: relative;
}
.roster-item:hover { background: var(--paper-deep); }
.roster-item.active {
  background: var(--paper-deep);
  box-shadow: inset 2px 0 0 var(--accent);
}
.roster-item.ghost { opacity: 0.55; }
.roster-item.ghost .tier-dot { filter: grayscale(0.5); }

.ghost-tag {
  font-family: var(--mono);
  font-size: 8px;
  background: var(--ink-mute);
  color: var(--paper);
  padding: 1px 4px;
  border-radius: 2px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: 1px;
}

.tier-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--mono);
  flex-shrink: 0;
}
.roster-name {
  font-weight: 500;
  flex: 1;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.roster-meta {
  font-size: 11px;
  color: var(--ink-mute);
  font-family: var(--mono);
}
.roster-pv {
  font-size: 11px;
  color: var(--ink-mute);
  font-family: var(--mono);
  flex-shrink: 0;
  white-space: nowrap;
}

.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--ink-mute);
  font-size: 13px;
  font-style: italic;
  font-family: var(--display);
}

/* ─── CANVAS / VIEWS ───────────────────────────── */
.canvas-wrap {
  position: relative;
  background: var(--paper);
  overflow: hidden;
}

.view {
  position: absolute;
  inset: 0;
  display: none;
}
.view.active { display: block; }

.canvas-toolbar {
  position: absolute;
  top: 16px;
  left: 16px;
  display: flex;
  gap: 6px;
  z-index: 5;
  background: var(--paper-warm);
  padding: 6px;
  border-radius: 8px;
  border: 1px solid var(--line);
  align-items: center;
}
.canvas-toolbar button {
  padding: 6px 11px;
  font-size: 12px;
}
.canvas-toolbar button#btn-zoom-in,
.canvas-toolbar button#btn-zoom-out,
.canvas-toolbar button#btn-zoom-reset {
  padding: 6px 9px;
  font-family: var(--mono);
  font-size: 13px;
  min-width: 30px;
  justify-content: center;
}
.toolbar-divider {
  width: 1px;
  height: 20px;
  background: var(--line);
  margin: 0 2px;
}
.zoom-indicator {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-mute);
  padding: 0 6px;
  min-width: 42px;
  text-align: center;
  letter-spacing: 0.04em;
}
#btn-archive-toggle .arch-count {
  background: var(--paper-deep);
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 3px;
}
#btn-archive-toggle.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
#btn-archive-toggle.active .arch-count {
  background: rgba(255,255,255,0.2);
  color: var(--paper);
}

.canvas-instructions {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 5;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 12px;
  display: none;
  align-items: center;
  gap: 8px;
  max-width: 260px;
}
.canvas-instructions.show { display: flex; }
.pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 1.4s infinite;
  flex-shrink: 0;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

#canvas {
  position: absolute;
  inset: 0;
  cursor: grab;
  overflow: hidden;
}
#canvas:active { cursor: grabbing; }
#canvas.connecting { cursor: crosshair; }
#canvas.connecting .node { cursor: crosshair; }

/* Viewport that holds nodes + edges, transformed for pan/zoom */
#viewport {
  position: absolute;
  top: 0; left: 0;
  width: 4000px;
  height: 3000px;
  transform-origin: 0 0;
  transition: transform 0.05s linear;
}

#canvas.focused .node:not(.in-focus) { display: none; }
#canvas.focused #edges path:not(.in-focus) { display: none; }
#canvas.focused .edge-label:not(.in-focus) { display: none; }

.focus-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 5;
  background: var(--accent);
  color: white;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12px;
  display: none;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(180,57,31,0.25);
}
.focus-badge.show { display: inline-flex; }
.focus-badge button {
  background: rgba(255,255,255,0.18);
  border: none;
  color: white;
  padding: 3px 8px;
  font-size: 11px;
  border-radius: 4px;
}
.focus-badge button:hover { background: rgba(255,255,255,0.28); }

.node {
  position: absolute;
  width: 110px;
  cursor: grab;
  user-select: none;
  transition: opacity 0.18s ease;
}
.node:active { cursor: grabbing; }
.node-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-family: var(--display);
  font-weight: 500;
  font-size: 22px;
  font-style: italic;
  border: 3px solid var(--paper);
  box-shadow: 0 2px 0 var(--line), 0 4px 12px rgba(26,24,20,0.08);
  transition: transform 0.15s, box-shadow 0.15s;
}
.node:hover .node-circle {
  transform: scale(1.06);
  box-shadow: 0 2px 0 var(--ink-mute), 0 6px 16px rgba(26,24,20,0.15);
}
.node.selected .node-circle {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.node.in-focus.focus-center .node-circle {
  box-shadow: 0 0 0 4px var(--accent), 0 6px 16px rgba(26,24,20,0.18);
  border-color: var(--paper);
}
.node-name {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  margin-top: 6px;
  color: var(--ink);
}
.node-tier-label {
  text-align: center;
  font-size: 10px;
  color: var(--ink-mute);
  margin-top: 1px;
  font-family: var(--mono);
}

/* Ghost mode node — faded, dashed border */
.node.ghost { opacity: 0.55; }
.node.ghost .node-circle {
  border-style: dashed;
  border-width: 2px;
  border-color: var(--ink-mute);
  filter: grayscale(0.4);
}
.node.ghost .node-name {
  font-style: italic;
  color: var(--ink-mute);
}

/* Quit / old-partnership node — heavily faded, grayscale, struck through */
.node.archived { opacity: 0.4; }
.node.archived .node-circle {
  border-style: dashed;
  border-width: 2px;
  border-color: var(--ink-mute);
  filter: grayscale(0.85);
}
.node.archived .node-name { font-style: italic; color: var(--ink-mute); text-decoration: line-through; }
.node.archived .node-tier-label { opacity: 0.6; }

/* Couple heart marker */
.couple-mark {
  position: absolute;
  top: -10px;
  right: 16px;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--magenta);
  color: white;
  font-size: 10px;
  border-radius: 50%;
  border: 2px solid var(--paper);
  z-index: 1;
  box-shadow: 0 2px 4px rgba(184,55,122,0.3);
}

#edges {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
#edges path { pointer-events: stroke; cursor: pointer; transition: stroke-opacity 0.18s ease, stroke-width 0.18s ease, opacity 0.18s ease; }
#edges path:hover { stroke-width: 2.4; }
#edges path.archived { opacity: 0.55; }

/* All non-violation edges default to 50% opacity so the canvas reads quietly.
   Hover (or the wider hit-area for upline) bumps them to full strength. */
#edges path.edge:not(.violation) { stroke-opacity: 0.5; }
#edges path.edge.hover-reveal { stroke-opacity: 1; stroke-width: 2.2; }
#edges path.edge.violation { stroke-opacity: 1; }

/* Labels for non-violation/non-archived edges hide by default and reveal on hover */
.edge-label:not(.bad):not(.archived) {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
.edge-label.hover-reveal { opacity: 1; }

/* Quiet upline edges go even further — almost invisible. */
#edges path.upline-quiet { stroke-opacity: 0.18; stroke-width: 1.3; }
#edges path.upline-quiet.hover-reveal {
  stroke-opacity: 1;
  stroke-width: 1.8;
}
#edges path.edge-upline-hit { cursor: pointer; pointer-events: stroke; }
.edge-label.upline-quiet {
  opacity: 0;
  pointer-events: none;
}
.edge-label.upline-quiet.hover-reveal { opacity: 1; }
#canvas.focused #edges path.upline-quiet.in-focus { stroke-opacity: 0.55; }

.edge-label {
  position: absolute;
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-family: var(--mono);
  color: var(--ink-soft);
  pointer-events: none;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  transition: opacity 0.18s ease;
  z-index: 2;
}
.edge-label.bad { background: var(--accent); color: white; border-color: var(--accent); }
.edge-label.couple {
  background: var(--magenta);
  color: white;
  border-color: var(--magenta);
}
.edge-label.archived {
  background: var(--paper-deep);
  color: var(--ink-mute);
  opacity: 0.7;
}

.empty-canvas {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--ink-mute);
  pointer-events: none;
}
.empty-canvas-title {
  font-family: var(--display);
  font-style: italic;
  font-size: 28px;
  color: var(--ink-soft);
  margin-bottom: 6px;
  font-weight: 400;
}
.empty-canvas-sub { font-size: 13px; max-width: 280px; line-height: 1.5; }

/* ─── TIMELINE ───────────────────────────── */
.timeline-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  padding: 24px 32px;
  overflow: hidden;
}
.timeline-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-shrink: 0;
}
.timeline-title {
  font-family: var(--display);
  font-style: italic;
  font-size: 24px;
  font-weight: 500;
}
.timeline-subtitle {
  font-size: 12px;
  color: var(--ink-mute);
  margin-top: 2px;
}
.timeline-range {
  display: flex;
  gap: 4px;
  background: var(--paper-warm);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px;
}
.timeline-range button {
  border: none;
  background: transparent;
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 4px;
  font-family: var(--mono);
  color: var(--ink-soft);
}
.timeline-range button.active { background: var(--ink); color: var(--paper); }

.timeline-canvas {
  flex: 1;
  position: relative;
  background: var(--paper-warm);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.timeline-svg { width: 100%; height: 100%; display: block; }

.timeline-legend {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  font-size: 11px;
  color: var(--ink-soft);
  flex-shrink: 0;
}
.timeline-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.timeline-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--ink-mute);
  text-align: center;
  padding: 32px;
}
.timeline-empty-title {
  font-family: var(--display);
  font-style: italic;
  font-size: 24px;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

/* Timeline tooltip + line hover state */
.timeline-tooltip {
  position: absolute;
  display: none;
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 8px;
  padding: 10px 12px;
  box-shadow: 0 8px 24px rgba(26,24,20,0.18);
  font-size: 12px;
  z-index: 20;
  pointer-events: none;
  min-width: 200px;
  max-width: 240px;
}
.tlt-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line-soft);
}
.tlt-tier {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  flex-shrink: 0;
}
.tlt-name {
  font-family: var(--display);
  font-style: italic;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.1;
}
.tlt-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 3px 0;
  font-size: 11px;
}
.tlt-row span:first-child {
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-mute);
  flex: 1;
}
.tlt-row b {
  font-weight: 600;
  color: var(--ink);
}
.tlt-row small {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--ink-mute);
}

/* Timeline line interactions — lines themselves are not hover targets
   (overlapping tier rows make them ambiguous); only event markers are. */
.tl-line { cursor: default; transition: opacity 0.18s ease, stroke-width 0.18s ease; }
.tl-line.tl-active { stroke-width: 3.4; }
.tl-line.tl-dim { opacity: 0.18; }
.tl-hit-dot { cursor: pointer; }
.tl-dot, .tl-endcap { cursor: pointer; }

/* ─── DIAGNOSTIC ───────────────────────────── */
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.metric {
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 10px 12px;
}
.metric-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-mute);
  margin-bottom: 4px;
  font-family: var(--mono);
}
.metric-value {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 500;
  line-height: 1;
  color: var(--ink);
}
.metric.danger .metric-value { color: var(--accent); }
.metric.success .metric-value { color: var(--teal); }

/* ─── PV TRACKER ───────────────────────────── */
.pv-head { cursor: pointer; user-select: none; }
.pv-head-title { display: inline-flex; align-items: center; gap: 6px; }
.pv-chev { display: inline-block; font-size: 9px; transition: transform .15s ease; }
.pv-section.collapsed .pv-chev { transform: rotate(-90deg); }
.pv-section.collapsed .pv-body { display: none; }

.pv-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.pv-stat { background: var(--paper); border: 1px solid var(--line-soft); border-radius: 8px; padding: 8px 10px; }
.pv-stat-val { font-family: var(--display); font-size: 22px; line-height: 1; color: var(--accent); }
.pv-stat-lab { font-family: var(--mono); font-size: 9px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-mute); margin-top: 4px; }

.pv-row { display: flex; gap: 9px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.pv-row:last-child { border-bottom: none; }
.pv-row.done { opacity: .42; }
.pv-row.done .pv-name { text-decoration: line-through; }
.pv-check { flex: none; padding-top: 2px; cursor: pointer; }
.pv-check input { width: 16px; height: 16px; accent-color: var(--teal); cursor: pointer; }
.pv-main { flex: 1; min-width: 0; }
.pv-row-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pv-name { display: inline-flex; align-items: center; gap: 6px; background: none; border: none; padding: 0; cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 600; color: var(--ink); text-align: left; }
.pv-name:hover { color: var(--accent); }
.tier-dot.inline { width: 18px; height: 18px; font-size: 8px; flex: none; }
.pv-val { font-family: var(--mono); font-size: 11px; flex: none; white-space: nowrap; }
.pv-val.none { color: var(--accent); }
.pv-val.low { color: #8a6020; }
.pv-los { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 5px; }
.pv-los-lab { font-family: var(--mono); font-size: 8px; letter-spacing: .08em; color: var(--ink-mute); background: var(--paper-deep); padding: 1px 4px; border-radius: 3px; }
.pv-up { background: none; border: none; padding: 0; cursor: pointer; font-family: var(--mono); font-size: 10px; color: var(--ink-soft); display: inline-flex; align-items: center; gap: 3px; }
.pv-up.direct { color: var(--ink); font-weight: 600; }
.pv-up:hover { color: var(--accent); }
.pv-up-t { font-size: 8px; color: var(--ink-mute); }
.pv-arrow { color: var(--ink-mute); font-size: 9px; }
.pv-los-none { font-family: var(--mono); font-size: 10px; color: var(--ink-mute); font-style: italic; }

.insight-card {
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--ink-mute);
  border-radius: 4px;
  padding: 10px 12px;
  margin-bottom: 8px;
  font-size: 12px;
  line-height: 1.55;
}
.insight-card.risk { border-left-color: var(--accent); }
.insight-card.opp { border-left-color: var(--teal); }
/* Opportunity "mark implemented" checkbox */
.insight-card.opp { position: relative; padding-right: 34px; }
.opp-check {
  position: absolute; top: 8px; right: 8px;
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.opp-check input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--teal); margin: 0; }
.insight-card.opp.done { opacity: 0.5; border-left-color: var(--ink-mute); background: var(--paper-warm); }
.insight-card.opp.done .insight-body { text-decoration: line-through; text-decoration-color: var(--ink-mute); }
.insight-card.opp.done .insight-kicker { color: var(--ink-mute); }
.insight-card[data-kind="bottleneck"] { border-left-color: var(--accent); }
.insight-card[data-kind="group-coaching"] { border-left-color: var(--violet); }
.insight-card[data-kind="training-pod"] { border-left-color: var(--cobalt); }
.insight-card[data-kind="tier-path"] { border-left-color: var(--bronze); }
.insight-card[data-kind="rebuild"] { border-left-color: var(--slate); }
.insight-card[data-kind="cadence"] { border-left-color: var(--cobalt); }
.insight-card[data-kind="stalled"] { border-left-color: var(--gold); }
.insight-card[data-kind="runner"] { border-left-color: var(--teal); }
.insight-card[data-kind="runner"] .insight-kicker { color: var(--teal); }
.insight-card .insight-kicker {
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
  color: var(--ink-mute);
}
.insight-card.risk .insight-kicker { color: var(--accent); }
.insight-card.opp .insight-kicker { color: var(--teal); }
.insight-card.goal-insight { border-left-color: var(--bronze); background: var(--gold-soft); }
.insight-card.goal-insight .insight-kicker { color: #8a6020; }
.insight-card b { font-weight: 600; }

.legend { display: flex; flex-direction: column; gap: 6px; font-size: 11px; color: var(--ink-soft); }
.legend-row { display: flex; align-items: center; gap: 8px; }
.legend-line { width: 22px; height: 2px; }

/* ─── DRAWER ───────────────────────────── */
.drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 380px;
  background: var(--paper);
  border-left: 1px solid var(--line);
  box-shadow: -12px 0 32px rgba(26,24,20,0.08);
  z-index: 20;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.drawer.show { transform: translateX(0); }
.drawer.ghost .drawer-avatar {
  filter: grayscale(0.5);
  opacity: 0.7;
  border-style: dashed;
}

.drawer-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--paper-warm);
  flex-shrink: 0;
}
.drawer-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-family: var(--display);
  font-size: 20px;
  font-style: italic;
  font-weight: 500;
  border: 3px solid var(--paper);
  box-shadow: 0 2px 0 var(--line);
  flex-shrink: 0;
}
.drawer-id { flex: 1; min-width: 0; }
.drawer-name {
  font-family: var(--display);
  font-style: italic;
  font-size: 22px;
  font-weight: 500;
  line-height: 1.1;
  cursor: text;
}
.drawer-name:hover { color: var(--accent); }
.drawer-meta {
  font-size: 11px;
  color: var(--ink-mute);
  font-family: var(--mono);
  margin-top: 4px;
  letter-spacing: 0.04em;
}
.drawer-close {
  border: none;
  background: transparent;
  padding: 4px 8px;
  font-size: 18px;
  color: var(--ink-mute);
  cursor: pointer;
  flex-shrink: 0;
}
.drawer-close:hover { color: var(--ink); background: var(--paper-deep); border-radius: 4px; }

.drawer-actions {
  padding: 12px 24px;
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--line-soft);
  flex-shrink: 0;
  flex-wrap: wrap;
  align-items: center;
}
.drawer-actions button {
  font-size: 11px;
  padding: 6px 10px;
}
.drawer-actions .focus-help {
  padding: 6px 9px;
  font-family: var(--mono);
  font-weight: 600;
  color: var(--ink-mute);
  min-width: 28px;
  justify-content: center;
}
.drawer-actions .focus-help:hover { color: var(--ink); background: var(--paper-warm); }

.drawer-body { flex: 1; overflow-y: auto; }

.drawer-section {
  padding: 18px 24px;
  border-bottom: 1px solid var(--line-soft);
}
.drawer-section:last-child { border-bottom: none; }
.drawer-section-label {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-mute);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.autosaves {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--ink-mute);
  letter-spacing: 0.06em;
}

.tier-pill-group {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 4px;
}
.tier-pill {
  border: 1px solid var(--line);
  background: var(--paper-warm);
  border-radius: 4px;
  padding: 8px 0 6px;
  font-family: var(--mono);
  font-size: 10px;
  text-align: center;
  cursor: pointer;
  color: var(--ink-soft);
  transition: all 0.15s;
}
.tier-pill:hover { border-color: var(--ink-mute); }
.tier-pill.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
  font-weight: 600;
}
.tier-pill-help {
  font-size: 11px;
  color: var(--ink-mute);
  margin-top: 8px;
  font-family: var(--mono);
  text-align: center;
}

/* Launch date row */
.launch-row {
  display: flex;
  gap: 8px;
}
.launch-row select,
.launch-row input {
  padding: 8px 10px;
  font-family: var(--body);
  font-size: 13px;
  background: var(--paper-warm);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  outline: none;
}
.launch-row select { flex: 1; }
.launch-row input { width: 92px; font-family: var(--mono); }
.launch-row select:focus,
.launch-row input:focus { border-color: var(--ink); background: var(--paper); }

/* Ghost toggle */
.ghost-toggle {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  background: var(--paper-warm);
  border: 1px solid var(--line-soft);
}
.ghost-toggle:hover { border-color: var(--ink-mute); }
.ghost-toggle input { display: none; }
.ghost-slider {
  position: relative;
  width: 32px;
  height: 18px;
  background: var(--line);
  border-radius: 999px;
  flex-shrink: 0;
  transition: background 0.2s;
  margin-top: 2px;
}
.ghost-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: var(--paper);
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.ghost-toggle input:checked + .ghost-slider { background: var(--slate); }
.ghost-toggle input:checked + .ghost-slider::after { transform: translateX(14px); }
.ghost-label { font-size: 12px; flex: 1; }
.ghost-label b { display: block; font-weight: 600; }
.ghost-label small {
  display: block;
  color: var(--ink-mute);
  font-size: 11px;
  line-height: 1.4;
  margin-top: 2px;
  font-family: var(--body);
}

/* Monthly notes: month picker row above the textarea */
.notes-month-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.notes-month-select {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  font-family: var(--body);
  font-size: 12px;
  background: var(--paper-warm);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  outline: none;
  cursor: pointer;
}
.notes-month-select:focus { border-color: var(--ink); background: var(--paper); }
.notes-month-today {
  flex-shrink: 0;
  padding: 7px 10px;
  font-size: 11px;
  font-family: var(--mono);
  letter-spacing: 0.02em;
  color: var(--ink-soft);
}
.notes-area.past-month {
  background: var(--paper-deep);
  border-style: dashed;
}

.notes-area, .motivations-area {
  width: 100%;
  min-height: 80px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper-warm);
  font-family: var(--body);
  font-size: 13px;
  color: var(--ink);
  resize: vertical;
  line-height: 1.55;
  outline: none;
  transition: border 0.15s;
}
.notes-area:focus, .motivations-area:focus { border-color: var(--ink); background: var(--paper); }
.motivations-area {
  font-style: italic;
  font-family: var(--display);
  font-size: 14px;
}
.notes-hint {
  font-size: 10px;
  font-family: var(--mono);
  color: var(--ink-mute);
  margin-top: 6px;
  letter-spacing: 0.04em;
}

.connection-row {
  display: grid;
  grid-template-columns: 22px 1fr auto auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 6px 10px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line-soft);
  font-size: 12px;
}
.connection-row:last-child { border-bottom: none; }
.connection-row.archived { opacity: 0.55; }
.connection-row .tier-dot { width: 22px; height: 22px; font-size: 9px; }
.connection-row .conn-name { font-weight: 500; cursor: pointer; }
.connection-row .conn-name:hover { color: var(--accent); }
.connection-row .conn-type {
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--paper);
  white-space: nowrap;
}
.connection-row .conn-edit {
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-mute);
  font-size: 12px;
  padding: 4px 6px;
  min-width: 26px;
  justify-content: center;
  border-radius: 4px;
}
.connection-row .conn-edit:hover {
  background: var(--paper-warm);
  color: var(--ink);
  border-color: var(--line);
}
.connection-row .conn-meta {
  grid-column: 2 / -1;
  font-size: 10px;
  font-family: var(--mono);
  color: var(--ink-mute);
  letter-spacing: 0.04em;
}
.connection-empty {
  font-size: 12px;
  color: var(--ink-mute);
  font-style: italic;
  font-family: var(--display);
  padding: 4px 0;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
}
.history-list::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: var(--line);
}
.history-entry {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  font-size: 12px;
  position: relative;
}
.history-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--ink-mute);
  border: 2px solid var(--paper);
  flex-shrink: 0;
  margin-top: 3px;
  z-index: 1;
}
.history-dot.tier { background: var(--accent); }
.history-dot.joined { background: var(--teal); }
.history-dot.connection { background: var(--violet); }
.history-content { flex: 1; line-height: 1.5; }
.history-del {
  flex: none; align-self: flex-start; border: none; background: transparent;
  color: var(--ink-mute); font-size: 12px; cursor: pointer;
  width: 22px; height: 22px; border-radius: 5px; opacity: 0; transition: opacity 0.12s, background 0.12s, color 0.12s;
  display: inline-flex; align-items: center; justify-content: center; padding: 0; line-height: 1;
}
.history-entry:hover .history-del { opacity: 1; }
.history-del:hover { background: var(--accent); color: var(--paper); }
.history-text { color: var(--ink-soft); }
.history-text b { color: var(--ink); font-weight: 600; }
.history-date {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-mute);
  margin-top: 2px;
}

/* ─── MODAL ───────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26,24,20,0.45);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}
.modal-backdrop.show { display: flex; }
.modal {
  background: var(--paper);
  border-radius: 10px;
  padding: 28px;
  width: 380px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(26,24,20,0.3);
  border: 1px solid var(--line);
}
.modal h3 {
  font-family: var(--display);
  font-style: italic;
  font-weight: 500;
  font-size: 22px;
  margin-bottom: 4px;
}
.modal .modal-sub {
  font-size: 12px;
  color: var(--ink-mute);
  margin-bottom: 20px;
}
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 11px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-mute);
  margin-bottom: 5px;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  font-family: var(--body);
  font-size: 14px;
  background: var(--paper-warm);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  outline: none;
  transition: border 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--ink);
  background: var(--paper);
}
.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin-top: 20px;
  align-items: center;
}
.modal-actions .actions-right { display: flex; gap: 8px; }
#modal-extra { display: flex; gap: 6px; }

/* Relationship multi-select chips */
.rel-chip-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.rel-chip {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  background: var(--paper-warm);
  border: 1.5px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.rel-chip:hover { border-color: var(--ink-mute); }
.rel-chip.checked {
  background: var(--paper);
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(26,24,20,0.05);
}
.rel-chip input[type="checkbox"] {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 16px;
  height: 16px;
  accent-color: var(--ink);
  cursor: pointer;
}
.rel-chip-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
  flex-shrink: 0;
}
.rel-chip-label {
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.rel-chip-sub {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rel-chip .sub-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}
.rel-chip .sub-row label {
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-mute);
  margin: 0;
  flex-shrink: 0;
  width: 70px;
}
.rel-chip .sub-row select,
.rel-chip .sub-row input {
  flex: 1;
  padding: 4px 6px;
  font-size: 11px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  font-family: var(--body);
}
.rel-chip .sub-row select:disabled,
.rel-chip .sub-row input:disabled {
  opacity: 0.4;
  pointer-events: none;
}
.rel-chip .sub-inline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}
.rel-chip .sub-inline small {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--ink-mute);
  text-transform: uppercase;
}
.rel-chip .sub-note {
  font-size: 10px;
  color: var(--ink-mute);
  font-style: italic;
  line-height: 1.4;
}

/* ─── PAIR MENU (all-relationships between two people) ─── */
.pair-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pair-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper-warm);
}
.pair-row.archived { opacity: 0.6; background: var(--paper-deep); }
.pair-swatch {
  width: 4px;
  align-self: stretch;
  border-radius: 2px;
  flex-shrink: 0;
}
.pair-row-main { flex: 1; min-width: 0; }
.pair-row-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.pair-row-title b { font-size: 13px; }
.pair-row-dir {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
}
.pair-row-meta {
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
}
.pair-row-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.pair-row-actions button {
  padding: 4px 8px;
  font-size: 11px;
  min-width: 28px;
  justify-content: center;
}

/* ─── PROCESSES INPUT (drawer) ─── */
.processes-row {
  display: flex;
  align-items: stretch;
  gap: 6px;
}
.processes-row .proc-step {
  width: 36px;
  padding: 8px 0;
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 600;
  background: var(--paper-warm);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.processes-row .proc-step:hover {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.processes-row .processes-input {
  flex: 1;
  padding: 8px 12px;
  font-family: var(--display);
  font-size: 20px;
  font-style: italic;
  font-weight: 500;
  text-align: center;
  background: var(--paper-warm);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  outline: none;
  -moz-appearance: textfield;
}
.processes-row .processes-input::-webkit-outer-spin-button,
.processes-row .processes-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.processes-row .processes-input:focus {
  border-color: var(--ink);
  background: var(--paper);
}

/* ─── PAST PARTNERS LIST ─── */
.past-partners-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 6px;
}
.past-row {
  display: grid;
  grid-template-columns: 26px 1fr auto auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--paper-warm);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  border-left: 3px solid var(--ink-mute);
}
.past-row .tier-dot {
  width: 26px;
  height: 26px;
  font-size: 10px;
  opacity: 0.7;
  filter: grayscale(0.4);
}
.past-row .tier-dot.past-unknown {
  background: var(--paper-deep);
  color: var(--ink-mute);
  border: 1px dashed var(--line);
}
.past-main { min-width: 0; }
.past-name {
  font-weight: 600;
  font-size: 13px;
  font-style: italic;
  font-family: var(--display);
  text-decoration: line-through;
  text-decoration-color: var(--line);
  text-decoration-thickness: 1px;
  color: var(--ink-soft);
}
.past-meta {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
  margin-top: 2px;
}
.past-reason {
  font-family: var(--body);
  font-style: italic;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink-soft);
}
.past-bringback, .past-edit, .past-remove {
  padding: 4px 8px;
  font-size: 12px;
  min-width: 28px;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink-mute);
}
.past-edit:hover { background: var(--paper); color: var(--ink); border-color: var(--line); }
.past-bringback:hover { background: var(--teal-soft); color: var(--teal); border-color: var(--teal-soft); }
.past-remove:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-soft); }

/* Quit on-map people surfaced as past partnerships */
.past-row.past-quit { grid-template-columns: 26px 1fr auto auto; border-left-color: var(--accent); }
.past-open, .past-restore {
  padding: 4px 8px; font-size: 12px; cursor: pointer;
  background: var(--paper-warm); border: 1px solid transparent; border-radius: 5px; color: var(--ink-soft);
}
.past-open:hover { background: var(--paper); color: var(--ink); border-color: var(--line); }
.past-restore:hover { background: var(--teal-soft); color: var(--teal); border-color: var(--teal-soft); }

/* Bring-back modal options */
.bb-status { display: flex; flex-direction: column; gap: 8px; }
.bb-opt {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px;
  background: var(--paper-warm);
  border: 1.5px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.bb-opt:hover { border-color: var(--ink-mute); }
.bb-opt input { margin-top: 3px; }
.bb-opt span { display: flex; flex-direction: column; gap: 2px; }
.bb-opt b { font-size: 13px; }
.bb-opt small { font-size: 11px; color: var(--ink-mute); line-height: 1.4; }

.add-past-partner {
  font-size: 11px;
  padding: 3px 8px;
  font-family: var(--mono);
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  border-color: transparent;
}
.add-past-partner:hover { background: var(--paper-warm); color: var(--ink); border-color: var(--line); }

/* ─── PERSON INSIGHTS (drawer) ─── */
.person-insights {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.person-insights .insight-card { margin-bottom: 0; }

/* ─── PARTNERSHIP ENDED MODAL ─── */
.pe-prefill {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-mute);
  padding: 8px 12px;
  background: var(--paper-warm);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  letter-spacing: 0.04em;
}
.pe-targets {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pe-target {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--paper-warm);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}
.pe-target:hover { border-color: var(--ink-mute); }
.pe-target input { accent-color: var(--ink); }

/* Partner chooser for "Partnership ended" from drawer */
.pe-pick-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pe-pick {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--paper-warm);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.12s;
}
.pe-pick:hover {
  background: var(--paper);
  border-color: var(--ink);
}
.pe-pick-name { flex: 1; font-weight: 500; font-size: 13px; }
.pe-pick-tier {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-mute);
}

/* Drawer footer with action buttons */
.drawer-footer {
  display: flex;
  gap: 8px;
  background: var(--paper-warm);
  border-top: 1px solid var(--line);
  border-bottom: none !important;
  padding: 16px 24px;
}
.drawer-footer button {
  flex: 1;
  justify-content: center;
  padding: 9px 12px;
  font-size: 12px;
}
.drawer-footer .btn-partnership-ended {
  color: var(--accent);
  border-color: var(--accent-soft);
  background: var(--paper);
}
.drawer-footer .btn-partnership-ended:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

/* ─── REPORT ───────────────────────────── */
.report-wrap {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  background: var(--paper);
  padding: 32px 40px;
}
.report {
  max-width: 760px;
  margin: 0 auto;
  background: var(--paper);
  padding: 56px 56px 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(26,24,20,0.06);
}
.report-actions {
  max-width: 760px;
  margin: 0 auto 16px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.report-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 24px;
  border-bottom: 2px solid var(--ink);
  margin-bottom: 32px;
}
.report-h1 {
  font-family: var(--display);
  font-style: italic;
  font-size: 36px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.report-team-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 6px;
}
.report-date {
  text-align: right;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.report-date strong {
  display: block;
  font-family: var(--display);
  font-style: italic;
  font-weight: 500;
  font-size: 20px;
  color: var(--ink);
  letter-spacing: -0.01em;
  text-transform: none;
  margin-top: 4px;
}

.report-section {
  margin-bottom: 36px;
  page-break-inside: avoid;
}
.report-section h2 {
  font-family: var(--display);
  font-style: italic;
  font-size: 22px;
  font-weight: 500;
  margin-bottom: 14px;
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.report-section h2::before {
  content: attr(data-num);
  font-family: var(--mono);
  font-style: normal;
  font-size: 11px;
  color: var(--ink-mute);
  font-weight: 400;
  letter-spacing: 0.1em;
}
.report-h2-meta {
  font-family: var(--mono);
  font-style: normal;
  font-size: 11px;
  color: var(--ink-mute);
  font-weight: 400;
  letter-spacing: 0.08em;
}

.report-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.report-metric {
  padding: 16px 18px;
  border-right: 1px solid var(--line);
}
.report-metric:last-child { border-right: none; }
.report-metric .rm-label {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-mute);
  margin-bottom: 6px;
}
.report-metric .rm-value {
  font-family: var(--display);
  font-size: 32px;
  font-weight: 500;
  line-height: 1;
}

.report-tier-bar {
  display: flex;
  height: 36px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--paper-warm);
  margin: 12px 0 8px;
  border: 1px solid var(--line-soft);
}
.report-tier-bar-segment {
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  min-width: 0;
}
.report-tier-distribution {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 4px;
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--ink-mute);
  text-align: center;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.report-table th {
  text-align: left;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-mute);
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
.report-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-soft);
}
.report-table tr:last-child td { border-bottom: none; }
.report-table .rt-name { font-weight: 600; }
.report-table .rt-tier-dot {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  color: white;
  text-align: center;
  font-size: 9px;
  font-family: var(--mono);
  font-weight: 600;
  line-height: 18px;
  vertical-align: middle;
  margin-right: 6px;
}

.report-insight {
  border-left: 3px solid var(--ink-mute);
  padding: 10px 14px;
  margin-bottom: 10px;
  font-size: 12.5px;
  line-height: 1.55;
  background: var(--paper-warm);
  border-radius: 0 4px 4px 0;
}
.report-insight.risk { border-left-color: var(--accent); }
.report-insight.opp { border-left-color: var(--teal); }
/* Match the sidebar's per-kind accent colors so the report reads the same. */
.report-insight[data-kind="bottleneck"] { border-left-color: var(--accent); }
.report-insight[data-kind="group-coaching"] { border-left-color: var(--violet); }
.report-insight[data-kind="training-pod"] { border-left-color: var(--cobalt); }
.report-insight[data-kind="tier-path"] { border-left-color: var(--bronze); }
.report-insight[data-kind="rebuild"] { border-left-color: var(--slate); }
.report-insight[data-kind="cadence"] { border-left-color: var(--cobalt); }
.report-insight[data-kind="stalled"] { border-left-color: var(--gold); }
.report-insight[data-kind="runner"] { border-left-color: var(--teal); }
.report-insight .ri-kicker {
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-mute);
  margin-bottom: 4px;
}
.report-insight.risk .ri-kicker { color: var(--accent); }
.report-insight.opp .ri-kicker { color: var(--teal); }

.report-foot {
  margin-top: 48px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-mute);
  text-align: center;
  letter-spacing: 0.06em;
}

/* ─── SCROLLBAR ───────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-mute); }

/* ─── RESPONSIVE ───────────────────────────── */
@media (max-width: 1280px) {
  .app { grid-template-columns: 240px 1fr 320px; }
  .drawer { width: 360px; }
  .save-indicator { display: none; }
}
@media (max-width: 1400px) {
  .subtitle { display: none; }
  .team-switcher { max-width: 220px; }
}
/* Mid widths: keep every header control on-screen — the kebab + Import must never
   clip. Reclaim space from the explicit Save (auto-save covers it) and collapse the
   upgrade pill to its mark. */
@media (max-width: 1180px) {
  header { gap: 10px; }
  .header-actions { gap: 6px; }
  #btn-import-los .ils-word { display: none; }
  .team-switcher { min-width: 150px; max-width: 200px; }
  .month-nav { border-left: none; padding-left: 0; margin-left: 0; }
  .month-nav .month-label { max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (max-width: 980px) {
  header { gap: 8px; }
  .logo { font-size: 18px; }
  .view-toggle button { padding: 5px 9px; }
  .month-nav .month-label { max-width: 72px; font-size: 12px; }
  .team-switcher { min-width: 120px; max-width: 160px; }
}
@media (max-width: 860px) {
  /* ─ Header: compact, secondary controls hidden behind hamburgers ─ */
  header { height: 56px; padding: 0 12px; gap: 8px; }
  .subtitle, .view-toggle, .header-spacer, .save-indicator, .header-actions { display: none; }
  /* The team switcher is the priority — give it a real minimum so the name never
     collapses to an empty box. The wordmark yields space first instead. */
  .brand { min-width: 0; flex-shrink: 1; overflow: hidden; }
  .logo { font-size: 18px; flex-shrink: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .logo-tag { display: none; }
  .team-switcher { border-left: none; padding-left: 0; margin-left: 0; flex: 1 1 auto; min-width: 120px; max-width: none; }
  .team-trigger { min-width: 0; width: 100%; padding: 7px 10px; }
  .month-nav { border-left: none; padding-left: 0; margin-left: 0; flex-shrink: 0; }
  .month-nav button { width: 26px; height: 26px; font-size: 15px; }
  .month-nav .month-label { font-size: 12px; min-width: 0; max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .m-iconbtn { flex-shrink: 0; }

  .mobile-only { display: flex; }
  .mobile-tabs { display: flex; }

  /* ─ Single-pane body: Roster (hero) ⇄ tree map ─ */
  .app { display: block; height: calc(100vh - 56px - 48px); position: relative; }
  .panel { max-height: none; border: none; height: 100%; }
  .panel:not(.right) { display: none; }
  body[data-mtab="roster"] .panel:not(.right) { display: block; }
  .canvas-wrap { display: none; height: 100%; }
  body[data-mtab="map"] .canvas-wrap { display: block; }
  body[data-mtab="map"] .panel:not(.right) { display: none; }

  /* Roster sizing as the hero */
  .roster-item { padding: 12px 12px; }

  /* ─ "At a glance" diagnostic → full-screen overlay ─ */
  .panel.right {
    display: none;
    position: fixed; inset: 56px 0 0 0;
    width: 100%; max-height: none; height: calc(100vh - 56px);
    z-index: 360; border-left: none;
    transform: translateX(100%); transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
  }
  body.ataglance-open .panel.right { display: block; transform: translateX(0); }
  .m-panel-head { display: flex; }

  /* ─ Canvas chrome: keep toolbar + hint from colliding ─ */
  .canvas-toolbar {
    top: 8px; left: 8px; right: 8px;
    flex-wrap: wrap; justify-content: flex-start;
    padding: 5px; gap: 5px;
  }
  .canvas-toolbar button { padding: 7px 10px; }
  .canvas-instructions {
    top: auto; bottom: 12px; left: 8px; right: 8px; max-width: none;
    justify-content: center;
  }
  .focus-badge { top: auto; bottom: 64px; left: 8px; right: 8px; }

  /* ─ Drawer: full width ─ */
  .drawer { width: 100%; z-index: 380; }

  /* ─ Report: tight padding + 2×2 metrics so nothing overhangs ─ */
  .report-wrap { padding: 10px; }
  .report-actions { margin-bottom: 10px; }
  .report { padding: 22px 16px 28px; border-radius: 8px; }
  .report-header { padding-bottom: 16px; margin-bottom: 22px; }
  .report-h1 { font-size: 26px; }
  .report-section { margin-bottom: 26px; }

  .report-metrics { grid-template-columns: 1fr 1fr; }
  .report-metric { padding: 12px 14px; }
  .report-metric .rm-value { font-size: 26px; }
  .report-metric:nth-child(2n) { border-right: none; }
  .report-metric:nth-child(-n+2) { border-bottom: 1px solid var(--line); }

  /* Roster table: shrink so all columns fit the viewport */
  .report-table { font-size: 11px; }
  .report-table th, .report-table td { padding: 7px 6px; }
  .report-table th { letter-spacing: 0.04em; }
  /* Re-balance columns: give Tier room for its criteria, trim Name. Overrides
     the inline width on the <th> cells (hence !important). */
  .report-table th:nth-child(1), .report-table td:nth-child(1) { width: 26% !important; }
  .report-table th:nth-child(2), .report-table td:nth-child(2) { width: 30% !important; }
  .report-table th:nth-child(3), .report-table td:nth-child(3) { width: 22% !important; }
  .report-table th:nth-child(4), .report-table td:nth-child(4) { width: 22% !important; }

  /* Slightly larger touch targets in modals */
  .modal { width: min(94vw, 460px) !important; }
}

/* Phones: the wordmark yields entirely so the functional controls never clip. */
@media (max-width: 520px) {
  .brand { display: none; }
  .month-nav .month-label { max-width: 60px; }
}

/* ─── PRINT ───────────────────────────── */
@media print {
  html, body { overflow: visible !important; height: auto !important; background: white !important; }
  body { background-image: none !important; }
  header, .panel, .canvas-wrap > *:not(#view-report), .drawer, .modal-backdrop, .report-actions { display: none !important; }
  .app { display: block !important; height: auto !important; }
  .canvas-wrap { position: static !important; overflow: visible !important; }
  #view-report { display: block !important; position: static !important; padding: 0 !important; }
  .report-wrap { position: static !important; overflow: visible !important; padding: 0 !important; }
  .report {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    max-width: 100% !important;
  }
  .report-section { page-break-inside: avoid; }
}

/* ─── DRAWER BUSINESS STATS (LOS bio) ───────────────────── */
.bizstats-section { background: var(--paper-warm); border-radius: 8px; padding: 14px 14px 12px; border: 1px solid var(--line-soft); }
.biz-period { font-family: var(--mono); font-size: 9px; color: var(--ink-mute); letter-spacing: 0.06em; }
.bizstats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.bizstat {
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 8px 6px 7px;
  text-align: center;
}
.bizstat-label { font-family: var(--mono); font-size: 8px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-mute); }
.bizstat-value { font-family: var(--display); font-size: 18px; font-weight: 500; color: var(--ink); line-height: 1.2; margin: 2px 0 1px; }
.bizstat-value.mono { font-family: var(--mono); font-size: 11px; font-weight: 500; word-break: break-all; }
.bizstat-hint { font-size: 9px; color: var(--ink-mute); }
.bizstat.good .bizstat-value { color: var(--teal); }
.bizstat.warn .bizstat-value { color: #8a6020; }
.bizstat.bad  .bizstat-value { color: var(--accent); }

/* ─── MOMENTUM & TRENDS ───────────────────────────── */
/* Drawer business trends */
.biz-trends { margin-top: 12px; }
.biz-trends-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.biz-trends-title { font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-mute); }
.biz-momentum {
  font-family: var(--mono); font-size: 9px; font-weight: 600; letter-spacing: 0.04em;
  padding: 2px 7px; border-radius: 10px; text-transform: uppercase;
}
.biz-momentum.accelerating { background: var(--teal-soft); color: var(--teal); }
.biz-momentum.cooling { background: var(--accent-soft); color: var(--accent); }
.biz-momentum.steady { background: var(--paper-deep); color: var(--ink-soft); }
.biz-delta-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.biz-delta {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  padding: 3px 8px; border-radius: 6px; background: var(--paper); border: 1px solid var(--line-soft);
  color: var(--ink-soft);
}
.biz-delta .biz-delta-l { font-weight: 400; color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.04em; font-size: 8px; }
.biz-delta.good { color: var(--teal); border-color: var(--teal-soft); }
.biz-delta.bad { color: var(--accent); border-color: var(--accent-soft); }
.biz-delta.flat { color: var(--ink-mute); }
.biz-spark-wrap { display: flex; align-items: center; gap: 8px; color: var(--teal); }
.biz-spark-cap { font-family: var(--mono); font-size: 8px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-mute); }
.biz-spark { display: block; overflow: visible; }

/* Roster momentum arrow */
.roster-mom { font-size: 9px; flex-shrink: 0; line-height: 1; }
.roster-mom.accelerating { color: var(--teal); }
.roster-mom.cooling { color: var(--accent); }

/* This-month digest (right panel) */
.dg-row { display: flex; gap: 9px; align-items: flex-start; padding: 7px 0; border-bottom: 1px solid var(--line-soft); }
.dg-row:last-child { border-bottom: none; }
.dg-ic {
  flex-shrink: 0; width: 18px; height: 18px; border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; color: var(--paper); margin-top: 1px;
}
.dg-row.promo .dg-ic, .dg-row.gain .dg-ic { background: var(--teal); }
.dg-row.joined .dg-ic { background: var(--violet); }
.dg-row.drop .dg-ic, .dg-row.demo .dg-ic { background: var(--gold); }
.dg-row.zero .dg-ic { background: var(--accent); }
.dg-main { flex: 1; min-width: 0; }
.dg-lab { display: block; font-family: var(--mono); font-size: 9px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-mute); margin-bottom: 2px; }
.dg-people { font-size: 12px; color: var(--ink-soft); line-height: 1.5; }
.dg-name { background: none; border: none; padding: 0; font: inherit; font-weight: 600; color: var(--ink); cursor: pointer; }
.dg-name:hover { color: var(--accent); }
.dg-people small { font-family: var(--mono); font-size: 10px; color: var(--ink-mute); font-weight: 400; }

/* Timeline team-trend strip */
.timeline-trend { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; flex-shrink: 0; }
.tt-card {
  flex: 1; min-width: 180px;
  background: var(--paper-warm); border: 1px solid var(--line-soft);
  border-radius: 8px; padding: 10px 12px;
}
.tt-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.tt-lab { font-family: var(--mono); font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-mute); }
.tt-val { font-family: var(--display); font-style: italic; font-size: 16px; font-weight: 500; color: var(--ink); }
.tt-delta { margin-left: auto; font-family: var(--mono); font-size: 10px; font-weight: 600; }
.tt-delta.good { color: var(--teal); }
.tt-delta.bad { color: var(--accent); }
.tt-delta.flat { color: var(--ink-mute); }
.tt-card .biz-spark.vol { color: var(--teal); width: 100%; height: 34px; }
.tt-card .biz-spark.bonus { color: var(--cobalt); width: 100%; height: 34px; }
.tt-meta { display: flex; flex-direction: column; justify-content: center; }
.tt-range { font-family: var(--mono); font-size: 10px; color: var(--ink-mute); }

/* ─── ROSTER FILTER CHIPS ───────────────────────────── */
.roster-filters { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.rf-chip {
  font-size: 11px; padding: 4px 9px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--paper); color: var(--ink-soft); font-family: var(--body);
  display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
}
.rf-chip:hover { border-color: var(--ink-mute); }
.rf-chip.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.rf-n { font-family: var(--mono); font-size: 9px; opacity: 0.7; }
.node.filter-dim { opacity: 0.12; pointer-events: none; }

/* ─── LEG HEALTH CARDS ───────────────────────────── */
.legs-intro { font-size: 11px; color: var(--ink-mute); line-height: 1.5; margin-bottom: 10px; }
.leg-card {
  display: block; width: 100%; text-align: left;
  background: var(--paper); border: 1px solid var(--line-soft); border-radius: 8px;
  padding: 9px 11px; margin-bottom: 7px; cursor: pointer; font-family: var(--body);
}
.leg-card:hover, .leg-card.active {
  background: var(--ink); color: var(--paper); border-color: var(--ink);
}
/* On the dark hover/active surface, lift every child to readable light tones. */
.leg-card:hover .leg-vol, .leg-card.active .leg-vol { color: var(--paper); }
.leg-card:hover .leg-stats, .leg-card.active .leg-stats { color: rgba(250,247,240,0.75); }
.leg-card:hover .leg-bar, .leg-card.active .leg-bar { background: rgba(250,247,240,0.18); }
.leg-card:hover .leg-mom.accelerating, .leg-card.active .leg-mom.accelerating { color: #6cd0a8; }
.leg-card:hover .leg-mom.cooling, .leg-card.active .leg-mom.cooling { color: #f0a08c; }
.leg-top { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
.leg-top .tier-dot.inline { width: 20px; height: 20px; font-size: 8px; }
.leg-name { font-weight: 600; font-size: 13px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leg-mom { font-size: 9px; }
.leg-mom.accelerating { color: var(--teal); }
.leg-mom.cooling { color: var(--accent); }
.leg-vol { font-family: var(--mono); font-size: 11px; color: var(--ink-soft); }
.leg-stats { display: flex; gap: 10px; font-family: var(--mono); font-size: 10px; color: var(--ink-mute); margin-bottom: 6px; }
.leg-bar { height: 5px; background: var(--paper-deep); border-radius: 3px; overflow: hidden; }
.leg-bar-fill { height: 100%; background: var(--teal); border-radius: 3px; }

/* ─── DRAWER MILESTONES ───────────────────────────── */
.biz-miles { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.biz-mile {
  font-family: var(--mono); font-size: 9px; font-weight: 600; letter-spacing: 0.03em;
  padding: 3px 8px; border-radius: 10px; background: var(--gold-soft); color: #8a6020;
}
.biz-mile.first100 { background: var(--teal-soft); color: var(--teal); }
.biz-mile.anniversary { background: var(--violet-soft); color: var(--violet); }

/* ─── REPORT LEADERBOARD ───────────────────────────── */
.report-leaders .rl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 18px; margin-bottom: 14px; }
.rl-col-h { font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-mute); margin-bottom: 8px; }
.rl-list { list-style: none; margin: 0; padding: 0; }
.rl-list li { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 12.5px; border-bottom: 1px solid var(--line-soft); }
.rl-list li:last-child { border-bottom: none; }
.rl-rank { font-family: var(--mono); font-size: 10px; color: var(--ink-mute); width: 14px; }
.rl-name { flex: 1; font-weight: 600; }
.rl-val { font-family: var(--mono); font-size: 11px; color: var(--ink-soft); }
.rl-miles { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.rl-mile { display: inline-block; font-size: 12px; background: var(--paper-warm); border: 1px solid var(--line-soft); border-radius: 14px; padding: 4px 10px; margin: 0 6px 6px 0; color: var(--ink-soft); }
.rl-mile b { color: var(--ink); }

/* ─── TIDY / BULK ───────────────────────────── */
#btn-tidy { font-family: var(--body); font-size: 12px; }
#btn-select-mode { font-family: var(--body); font-size: 12px; }
#btn-select-mode.on { background: var(--ink); color: var(--paper); }

/* Map node selection (select mode) */
.node.selectable { cursor: pointer; }
.node.multi-selected .node-circle {
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 6px var(--ink);
}
.node.multi-selected::after {
  content: '✓'; position: absolute; top: -4px; right: 50%; transform: translateX(50%) translateX(20px);
  width: 18px; height: 18px; background: var(--ink); color: var(--paper);
  border: 2px solid var(--paper); border-radius: 50%; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; z-index: 6;
}

/* Roster select-mode + bulk bar */
.roster-sel-controls { margin-left: auto; display: flex; gap: 6px; }
.roster-select-toggle {
  font-size: 11px; font-family: var(--body); color: var(--ink-soft);
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 3px 11px; cursor: pointer;
}
.roster-select-toggle:hover { border-color: var(--ink-mute); }
.roster-select-toggle.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.roster-item.selectable { cursor: pointer; }
.roster-check {
  width: 19px; height: 19px; flex: none; border: 2px solid var(--ink-mute); border-radius: 5px;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--paper);
  background: var(--paper); transition: background 0.1s, border-color 0.1s;
}
.roster-item.selectable:hover .roster-check { border-color: var(--ink); }
.roster-item.selected .roster-check { background: var(--ink); border-color: var(--ink); }
.roster-item.selected { background: var(--paper-deep); }

.bulk-bar {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 1100; display: flex; align-items: center; gap: 16px;
  padding: 10px 12px 10px 20px;  background: var(--ink); border-radius: 12px; color: var(--paper);
  box-shadow: 0 12px 40px rgba(26,24,20,0.4);
  animation: bulkRise 0.16s ease-out;
}
@keyframes bulkRise { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.bulk-bar.idle { padding: 7px 9px; gap: 8px; box-shadow: 0 6px 20px rgba(26,24,20,0.28); }
.bulk-bar[hidden] { display: none !important; }
/* Keep the floating select bar out from on top of full-screen overlays/modals. */
body:has(.los-overlay.show) .bulk-bar,
body:has(.qf-overlay.show) .bulk-bar,
body:has(.m-menu-overlay.show) .bulk-bar,
body:has(.modal-backdrop.show) .bulk-bar { display: none !important; }
/* On mobile the floating select bar is a map-only tool — never let it sit on
   top of the roster tab, an open person drawer, or the At-a-glance panel.
   NOTE: each selector is its OWN rule on purpose. A :has() selector that an
   older mobile browser doesn't understand would invalidate an entire shared
   selector list — so the critical roster-tab guard is kept :has()-free and
   standalone. */
@media (max-width: 860px) {
  body:not([data-mtab="map"]) .bulk-bar { display: none !important; }
}
@media (max-width: 860px) {
  body.ataglance-open .bulk-bar { display: none !important; }
}
@media (max-width: 860px) {
  body:has(.drawer.show) .bulk-bar { display: none !important; }
}
.bulk-count { font-family: var(--mono); font-size: 12px; opacity: 0.85; white-space: nowrap; }
.bulk-actions { display: flex; align-items: center; gap: 8px; }
.bulk-btn {
  font-size: 12.5px; font-family: var(--body); cursor: pointer; white-space: nowrap;
  background: rgba(255,255,255,0.14); color: var(--paper); border: none; border-radius: 7px; padding: 8px 14px;
}
.bulk-btn:hover { background: rgba(255,255,255,0.26); }
.bulk-btn:disabled { opacity: 0.35; cursor: default; }
.bulk-btn:disabled:hover { background: rgba(255,255,255,0.14); }
.bulk-btn.ghost { background: transparent; color: rgba(255,255,255,0.6); padding: 8px 10px; }
.bulk-btn.ghost:hover { color: var(--paper); background: rgba(255,255,255,0.1); }
.bulk-btn.ghost:disabled:hover { background: transparent; }
.bulk-btn.done { background: var(--paper); color: var(--ink); font-weight: 600; }
.bulk-btn.done:hover { background: #fff; }
.bulk-btn.danger { background: rgba(217,87,46,0.22); color: #f3b9a6; }
.bulk-btn.danger:hover { background: rgba(217,87,46,0.38); color: #fff; }

.bulk-choice { display: flex; gap: 8px; }
.bulk-choice-btn {
  flex: 1; padding: 14px 8px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--paper); font-family: var(--body); font-size: 14px; font-weight: 600; cursor: pointer; color: var(--ink);
}
.bulk-choice-btn:hover { border-color: var(--ink); background: var(--paper-deep); }
.bulk-choice-btn.danger:hover { border-color: var(--accent); color: var(--accent); }
.modal-label { display: block; font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-mute); margin-bottom: 6px; }
.modal-input { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); font-family: var(--body); font-size: 14px; color: var(--ink); }

/* ─── QUICK FIND / COMMAND PALETTE ───────────────────────────── */
.qf-overlay {
  position: fixed; inset: 0; z-index: 1200; display: none;
  background: rgba(26,24,20,0.4); backdrop-filter: blur(2px);
  align-items: flex-start; justify-content: center; padding-top: 12vh;
}
.qf-overlay.show { display: flex; }
.qf-panel {
  width: min(560px, 92vw); background: var(--paper);
  border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 24px 64px rgba(26,24,20,0.32); overflow: hidden;
}
.qf-input {
  width: 100%; border: none; outline: none; background: var(--paper);
  padding: 18px 20px; font-family: var(--display); font-style: italic;
  font-size: 22px; color: var(--ink); border-bottom: 1px solid var(--line-soft);
}
.qf-input::placeholder { color: var(--ink-mute); }
.qf-results { max-height: 46vh; overflow-y: auto; padding: 6px; }
.qf-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 12px; border: none; background: transparent; border-radius: 8px;
  cursor: pointer; text-align: left; font-family: var(--body);
}
.qf-row.active { background: var(--paper-deep); }
.qf-row .tier-dot.inline { width: 24px; height: 24px; font-size: 9px; flex: none; }
.qf-name { font-weight: 600; font-size: 14px; color: var(--ink); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qf-meta { font-family: var(--mono); font-size: 10px; color: var(--ink-mute); flex: none; }
.qf-empty { padding: 24px; text-align: center; color: var(--ink-mute); font-style: italic; font-family: var(--display); }
.qf-hint {
  display: flex; gap: 16px; justify-content: center;
  padding: 10px; border-top: 1px solid var(--line-soft); background: var(--paper-warm);
  font-family: var(--mono); font-size: 10px; color: var(--ink-mute);
}
#btn-find { display: flex; align-items: center; }
.readonly-banner { display: none; }
body.readonly .readonly-banner {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  background: var(--ink); color: var(--paper); font-size: 12px; padding: 7px 14px;
  position: relative; z-index: 40;
}
body.readonly .readonly-banner button {
  background: rgba(255,255,255,0.16); color: var(--paper); border: none;
  padding: 4px 10px; font-size: 11px; border-radius: 5px; cursor: pointer;
}
body.readonly .app { height: calc(100vh - 64px - 35px); }
body.readonly #btn-add,
body.readonly #btn-save,
body.readonly #btn-import-los,
body.readonly .overflow-menu-wrap,
body.readonly .panel:not(.right) > .panel-section:first-child,
body.readonly #btn-connect,
body.readonly .drawer-actions,
body.readonly .drawer-footer,
body.readonly .status-seg,
body.readonly .add-past-partner,
body.readonly .processes-row .proc-step,
body.readonly .team-menu-actions { display: none !important; }
body.readonly .notes-month-row,
body.readonly .notes-area,
body.readonly .motivations-area,
body.readonly .processes-input,
body.readonly .launch-row,
body.readonly .tier-pill-group,
body.readonly .bizstat-input { pointer-events: none; opacity: 0.9; }

/* Editable business stats (manual PV / bonus / ABO entry) */
.bizstat.editable { padding-bottom: 6px; }
.bizstat-inwrap { position: relative; display: flex; align-items: center; justify-content: center; }
.bizstat-input {
  width: 100%;
  text-align: center;
  border: 1px solid var(--line);
  background: var(--paper-warm);
  border-radius: 5px;
  padding: 4px 6px;
  margin: 3px 0 2px;
  font-family: var(--display);
  font-size: 17px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.2;
  -moz-appearance: textfield;
  transition: border-color 0.15s, background 0.15s;
}
.bizstat-input::-webkit-outer-spin-button,
.bizstat-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.bizstat-input.mono { font-family: var(--mono); font-size: 11px; }
.bizstat-input::placeholder { color: var(--ink-mute); font-weight: 400; }
.bizstat-input:hover { border-color: var(--ink-mute); }
.bizstat-input:focus { outline: none; border-color: var(--teal); background: var(--paper); }
.bizstat-suffix {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-family: var(--display); font-size: 12px; color: var(--ink-mute); pointer-events: none;
}
.bizstat.editable.good .bizstat-input { color: var(--teal); }
.bizstat.editable.warn .bizstat-input { color: #8a6020; }
.bizstat.editable.bad  .bizstat-input { color: var(--accent); }

/* ─── IMPORT LOS WIZARD ─────────────────────────────────── */
.los-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(26,24,20,0.42);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 32px;
  opacity: 0; transition: opacity 0.18s;
}
.los-overlay.show { opacity: 1; }
.los-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(26,24,20,0.28);
  width: min(820px, 100%);
  max-height: 100%;
  display: flex; flex-direction: column;
  overflow: hidden;
  transform: translateY(8px) scale(0.99);
  transition: transform 0.18s;
}
.los-overlay.show .los-panel { transform: none; }
.los-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.los-title { font-family: var(--display); font-style: italic; font-size: 24px; font-weight: 500; }
.los-sub { font-size: 12px; color: var(--ink-mute); margin-top: 2px; }
.los-close {
  border: none; background: transparent; font-size: 24px; line-height: 1;
  color: var(--ink-mute); cursor: pointer; padding: 2px 6px;
}
.los-close:hover { background: transparent; color: var(--accent); }
.los-summary {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 14px 24px;
  background: var(--paper-warm);
  border-bottom: 1px solid var(--line-soft);
}
.los-chip {
  font-size: 12px; color: var(--ink-soft);
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 20px; padding: 5px 12px;
  display: flex; align-items: center; gap: 6px;
}
.los-chip b { color: var(--ink); font-weight: 600; }
.los-chip-n { font-family: var(--mono); font-weight: 600; color: var(--ink); }
.los-chip.warn { background: #fbf2ec; border-color: var(--accent-soft); color: var(--accent); }
.los-chip.warn .los-chip-n { color: var(--accent); }
.los-tabs {
  display: flex; gap: 4px;
  padding: 12px 24px 0;
  border-bottom: 1px solid var(--line-soft);
}
.los-tabs button {
  border: none; background: transparent;
  font-family: var(--body); font-size: 13px; font-weight: 500;
  color: var(--ink-mute); cursor: pointer;
  padding: 8px 12px; border-radius: 6px 6px 0 0;
  border-bottom: 2px solid transparent;
  display: flex; align-items: center; gap: 6px;
}
.los-tabs button:hover { background: var(--paper-warm); color: var(--ink); }
.los-tabs button.active { color: var(--ink); border-bottom-color: var(--accent); }
.los-tab-badge {
  font-family: var(--mono); font-size: 9px; font-weight: 600;
  background: var(--accent); color: var(--paper);
  border-radius: 10px; padding: 1px 6px;
}
.los-body { overflow-y: auto; padding: 16px 24px; flex: 1; }
.los-note {
  font-size: 12px; color: var(--ink-soft); line-height: 1.55;
  background: var(--paper-warm); border: 1px solid var(--line-soft);
  border-radius: 6px; padding: 10px 12px; margin-bottom: 14px;
}

/* Tier sync table */
.los-row {
  display: grid;
  grid-template-columns: 1fr 64px 60px 130px 190px;
  align-items: center;
  gap: 8px;
  padding: 7px 6px;
  border-bottom: 1px solid var(--line-soft);
}
.los-row-head {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-mute);
  border-bottom: 1px solid var(--line);
  position: sticky; top: -16px; background: var(--paper); z-index: 2;
}
.los-row.los-edited { background: #fbf6ec; box-shadow: inset 2px 0 0 #8a6020; }
.los-c-name { display: flex; align-items: center; gap: 7px; min-width: 0; }
.los-branch { color: var(--ink-mute); font-family: var(--mono); font-size: 11px; opacity: 0.6; }
.los-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.los-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.los-tag {
  font-family: var(--mono); font-size: 8px; letter-spacing: 0.04em;
  background: var(--paper-deep); color: var(--ink-soft);
  padding: 1px 5px; border-radius: 3px; flex-shrink: 0;
}
.los-tag.zero { background: var(--accent-soft); color: var(--accent); }
.los-c-pv, .los-c-bon { font-family: var(--mono); font-size: 12px; text-align: right; }
.los-pv.good { color: var(--teal); font-weight: 600; }
.los-pv.warn { color: #8a6020; }
.los-pv.bad  { color: var(--ink-mute); }
.los-c-hp { font-size: 12px; color: var(--ink-soft); }
.los-muted { color: var(--ink-mute); font-size: 11px; }
.los-tier-select {
  width: 100%; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 5px;
  background: var(--paper); font-family: var(--body); font-size: 12px;
  color: var(--ink); cursor: pointer;
}
.los-tier-select:focus { border-color: var(--ink); outline: none; }

/* 0-PV triage */
.los-zrow {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 6px; border-bottom: 1px solid var(--line-soft);
}
.los-zname { font-weight: 500; display: flex; align-items: center; gap: 6px; }
.los-zmeta { font-family: var(--mono); font-size: 10px; color: var(--ink-mute); margin-top: 2px; }
.los-seg {
  display: flex; flex-shrink: 0;
  border: 1px solid var(--line); border-radius: 6px; overflow: hidden;
}
.los-seg button {
  border: none; background: var(--paper); border-radius: 0;
  font-family: var(--body); font-size: 11px; color: var(--ink-soft);
  padding: 6px 12px; cursor: pointer; border-left: 1px solid var(--line);
}
.los-seg button:first-child { border-left: none; }
.los-seg button:hover { background: var(--paper-warm); }
.los-seg button.on { background: var(--ink); color: var(--paper); }
.los-seg button[data-status="ghost"].on { background: var(--ink-mute); }
.los-seg button[data-status="quit"].on { background: var(--accent); }
.los-empty { text-align: center; color: var(--ink-mute); font-style: italic; font-family: var(--display); padding: 40px 0; }
.los-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 24px;
  border-top: 1px solid var(--line-soft);
  background: var(--paper-warm);
}
.los-foot-info { font-size: 11px; color: var(--ink-mute); }
.los-foot-actions { display: flex; gap: 8px; }

/* Mentoring tab */
.los-ment-toolbar {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
}
.los-ment-csearch {
  width: 100%; margin: 8px 0 4px; padding: 7px 10px;
  border: 1px solid var(--line); border-radius: 7px;
  background: var(--paper); font-family: var(--body); font-size: 12px; color: var(--ink);
}
.los-ment-csearch:focus { border-color: var(--ink); outline: none; }
.los-ment-ignore {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--ink-soft); white-space: nowrap; cursor: pointer;
  padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper);
}
.los-ment-ignore input { width: 14px; height: 14px; accent-color: var(--ink); }
.los-ment-allwrap {
  display: inline-flex; align-items: center; gap: 4px; cursor: pointer;
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-mute); padding: 2px 6px; border: 1px solid var(--line); border-radius: 10px;
}
.los-ment-allwrap input { width: 13px; height: 13px; accent-color: var(--ink); }
.los-ment-addform {
  background: var(--paper-warm); border: 1px solid var(--line-soft);
  border-radius: 8px; padding: 12px 14px; margin-bottom: 16px;
}
.los-ment-addlabel { font-size: 12px; font-weight: 600; margin-bottom: 8px; }
.los-ment-addlabel small { font-weight: 400; color: var(--ink-mute); }
.los-ment-addrow { display: flex; gap: 8px; }
.los-ment-name { flex: 1; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); font-family: var(--body); font-size: 13px; }
.los-ment-name:focus { border-color: var(--ink); outline: none; }
.los-ment-tier { padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); font-family: var(--body); font-size: 12px; }
.los-ment-add { white-space: nowrap; }
.los-ment-group { margin-bottom: 18px; }
.los-ment-grouphead {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink); font-weight: 600; padding: 4px 0 8px; border-bottom: 1px solid var(--line);
  margin-bottom: 10px;
}
.los-ment-grouphead span { color: var(--ink-mute); font-weight: 400; }
.los-ment-card { background: var(--paper-warm); border: 1px solid var(--line-soft); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.los-ment-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.los-ment-name-l { font-weight: 600; }
.los-ment-tier { font-family: var(--mono); font-size: 10px; color: var(--paper); background: var(--ink-mute); padding: 1px 6px; border-radius: 3px; }
.los-ment-mentors-of { font-size: 12px; color: var(--ink-mute); }
.los-ment-mentors-of b { color: var(--accent); font-family: var(--mono); }
.los-ment-freq-wrap {
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 16px;
  padding: 3px 6px 3px 10px;
}
.los-ment-setall { font-family: var(--mono); font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-mute); }
.los-ment-default {
  border: none; background: var(--paper-warm); border-radius: 12px;
  font-family: var(--body); font-size: 11px; font-weight: 500; color: var(--ink);
  padding: 3px 8px; cursor: pointer; outline: none;
}
.los-ment-default:hover { background: var(--paper-deep); }
.los-ment-mentees { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.los-ment-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 8px 4px 8px; background: var(--paper); border: 1px solid var(--line);
  border-radius: 16px; font-size: 12px; user-select: none;
}
.los-ment-chip:hover { border-color: var(--ink-mute); }
.los-ment-chip.checked { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.los-ment-pick { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.los-ment-chip input { width: 13px; height: 13px; }
.los-ment-chip small { font-family: var(--mono); font-size: 10px; opacity: 0.7; }
.los-ment-mfreq {
  display: none;
  background: var(--paper); color: var(--ink); border: 1px solid var(--line);
  border-radius: 10px; font-family: var(--body); font-size: 10px; padding: 2px 4px; cursor: pointer;
}
.los-ment-chip.checked .los-ment-mfreq { display: inline-block; }
.los-ment-none { font-size: 12px; color: var(--ink-mute); font-style: italic; margin-top: 8px; }

/* Month picker in wizard */
.los-monthbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 24px;
  background: var(--paper);
  border-bottom: 1px solid var(--line-soft);
}
.los-mb-label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-mute); }
.los-monthbar select, .los-monthbar input {
  padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--paper-warm); font-family: var(--body); font-size: 13px; color: var(--ink);
}
.los-monthbar .los-mp-year { width: 84px; }
.los-mb-note { font-size: 11px; color: var(--ink-mute); margin-left: auto; }
.los-mb-note b { color: var(--ink); }

/* Header month navigator */
.month-nav {
  display: flex; align-items: center; gap: 4px;
  border-left: 1px solid var(--line); padding-left: 14px; margin-left: 4px;
}
.month-nav button {
  width: 28px; height: 28px; padding: 0; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; line-height: 1; color: var(--ink-soft);
}
.month-nav button:disabled { opacity: 0.35; cursor: default; }
.month-nav button:disabled:hover { background: transparent; border-color: var(--line); }
.month-label {
  font-family: var(--display); font-style: italic; font-size: 15px; font-weight: 500;
  min-width: 96px; text-align: center; color: var(--ink);
}

/* Roster: not-active-this-month group */
.roster-divider {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-mute); padding: 12px 4px 6px; margin-top: 4px;
  border-top: 1px solid var(--line-soft);
}
.ghost-tag.quit { background: var(--accent); }

/* ─── SETTINGS: TIERS & RULES ───────────────────────────── */
.tier-guide-edit {
  margin-left: auto;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 3px 8px;
  cursor: pointer;
  transition: all 0.12s;
}
.tier-guide-edit:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
#tier-guide .tg-row { display: flex; align-items: center; gap: 7px; }
#tier-guide .tg-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }

.settings-tabs {
  display: flex; gap: 4px;
  background: var(--paper-warm);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 18px;
}
.settings-tabs button {
  flex: 1; border: none; background: transparent;
  border-radius: 5px; padding: 8px 10px;
  font-family: var(--body); font-size: 13px; font-weight: 500;
  color: var(--ink-soft); cursor: pointer;
}
.settings-tabs button.active { background: var(--ink); color: var(--paper); }
.settings-tabs button:not(.active):hover { background: var(--paper-deep); color: var(--ink); }

.set-hint { font-size: 12px; color: var(--ink-mute); line-height: 1.6; margin-bottom: 14px; }
.set-hint code {
  font-family: var(--mono); font-size: 11px;
  background: var(--paper-warm); border: 1px solid var(--line-soft);
  border-radius: 4px; padding: 1px 5px; color: var(--ink-soft);
}

.set-tier-list { display: flex; flex-direction: column; gap: 8px; }
.set-tier-row { display: flex; align-items: center; gap: 10px; }
.set-tier-dot {
  flex: none; width: 34px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px; color: #fff;
  font-family: var(--mono); font-size: 11px; font-weight: 600;
}
.set-tier-input, .wiz-tier-input {
  flex: 1; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 7px;
  background: var(--paper); font-family: var(--body); font-size: 14px; color: var(--ink);
  transition: border 0.15s;
}
.set-tier-input:focus, .wiz-tier-input:focus { outline: none; border-color: var(--ink); }

.set-actions-row { display: flex; gap: 8px; margin-top: 16px; align-items: center; }
.set-reset, .set-add-rule {
  border: 1px solid var(--line); background: var(--paper);
  border-radius: 7px; padding: 8px 14px;
  font-family: var(--body); font-size: 13px; font-weight: 500;
  color: var(--ink-soft); cursor: pointer; transition: all 0.12s;
}
.set-add-rule { color: var(--ink); }
.set-add-rule:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.set-reset { margin-left: auto; }
.set-reset:hover { border-color: var(--ink-mute); background: var(--paper-deep); }

.set-rule-list { display: flex; flex-direction: column; gap: 12px; }
.set-empty { font-size: 13px; color: var(--ink-mute); padding: 14px; text-align: center; }
.set-rule {
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--paper-warm); padding: 12px 13px;
  transition: opacity 0.15s;
}
.set-rule.off { opacity: 0.5; }
.set-rule-head { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.set-rule-name {
  flex: 1; padding: 6px 9px;
  border: 1px solid transparent; border-radius: 6px;
  background: transparent; font-family: var(--body); font-size: 14px; font-weight: 600; color: var(--ink);
}
.set-rule-name:hover { border-color: var(--line); background: var(--paper); }
.set-rule-name:focus { outline: none; border-color: var(--ink); background: var(--paper); }
.set-rule-del {
  flex: none; border: none; background: transparent;
  color: var(--ink-mute); font-size: 14px; cursor: pointer;
  width: 26px; height: 26px; border-radius: 6px;
}
.set-rule-del:hover { background: var(--accent); color: var(--paper); }

.set-rule-logic, .set-rule-msg {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  font-size: 12px;
}
.set-rule-msg { margin-top: 9px; }
.set-kw { color: var(--ink-mute); }
.set-structural { color: var(--ink-mute); font-style: italic; }
.set-rule select, .set-rule-value {
  padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--paper); font-family: var(--body); font-size: 12px; color: var(--ink);
}
.set-rule-value { width: 56px; font-family: var(--mono); text-align: center; }
.set-rule-message {
  flex: 1; min-width: 200px; padding: 7px 9px;
  border: 1px solid var(--line); border-radius: 6px;
  background: var(--paper); font-family: var(--body); font-size: 12px; color: var(--ink);
}
.set-rule select:focus, .set-rule input:focus { outline: none; border-color: var(--ink); }

/* Mini toggle switch */
.set-switch { flex: none; position: relative; width: 34px; height: 20px; cursor: pointer; }
.set-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.set-switch-track {
  position: absolute; inset: 0; border-radius: 999px;
  background: var(--line); transition: background 0.15s;
}
.set-switch-track::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  transition: transform 0.15s; box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.set-switch input:checked + .set-switch-track { background: var(--teal); }
.set-switch input:checked + .set-switch-track::after { transform: translateX(14px); }

/* New-team wizard */
.wiz-field { display: block; margin-bottom: 18px; }
.wiz-field span { display: block; font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-mute); margin-bottom: 6px; }
.wiz-field input {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 7px;
  background: var(--paper); font-family: var(--body); font-size: 14px; color: var(--ink);
}
.wiz-field input:focus { outline: none; border-color: var(--ink); }
.wiz-tier-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.wiz-tier-head span:first-child { font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-mute); }
.wiz-tier-sub { font-size: 11px; color: var(--ink-mute); }

.wiz-steps { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.wiz-step {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 500; color: var(--ink-mute);
}
.wiz-step b {
  width: 20px; height: 20px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--paper-deep); color: var(--ink-mute);
  font-family: var(--mono); font-size: 11px; font-weight: 600;
}
.wiz-step.active { color: var(--ink); }
.wiz-step.active b { background: var(--ink); color: var(--paper); }
.wiz-step.done b { background: var(--teal); color: #fff; }
.wiz-step-sep { flex: 1; height: 1px; background: var(--line); max-width: 60px; }

/* Settings → Defaults */
.set-group { margin-bottom: 22px; }
.set-group-label {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--ink-mute); margin-bottom: 10px;
}
.set-num-row { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.set-num-row label { flex: 1; font-size: 13px; font-weight: 500; color: var(--ink); display: flex; flex-direction: column; gap: 2px; }
.set-num-sub { font-size: 11px; font-weight: 400; color: var(--ink-mute); }
.set-num-input { flex: none; display: flex; align-items: center; gap: 6px; }
.set-num-input input {
  width: 80px; padding: 8px 10px; text-align: right;
  border: 1px solid var(--line); border-radius: 7px; background: var(--paper);
  font-family: var(--mono); font-size: 14px; color: var(--ink);
}
.set-num-input input:focus { outline: none; border-color: var(--ink); }
.set-num-input span { font-family: var(--mono); font-size: 11px; color: var(--ink-mute); }
.set-opt-list { display: flex; flex-direction: column; gap: 7px; margin-bottom: 9px; }
.set-opt-row { display: flex; align-items: center; gap: 8px; }
.set-opt-input {
  flex: 1; padding: 8px 11px;
  border: 1px solid var(--line); border-radius: 7px; background: var(--paper);
  font-family: var(--body); font-size: 13px; color: var(--ink);
}
.set-opt-input:focus { outline: none; border-color: var(--ink); }
.set-opt-del {
  flex: none; border: none; background: transparent; color: var(--ink-mute);
  font-size: 13px; cursor: pointer; width: 28px; height: 28px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center; padding: 0; line-height: 1;
}
.set-opt-del:hover { background: var(--accent); color: var(--paper); }

/* ─── INSIGHT CARD GUIDE (Rules tab) ─── */
.set-cards-block { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 18px; }
.set-cards-head { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.set-cards-head > span:first-child {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-mute);
}
.set-cards-sub { font-size: 12px; color: var(--ink-mute); line-height: 1.5; }
.set-card-guide { display: flex; flex-direction: column; gap: 10px; }
.set-card-row { display: flex; align-items: flex-start; gap: 12px; }
.set-card-row .set-card-preview { flex: 1; min-width: 0; }
.set-card-row .set-card-preview .insight-card { margin-bottom: 0; }
.set-card-row.off .set-card-preview { opacity: 0.4; filter: grayscale(0.55); }
.set-card-switch {
  flex: none; margin-top: 7px;
  width: 38px; height: 22px; border-radius: 999px;
  border: none; background: var(--line); cursor: pointer; position: relative;
  padding: 0; transition: background 0.18s;
}
.set-card-switch:hover { background: var(--ink-mute); }
.set-card-switch.on { background: var(--teal); }
.set-card-switch.on:hover { background: #185c48; }
.set-card-knob {
  position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
  background: var(--paper); border-radius: 50%; transition: transform 0.18s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.set-card-switch.on .set-card-knob { transform: translateX(16px); }

/* ─── RULE EDITOR + VIOLATION PREVIEW (side by side) ─── */
.set-rule-pair { display: flex; gap: 14px; align-items: stretch; }
.set-rule-pair > .set-rule { flex: 1.35; min-width: 0; margin: 0; }
.set-rule-preview { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; justify-content: center; }
.set-rule-preview-lab { font-family: var(--mono); font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-mute); }
.set-rule-preview .insight-card { margin-bottom: 0; }
@media (max-width: 760px) { .set-rule-pair { flex-direction: column; } }

.set-add-opt {
  border: 1px dashed var(--line); background: transparent; color: var(--ink-soft);
  border-radius: 7px; padding: 7px 12px; font-family: var(--body); font-size: 12px; cursor: pointer;
}
.set-add-opt:hover { border-color: var(--ink-mute); background: var(--paper-warm); color: var(--ink); }

/* In-app confirm dialog */
.confirm-msg { font-size: 14px; line-height: 1.6; color: var(--ink-soft); margin: 0; }
#modal-ok.danger-btn { background: var(--accent); border-color: var(--accent); color: #fff; }
#modal-ok.danger-btn:hover { background: #962f19; border-color: #962f19; }
