:root {
  color-scheme: light;
  --blue: #005bbb;
  --blue-dark: #003f82;
  --blue-soft: #eaf3ff;
  --navy: #14263d;
  --teal: #087f6c;
  --teal-soft: #e6f5f1;
  --violet: #6555a5;
  --coral: #b84d3e;
  --surface: #ffffff;
  --surface-2: #f4f7fa;
  --surface-3: #e9eef4;
  --ink: #162233;
  --muted: #5d6b7c;
  --line: #d7e0e9;
  --shadow: 0 12px 34px rgba(20, 38, 61, .10);
  --radius: 18px;
}

* { box-sizing: border-box; }

html { background: var(--surface-2); }

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 85% -10%, rgba(0, 91, 187, .11), transparent 34rem),
    var(--surface-2);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

button, input, select { font: inherit; }
button { color: inherit; }
button, label, select { -webkit-tap-highlight-color: transparent; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
[role="button"]:focus-visible {
  outline: 3px solid rgba(0, 91, 187, .35);
  outline-offset: 2px;
}

.app-shell { min-height: 100vh; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 10px max(18px, env(safe-area-inset-left));
  border-bottom: 1px solid rgba(215, 224, 233, .88);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.brand-mark {
  position: relative;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border: 2px solid var(--blue);
  border-radius: 50%;
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}

.brand-mark::before { inset: 8px; border: 2px solid var(--blue); }
.brand-mark::after { width: 8px; height: 8px; right: -3px; top: 6px; background: var(--teal); }
.brand-text { display: grid; line-height: 1.12; }
.brand-text strong { font-size: 16px; letter-spacing: -.01em; }
.brand-text span { color: var(--muted); font-size: 12px; }

.header-action {
  min-height: 40px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--blue-dark);
  padding: 8px 10px;
  font-weight: 650;
  cursor: pointer;
}

.main {
  width: min(100% - 28px, 1080px);
  margin: 0 auto;
  padding: 30px 0 calc(92px + env(safe-area-inset-bottom));
}

.main.narrow { width: min(100% - 28px, 720px); }

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(1.7rem, 4vw, 2.35rem); line-height: 1.12; letter-spacing: -.035em; }
h2 { margin-bottom: 8px; font-size: 1.25rem; line-height: 1.25; letter-spacing: -.015em; }
h3 { margin-bottom: 6px; font-size: 1rem; }
p { margin-bottom: 12px; }
.muted { color: var(--muted); }
.eyebrow { margin-bottom: 7px; color: var(--blue-dark); font-size: .78rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.screen-heading { margin-bottom: 22px; }
.screen-heading p { max-width: 64ch; color: var(--muted); }
.small { font-size: .82rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-body { padding: clamp(18px, 4vw, 28px); }
.stack { display: grid; gap: 16px; }
.stack-sm { display: grid; gap: 10px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }

.field { display: grid; gap: 7px; }
.field > span, .field-label { font-size: .88rem; font-weight: 700; }
.field-hint { color: var(--muted); font-size: .78rem; }

input[type="text"], input[type="email"], select {
  width: 100%;
  min-height: 48px;
  border: 1px solid #bcc9d6;
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  padding: 11px 13px;
  font-size: 16px;
}

input::placeholder { color: #788697; }

.button-row { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.button-row.split { justify-content: space-between; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 10px 15px;
  font-weight: 700;
  cursor: pointer;
}

.btn:hover { background: var(--surface-2); }
.btn-primary { border-color: var(--blue); background: var(--blue); color: white; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--blue-dark); }
.btn-sm { min-height: 40px; padding: 8px 11px; font-size: .84rem; }
.btn-block { width: 100%; }
.btn:disabled { cursor: not-allowed; opacity: .48; }

.notice {
  padding: 12px 14px;
  border-left: 4px solid var(--blue);
  background: var(--blue-soft);
  color: var(--navy);
  font-size: .88rem;
}

.error { min-height: 1.25em; margin-top: 8px; color: #a22d25; font-size: .86rem; font-weight: 650; }

.welcome {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr);
  gap: clamp(24px, 6vw, 68px);
  align-items: center;
  min-height: calc(100vh - 176px);
}

.welcome-copy h1 { max-width: 12ch; font-size: clamp(2.3rem, 7vw, 4.8rem); }
.welcome-copy p { max-width: 50ch; font-size: 1.05rem; color: var(--muted); }
.orbit-preview { position: relative; width: min(80vw, 340px); aspect-ratio: 1; margin: 28px auto 0; }
.orbit-preview .orbit { position: absolute; border: 1px solid rgba(0, 91, 187, .24); border-radius: 50%; }
.orbit-preview .orbit.one { inset: 2%; }
.orbit-preview .orbit.two { inset: 24%; border-width: 2px; }
.orbit-preview .person-dot { position: absolute; inset: 39%; display: grid; place-items: center; border-radius: 50%; background: var(--blue); color: white; font-weight: 800; }
.orbit-preview .identity-dot { position: absolute; width: 22px; height: 22px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 5px var(--blue-soft); }
.orbit-preview .identity-dot:nth-of-type(4) { left: 46%; top: -2%; opacity: .95; }
.orbit-preview .identity-dot:nth-of-type(5) { right: 3%; top: 40%; opacity: .58; }
.orbit-preview .identity-dot:nth-of-type(6) { left: 29%; bottom: 23%; opacity: .32; }
.orbit-preview .identity-dot:nth-of-type(7) { left: 9%; top: 33%; opacity: .72; }

.progress-wrap { display: grid; gap: 8px; margin-bottom: 24px; }
.progress-meta { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: .79rem; }
.progress-track { height: 6px; overflow: hidden; border-radius: 99px; background: var(--surface-3); }
.progress-fill { height: 100%; border-radius: inherit; background: var(--blue); transition: width .25s ease; }

.selected-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 48px;
  margin-bottom: 14px;
  padding: 10px;
  border: 1px dashed #aebdcb;
  border-radius: 13px;
  background: var(--surface-2);
}

.chip, .identity-option, .segment, .dot-button, .mini-link {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.chip { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; border-radius: 999px; padding: 7px 10px; font-size: .82rem; }
.chip.selected { border-color: rgba(0, 91, 187, .55); background: var(--blue-soft); color: var(--blue-dark); }
.chip .x { font-weight: 800; }

.identity-toolbar { display: grid; grid-template-columns: 1fr 220px; gap: 10px; margin-bottom: 16px; }
.identity-groups { display: grid; gap: 18px; }
.identity-group { border-top: 1px solid var(--line); padding-top: 15px; }
.identity-group:first-child { border-top: 0; }
.identity-group h3 { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.identity-group h3 span { color: var(--muted); font-size: .76rem; font-weight: 500; }
.identity-options { display: flex; flex-wrap: wrap; gap: 8px; }
.identity-option { min-height: 44px; border-radius: 12px; padding: 9px 11px; text-align: left; font-size: .88rem; }
.identity-option[aria-pressed="true"] { border-color: var(--blue); background: var(--blue-soft); color: var(--blue-dark); font-weight: 700; }

.custom-add { display: grid; grid-template-columns: 210px 1fr auto; gap: 9px; align-items: end; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }

.identity-cards { display: grid; gap: 14px; }
.identity-card { padding: 17px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.identity-card-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 13px; }
.identity-card-head p { margin: 0; color: var(--muted); font-size: .78rem; }
.identity-card-fields { display: grid; grid-template-columns: 1.35fr .65fr; gap: 14px; }

.segments { display: flex; gap: 7px; }
.segment { flex: 1 1 0; min-height: 44px; border-radius: 11px; padding: 8px; font-size: .78rem; line-height: 1.2; }
.segment[aria-pressed="true"] { border-color: var(--blue); background: var(--blue); color: white; font-weight: 700; }

.salience-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.dot-button { min-height: 44px; border-radius: 11px; padding: 8px 4px; color: var(--blue-dark); letter-spacing: 2px; }
.dot-button[aria-pressed="true"] { border-color: var(--blue); background: var(--blue-soft); font-weight: 800; }

.deep-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.deep-choice { position: relative; min-height: 112px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); padding: 16px; text-align: left; cursor: pointer; }
.deep-choice p { margin: 4px 0 0; color: var(--muted); font-size: .8rem; }
.deep-choice[aria-pressed="true"] { border-color: var(--blue); background: var(--blue-soft); box-shadow: inset 0 0 0 1px var(--blue); }
.deep-choice .check { position: absolute; right: 12px; top: 12px; display: grid; place-items: center; width: 24px; height: 24px; border: 1px solid #aab7c5; border-radius: 50%; background: var(--surface); color: transparent; font-size: .8rem; }
.deep-choice[aria-pressed="true"] .check { border-color: var(--blue); background: var(--blue); color: white; }

.option-section { padding: 17px 0; border-top: 1px solid var(--line); }
.option-section:first-of-type { border-top: 0; padding-top: 4px; }
.option-section-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.option-section-head p { margin: 0; color: var(--muted); font-size: .79rem; }
.option-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.option-grid .chip { border-radius: 11px; }
.radio-list { display: grid; gap: 8px; }
.radio-option { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 10px; border: 1px solid var(--line); border-radius: 11px; cursor: pointer; }
.radio-option:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); }
.radio-option input { margin-top: 3px; }

.review-layout { display: grid; grid-template-columns: minmax(300px, .88fr) minmax(0, 1.12fr); gap: 22px; align-items: start; }
.ring-card { padding: 16px; }
.ring-svg { display: block; width: 100%; height: auto; aspect-ratio: 10 / 9; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 12px 2px 0; color: var(--muted); font-size: .76rem; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-swatch { width: 13px; height: 13px; border-radius: 50%; background: var(--blue); }
.legend-swatch.low { opacity: .32; }
.legend-swatch.mid { opacity: .62; }
.legend-swatch.high { opacity: 1; }
.review-list { display: grid; gap: 10px; }
.review-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.review-row:last-child { border-bottom: 0; }
.review-row p { margin: 3px 0 0; color: var(--muted); font-size: .79rem; }
.salience { color: var(--blue-dark); letter-spacing: 2px; white-space: nowrap; }
.vpr-summary { margin-top: 9px; color: var(--ink) !important; }

.app-tabs {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: max(10px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(var(--tab-count, 3), 1fr);
  width: min(calc(100% - 24px), 500px);
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 10px 32px rgba(20, 38, 61, .18);
  backdrop-filter: blur(16px);
}
.app-tab { min-height: 48px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); font-size: .8rem; font-weight: 750; cursor: pointer; }
/* Back leads the same bar rather than floating on one of its own. It is sized
   to its label so the view tabs keep their equal share of the width. */
.app-tabs.with-back { grid-template-columns: auto repeat(var(--tab-count, 3), 1fr); }
.app-tab.back { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 14px; background: var(--navy); color: white; }
.app-tab.back:hover { background: #0d1a2b; }
.tab-arrow { font-size: 1rem; line-height: 1; }
.app-tab.active { background: var(--navy); color: white; }

.explore-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.explore-head .screen-heading { margin: 0; }
.graph-controls { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.graph-controls select { width: auto; min-height: 42px; padding: 8px 34px 8px 10px; font-size: .84rem; }
.graph-return { min-height: 42px; padding: 8px 12px; border: 1px solid var(--blue); border-radius: 11px; background: var(--surface); color: var(--blue-dark); font-weight: 750; cursor: pointer; }
.network-view-switch { display: inline-grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: -3px 0 14px; padding: 4px; border: 1px solid var(--line); border-radius: 13px; background: #eaf1f8; }
.network-view-button { min-height: 40px; padding: 8px 16px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: .86rem; font-weight: 800; cursor: pointer; }
.network-view-button:hover, .network-view-button:focus-visible { color: var(--blue-dark); }
.network-view-button.active { background: var(--surface); color: var(--navy); box-shadow: 0 2px 10px rgba(20, 38, 61, .11); }
.graph-layer-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 14px; }
.team-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin: 2px 0 12px; }
.team-filters-label { margin-right: 2px; color: var(--muted); font-size: .74rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.team-chip { min-height: 34px; padding: 5px 11px; font-size: .78rem; letter-spacing: .02em; }
.team-clear { min-height: 34px; padding: 5px 11px; border: 0; border-radius: 999px; background: transparent; color: var(--blue); font-size: .78rem; font-weight: 750; text-decoration: underline; cursor: pointer; }
.placement-chip { min-height: 42px; padding: 8px 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--blue-dark); font-size: .84rem; font-weight: 750; cursor: pointer; }
.placement-chip:hover, .placement-chip:focus-visible { border-color: var(--blue); }
.placement-chip.active { border-color: var(--blue); background: var(--blue); color: white; }

.graph-panel { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.graph-stage { width: 100%; min-height: 620px; touch-action: none; cursor: grab; user-select: none; }
/* Labels inside the SVG are selectable text as far as the browser is concerned,
   so dragging across them draws a selection box instead of panning. */
.graph-svg, .graph-svg text { user-select: none; -webkit-user-select: none; }
/* Keep a focus ring for keyboard users without boxing every mouse click. */
.graph-svg .person-focus:focus:not(:focus-visible),
.graph-svg .people-connection:focus:not(:focus-visible),
.graph-svg .connection-marker:focus:not(:focus-visible) { outline: none; }
.graph-stage.dragging { cursor: grabbing; }
.graph-svg { display: block; width: 100%; height: 620px; }
.graph-tools { position: absolute; top: 12px; right: 12px; display: grid; gap: 7px; }
.graph-tool { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.95); color: var(--navy); font-weight: 800; cursor: pointer; box-shadow: 0 5px 18px rgba(20,38,61,.1); }
.graph-empty { display: grid; place-items: center; min-height: 420px; padding: 30px; text-align: center; }

.graph-svg .person-halo { fill: rgba(0, 91, 187, .07); stroke: rgba(0, 91, 187, .16); stroke-width: 1.5; }
.graph-svg .person-node.current .person-halo { fill: rgba(0, 91, 187, .12); stroke: rgba(0, 91, 187, .32); }
.graph-svg .person-core { fill: var(--navy); stroke: white; stroke-width: 3; }
.graph-svg .person-core.current { fill: var(--blue); }
.graph-svg .person-core-hit { fill: transparent; cursor: pointer; }
.graph-svg .person-focus:focus .person-core,
.graph-svg .person-focus:hover .person-core { stroke: var(--teal); stroke-width: 4; }
.graph-svg .person-initials { fill: white; font-size: 11px; font-weight: 800; text-anchor: middle; dominant-baseline: middle; pointer-events: none; }
.graph-svg .person-node.current .person-initials { font-size: 13px; }
.graph-svg .person-name { fill: var(--ink); font-size: 12px; font-weight: 750; text-anchor: middle; pointer-events: none; }
.graph-svg .person-status { fill: var(--muted); font-size: 9px; font-weight: 700; text-anchor: middle; pointer-events: none; }
.graph-svg .connection-line { fill: none; stroke: var(--blue); stroke-width: 2.4; stroke-linecap: round; opacity: .68; pointer-events: none; transition: opacity .16s ease, stroke-width .16s ease; }
.graph-svg .connection-line.dimension { stroke: var(--teal); stroke-dasharray: 7 6; opacity: .7; }
.graph-svg .connection-hit { fill: none; stroke: transparent; stroke-width: 22; cursor: pointer; pointer-events: stroke; }
.graph-svg .people-connection:hover .connection-line,
.graph-svg .people-connection:focus .connection-line { opacity: 1; stroke-width: 3.4; }
.graph-svg .connection-node { fill: white; stroke: var(--blue); stroke-width: 2.4; pointer-events: none; transition: r .16s ease, stroke-width .16s ease; }
.graph-svg .connection-node.dimension { stroke: var(--teal); }
.graph-svg .connection-node-hit { fill: transparent; cursor: pointer; }
.graph-svg .connection-marker:hover .connection-node,
.graph-svg .connection-marker:focus .connection-node { r: 8.5; stroke-width: 3.2; }
.graph-svg .connection-marker:focus { outline: none; }
.graph-svg .people-connection:hover .connection-node { stroke-width: 3.2; }
.department-graph .person-core { fill: var(--blue-dark); stroke-width: 2.5; }
.department-graph .person-initials { font-size: 10px; letter-spacing: .02em; }
.department-graph .person-name { font-size: 10.5px; font-weight: 700; }
/* Labels sit over the connection lines, so give each one an opaque plate to
   read against. Sized from the rendered text after each draw. */
.department-graph .person-name-pill { fill: rgba(255,255,255,.93); stroke: var(--line); stroke-width: .8; pointer-events: none; }
[data-detail="far"] .department-graph .person-name-pill { opacity: 0; }
.department-graph .person-nameplate { transition: opacity .14s ease; }
/* Level of detail. A node too small to read carries no text; as the reader
   zooms in the name appears, then the initials inside the node. The stage's
   data-detail is set on zoom, so this costs no redraw. */
.department-graph .person-initials,
.department-graph .person-name { transition: opacity .14s ease; }
[data-detail="mid"] .department-graph .person-initials { opacity: 0; }
[data-detail="far"] .department-graph .person-initials,
[data-detail="far"] .department-graph .person-name { opacity: 0; }
/* Thin the lines out when pulled right back, so the shape of the cohort reads
   instead of a wall of ink. */
[data-detail="far"] .department-graph .connection-line { opacity: calc(var(--edge-ink, .42) * .6); }
/* The department view carries names and a whole cohort, so it needs more room
   on screen than a single CA's network does. */
.graph-panel.department .graph-stage { min-height: 780px; }
.department-graph .connection-line { stroke-width: 1.65; opacity: var(--edge-ink, .42); }
.department-graph .connection-line.dimension { opacity: var(--edge-ink, .46); stroke-dasharray: 5 5; }
.department-graph .people-connection:hover .connection-line,
.department-graph .people-connection:focus .connection-line { opacity: 1; stroke-width: 3; }

.graph-focusbar { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); background: #f3f8fc; }
.graph-focusbar div { min-width: 0; }
.graph-focusbar strong, .graph-focusbar span { display: block; }
.graph-focusbar strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--navy); }
.graph-focusbar span { margin-top: 2px; color: var(--muted); font-size: .76rem; }
.graph-focusbar button { min-height: 36px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--blue-dark); font-weight: 750; cursor: pointer; }
.graph-focusbar .focus-clear { width: 36px; padding: 0; font-size: 1.15rem; }

.graph-legend { display: flex; flex-wrap: wrap; gap: 9px 18px; padding: 13px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: .76rem; }
.graph-more { display: flex; gap: 7px 16px; align-items: baseline; padding: 11px 16px; border-top: 1px solid var(--line); background: #f3f8fc; color: var(--navy); font-size: .8rem; }
.graph-more span { color: var(--muted); }
.match-dot { width: 13px; height: 13px; border: 3px solid var(--teal); border-radius: 50%; background: transparent; }
.match-dot.exact { background: var(--teal); }
.line-sample { width: 24px; border-top: 2px solid var(--blue); }
.line-sample.dimension { border-top-style: dashed; border-color: var(--teal); }
.person-key { width: 14px; height: 14px; border: 3px solid rgba(0, 91, 187, .28); border-radius: 50%; background: var(--blue); }
.ring-key { width: 15px; height: 15px; border: 2px solid; border-radius: 50%; background: white; }
.ring-key.outer { border-color: #005bbb; background: rgba(0, 91, 187, .08); }
.ring-key.inner { border-color: #6657a6; background: rgba(102, 87, 166, .10); }

.detail-panel { margin-top: 18px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.detail-panel h2 { margin-bottom: 2px; }

.connection-list { display: grid; gap: 10px; margin-top: 18px; }
.person-row { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.avatar { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--navy); color: white; font-size: .78rem; font-weight: 800; }
.person-row p { margin: 2px 0 0; color: var(--muted); font-size: .79rem; }
.match-label { display: inline-flex; align-items: center; gap: 5px; margin-top: 4px; color: var(--teal); font-size: .74rem; font-weight: 750; }

.pattern-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pattern { display: inline-flex; gap: 6px; padding: 7px 9px; border-radius: 999px; background: var(--teal-soft); color: #075d51; font-size: .78rem; }
.pattern b { font-weight: 800; }

.compare-sections { display: grid; gap: 18px; }
.compare-block h2 { margin: 0 0 7px 2px; color: var(--muted); font-size: .76rem; letter-spacing: .075em; text-transform: uppercase; }
.compare-table { width: 100%; overflow: hidden; border: 1px solid var(--line); border-collapse: separate; border-spacing: 0; border-radius: 13px; table-layout: fixed; font-size: .84rem; }
.compare-table th, .compare-table td { width: 33.333%; padding: 11px 12px; border-right: 1px solid var(--line); text-align: center; vertical-align: top; overflow-wrap: anywhere; }
.compare-table tr > :last-child { border-right: 0; }
.compare-table thead th { border-bottom: 1px solid var(--line); background: var(--surface-2); color: var(--navy); font-size: .8rem; font-weight: 800; text-align: center; }
.compare-table .shared { background: var(--teal-soft); }
.compare-table td span { display: block; }
.compare-table td span + span { margin-top: 4px; }

.ring-summary { display: grid; grid-template-columns: minmax(280px, .8fr) minmax(0, 1.2fr); gap: 20px; }

@media (max-width: 760px) {
  .main { width: min(100% - 22px, 720px); padding-top: 20px; }
  .welcome { grid-template-columns: 1fr; min-height: auto; padding-top: 12px; }
  .welcome-copy h1 { max-width: 10ch; font-size: 2.75rem; }
  .orbit-preview { width: min(68vw, 270px); margin-top: 12px; }
  .grid-2, .review-layout, .ring-summary { grid-template-columns: 1fr; }
  .identity-card-fields { grid-template-columns: 1fr; }
  .identity-toolbar { grid-template-columns: 1fr; }
  .custom-add { grid-template-columns: 1fr; }
  .explore-head { display: grid; align-items: start; }
  .graph-controls { justify-content: flex-start; }
  .network-view-switch { width: 100%; }
  .graph-stage, .graph-svg { min-height: 660px; height: 660px; }
  .graph-panel.department .graph-stage, .graph-panel.department .graph-svg { min-height: 780px; height: 780px; }
  .person-row { grid-template-columns: 42px minmax(0, 1fr); }
  .person-row .btn { grid-column: 1 / -1; width: 100%; }
  .compare-sections { gap: 16px; }
  .compare-table th, .compare-table td { padding: 10px 8px; font-size: .76rem; }
  .compare-table thead th { font-size: .76rem; }
}

@media (max-width: 520px) {
  .app-header { min-height: 58px; }
  .brand-mark { width: 34px; height: 34px; flex-basis: 34px; }
  .main { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
  /* A narrow bar cannot carry the word as well as the arrow. */
  .app-tab.back { padding: 0 11px; }
  .tab-back-label { display: none; }
  .panel-body { padding: 17px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .button-row .btn { flex: 1 1 120px; }
  .button-row.split .btn { flex: 1 1 120px; }
  .deep-grid { grid-template-columns: 1fr; }
  .segments { display: grid; grid-template-columns: repeat(3, 1fr); }
  .segment { padding: 7px 5px; font-size: .73rem; }
  .explore-head h1 { font-size: 1.65rem; }
  .graph-controls { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .graph-controls select { width: 100%; }
  .network-view-button { padding-inline: 9px; font-size: .8rem; }
  .graph-panel { border-radius: 16px; }
  .graph-stage, .graph-svg { min-height: 680px; height: 680px; }
  .graph-panel.department .graph-stage, .graph-panel.department .graph-svg { min-height: 800px; height: 800px; }
  .graph-legend { gap: 8px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
