:root {
    color-scheme: light;
    --page: #fff;
    --subtle: #f7f9fc;
    --ink: #142036;
    --muted: #546278;
    --line: #dce3ed;
    --control-line: #b5c1d2;
    --accent: #254cc3;
    --accent-hover: #193a9f;
    --accent-soft: #eef3ff;
    --danger: #a12623;
    --success: #195e3c;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    line-height: 1.5;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--page);
    color: var(--ink);
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
h1, h2, p { margin: 0; }

:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}

.skip-link {
    position: absolute;
    left: 16px;
    top: 12px;
    z-index: 1;
    padding: 8px 12px;
    background: var(--page);
    color: var(--accent);
    transform: translateY(-150%);
}

.skip-link:focus { transform: none; }
.site-header { border-bottom: 1px solid var(--line); }

.site-header-inner {
    width: min(100% - 64px, 1240px);
    margin-inline: auto;
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    font-size: 15px;
    font-weight: 720;
    letter-spacing: -.015em;
}

.brand-mark {
    display: grid;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 9px;
    background: var(--accent);
    color: white;
    font-size: 12px;
    letter-spacing: .025em;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 42px;
    padding: 7px 14px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 650;
    cursor: pointer;
    white-space: nowrap;
}

.button-secondary {
    background: var(--page);
    border-color: var(--control-line);
    color: var(--ink);
}

