:root {
    color-scheme: dark;
    --ink: #f4f8fb;
    --muted: #9fb0c2;
    --surface: #101d2e;
    --line: rgba(255, 255, 255, 0.1);
    --green: #20d6a6;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: #07111f; }

body {
    min-height: 100%;
    margin: 0;
    color: var(--ink);
    background: radial-gradient(circle at 82% 18%, rgba(41, 151, 232, 0.15), transparent 34rem), radial-gradient(circle at 12% 80%, rgba(32, 214, 166, 0.08), transparent 28rem), #07111f;
    font-family: Inter, Aptos, "Segoe UI", sans-serif;
}

a { color: inherit; }
.site-shell { min-height: 100vh; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: min(1180px, calc(100% - 48px));
    margin: 0 auto;
    padding: 24px 0;
}

.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; letter-spacing: 0.01em; }
.brand img { width: 38px; height: 38px; }
.brand strong { font-size: 0.8rem; letter-spacing: 0.13em; }
.topbar nav { display: flex; align-items: center; gap: 24px; }
.topbar nav > a:not(.button) { color: var(--muted); text-decoration: none; }
.identity { max-width: 220px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
main { width: min(1180px, calc(100% - 48px)); margin: 0 auto; }

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
    align-items: center;
    min-height: 620px;
    gap: 8vw;
    padding: 56px 0 80px;
}

.eyebrow { display: block; margin-bottom: 22px; color: var(--green); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 28px; font-size: clamp(2.9rem, 6.2vw, 5.8rem); font-weight: 500; letter-spacing: -0.055em; line-height: 0.98; }
h1 em { color: var(--green); font-style: normal; }

