/* Expert Interview: Intelie design system ("A Decade in the Making") on the web.
   One blue family on ink and grays, white canvas, hairlines, no gradients or shadows. */

@font-face { font-family: "Fira Sans"; font-weight: 300; font-display: swap; src: url("fonts/fira-sans-latin-300-normal.woff2") format("woff2"); }
@font-face { font-family: "Fira Sans"; font-weight: 400; font-display: swap; src: url("fonts/fira-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Fira Sans"; font-weight: 500; font-display: swap; src: url("fonts/fira-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Fira Sans"; font-weight: 600; font-display: swap; src: url("fonts/fira-sans-latin-600-normal.woff2") format("woff2"); }

:root {
    --ink: #111C20;
    --ink-soft: #3A4449;
    --gray: #5F656A;          /* secondary text, 5.9:1 on white */
    --gray-line: #9AA0A6;     /* graphics only */
    --line-strong: #7C848B;   /* interactive edges, 3.8:1 on white */
    --rule: #E6E8EB;
    --card: #F5F8FB;
    --tint: #E2F1FA;
    --tint-strong: #CDE5F7;
    --sky: #4FA3E3;
    --brand: #1097D0;
    --deep: #03658F;
    --deep-hover: #024E6F;
    --amber: #E97B38;         /* problems only */
    --amber-text: #9A4A16;
    --green: #2FA46A;         /* positive outcomes only */
    --canvas: #FFFFFF;

    --radius: 4px;
    --header-h: 56px;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

    --text-xs: 0.8125rem;   /* 13 */
    --text-sm: 0.9375rem;   /* 15 */
    --text-md: 1.0625rem;   /* 17 */
    --text-lg: 1.1875rem;   /* 19 */
    --text-xl: 1.5rem;      /* 24 */
    --text-2xl: 2.25rem;    /* 36 */
    --text-3xl: 3rem;       /* 48 */
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    font-family: "Fira Sans", system-ui, sans-serif;
    font-size: var(--text-md);
    line-height: 1.55;
    color: var(--ink);
    background: var(--canvas);
    font-variant-numeric: lining-nums;
    -webkit-font-smoothing: antialiased;
}
::selection { background: var(--tint-strong); color: var(--ink); }
input, textarea, button, select { font: inherit; color: inherit; caret-color: var(--brand); }
h1, h2, h3 { margin: 0; font-weight: 300; line-height: 1.15; text-wrap: balance; }
p { margin: 0; }
a { color: var(--deep); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { color: var(--deep-hover); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
* { scrollbar-width: thin; scrollbar-color: var(--gray-line) transparent; }

/* ---------- Shell ---------- */

.app-header {
    position: sticky;
    top: 0;
    z-index: 10;
    height: var(--header-h);
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 0 24px;
    background: var(--ink);
    color: #fff;
}
.app-header .brand { display: flex; align-items: center; gap: 16px; color: #fff; text-decoration: none; }
.app-header .brand img { height: 18px; width: auto; display: block; }
.app-header .product {
    padding-left: 16px;
    border-left: 1px solid rgba(255, 255, 255, 0.24);
    font-weight: 300;
    font-size: var(--text-lg);
    letter-spacing: 0.01em;
}
.app-header .spacer { flex: 1; }
.app-header .user { font-size: var(--text-sm); color: rgba(255, 255, 255, 0.78); }
.app-header .header-link {
    color: #fff;
    font-size: var(--text-sm);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: var(--radius);
}
.app-header .header-link:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.app-header :focus-visible { outline-color: var(--sky); }

.classification {
    font-size: var(--text-xs);
    color: var(--gray);
}

/* ---------- Buttons and inputs ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 48px;
    padding: 0 22px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: var(--text-md);
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 160ms var(--ease-out), border-color 160ms var(--ease-out), color 160ms var(--ease-out);
}
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-primary { background: var(--deep); color: #fff; }
.btn-primary:hover { background: var(--deep-hover); color: #fff; }
.btn-secondary { background: var(--canvas); color: var(--deep); border-color: var(--brand); }
.btn-secondary:hover { background: var(--tint); color: var(--deep-hover); }
.btn-quiet { background: transparent; color: var(--ink-soft); border-color: var(--rule); }
.btn-quiet:hover { border-color: var(--gray-line); color: var(--ink); }
.btn:disabled, .btn[aria-disabled="true"] {
    background: var(--card);
    color: var(--gray);
    border-color: var(--rule);
    cursor: not-allowed;
}
.btn-lg { min-height: 56px; padding: 0 28px; font-size: var(--text-lg); }

.field { display: grid; gap: 6px; }
.field label { font-size: var(--text-sm); font-weight: 500; color: var(--ink-soft); }
.field .help { font-size: var(--text-xs); color: var(--gray); }
.input {
    width: 100%;
    min-height: 48px;
    padding: 10px 14px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--canvas);
}
.input:hover { border-color: var(--ink-soft); }
.input:focus-visible { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }

.notice {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: var(--text-sm);
    background: var(--card);
    border: 1px solid var(--rule);
}
.notice-error { background: #FDF1EA; border-color: #F6CDB2; color: var(--amber-text); }
.notice-success { background: #EAF6EF; border-color: #BFE3CE; color: #1E6B45; }

.tag {
    display: inline-block;
    padding: 1px 8px;
    border: 1px solid var(--tint-strong);
    border-radius: 999px;
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--deep);
    vertical-align: 2px;
    white-space: nowrap;
}

/* ---------- Sign-in pages ---------- */

.auth {
    min-height: calc(100vh - var(--header-h));
    display: grid;
    place-items: center;
    padding: 48px 16px;
}
.auth-panel { width: min(420px, 100%); display: grid; gap: 24px; }
.auth-panel h1 { font-size: var(--text-2xl); }
.auth-panel .lede { color: var(--gray); }
.auth-panel form { display: grid; gap: 18px; }
.auth-panel .btn { width: 100%; }
.auth-panel .switch-link { font-size: var(--text-sm); color: var(--gray); }

/* ---------- Start page ---------- */

.start {
    max-width: 1200px;
    margin: 0 auto;
    padding: 64px 32px 48px;
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 72px;
    align-items: start;
}
.start-intro { position: sticky; top: calc(var(--header-h) + 64px); display: grid; gap: 20px; }
.start-intro h1 { font-size: var(--text-3xl); letter-spacing: -0.015em; }
.start-intro h1 em { font-style: normal; color: var(--brand); }
.start-intro .lede { font-size: var(--text-lg); color: var(--ink-soft); max-width: 40ch; }
.start-intro .privacy { font-size: var(--text-sm); color: var(--gray); max-width: 44ch; padding-top: 20px; border-top: 1px solid var(--rule); }

.start-form { display: grid; gap: 44px; }
.start-step { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 14px; }
.start-step legend { padding: 0; margin-bottom: 14px; font-size: var(--text-xl); font-weight: 300; }

.segmented { display: flex; flex-wrap: wrap; gap: 8px; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span {
    display: inline-flex;
    align-items: center;
    min-height: 48px;
    padding: 0 20px;
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    font-weight: 500;
    color: var(--ink-soft);
    cursor: pointer;
    transition: background-color 160ms var(--ease-out), border-color 160ms var(--ease-out);
}
.segmented label:hover span { border-color: var(--gray-line); }
.segmented input:checked + span { background: var(--tint); border-color: var(--brand); color: var(--deep); }
.segmented input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }

.event-list { display: grid; border-top: 1px solid var(--rule); }
.event-option {
    position: relative;
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr) 168px;
    gap: 18px;
    align-items: start;
    padding: 20px 12px 20px 14px;
    border-bottom: 1px solid var(--rule);
    cursor: pointer;
    transition: background-color 160ms var(--ease-out);
}
.event-option:hover { background: var(--card); }
.event-option:has(input:checked) { background: var(--tint); }
.event-option:has(input:checked)::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 1px;
    background: var(--brand);
}
.event-option input { width: 18px; height: 18px; margin: 4px 0 0; accent-color: var(--deep); cursor: pointer; }
.event-option .text { display: grid; gap: 4px; }
.event-option .title { font-size: var(--text-lg); font-weight: 500; line-height: 1.3; }
.event-option .where { font-size: var(--text-sm); color: var(--gray); }
.event-option .summary { font-size: var(--text-sm); color: var(--ink-soft); line-height: 1.5; margin-top: 4px; max-width: 62ch; }
.event-option .thumb { width: 168px; height: 56px; margin-top: 4px; }
.event-option .thumb path { fill: none; stroke: var(--brand); stroke-width: 1.25; vector-effect: non-scaling-stroke; }
.event-option .thumb path.second { stroke: var(--deep); }
.event-option .thumb line { stroke: var(--rule); stroke-width: 1; vector-effect: non-scaling-stroke; }

.start-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; }
.start-actions .hint { font-size: var(--text-sm); color: var(--gray); }
.loading-text { padding: 20px 14px; color: var(--gray); }

/* ---------- Conversation page ---------- */

.interview {
    height: calc(100vh - var(--header-h));
    height: calc(100dvh - var(--header-h));
    display: grid;
    grid-template-columns: minmax(0, 1fr) 400px;
}
.conversation { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-height: 0; }

.toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 32px;
    border-bottom: 1px solid var(--rule);
    min-height: 60px;
}
.toolbar .spacer { flex: 1; }

.presence { display: inline-flex; align-items: center; gap: 10px; font-size: var(--text-sm); color: var(--ink-soft); }
.presence .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gray-line); flex: none; }
.presence[data-state="ready"] .dot,
.presence[data-state="listening"] .dot { background: var(--brand); }
.presence[data-state="thinking"] .dot { background: var(--sky); animation: breathe 1.6s ease-in-out infinite; }
.presence[data-state="recording"] .dot { background: var(--deep); animation: breathe 1s ease-in-out infinite; }
.presence[data-state="ended"] .dot { background: var(--green); }
.presence[data-state="error"] .dot { background: var(--amber); }
.presence[data-state="error"] { color: var(--amber-text); }