.button-secondary:hover { background: var(--subtle); }
.button-secondary[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.button-small { min-height: 36px; padding-inline: 9px; font-size: 13px; }
.plus { font-size: 18px; line-height: 1; font-weight: 500; }
.button-primary { background: var(--accent); color: white; padding-inline: 19px; }
.button-primary:hover { background: var(--accent-hover); }
.button:disabled { background: #e8edf6; color: var(--muted); cursor: not-allowed; }

.workspace {
    width: min(100% - 64px, 1240px);
    margin: 46px auto 56px;
    display: grid;
    grid-template-columns: 235px minmax(0, 1fr);
    gap: clamp(28px, 5vw, 76px);
    align-items: start;
}

.profile-nav {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 15px 12px 12px;
}

.profile-nav-heading {
    padding: 0 3px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.profile-nav h2 { font-size: 15px; font-weight: 700; }
.profile-list { margin: 12px 0 0; padding: 0; list-style: none; }
.profile-list li + li { margin-top: 4px; }

.profile-link {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 42px;
    padding: 7px 9px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.profile-link:hover { background: var(--subtle); }
.profile-link[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

.profile-initial {
    flex: 0 0 27px;
    display: grid;
    height: 27px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--page);
    font-size: 12px;
    font-weight: 750;
}

.empty-profiles { margin: 10px 4px 4px; color: var(--muted); font-size: 13px; }
.profile-main { min-width: 0; }
.page-heading { margin-bottom: 23px; }

h1 {
    font-size: clamp(29px, 3.6vw, 39px);
    font-weight: 750;
    line-height: 1.12;
    letter-spacing: -.038em;
}

.intro { margin-top: 9px; color: var(--muted); font-size: 15px; }

.profile-form {
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 3px 10px #14203607;
}

.form-section { padding: 22px 26px; }
.form-section + .form-section { border-top: 1px solid var(--line); }
.form-section h2 { margin-bottom: 15px; font-size: 16px; font-weight: 740; letter-spacing: -.01em; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px 20px; }
.field { min-width: 0; }

.field label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    font-weight: 630;
}

.field input, .field select, .field textarea {
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid var(--control-line);
    border-radius: 7px;
    background: var(--page);
    color: var(--ink);
    font-size: 15px;
}

.field textarea { display: block; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: #617188; }
.field [aria-invalid="true"] { border-color: var(--danger); }
.helptext { margin: 5px 0; color: var(--muted); font-size: 13px; }
.extra-field { margin-top: 15px; }

.errorlist {
    margin: 4px 0 6px;
    padding: 0;
    list-style: none;
    color: var(--danger);
    font-size: 14px;
}

.form-alert, .success-message {
    border-radius: 8px;
    padding: 10px 13px;
    font-size: 14px;
    font-weight: 630;
}

.form-alert { margin: 18px 26px 0; color: var(--danger); background: #fff1ef; }
.success-message { margin-bottom: 14px; color: var(--success); background: #edf8f1; }

.form-actions {
    display: flex;
    justify-content: flex-end;
    padding: 14px 26px;
    border-top: 1px solid var(--line);
    border-radius: 0 0 14px 14px;
    background: var(--subtle);
}

.sign-in-layout { margin: clamp(45px, 15vh, 135px) auto 48px; width: min(100% - 40px, 420px); }

.sign-in-card {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 30px;
    box-shadow: 0 8px 30px #1420360a;
}

.sign-in-form { display: grid; gap: 14px; margin-top: 22px; }
.sign-in-form .button { margin-top: 3px; }

.profile-steps {
    display: flex;
    gap: 7px 12px;
    flex-wrap: wrap;
    margin: 0 0 17px;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
    font-weight: 650;
}

.profile-steps a { padding: 6px 2px 9px; color: var(--muted); }
.profile-steps a:hover, .profile-steps [aria-current="page"] { color: var(--accent); }
.profile-steps [aria-current="page"] { border-bottom: 2px solid var(--accent); }

.strategy-overview, .strategy-record, .strategy-empty, .category-card {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 19px 22px;
}

.strategy-overview {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px 20px;
    background: var(--subtle);
}

.strategy-record, .strategy-empty { margin-top: 14px; }
.strategy-overview h2, .strategy-record h2, .strategy-empty h2, .category-section-heading h2, .strategy-history h2 { font-size: 17px; }
.strategy-meta { margin: 3px 0 0; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.strategy-generator { display: grid; justify-items: end; gap: 7px; }
.retry-confirmation { max-width: 260px; font-size: 13px; color: var(--ink); cursor: pointer; }
.retry-confirmation input { accent-color: var(--accent); }
.strategy-costs { display: grid; gap: 5px; margin: 9px 0; font-size: 13px; }
.strategy-costs dt { font-weight: 650; }
.strategy-costs dd { margin: 0; color: var(--muted); }
.strategy-record-heading, .category-title-row, .strategy-actions {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px 16px;
}

.strategy-notice { margin: 10px 0; padding: 8px 12px; border-radius: 8px; font-size: 14px; }
.strategy-error { color: var(--danger); background: #fff1ef; }
.strategy-warning { color: #674a0e; background: #fff6dd; }
.strategy-details { margin-top: 9px; font-size: 14px; }
.strategy-details summary { width: fit-content; color: var(--accent); font-weight: 650; cursor: pointer; }
.snapshot-list { display: grid; gap: 9px 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.snapshot-list dt { font-weight: 650; }
.snapshot-list dd { margin: 0; color: var(--muted); overflow-wrap: anywhere; }
.category-section-heading { margin: 24px 0 11px; }
.category-list { display: grid; gap: 12px; }
.category-card { box-shadow: 0 3px 10px #14203607; overflow-wrap: anywhere; }
.category-title-row h3 { margin: 0; font-size: 18px; letter-spacing: -.015em; }
.category-fit { margin-top: 2px; color: var(--muted); font-size: 13px; }
.category-fit strong { color: var(--accent); font-size: 20px; }

.category-select, .category-blocked, .category-research {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    min-height: 38px;
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 650;
}

.category-select { color: var(--accent); background: var(--accent-soft); cursor: pointer; }
.category-select input { margin: 0; width: 16px; height: 16px; accent-color: var(--accent); }
.category-blocked { color: var(--danger); background: #fff1ef; }
.category-research { color: #674a0e; background: #fff6dd; }
.category-rationale, .compatible-services, .referral-model { margin-top: 10px; font-size: 14px; }
.category-scores {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
    margin: 13px 0 0;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--subtle);
    font-size: 13px;
}

.category-scores dt { color: var(--muted); }
.category-scores dd { margin: 0; font-weight: 730; }
.legacy-scores { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.category-assessment { margin-top: 9px; font-size: 14px; }
.category-assessment p + p { margin-top: 2px; color: var(--muted); }
.category-conflicts { margin: 8px 0 0; padding-left: 19px; color: var(--danger); font-size: 14px; }
.research-reasons { color: #674a0e; }
.service-checks { list-style: none; margin: 6px 0 0; padding: 0; color: var(--muted); }
.service-checks li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.service-checks li strong, .referral-model strong { color: var(--ink); }
.relationship-label { margin-left: 3px; color: var(--muted); font-size: 12px; font-weight: 650; }
.relationship-complementary { color: var(--success); }
.relationship-direct_overlap, .relationship-uncertain, .relationship-direct_competition { color: var(--danger); }
.relationship-partial_overlap, .relationship-potential_conflict { color: #674a0e; }
.prospecting-list { display: grid; gap: 6px 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 6px 0 0; }
.prospecting-list dt { font-weight: 650; }
.prospecting-list dd { margin: 0; color: var(--muted); }
.prospecting-list ul { margin: 0; padding-left: 18px; }
.referral-model { padding-top: 8px; border-top: 1px solid var(--line); color: var(--muted); }
.referral-model h4 { margin: 0 0 3px; color: var(--ink); }
.referral-model p + p { margin-top: 3px; }
.strategy-actions { align-items: center; margin: 12px 0 0; }
.strategy-history { margin-top: 20px; }
.strategy-history ul { list-style: none; margin: 4px 0 0; padding: 0; }
.strategy-history li { margin-top: 3px; }
.text-link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; font-size: 14px; }
.text-link[aria-current="page"] { font-weight: 700; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 860px) {
    .site-header-inner, .workspace { width: calc(100% - 40px); }
    .workspace { grid-template-columns: minmax(0, 1fr); gap: 24px; margin-top: 24px; }
    .profile-list { display: flex; flex-wrap: wrap; gap: 4px 8px; }
    .profile-list li { max-width: 100%; }
    .profile-list li + li { margin-top: 0; }
}

@media (max-width: 600px) {
    .site-header-inner { min-height: 62px; }
    .site-header-inner, .workspace { width: calc(100% - 32px); }
    .sign-out { padding-inline: 10px; }
    .form-grid { grid-template-columns: minmax(0, 1fr); }
    .form-section { padding: 18px 16px; }
    .form-alert { margin-inline: 16px; }
    .form-actions { padding-inline: 16px; }
    .form-actions .button { width: 100%; }
    .sign-in-card { padding: 22px; }
    .strategy-overview, .strategy-record, .strategy-empty, .category-card { padding: 14px 15px; }
    .strategy-overview { align-items: stretch; flex-direction: column; }
    .strategy-overview .button { width: 100%; }
    .strategy-record-heading { flex-wrap: wrap; }
    .snapshot-list, .prospecting-list { grid-template-columns: minmax(0, 1fr); }
    .category-title-row { flex-wrap: wrap; }
    .category-scores { grid-template-columns: minmax(0, 1fr); }
    .category-scores > div { display: flex; justify-content: space-between; gap: 8px; }
}

.discovery-followup { margin-top: 10px; }
.discovery-main h2 { font-size: 17px; }
.discovery-config { margin-top: 16px; }
.discovery-panel {
    margin: 0 0 16px;
    padding: 20px 22px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--page);
}
.discovery-panel.strategy-warning { background: #fff6dd; }
.discovery-approval { background: var(--subtle); }
.discovery-panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 16px;
}
.discovery-fieldset { border: 0; margin: 12px 0 0; padding: 0; min-width: 0; }
.discovery-category-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.discovery-category-choices label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 11px;
    border: 1px solid var(--line);
    border-radius: 7px;
    font-size: 14px;
    cursor: pointer;
}
.discovery-category-choices input, .discovery-check input { accent-color: var(--accent); }
.discovery-location, .discovery-filter-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px 16px;
}
.discovery-location { margin-top: 10px; }
.discovery-approve-form, .discovery-filter-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin-top: 14px;
}
.discovery-check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.discovery-quote-list { padding-left: 20px; margin: 0; font-size: 14px; }
.discovery-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr));
    gap: 10px;
    margin: 14px 0;
}
.discovery-metrics > div {
    padding: 9px 11px;
    background: var(--accent-soft);
    border-radius: 8px;
    min-width: 0;
}
.discovery-metrics dt { color: var(--muted); font-size: 13px; }
.discovery-metrics dd { margin: 1px 0 0; font-weight: 720; overflow-wrap: anywhere; }
.discovery-activity { padding: 0; margin: 8px 0 0; list-style: none; font-size: 14px; }
.discovery-activity > li { padding: 10px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.discovery-activity a + a { margin-left: 12px; }
.prospect-results-heading { margin: 20px 0 12px; }
.prospect-table-shell { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.prospect-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 14px; }
.prospect-table th { background: var(--subtle); font-size: 13px; }
.prospect-table th, .prospect-table td { padding: 12px 14px; vertical-align: top; overflow-wrap: anywhere; }
.prospect-table td { border-top: 1px solid var(--line); }
.prospect-table a { font-weight: 650; }
.prospect-status {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 7px;
    color: #754b08;
    background: #fff6dd;
    font-size: 12px;
    font-weight: 650;
}
.prospect-selected { background: var(--accent-soft); color: var(--accent); }

@media (max-width: 640px) {
    .discovery-panel { padding: 15px; }
    .discovery-location, .discovery-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .discovery-category-choices { display: grid; }
    .discovery-category-choices label { width: 100%; }
    .prospect-table-shell { border: 0; overflow: visible; }
    .prospect-table, .prospect-table tbody { display: block; }
    .prospect-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .prospect-table tr { display: block; margin-bottom: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 9px; }
    .prospect-table td { display: block; padding: 3px 0; border: 0; }
    .prospect-table td[data-label]::before { content: attr(data-label) " · "; color: var(--muted); font-size: 12px; }
}