.hero-copy > p, .dashboard-heading > p, .access-panel > p { max-width: 660px; margin-bottom: 34px; color: var(--muted); font-size: 1.12rem; line-height: 1.7; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 20px; border: 1px solid transparent; border-radius: 12px; font-weight: 650; text-decoration: none; transition: transform 140ms ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: #04130f; background: var(--green); }
.button-secondary { border-color: var(--line); color: var(--ink); background: rgba(255, 255, 255, 0.04); }

.pulse-visual { position: relative; display: grid; place-items: center; min-height: 380px; }
.pulse-visual::before { position: absolute; width: 290px; height: 290px; border-radius: 50%; background: rgba(32, 214, 166, 0.1); box-shadow: 0 0 120px rgba(32, 214, 166, 0.18); content: ""; }
.pulse-visual img { position: relative; width: 210px; filter: drop-shadow(0 28px 40px rgba(0, 0, 0, 0.35)); }
.pulse-line { position: absolute; right: -10%; left: -10%; height: 1px; background: linear-gradient(90deg, transparent, rgba(32, 214, 166, 0.55), transparent); }

.promise, .dashboard-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; overflow: hidden; margin-bottom: 72px; border: 1px solid var(--line); border-radius: 18px; background: var(--line); }
.promise article, .dashboard-grid article, .dashboard-card { padding: 30px; background: rgba(16, 29, 46, 0.94); }
.promise span, .dashboard-grid span { display: block; margin-bottom: 26px; color: var(--green); font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; }
.promise h2 { margin-bottom: 10px; font-size: 1.35rem; }
.promise p, .dashboard-grid p { margin: 0; color: var(--muted); line-height: 1.55; }
.dashboard-heading, .access-panel { padding: 100px 0 56px; }
.dashboard-heading h1, .access-panel h1 { max-width: 850px; font-size: clamp(2.5rem, 5vw, 4.8rem); }
.api-identity { display: grid; grid-template-columns: minmax(210px, 0.7fr) minmax(220px, 0.8fr) minmax(300px, 1.5fr); align-items: center; gap: 28px; margin-bottom: 24px; padding: 22px 28px; border: 1px solid var(--line); border-radius: 18px; background: rgba(16, 29, 46, 0.78); }
.api-identity strong { font-size: 1.05rem; }
.api-identity p { margin: 0; color: var(--muted); line-height: 1.5; }
.api-status { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.76rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.api-status::before { width: 9px; height: 9px; border-radius: 50%; content: ""; }
.api-status-online::before { background: var(--green); box-shadow: 0 0 16px rgba(32, 214, 166, 0.8); }
.api-status-offline::before { background: #ffb55e; box-shadow: 0 0 16px rgba(255, 181, 94, 0.55); }
.dashboard-grid { grid-template-columns: repeat(2, 1fr); }
.dashboard-grid strong { display: block; margin-bottom: 10px; font-size: 1.22rem; }
.dashboard-card { color: inherit; text-decoration: none; transition: background 140ms ease; }
.dashboard-card:hover { background: rgba(21, 42, 62, 0.98); }
.correlation { font-family: "Cascadia Code", Consolas, monospace; }

.module-heading, .detail-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; padding: 72px 0 42px; }
.module-heading h1, .detail-heading h1 { margin-bottom: 14px; font-size: clamp(2.8rem, 5vw, 5rem); }
.module-heading p, .detail-heading p { margin: 0; color: var(--muted); font-size: 1.05rem; line-height: 1.6; }
.module-heading .eyebrow, .detail-heading .eyebrow, .section-title .eyebrow, .company-facts .eyebrow { margin-bottom: 12px; }
.back-link { display: inline-block; margin-bottom: 30px; color: var(--muted); text-decoration: none; }
.back-link:hover { color: var(--ink); }
.source-badge, .primary-badge { display: inline-flex; align-items: center; width: fit-content; border: 1px solid rgba(32, 214, 166, 0.35); border-radius: 999px; color: var(--green); background: rgba(32, 214, 166, 0.08); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.source-badge { margin-bottom: 10px; padding: 10px 14px; }
.primary-badge { margin-bottom: 12px; padding: 5px 9px; }

.notice { margin-bottom: 24px; padding: 15px 18px; border: 1px solid; border-radius: 12px; line-height: 1.5; }
.notice-success { border-color: rgba(32, 214, 166, 0.32); color: #adf8e3; background: rgba(32, 214, 166, 0.08); }
.notice-error { border-color: rgba(255, 132, 132, 0.34); color: #ffd0d0; background: rgba(156, 46, 63, 0.22); }

.prospect-toolbar { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 30px; }
.toolbar-block { padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: rgba(16, 29, 46, 0.78); }
.toolbar-highlight { border-color: rgba(32, 214, 166, 0.25); background: linear-gradient(135deg, rgba(32, 214, 166, 0.08), rgba(16, 29, 46, 0.9)); }
.toolbar-block > label { display: block; margin-bottom: 10px; color: var(--ink); font-weight: 650; }
.toolbar-block small { display: block; margin-top: 10px; color: var(--muted); }
.inline-field { display: flex; gap: 10px; }
.inline-field input { flex: 1; min-width: 0; }

input, textarea, select { width: 100%; border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 10px; outline: none; color: var(--ink); background: rgba(5, 15, 27, 0.8); font: inherit; }
input { min-height: 46px; padding: 0 13px; }
textarea { min-height: 96px; padding: 12px 13px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(32, 214, 166, 0.1); }
button:disabled { cursor: wait; opacity: 0.55; }

.editor-panel, .contacts-section, .list-section, .company-facts { margin-bottom: 32px; padding: 28px; border: 1px solid var(--line); border-radius: 18px; background: rgba(16, 29, 46, 0.82); }
.section-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.section-title h2 { margin-bottom: 0; font-size: 1.55rem; }
.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field > span, .check-field > span { color: var(--muted); font-size: 0.82rem; font-weight: 650; }
.field-wide { grid-column: span 2; }
.field-full { grid-column: 1 / -1; }
.check-field { display: flex; align-items: center; gap: 10px; min-height: 46px; padding-top: 22px; }
.check-field input { width: 18px; min-height: 18px; accent-color: var(--green); }
.form-actions { display: flex; align-items: center; gap: 18px; margin-top: 24px; }
.form-actions > span { color: var(--muted); font-size: 0.85rem; }
.validation-errors { margin: 0 0 22px; padding: 14px 18px 14px 36px; border: 1px solid rgba(255, 132, 132, 0.3); border-radius: 10px; color: #ffd0d0; background: rgba(156, 46, 63, 0.2); }
.validation-message { margin-top: 3px; color: #ffb8b8; font-size: 0.78rem; }

.empty-state { padding: 42px; border: 1px dashed rgba(255, 255, 255, 0.15); border-radius: 14px; color: var(--muted); text-align: center; }
.empty-state strong { display: block; margin-bottom: 8px; color: var(--ink); font-size: 1.05rem; }
.empty-state p { margin: 0; }
.page-loading { margin-top: 80px; }
.prospect-list { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; }
.prospect-row { display: grid; grid-template-columns: minmax(240px, 1.6fr) 1fr 1fr 0.5fr auto; align-items: center; gap: 24px; padding: 20px 22px; color: inherit; background: rgba(7, 17, 31, 0.45); text-decoration: none; transition: background 140ms ease; }
.prospect-row + .prospect-row { border-top: 1px solid var(--line); }
.prospect-row:hover { background: rgba(32, 214, 166, 0.06); }
.prospect-row > div { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.prospect-row small { color: var(--muted); font-size: 0.68rem; letter-spacing: 0.09em; text-transform: uppercase; }
.reminders .reminder-target { display: block; margin: 8px 0; white-space: normal; text-align: left; }
.reminders .task-card { margin: 12px 0; overflow-wrap: anywhere; }
.reminders fieldset { margin-top: 16px; }
.prospect-row span { overflow-wrap: anywhere; white-space: normal; }
.prospect-name strong { overflow: hidden; font-size: 1rem; text-overflow: ellipsis; white-space: nowrap; }
.prospect-name span { color: var(--muted); font-size: 0.86rem; }
.row-arrow { color: var(--green); font-size: 1.35rem; }

.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; align-items: start; gap: 24px; }
.company-facts { position: sticky; top: 20px; }
.company-facts dl, .contact-card dl { margin: 0; }
.company-facts dl > div, .contact-card dl > div { padding: 14px 0; border-top: 1px solid var(--line); }
.company-facts dt, .contact-card dt { margin-bottom: 5px; color: var(--muted); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; }
.company-facts dd, .contact-card dd { margin: 0; overflow-wrap: anywhere; }
.contact-editor { margin-bottom: 24px; padding: 24px; border: 1px solid rgba(32, 214, 166, 0.22); border-radius: 14px; background: rgba(5, 15, 27, 0.55); }
.contacts-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.contact-card { padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: rgba(7, 17, 31, 0.48); }
.contact-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.contact-card-heading > div:first-child { display: flex; flex-direction: column; align-items: flex-start; }
.contact-card-heading strong { margin-bottom: 5px; font-size: 1.1rem; }
.contact-card-heading span:not(.primary-badge) { color: var(--muted); }
.contact-actions { display: flex; gap: 10px; }
.contact-actions button { padding: 0; border: 0; color: var(--muted); background: none; cursor: pointer; font: inherit; font-size: 0.8rem; }
.contact-actions button:hover { color: var(--green); }
.contact-card a { color: var(--ink); text-decoration-color: rgba(32, 214, 166, 0.45); }

.modal-backdrop { position: fixed; inset: 0; z-index: 500; display: grid; place-items: center; padding: 28px; background: rgba(2, 8, 16, 0.78); backdrop-filter: blur(10px); }
.registry-dialog { display: flex; flex-direction: column; width: min(1020px, 100%); max-height: min(860px, calc(100vh - 56px)); overflow: hidden; border: 1px solid rgba(32, 214, 166, 0.28); border-radius: 22px; background: #0c1929; box-shadow: 0 28px 90px rgba(0, 0, 0, 0.55); }
.registry-dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 28px 30px 22px; border-bottom: 1px solid var(--line); }
.registry-dialog-header .eyebrow { margin-bottom: 9px; }
.registry-dialog-header h2 { margin-bottom: 8px; font-size: 1.65rem; }
.registry-dialog-header p { margin: 0; color: var(--muted); }
.icon-button { display: grid; flex: 0 0 auto; place-items: center; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: rgba(255, 255, 255, 0.04); cursor: pointer; font: inherit; font-size: 1.5rem; }
.registry-results-summary { padding: 15px 30px; color: var(--muted); font-size: 0.85rem; }
.registry-results { overflow-y: auto; padding: 0 30px 30px; }
.registry-result { border: 1px solid var(--line); border-radius: 15px; background: rgba(5, 15, 27, 0.62); }
.registry-result + .registry-result { margin-top: 12px; }
.registry-result-main { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 20px; }
.registry-result-main > div:first-child { display: flex; flex-direction: column; gap: 5px; min-width: 0; color: var(--muted); font-size: 0.86rem; }
.registry-result-title { display: flex; align-items: center; gap: 10px; }
.registry-result-title strong { overflow: hidden; color: var(--ink); font-size: 1.08rem; text-overflow: ellipsis; white-space: nowrap; }
.registry-trade-name { color: var(--ink); }
.status-chip { display: inline-flex; flex: 0 0 auto; padding: 4px 8px; border: 1px solid; border-radius: 999px; font-size: 0.66rem; font-weight: 750; letter-spacing: 0.07em; text-transform: uppercase; }
.status-active { border-color: rgba(32, 214, 166, 0.32); color: #79efd0; background: rgba(32, 214, 166, 0.08); }
.status-closed { border-color: rgba(255, 132, 132, 0.32); color: #ffc1c1; background: rgba(156, 46, 63, 0.18); }
.registry-result-actions { display: flex; flex: 0 0 auto; gap: 10px; }
.registry-details { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; border-top: 1px solid var(--line); background: var(--line); }
.registry-details > div { display: flex; flex-direction: column; gap: 6px; padding: 16px 20px; background: #0d1a2a; }
.registry-details > div:nth-child(4) { grid-column: span 2; }
.registry-details small { color: var(--muted); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; }
.registry-detail-wide { grid-column: 1 / -1; }

#blazor-error-ui { position: fixed; right: 20px; bottom: 20px; left: 20px; z-index: 1000; display: none; padding: 16px 50px 16px 18px; border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 12px; color: var(--ink); background: #7b2531; }
#blazor-error-ui .reload { margin-left: 8px; }
#blazor-error-ui .dismiss { position: absolute; top: 13px; right: 18px; cursor: pointer; }

@media (max-width: 760px) {
    .topbar, main { width: min(100% - 32px, 1180px); }
    .topbar { align-items: flex-start; }
    .topbar nav { gap: 12px; }
    .identity, .topbar nav > a:not(.button) { display: none; }
    .hero { grid-template-columns: 1fr; min-height: auto; padding-top: 72px; }
    .pulse-visual { min-height: 280px; }
    .pulse-visual img { width: 160px; }
    .api-identity { grid-template-columns: 1fr; gap: 12px; }
    .promise, .dashboard-grid { grid-template-columns: 1fr; }
    .module-heading, .detail-heading { align-items: flex-start; flex-direction: column; padding-top: 48px; }
    .prospect-toolbar, .detail-layout, .contacts-grid { grid-template-columns: 1fr; }
    .inline-field, .form-actions { align-items: stretch; flex-direction: column; }
    .form-grid { grid-template-columns: 1fr; }
    .field-wide, .field-full { grid-column: auto; }
    .prospect-row { grid-template-columns: 1fr auto; }
    .prospect-row > div:not(.prospect-name):not(.prospect-address) { display: none; }
    .prospect-row .prospect-name { grid-column: 1; grid-row: 1; }
    .prospect-row .row-arrow { grid-column: 2; grid-row: 1; }
    .prospect-row .prospect-address { grid-column: 1 / -1; }
    .company-facts { position: static; }
    .modal-backdrop { align-items: end; padding: 0; }
    .registry-dialog { max-height: 92vh; border-right: 0; border-bottom: 0; border-left: 0; border-radius: 20px 20px 0 0; }
    .registry-dialog-header { padding: 22px 20px 18px; }
    .registry-results-summary { padding: 14px 20px; }
    .registry-results { padding: 0 20px 24px; }
    .registry-result-main { align-items: stretch; flex-direction: column; }
    .registry-result-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .registry-details { grid-template-columns: 1fr 1fr; }
    .registry-details > div:nth-child(4) { grid-column: span 1; }
    .registry-detail-wide { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

.task-filter { margin: 0 0 24px; cursor: pointer; }
.task-filter input, .check-field input { width: 20px; height: 20px; accent-color: var(--green); }
.prospect-tasks { margin-bottom: 28px; }
.task-list { display: grid; gap: 12px; }
.task-card { display: flex; flex-direction: column; gap: 6px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font: inherit; text-align: left; overflow-wrap: anywhere; }
button.task-card { width: 100%; cursor: pointer; }
button.task-card:hover, button.task-card:focus-visible { border-color: var(--green); }
.task-card small { color: var(--muted); }
.task-card p { margin: 4px 0; }
.task-history { margin-top: 24px; }
.task-history summary { cursor: pointer; padding: 12px 0; color: var(--muted); }
.task-history article { margin-top: 12px; }
.task-due { color: var(--green) !important; }
.preserve-lines { white-space: pre-wrap; overflow-wrap: anywhere; }
.company-readonly { display: grid; gap: 20px; margin: 0; }
.company-readonly dt { color: var(--muted); font-size: 0.85rem; margin-bottom: 6px; }
.company-readonly dd { margin: 0; overflow-wrap: anywhere; }
.client-tabs { display: flex; flex-wrap: wrap; gap: 10px; margin: 24px 0; }
.client-list-card { display: grid; gap: 8px; padding: 22px; border: 1px solid #24374d; border-radius: 14px; background: #101d2e; color: #f4f8fb; text-decoration: none; }
.client-list-card:hover { border-color: #20d6a6; }
.client-list-card span, .client-list-card small { color: #9fb0c2; }
.equipment-card { border: 1px solid #24374d; border-radius: 14px; padding: 22px; margin: 18px 0; overflow-wrap: anywhere; }
.equipment-card summary { cursor: pointer; color: #20d6a6; padding: 12px 0; }
.client-fieldset { border: 0; padding: 16px 0; min-inline-size: 0; }
.client-fieldset legend { font-size: 1.15rem; font-weight: 700; }
.client-fieldset .field { margin-bottom: 14px; }
.client-fieldset:disabled { opacity: .65; }