.switch { display: inline-flex; align-items: center; gap: 10px; font-size: var(--text-sm); color: var(--ink-soft); cursor: pointer; min-height: 44px; }
.switch input {
    appearance: none;
    width: 40px;
    height: 24px;
    margin: 0;
    border-radius: 999px;
    background: var(--line-strong);
    position: relative;
    cursor: pointer;
    transition: background-color 160ms var(--ease-out);
}
.switch input::after {
    content: "";
    position: absolute;
    top: 3px; left: 3px;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: #fff;
    transition: transform 200ms var(--ease-out);
}
.switch input:checked { background: var(--deep); }
.switch input:checked::after { transform: translateX(16px); }

.transcript { overflow-y: auto; scroll-behavior: smooth; padding: 40px 32px 24px; }
.transcript-inner { max-width: 72ch; margin: 0 auto; display: grid; gap: 28px; }

.turn { display: grid; gap: 6px; animation: arrive 420ms var(--ease-out) both; }
.turn .who { font-size: var(--text-xs); font-weight: 500; color: var(--gray); }
.turn .words { white-space: pre-wrap; overflow-wrap: anywhere; }
.turn-interviewer .words { font-size: var(--text-lg); line-height: 1.6; color: var(--ink); }
.turn-person { justify-self: end; max-width: 88%; }
.turn-person .who { text-align: right; }
.turn-person .words {
    padding: 12px 16px;
    background: var(--tint);
    border-radius: var(--radius);
    color: var(--ink);
    line-height: 1.55;
}

.thinking { display: grid; gap: 10px; color: var(--gray); font-size: var(--text-sm); }
.thinking .bar { position: relative; height: 2px; width: 160px; background: var(--rule); overflow: hidden; border-radius: 2px; }
.thinking .bar::after {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 40%;
    background: var(--brand);
    animation: sweep 1.8s var(--ease-out) infinite;
}
.thinking[hidden] { display: none; }

.composer { border-top: 1px solid var(--rule); padding: 16px 32px 12px; background: var(--canvas); }
.composer-inner { max-width: 72ch; margin: 0 auto; display: grid; gap: 8px; }
.composer form { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: end; }
.composer textarea {
    min-height: 56px;
    max-height: 200px;
    resize: none;
    padding: 15px 16px;
    line-height: 1.45;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--canvas);
}
.composer textarea:hover { border-color: var(--ink-soft); }
.composer textarea:focus-visible { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
.composer textarea::placeholder { color: var(--gray); }
.composer textarea:disabled { background: var(--card); border-color: var(--rule); cursor: not-allowed; }
.speak { min-width: 148px; }
.speak .elapsed { font-variant-numeric: tabular-nums; font-weight: 400; }
.speak[aria-pressed="true"] { background: var(--deep); color: #fff; border-color: var(--deep); }
.speak[aria-pressed="true"] .rec-dot { display: inline-block; }
.speak .spinner { display: none; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--tint-strong); border-top-color: var(--deep); animation: spin 0.8s linear infinite; }
.speak.is-processing { background: var(--tint); color: var(--deep); border-color: var(--brand); cursor: progress; }
.speak.is-processing .spinner { display: inline-block; }
.rec-dot { display: none; width: 10px; height: 10px; border-radius: 50%; background: #fff; animation: breathe 1s ease-in-out infinite; }
.send { width: 56px; padding: 0; }
.composer .status { min-height: 1.4em; font-size: var(--text-xs); color: var(--gray); }
.composer .status.is-error { color: var(--amber-text); }

/* Event panel: the record lies open beside the conversation as a memory aid */
.event-panel {
    border-left: 1px solid var(--rule);
    background: var(--card);
    overflow-y: auto;
    min-height: 0;
}
.event-panel details { padding: 28px 28px 24px; }
.event-panel summary { list-style: none; cursor: default; display: grid; gap: 6px; }
.event-panel summary::-webkit-details-marker { display: none; }
.event-panel h2 { font-size: var(--text-xl); }
.event-panel .where { font-size: var(--text-sm); color: var(--gray); }
.event-panel .chevron { display: none; width: 24px; height: 24px; color: var(--deep); transition: transform 200ms var(--ease-out); }
.event-panel .summary { margin-top: 16px; font-size: var(--text-sm); color: var(--ink-soft); line-height: 1.55; }

.log-track { margin-top: 24px; display: grid; gap: 8px; }
.log-track .track-label { font-size: var(--text-xs); color: var(--gray); display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.log-track .track-label span:last-child { white-space: nowrap; font-variant-numeric: tabular-nums; }
.log-track .track-label .is-reading { color: var(--deep); font-weight: 500; }
.log-track svg { width: 100%; height: 168px; display: block; background: var(--canvas); border: 1px solid var(--rule); border-radius: var(--radius); overflow: visible; }
.log-track .grid { stroke: var(--rule); stroke-width: 1; vector-effect: non-scaling-stroke; }
.log-track .series { fill: none; stroke: var(--brand); stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.log-track .series.second { stroke: var(--deep); }
.log-track .tick { stroke: var(--gray-line); stroke-width: 1; vector-effect: non-scaling-stroke; stroke-dasharray: 2 3; transition: stroke 160ms var(--ease-out); }
.log-track .tick.is-active { stroke: var(--deep); stroke-dasharray: none; }
.log-track .axis { display: flex; justify-content: space-between; font-size: var(--text-xs); color: var(--gray); font-variant-numeric: tabular-nums; }
.log-track .legend { display: flex; gap: 16px; font-size: var(--text-xs); color: var(--gray); }
.log-track .legend i { display: inline-block; width: 14px; height: 2px; vertical-align: middle; margin-right: 6px; background: var(--brand); }
.log-track .legend i.second { background: var(--deep); }
.track-markers { position: relative; height: 28px; }
.track-markers button {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    width: 28px; height: 28px;
    padding: 0;
    border: 1px solid var(--brand);
    border-radius: 50%;
    background: var(--canvas);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--deep);
    font-variant-numeric: tabular-nums;
    cursor: pointer;
}
.track-markers button.is-active { background: var(--deep); border-color: var(--deep); color: #fff; }

.moments { margin: 24px 0 0; padding: 0; list-style: none; display: grid; }
.moments-title { margin-top: 28px; font-size: var(--text-sm); font-weight: 500; color: var(--ink-soft); }
.moments li {
    display: grid;
    grid-template-columns: 22px 72px minmax(0, 1fr);
    gap: 10px;
    align-items: baseline;
    padding: 9px 6px;
    border-bottom: 1px solid var(--rule);
    font-size: var(--text-sm);
    border-radius: 2px;
    transition: background-color 160ms var(--ease-out);
}
.moments li.is-active { background: var(--tint); }
.moments .n { font-size: var(--text-xs); font-weight: 600; color: var(--deep); font-variant-numeric: tabular-nums; text-align: center; }
.moments .when { color: var(--gray); font-variant-numeric: tabular-nums; font-size: var(--text-xs); }
.panel-foot { margin-top: 28px; display: grid; gap: 6px; font-size: var(--text-xs); color: var(--gray); }

/* ---------- Motion ---------- */

@keyframes arrive { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

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

/* ---------- Narrow screens ---------- */

@media (max-width: 1080px) {
    .interview { grid-template-columns: minmax(0, 1fr) 340px; }
}
@media (max-width: 900px) {
    .start { grid-template-columns: 1fr; gap: 40px; padding: 40px 16px; }
    .start-intro { position: static; }
    .start-intro h1 { font-size: var(--text-2xl); }
    .event-option { grid-template-columns: 22px minmax(0, 1fr); }
    .event-option .thumb { display: none; }

    .interview { display: flex; flex-direction: column; height: auto; min-height: calc(100dvh - var(--header-h)); }
    .event-panel { order: -1; border-left: 0; border-bottom: 1px solid var(--rule); overflow: visible; }
    .event-panel details { padding: 16px; }
    .event-panel summary { cursor: pointer; }
    .event-panel summary { grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; }
    .event-panel summary .chevron { display: block; grid-row: 1 / span 2; grid-column: 2; align-self: center; }
    .event-panel details[open] summary .chevron { transform: rotate(180deg); }
    .conversation { flex: 1; }
    .transcript { padding: 24px 16px; min-height: 50vh; }
    .toolbar, .composer { padding-left: 16px; padding-right: 16px; }
    .toolbar { flex-wrap: wrap; gap: 4px 16px; padding-top: 8px; padding-bottom: 8px; }
    .toolbar .presence { flex-basis: 100%; }
    .toolbar .btn { min-height: 44px; padding: 0 16px; }
    .composer { position: sticky; bottom: 0; }
    .composer form { grid-template-columns: minmax(0, 1fr) auto; }
    .speak { grid-column: 1 / -1; }
    .app-header .product { display: none; }
    .app-header { padding: 0 16px; gap: 8px; }
}

/* ---------- Knowledge map ---------- */

.app-header .header-nav { color: rgba(255, 255, 255, 0.86); }
.app-header .header-nav[aria-current="page"] { color: #fff; box-shadow: inset 0 -2px 0 var(--sky); border-radius: 0; }

.kmap {
    height: calc(100vh - var(--header-h));
    height: calc(100dvh - var(--header-h));
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr) 380px;
}
.kmap-side {
    border-right: 1px solid var(--rule);
    padding: 28px 24px 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.kmap-title { font-size: var(--text-xl); }
.kmap-lede { font-size: var(--text-sm); color: var(--ink-soft); }
.kmap-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; padding: 14px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.k-stat { font-size: var(--text-xs); color: var(--gray); line-height: 1.3; }
.k-stat strong { display: block; font-size: var(--text-xl); font-weight: 300; color: var(--ink); font-variant-numeric: tabular-nums; }
.kmap-filters { display: grid; gap: 12px; }
.kmap-filters select.input { min-height: 44px; padding: 8px 12px; }
.kmap-filters .switch { font-size: var(--text-xs); }
.kmap-subtitle { margin-top: 8px; font-size: var(--text-sm); font-weight: 500; color: var(--ink-soft); }
.kmap-feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; flex: 1; }
.kmap-feed li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; padding: 10px 0; border-bottom: 1px solid var(--rule); font-size: var(--text-xs); }
.kmap-feed li.empty { color: var(--gray); border: 0; }
.kmap-feed li.is-new { animation: arrive 600ms var(--ease-out) both; }
.k-when { color: var(--gray); font-variant-numeric: tabular-nums; }
.k-type-sm { color: var(--gray); }
.k-src { color: var(--gray); font-size: var(--text-xs); }
.k-why { flex-basis: 100%; color: var(--ink-soft); font-size: var(--text-xs); line-height: 1.45; }
.k-jump {
    padding: 0; border: 0; background: none; cursor: pointer;
    color: var(--deep); font-size: inherit; font-weight: 500; text-align: left;
    text-decoration: underline; text-decoration-color: var(--tint-strong); text-underline-offset: 0.2em;
}
.k-jump:hover { text-decoration-color: var(--deep); }
.k-badge { display: inline-block; padding: 0 7px; border-radius: 999px; font-size: 12px; font-weight: 500; border: 1px solid var(--tint-strong); color: var(--deep); background: var(--canvas); }
.k-badge-contradicts { border-color: #F6CDB2; color: var(--amber-text); background: #FDF1EA; }
.k-badge-related { border-color: var(--rule); color: var(--ink-soft); }

.kmap-canvas { position: relative; min-width: 0; background: var(--canvas); }
.kmap-canvas svg { width: 100%; height: 100%; display: block; cursor: grab; }
.kmap-canvas svg:active { cursor: grabbing; }
.kmap-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--gray); pointer-events: none; }
.kmap-empty[hidden] { display: none; }
.kmap-legend {
    position: absolute; left: 16px; bottom: 14px; right: 16px;
    display: flex; flex-wrap: wrap; gap: 6px 14px;
    font-size: 12px; color: var(--gray); pointer-events: none;
}
.k-leg { display: inline-flex; align-items: center; gap: 6px; }
.k-leg i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid; }
.k-leg i.k-leg-link { width: 18px; height: 0; border-radius: 0; border-width: 1.5px 0 0; border-style: dashed; }
.k-leg i.k-leg-ring { background: var(--canvas); border: 1.5px solid var(--gray-line); outline: 1.5px solid var(--brand); outline-offset: 2px; width: 8px; height: 8px; }
.k-link-agrees.k-leg-link { border-color: var(--deep); }
.k-link-contradicts.k-leg-link { border-color: var(--amber); }
.k-link-related.k-leg-link { border-color: var(--gray-line); }

.k-edge { stroke: var(--rule); stroke-width: 1.25; transition: opacity 200ms var(--ease-out); }
.k-link { fill: none; stroke-width: 1.5; stroke-dasharray: 5 4; cursor: pointer; transition: opacity 200ms var(--ease-out); }
.k-link-same_as, .k-link-agrees, .k-link-extends { stroke: var(--deep); }
.k-link-contradicts { stroke: var(--amber); }
.k-link-related { stroke: var(--gray-line); }
.k-node { cursor: pointer; transition: opacity 200ms var(--ease-out); }
.k-node .k-dot { stroke-width: 1.5; }
.k-node .k-ring { fill: none; stroke: none; }
.k-node.is-shared .k-ring { stroke: var(--brand); stroke-width: 1.5; }
.k-node.is-selected .k-ring { stroke: var(--ink); stroke-width: 2; }
.k-node:focus-visible { outline: none; }
.k-node:focus-visible .k-ring { stroke: var(--brand); stroke-width: 3; }
.k-pulse { fill: none; stroke: var(--brand); stroke-width: 1.5; pointer-events: none; }
.k-label {
    font-size: 12px; fill: var(--ink); pointer-events: none;
    paint-order: stroke; stroke: var(--canvas); stroke-width: 4px; stroke-linejoin: round;
}
.k-label.is-quiet { opacity: 0; transition: opacity 160ms var(--ease-out); }
.k-node:hover .k-label.is-quiet, .k-node.is-selected .k-label.is-quiet, .k-node:focus-visible .k-label.is-quiet { opacity: 1; }
.is-dim { opacity: 0.18; }

.kmap-inspector { border-left: 1px solid var(--rule); background: var(--card); padding: 28px 24px; overflow-y: auto; }
.kmap-hint { color: var(--gray); font-size: var(--text-sm); }
.k-head { display: flex; align-items: center; gap: 8px; }
.k-swatch { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid; }
.k-type { font-size: var(--text-xs); font-weight: 500; color: var(--ink-soft); }
.k-name { margin-top: 8px; font-size: var(--text-xl); }
.k-desc { margin-top: 10px; font-size: var(--text-sm); color: var(--ink-soft); }
.k-meta { margin-top: 6px; font-size: var(--text-xs); color: var(--gray); }
.k-section { margin-top: 24px; margin-bottom: 8px; font-size: var(--text-sm); font-weight: 500; color: var(--ink-soft); }
.k-quotes, .k-conn, .k-rel { list-style: none; margin: 0; padding: 0; display: grid; }
.k-quotes li { padding: 10px 0; border-bottom: 1px solid var(--rule); display: grid; gap: 4px; }
.k-quotes q { font-size: var(--text-sm); line-height: 1.5; quotes: "“" "”"; }
.k-quotes li.empty { color: var(--gray); font-size: var(--text-sm); }
.k-conn li { padding: 10px 0; border-bottom: 1px solid var(--rule); display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: var(--text-sm); }
.k-rel li { padding: 7px 0; border-bottom: 1px solid var(--rule); display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: var(--text-sm); }
.k-verb { color: var(--gray); font-size: var(--text-xs); min-width: 0; }

@media (max-width: 1180px) {
    .kmap { grid-template-columns: 280px minmax(0, 1fr) 320px; }
}
@media (max-width: 900px) {
    .kmap { display: flex; flex-direction: column; height: auto; }
    .kmap-canvas { height: 70vh; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
    .kmap-side, .kmap-inspector { border: 0; }
}
