:root {
    --bg: #f7f7f7;
    --bg-alt: #ffffff;
    --bg-card: #ffffff;
    --border: rgba(15, 23, 42, 0.12);
    --border-strong: rgba(15, 23, 42, 0.18);
    --border-subtle: rgba(15, 23, 42, 0.08);
    --accent: #2af0a6;
    --accent-blue: #2dd7ff;
    --accent-purple: #7b7cff;
    --accent-gold: #f8c046;
    --text: #1d2533;
    --text-dim: rgba(29, 37, 51, 0.62);
    --danger: #ff5f6d;
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
    --shadow: 0 18px 36px rgba(15, 23, 42, 0.08);
    font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

[hidden] {
    display: none !important;
}

body {
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    display: flex;
    flex-direction: column;
    font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.has-open-overlay {
    overflow: hidden;
}

body.is-auth-loading main.layout {
    opacity: 0.4;
    pointer-events: none;
}

body.is-unauthenticated main.layout {
    display: none;
}

body.is-unauthenticated #auth-gate {
    display: flex;
}

body.is-authenticated #auth-gate {
    display: none;
}

button {
    border: none;
    padding: 0.6rem 1.3rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease, color 0.2s ease;
}

button.primary {
    background: var(--accent);
    color: #03131b;
    box-shadow: 0 16px 42px rgba(42, 240, 166, 0.32);
}

button.primary:hover {
    transform: translateY(-2px);
}

button.primary.small,
button.ghost.small {
    padding: 0.45rem 0.95rem;
    font-size: 0.85rem;
}

button.ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

button.ghost:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.4rem clamp(1.2rem, 4vw, 3rem);
    border-bottom: 1px solid var(--border-subtle);
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.92);
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand h1 {
    font-size: clamp(1.3rem, 2.2vw, 1.8rem);
    letter-spacing: 0.04em;
}

.logo-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #8afcd6);
    box-shadow: 0 0 14px rgba(42, 240, 166, 0.9);
}

.top-actions {
    display: flex;
    gap: 0.9rem;
    align-items: center;
}

.primary-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.primary-actions > * {
    flex: 0 0 auto;
}

.auth-slot {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding-left: 0.9rem;
    margin-left: 0.6rem;
    border-left: 1px solid var(--border-subtle);
}

.auth-identity {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
}

.auth-username {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dim);
}

.auth-role {
    font-size: 0.75rem;
    font-weight: 500;
    color: rgba(29, 37, 51, 0.55);
    text-transform: capitalize;
}

.auth-gate {
    display: none;
    align-items: center;
    justify-content: center;
    padding: clamp(2rem, 6vw, 4rem);
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    max-width: 420px;
    width: 100%;
    padding: clamp(2.2rem, 5vw, 3rem);
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    text-align: center;
}

.auth-card h2 {
    font-size: clamp(1.9rem, 3.2vw, 2.4rem);
}

.auth-card p {
    color: var(--text-dim);
    line-height: 1.65;
}

.auth-card .auth-error {
    color: var(--danger);
    min-height: 1.2rem;
}

.layout {
    flex: 1;
    padding: clamp(1.8rem, 3.4vw, 3.6rem);
    max-width: min(1600px, 95vw);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2.2rem;
}

.hero {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 2.1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.3rem;
    box-shadow: var(--shadow);
}

.hero h2 {
    font-size: clamp(1.9rem, 3vw, 2.5rem);
    margin-bottom: 0.6rem;
}

.hero p {
    max-width: 560px;
    color: var(--text-dim);
    line-height: 1.65;
}

.hero-metrics {
    display: flex;
    gap: 1.1rem;
    flex-wrap: wrap;
}

.metric {
    background: rgba(42, 240, 166, 0.08);
    border: 1px solid rgba(42, 240, 166, 0.18);
    padding: 1.1rem 1.5rem;
    border-radius: var(--radius-sm);
    min-width: 160px;
}

.metric .label {
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    color: var(--text-dim);
}

.metric .value {
    display: block;
    font-size: 1.45rem;
    font-weight: 700;
}

.view-switch {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0;
}

.view-tab {
    border: 1px solid var(--border);
    background: var(--bg-alt);
    color: var(--text-dim);
    padding: 0.45rem 1.1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    cursor: pointer;
    transition: transform 0.15s ease, border 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.view-tab.is-hidden {
    display: none;
}

.view-tab:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.view-tab.is-active {
    background: linear-gradient(135deg, rgba(42, 240, 166, 0.18), rgba(45, 215, 255, 0.12));
    border-color: rgba(42, 240, 166, 0.45);
    color: var(--text);
}

.view-panel.is-hidden {
    display: none;
}

@media (max-width: 900px) {
    .top-bar {
        align-items: stretch;
    }

    .top-actions {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 0.8rem;
    }

    .primary-actions {
        flex: 1 1 220px;
        justify-content: flex-start;
    }

    .auth-slot {
        flex: 1 1 220px;
        border-left: none;
        margin-left: 0;
        padding-left: 0;
        padding-top: 0.75rem;
        border-top: 1px solid var(--border-subtle);
    }
}

@media (max-width: 640px) {
    .view-switch {
        flex-wrap: wrap;
    }

    .view-tab {
        font-size: 0.78rem;
        padding: 0.4rem 0.85rem;
        flex: 1 1 calc(50% - 0.5rem);
        text-align: center;
    }

    .top-actions {
        gap: 0.7rem;
    }

    .primary-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.55rem;
    }

    .primary-actions button,
    .auth-slot button {
        width: 100%;
    }

    .auth-slot {
        flex-direction: column;
        align-items: stretch;
        gap: 0.6rem;
    }

    .auth-identity {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
}

@media (max-width: 480px) {
    .view-tab {
        flex-basis: 100%;
    }

    .auth-identity {
        width: 100%;
    }
}

.filters-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 1.6rem 2.1rem;
    box-shadow: var(--shadow);
}

.filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.2rem;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 170px;
}

.filter-group span {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-dim);
}

.filter-group select,
.filter-group input {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 0.6rem 0.8rem;
    font: inherit;
    min-height: 44px;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: 2px solid rgba(42, 240, 166, 0.35);
    outline-offset: 2px;
}

.filter-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.section-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    text-align: left;
    margin-bottom: 1.55rem;
    gap: 0.5rem;
}

.section-header h3 {
    font-size: 1.3rem;
    margin: 0;
}

.section-header .caption {
    color: var(--text-dim);
    font-size: 0.9rem;
    line-height: 1.4;
    max-width: 60ch;
}

.section-header .phase-toggle-actions {
    display: flex;
    gap: 0.6rem;
    align-self: flex-start;
}

.funnel-phase-actions {
    margin-left: 0;
}

.macro-funnel-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.6rem 1.8rem 1.8rem;
    box-shadow: var(--shadow);
}

.route-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.6rem 1.8rem 1.8rem;
    box-shadow: var(--shadow);
}

.route-map-wrapper {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 1.4rem;
    border: 1px solid var(--border);
}

#pipeline-map {
    width: 100%;
    height: clamp(300px, 45vh, 440px);
}

.map-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    background: rgba(15, 23, 42, 0.7);
    color: #fff;
    text-align: center;
    padding: 1rem 1.5rem;
}

.route-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 0.7fr);
    gap: 1.8rem;
    align-items: start;
}

.route-form {
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
}

.route-field {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.route-field label {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
}

.route-field-caption {
    display: block;
    font-size: 0.8rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
    color: var(--text-soft);
    margin-left: 0.2rem;
}

.route-field select,
.route-field input {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 0.65rem 0.8rem;
    font: inherit;
    min-height: 44px;
}

.route-field select:focus,
.route-field input:focus,
.route-save-form input:focus {
    outline: 2px solid rgba(108, 139, 255, 0.35);
    outline-offset: 2px;
}

.route-custom {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    border: 1px dashed rgba(148, 163, 184, 0.4);
    background: rgba(148, 163, 184, 0.08);
}

.route-custom-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
}


.route-opportunity-scroll {
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-alt);
    max-height: 11.5rem;
    overflow-y: scroll;
    padding: 0.4rem;
    -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1) calc(100% - 2rem), rgba(0, 0, 0, 0));
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1) calc(100% - 2rem), rgba(0, 0, 0, 0));
}

.route-opportunity-scroll::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2rem;
    pointer-events: none;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, var(--bg-alt) 85%);
}

.route-opportunity-list {
    display: grid;
    gap: 0.2rem;
    padding-bottom: 1rem;
}

.route-opportunity-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0.65rem;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease;
}

.route-opportunity-item:hover,
.route-opportunity-item:focus-within {
    background: rgba(108, 139, 255, 0.12);
}

.route-opportunity-meta {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex: 1 1 auto;
    min-width: 0;
}

.route-opportunity-meta .name {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text);
}

.route-opportunity-meta .company {
    font-size: 0.82rem;
    color: var(--text-soft);
}

.route-opportunity-meta .tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    font-size: 0.72rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.route-opportunity-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.route-opportunity-actions button {
    padding: 0.35rem 0.75rem;
    font-size: 0.78rem;
}

.route-opportunity-hint {
    margin: 0.25rem 0 0;
    font-size: 0.78rem;
    color: var(--text-dim);
    text-align: right;
}

.route-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
}

.route-results {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-alt);
    padding: 1.2rem 1.4rem;
    min-height: 280px;
}

.route-summary {
    color: var(--text-soft);
    font-size: 0.95rem;
    line-height: 1.5;
}

.route-stats {
    display: flex;
    gap: 1.3rem;
}

.route-stat {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.85rem;
    color: var(--text-soft);
}

.route-stat .value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
}

.route-share {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    border-top: 1px dashed rgba(148, 163, 184, 0.35);
    padding-top: 0.8rem;
}

.route-share-grid {
    display: flex;
    gap: 0.8rem;
    align-items: center;
}

.route-qr {
    width: 160px;
    height: 160px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: rgba(15, 23, 42, 0.07);
    display: grid;
    place-items: center;
    overflow: hidden;
}

.route-qr img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.route-share-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.route-stop-scroll {
    position: relative;
    max-height: 12rem;
    overflow-y: scroll;
    padding-right: 0.4rem;
    margin-bottom: 0.75rem;
    -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1) calc(100% - 2.4rem), rgba(0, 0, 0, 0));
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1) calc(100% - 2.4rem), rgba(0, 0, 0, 0));
}

.route-stop-scroll::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2.4rem;
    pointer-events: none;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, var(--bg-card) 85%);
}

.route-stop-list {
    margin: 0;
    padding-left: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding-bottom: 1.4rem;
}

.route-stop-list li {
    background: rgba(108, 139, 255, 0.08);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.75rem;
    border: 1px solid rgba(108, 139, 255, 0.18);
    font-size: 0.88rem;
    line-height: 1.35;
}

.route-stop-list li .stop-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.route-stop-list li .stop-company {
    color: var(--text-soft);
    font-size: 0.82rem;
}

.route-stop-hint {
    margin: 0;
    font-size: 0.78rem;
    color: var(--text-dim);
    text-align: right;
}

.route-manager {
    margin-top: 1.6rem;
    border-top: 1px solid var(--border);
    padding-top: 1.2rem;
}

.route-manager summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--text);
    list-style: none;
}

.route-manager summary::marker {
    display: none;
}

.route-save-form {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem 1.2rem 1.2rem;
    background: var(--bg-alt);
}

.route-save-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.8rem;
}

.route-save-grid label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.82rem;
    color: var(--text-soft);
}

.route-save-grid input {
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.7rem;
    color: var(--text);
    font: inherit;
}

.route-save-options {
    display: flex;
    gap: 1.2rem;
    font-size: 0.85rem;
    color: var(--text-soft);
}

.route-save-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
}

.route-saved-list {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.route-empty {
    font-size: 0.85rem;
    color: var(--text-soft);
    margin: 0;
}

.route-saved-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-alt);
    gap: 0.8rem;
}

.route-saved-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.route-saved-info strong {
    font-size: 0.95rem;
}

.route-saved-info span {
    font-size: 0.8rem;
    color: var(--text-soft);
}

.route-saved-tags {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    font-size: 0.75rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.route-saved-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.route-saved-actions button {
    font-size: 0.76rem;
}

@media (max-width: 980px) {
    .route-body {
        grid-template-columns: 1fr;
    }
    .route-share-grid {
        flex-direction: column;
        align-items: flex-start;
    }
    .route-qr {
        width: 140px;
        height: 140px;
    }
}


.macro-funnel-card .section-header {
    margin-bottom: 1.55rem;
}


.macro-funnel-wrapper {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 1.8rem;
    align-items: start;
}

.macro-funnel-graphic {
    --funnel-base-width: clamp(260px, 30vw, 360px);
    position: relative;
    display: block;
    height: clamp(380px, 50vh, 520px);
    width: var(--funnel-base-width);
    margin: 0 auto;
    overflow: hidden;
    clip-path: polygon(10% 0, 90% 0, 78% 100%, 22% 100%);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.06), rgba(15, 23, 42, 0.12));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.macro-funnel-graphic::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0));
    pointer-events: none;
}

.funnel-slice {
    position: absolute;
    left: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 0.9rem;
    color: #071322;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.55);
    transition: opacity 0.2s ease, transform 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.35);
}

.funnel-slice:last-of-type {
    border-bottom: none;
}

.funnel-slice:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 32px rgba(15, 23, 42, 0.15);
}

.funnel-slice.is-muted {
    opacity: 0.35;
    filter: saturate(0.55);
}

.funnel-slice-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.funnel-slice-content h4 {
    font-size: 0.78rem;
    margin: 0;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.funnel-slice-count {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(7, 19, 34, 0.65);
}

.funnel-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1.6rem;
    color: var(--text-dim);
    font-weight: 500;
}

.macro-funnel-legend {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.1rem;
}

.macro-legend-item {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.9rem;
    align-items: center;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem 1.1rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border 0.2s ease;
}

.macro-legend-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.12);
}

.macro-legend-item:focus-visible {
    outline: 2px solid rgba(42, 240, 166, 0.45);
    outline-offset: 2px;
}

.legend-swatch {
    width: 18px;
    height: 18px;
    border-radius: 6px;
    box-shadow: 0 0 16px rgba(42, 240, 166, 0.45);
}

.macro-legend-item.is-muted {
    opacity: 0.85;
    filter: saturate(0.6);
    border-color: rgba(28, 36, 52, 0.12);
}

.macro-legend-item strong {
    display: block;
    font-size: 1rem;
}

.macro-legend-item p {
    margin-top: 0.25rem;
    color: var(--text-dim);
    font-size: 0.87rem;
    line-height: 1.5;
}

.contacts-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.contacts-controls {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    margin-bottom: 1.6rem;
}

.contacts-filters {
    display: grid;
    gap: 0.75rem 1rem;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    align-items: end;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-dim);
}

.filter-field input,
.filter-field select {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.6rem;
    font: inherit;
    color: var(--text);
}

.filter-actions {
    display: flex;
    gap: 0.6rem;
    justify-content: flex-end;
}

.contacts-bulk-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.select-all {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.85rem;
    color: var(--text-dim);
}

.bulk-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.bulk-actions .bulk-count {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-right: 0.4rem;
}

.ghost.danger {
    color: #8a1f2b;
    border-color: rgba(255, 111, 111, 0.45);
}

.ghost.danger:hover {
    color: #ffffff;
    background: rgba(255, 111, 111, 0.85);
}

.contacts-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.6rem;
}

.contacts-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.company-directory {
    margin-top: 2rem;
    border-top: 1px solid var(--border-subtle);
    padding-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.company-directory-header {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.company-directory-header h4 {
    font-size: 1.1rem;
}

.company-directory-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.company-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem 1.2rem;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.company-card.is-clickable {
    cursor: pointer;
    transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.company-card.is-clickable:hover,
.company-card.is-clickable:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(42, 240, 166, 0.15);
    background: #ffffff;
}

.company-card.is-clickable:focus {
    outline: none;
}

.company-card.is-active {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(42, 240, 166, 0.25);
}

.company-card-header {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.company-card-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.company-card-address {
    font-size: 0.9rem;
    color: var(--text-dim);
}

.company-card-contacts {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0;
    margin: 0;
}

.company-card-contacts li {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: baseline;
    font-size: 0.9rem;
    color: var(--text);
}

.company-contact-name {
    font-weight: 500;
}

.company-contact-role {
    color: var(--text-dim);
    font-size: 0.85rem;
}

.company-directory-empty {
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    background: rgba(255, 255, 255, 0.6);
    text-align: center;
    color: var(--text-dim);
    font-size: 0.9rem;
}

.contacts-empty {
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 1.2rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-dim);
}

.contact-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.75rem;
    align-items: stretch;
}

.contact-select {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem;
}

.contact-select input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.contact-card {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.9rem 1rem;
    text-align: left;
    cursor: pointer;
    transition: border 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.contact-card-top {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: space-between;
}

.contact-card-text {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    flex: 1 1 auto;
}

.contact-card:hover,
.contact-card:focus-visible {
    border-color: rgba(42, 240, 166, 0.45);
    box-shadow: 0 16px 30px rgba(42, 240, 166, 0.16);
    outline: none;
    transform: translateY(-1px);
}

.contact-card.is-active {
    border-color: rgba(44, 106, 220, 0.6);
    box-shadow: 0 18px 34px rgba(44, 106, 220, 0.16);
}

.contact-card-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.contact-card-actions .contact-action {
    min-width: 8.25rem;
    justify-content: center;
}

@media (max-width: 960px) {
    .contact-row {
        grid-template-columns: auto 1fr;
        gap: 0.5rem;
    }
    .contact-card-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    .contact-card-actions {
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 0.4rem;
    }
    .contact-card-actions .contact-action {
        flex: 1 1 auto;
        min-width: 0;
    }
}

.contact-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.6rem;
}

.contact-card-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.contact-company-pill {
    background: rgba(42, 240, 166, 0.16);
    color: #05684b;
    border-radius: 999px;
    padding: 0.1rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.contact-card-meta {
    font-size: 0.85rem;
    color: var(--text-dim);
}

.contact-card-foot {
    font-size: 0.78rem;
    color: rgba(29, 37, 51, 0.55);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.todo-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 2rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 1.6rem;
}

.todo-columns {
    display: grid;
    gap: 1.4rem;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.todo-column {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.todo-column h4 {
    font-size: 0.9rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(29, 37, 51, 0.64);
    margin-bottom: 0.3rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.todo-column.is-scheduled h4::before,
.todo-column.is-soon h4::before,
.todo-column.is-overdue h4::before,
.todo-column.is-completed h4::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    box-shadow: 0 0 10px currentColor;
}

.todo-column.is-scheduled h4::before {
    background: #2af0a6;
    color: #2af0a6;
}

.todo-column.is-soon h4::before {
    background: #f8c046;
    color: #f8c046;
}

.todo-column.is-overdue h4::before {
    background: #ff5f6d;
    color: #ff5f6d;
}

.todo-column.is-completed h4::before {
    background: #1d2533;
    color: #1d2533;
}

.todo-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    list-style: none;
}

.todo-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.82);
    padding: 0.9rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.todo-item.scheduled {
    border-left: 4px solid #2af0a6;
}

.todo-item.soon {
    border-left: 4px solid #f8c046;
    box-shadow: 0 16px 34px rgba(248, 192, 70, 0.16);
}

.todo-item.overdue {
    border-left: 4px solid #ff5f6d;
    box-shadow: 0 16px 34px rgba(255, 95, 109, 0.2);
}

.todo-item.completed {
    border-left: 4px solid #1d2533;
    background: rgba(7, 19, 34, 0.06);
}

.todo-item-header {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.9rem;
}

.todo-item-due {
    font-size: 0.8rem;
    color: var(--text-dim);
}

.todo-item-opportunity {
    font-size: 0.85rem;
    color: rgba(29, 37, 51, 0.78);
}

.todo-note {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin: 0;
}

.todo-item-actions {
    display: flex;
    justify-content: flex-end;
}

.todo-empty {
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    font-size: 0.85rem;
    color: var(--text-dim);
    text-align: center;
}

.todo-item.scheduled .todo-item-header strong {
    color: #045038;
}

.todo-item.soon .todo-item-header strong {
    color: #7a5200;
}

.todo-item.overdue .todo-item-header strong {
    color: #8a1f2b;
}

.todo-item.completed .todo-item-header strong {
    color: #1d2533;
}

.contact-chip {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.8rem;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-alt);
    cursor: pointer;
    transition: transform 0.15s ease, border 0.2s ease, box-shadow 0.2s ease;
}

.contact-chip:hover,
.contact-chip:focus-visible {
    transform: translateY(-2px);
    border-color: rgba(42, 240, 166, 0.35);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.1);
    outline: none;
}

.contact-chip.is-active {
    border-color: rgba(42, 240, 166, 0.5);
    box-shadow: 0 16px 30px rgba(42, 240, 166, 0.18);
}

.contact-chip .contact-name {
    font-weight: 600;
}

.contact-chip .contact-meta {
    font-size: 0.85rem;
    color: var(--text-dim);
}

.contact-detail-panel {
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-alt);
    padding: 2.6rem;
    min-height: 320px;
    display: flex;
    flex-direction: column;
    gap: 3rem;
    box-shadow: var(--shadow);
}

.contact-create-panel {
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
    padding-bottom: 1rem;
}

.contact-create-form {
    display: flex;
    flex-direction: column;
    gap: 1.6rem;
}

.contact-create-form .form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.2rem;
}

.contact-create-form label {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    font-size: 0.88rem;
    color: var(--text-dim);
}

.contact-create-form input,
.contact-create-form select {
    height: 2.75rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-subtle);
    background: var(--bg);
    padding: 0 0.9rem;
    font-size: 0.95rem;
    color: var(--text);
    transition: border 150ms ease;
}

.contact-create-form input:focus,
.contact-create-form select:focus {
    outline: none;
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(140, 79, 255, 0.12);
}

.company-picker {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.company-picker input {
    flex: 1;
}

.company-picker button {
    white-space: nowrap;
}

.company-picker-field .field-error {
    margin-top: 0.35rem;
    min-height: 1em;
}

.contact-create-form .form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.8rem;
}

.company-detail-panel {
    display: flex;
    flex-direction: column;
    gap: 1.6rem;
}

.opportunity-create-panel {
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
    padding-bottom: 0.5rem;
}

.opportunity-create-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.opportunity-create-form .form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.2rem;
}

.opportunity-create-form .form-row-full {
    display: grid;
    grid-template-columns: 1fr;
}

.opportunity-create-form label {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    font-size: 0.88rem;
    color: var(--text-dim);
}

.opportunity-create-form input,
.opportunity-create-form select,
.opportunity-create-form textarea {
    border-radius: 0.75rem;
    border: 1px solid var(--border-subtle);
    background: var(--bg);
    padding: 0.85rem 0.9rem;
    font-size: 0.95rem;
    color: var(--text);
    transition: border 160ms ease, box-shadow 160ms ease;
}

.opportunity-create-form input:focus,
.opportunity-create-form select:focus,
.opportunity-create-form textarea:focus {
    outline: none;
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(140, 79, 255, 0.12);
    background: #fff;
}

.opportunity-create-form textarea {
    resize: vertical;
    min-height: 120px;
}

.activity-toggle-field {
    border: 1px solid var(--border-subtle);
    border-radius: 0.9rem;
    padding: 1rem 1.2rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    background: var(--surface-subtle);
}

.activity-toggle-field legend {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-dim);
}

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.85rem;
    color: var(--text-dim);
}

.activity-fields {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.activity-fields.is-hidden {
    display: none;
}

.company-create-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.company-create-form .form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.2rem;
}

.company-create-form label {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    font-size: 0.88rem;
    color: var(--text-dim);
}

.company-create-form input,
.company-create-form select {
    height: 2.6rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-subtle);
    background: var(--bg);
    padding: 0 0.85rem;
    font-size: 0.95rem;
    color: var(--text);
    transition: border 150ms ease;
}

.company-create-form input:focus,
.company-create-form select:focus {
    outline: none;
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(140, 79, 255, 0.12);
}

.company-create-form .form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.8rem;
}

.onboarding-overlay {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(8px);
    transition: opacity 180ms ease;
}

.onboarding-overlay.is-hidden {
    pointer-events: none;
    opacity: 0;
}

.onboarding-panel {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 28px 64px rgba(15, 23, 42, 0.18);
    width: min(640px, 90vw);
    padding: 2.4rem;
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
}

.onboarding-header h4 {
    font-size: 1.6rem;
    margin-bottom: 0.35rem;
}

.onboarding-caption {
    color: var(--text-dim);
    font-size: 0.95rem;
}

.onboarding-step {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.onboarding-choice-grid {
    display: grid;
    gap: 1rem;
}

.onboarding-form {
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
}

.onboarding-form.is-hidden,
.onboarding-success.is-hidden,
.onboarding-step.is-hidden {
    display: none;
}

.onboarding-form-grid {
    display: grid;
    gap: 1.2rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.onboarding-form label {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-size: 0.9rem;
    color: var(--text-dim);
}

.onboarding-form input {
    height: 2.6rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-subtle);
    padding: 0 0.85rem;
    font-size: 0.96rem;
    transition: border 150ms ease;
}

.onboarding-form input:focus {
    outline: none;
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(140, 79, 255, 0.12);
}

.onboarding-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.9rem;
}

.onboarding-actions-centered {
    justify-content: center;
}

.onboarding-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.2rem;
}

.onboarding-success .success-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: #03131b;
    font-weight: 700;
}

#onboarding-success-code {
    display: inline-block;
    font-size: 1.1rem;
    letter-spacing: 0.18em;
    padding: 0.6rem 1.4rem;
    border: 1px dashed var(--border);
    border-radius: 999px;
    background: #f5f7fb;
}

.onboarding-overlay button[data-onboarding-choice="create"] {
    min-height: 3rem;
}

.onboarding-overlay button[data-onboarding-choice="join"] {
    min-height: 3rem;
    border-width: 2px;
}
.contact-detail-shell {
    display: flex;
    flex-direction: column;
    gap: 2.4rem;
}

.contact-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 3rem;
    flex-wrap: wrap;
    padding: 0.8rem 0 0.8rem 0;
}
.contact-detail-header > *:first-child {
    margin-right: auto;
}
.contact-detail-header > *:last-child {
    margin-left: 2rem;
}

.contact-summary {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 620px;
}

.contact-summary-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.contact-summary-title h4 {
    font-size: 1.35rem;
    line-height: 1.25;
}

.contact-stage-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    background: rgba(42, 240, 166, 0.14);
    color: #0a7450;
    border: 1px solid rgba(42, 240, 166, 0.4);
}

.contact-summary-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.1rem 1.6rem;
    font-size: 0.92rem;
    color: var(--text-dim);
}

.contact-link {
    color: var(--accent-blue);
    font-weight: 600;
}

.contact-link:hover,
.contact-link:focus-visible {
    text-decoration: underline;
}

.phone-link {
    color: var(--accent-blue);
    font-weight: 600;
    text-decoration: none;
}

.phone-link:hover,
.phone-link:focus-visible {
    text-decoration: underline;
}

.contact-tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.contact-tag-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.78rem;
    background: rgba(108, 139, 255, 0.14);
    color: #2a3d9f;
    border: 1px solid rgba(108, 139, 255, 0.28);
}

.contact-tag-chip.is-empty {
    border-style: dashed;
    color: var(--text-dim);
    background: transparent;
}

.contact-summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1.4rem;
}

.summary-stat {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 1.1rem 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.88);
}

.summary-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-dim);
}

.summary-value {
    font-size: 0.96rem;
    font-weight: 600;
    color: var(--text);
}

.contact-detail-content {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 3rem;
    align-items: flex-start;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 2.1rem;
}

.contact-section {
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
    padding: 1.95rem 2.15rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 22px 44px rgba(15, 23, 42, 0.08);
}

.contact-section .section-header {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.contact-section .section-header h5 {
    font-size: 0.95rem;
}

.contact-section .section-header span {
    font-size: 0.8rem;
    color: var(--text-dim);
}

.section-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.9rem 1.2rem;
}

.section-grid--triple {
    grid-template-columns: repeat(3, minmax(220px, 1fr));
}

.section-grid--double {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
}

.section-grid .field-full {
    grid-column: 1 / -1;
}

.contact-section .section-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.4rem 1.65rem;
}


.section-grid-full .field,
.section-grid .field-textarea {
    grid-column: 1 / -1;
}

.contact-form .field {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.activity-detail-panel {
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-alt);
    padding: 2.6rem;
    min-height: 320px;
    display: flex;
    flex-direction: column;
    gap: 2.4rem;
    box-shadow: var(--shadow);
}

.activity-detail-shell {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.activity-summary-card {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.activity-summary-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem 1.4rem;
    font-size: 0.9rem;
    color: var(--text-dim);
}

.activity-type-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    background: rgba(44, 106, 220, 0.12);
    color: #1d3f91;
    border: 1px solid rgba(44, 106, 220, 0.35);
}

.activity-detail-content {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 2.6rem;
    align-items: flex-start;
}

.activity-section {
    display: flex;
    flex-direction: column;
    gap: 1.35rem;
    padding: 1.85rem 2rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.07);
}

.activity-section .section-header {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.activity-section .section-header h5 {
    font-size: 0.95rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.activity-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.2rem 1.4rem;
}

.activity-info-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.activity-info-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-dim);
}

.activity-info-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}

.activity-info-note {
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.55;
    padding: 1rem 1.1rem;
    border-radius: var(--radius-sm);
    background: rgba(44, 106, 220, 0.08);
    border: 1px solid rgba(44, 106, 220, 0.18);
}

.activity-update-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.activity-update-select {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text);
}

.activity-update-select select {
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-alt);
    font: inherit;
}

.activity-update-select select:focus {
    outline: none;
    border-color: rgba(44, 106, 220, 0.45);
    box-shadow: 0 0 0 3px rgba(44, 106, 220, 0.2);
}

.activity-update-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text);
}

.activity-update-checkbox input[type='checkbox'] {
    width: 16px;
    height: 16px;
}

.activity-update-notes {
    min-height: 140px;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font: inherit;
    resize: vertical;
}

.activity-update-notes:focus {
    outline: none;
    border-color: rgba(44, 106, 220, 0.45);
    box-shadow: 0 0 0 3px rgba(44, 106, 220, 0.2);
}

.activity-related-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.activity-related-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
}

.activity-related-meta {
    font-size: 0.8rem;
    color: var(--text-dim);
}

.activity-related-actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.activity-chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.activity-detail-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.activity-open-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: var(--accent-blue);
}

.activity-open-link:hover,
.activity-open-link:focus-visible {
    text-decoration: underline;
}

.activity-card[data-activity-id] {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.activity-card[data-activity-id]:hover,
.activity-card[data-activity-id]:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 18px 32px rgba(15, 23, 42, 0.12);
}

.todo-item[data-activity-id] {
    cursor: pointer;
}
.todo-item[data-activity-id]:hover,
.todo-item[data-activity-id]:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 16px 30px rgba(15, 23, 42, 0.12);
}

.contact-form .field label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-dim);
}

.contact-form .field input,
.contact-form .field textarea,
.contact-form .field select {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 0.6rem 0.7rem;
    font: inherit;
}

.contact-form .field textarea {
    min-height: 120px;
    resize: vertical;
}

.contact-insights {
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
}

.contact-opportunity-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    padding: 0;
    margin: 0;
}

.contact-opportunity-card {
    border: 1px solid var(--border);
    border-left: 4px solid var(--opportunity-phase-color, var(--accent));
    border-radius: var(--radius-md);
    padding: 1rem 1.1rem;
    background: rgba(255, 255, 255, 0.82);
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.contact-opportunity-card.is-empty {
    align-items: center;
    text-align: center;
    color: var(--text-dim);
    border-style: dashed;
    background: rgba(255, 255, 255, 0.6);
}

.opportunity-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.opportunity-name {
    font-weight: 600;
    color: var(--text);
}

.opportunity-value {
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.opportunity-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.6rem;
    font-size: 0.85rem;
    color: var(--text-dim);
}

.phase-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid var(--phase-badge-color, var(--border));
    color: var(--phase-badge-color, var(--text));
}

.opportunity-card-activity {
    font-size: 0.85rem;
    color: var(--text-dim);
}

.opportunity-card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.contact-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.1rem;
}

.metric-card {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 1.15rem 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.9);
}

.metric-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-dim);
}

.metric-value {
    font-size: 0.94rem;
    font-weight: 600;
    color: var(--text);
}

.contact-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 0.4rem;
}

@media (max-width: 1100px) {
    .contact-detail-content {
        grid-template-columns: 1fr;
    }

    .contact-summary-stats {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
}

@media (max-width: 640px) {
    .contact-detail-panel {
        padding: 1.2rem;
    }

    .contact-section {
        padding: 1rem;
    }
}

.opportunity-form {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 1.875rem;
}

.opportunity-form .field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.opportunity-form .field label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-dim);
}

.opportunity-form .field input,
.opportunity-form .field textarea,
.opportunity-form .field select {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 0.65rem 0.8rem;
    font: inherit;
    box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.05);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.opportunity-form .field input:focus,
.opportunity-form .field input:focus-visible,
.opportunity-form .field select:focus,
.opportunity-form .field select:focus-visible,
.opportunity-form .field textarea:focus,
.opportunity-form .field textarea:focus-visible {
    outline: none;
    border-color: rgba(44, 106, 220, 0.55);
    box-shadow: 0 0 0 3px rgba(44, 106, 220, 0.18);
    background: #ffffff;
}

.opportunity-contacts-field {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.opportunity-section {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1.65rem 1.85rem;
    display: flex;
    flex-direction: column;
    gap: 1.35rem;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.06);
}

.opportunity-section + .opportunity-section,
.opportunity-form > .opportunity-section + .opportunity-section {
    margin-top: 1.875rem;
}


.opportunity-section[data-section="notes"] {
    padding-bottom: 1.6rem;
}

.opportunity-section .section-title {
    font-size: 0.86rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    font-weight: 700;
    color: rgba(7, 19, 34, 0.66);
}

.opportunity-section .section-caption {
    font-size: 0.82rem;
    color: var(--text-dim);
}

.section-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.1rem 1.5rem;
}

.section-body {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.opportunity-files {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.opportunity-files-empty {
    font-size: 0.88rem;
    color: var(--text-dim);
}

.opportunity-file {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 0.75rem 0.95rem;
    background: rgba(255, 255, 255, 0.9);
}

.opportunity-file-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.opportunity-file-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
    word-break: break-word;
}

.opportunity-file-details {
    font-size: 0.8rem;
    color: var(--text-dim);
}

.opportunity-file-actions {
    display: flex;
    gap: 0.6rem;
    flex-shrink: 0;
}

.opportunity-files-actions {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.opportunity-files-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.opportunity-files-buttons > * {
    flex: 0 0 auto;
}

.opportunity-files-hint {
    font-size: 0.78rem;
    color: var(--text-dim);
}

.activities-summary {
    position: relative;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.1rem;
    align-items: stretch;
}

.activity-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.85);
    padding: 0.9rem 1rem;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    border-left: 4px solid transparent;
}

.activity-card.is-scheduled {
    border-left-color: #2af0a6;
    box-shadow: 0 14px 30px rgba(42, 240, 166, 0.18);
}

.activity-card.is-soon {
    border-left-color: #f8c046;
    box-shadow: 0 16px 34px rgba(248, 192, 70, 0.16);
}

.activity-card.is-overdue {
    border-left-color: #ff5f6d;
    box-shadow: 0 16px 34px rgba(255, 95, 109, 0.2);
}

.activity-card.is-completed {
    border-left-color: #1d2533;
    background: rgba(7, 19, 34, 0.06);
}

.activity-label {
    font-size: 0.75rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(29, 37, 51, 0.64);
}

.activity-body strong {
    display: block;
    font-size: 0.9rem;
}

.activity-body {
    font-size: 0.85rem;
    color: rgba(7, 19, 34, 0.85);
}

.activity-meta {
    display: block;
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-top: 0.2rem;
}

.activity-note {
    font-size: 0.82rem;
    color: rgba(29, 37, 51, 0.78);
    margin: 0.35rem 0 0;
    line-height: 1.45;
}

.activity-empty {
    font-size: 0.82rem;
    color: var(--text-dim);
}

.activity-actions {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    align-items: flex-start;
    justify-self: end;
}

#opportunity-add-activity {
    align-self: flex-start;
}

.activity-popover {
    position: absolute;
    right: 0;
    top: calc(100% + 0.75rem);
    z-index: 20;
    width: min(320px, 90vw);
}

.activity-popover.is-hidden {
    display: none;
}

.activity-form {
    display: grid;
    gap: 0.7rem;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 18px 38px rgba(15, 23, 42, 0.16);
    width: min(280px, 100%);
}

.activity-form.is-hidden {
    display: none;
}

.checkbox-field {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    color: rgba(7, 19, 34, 0.75);
}

.checkbox-field input[type='checkbox'] {
    width: 16px;
    height: 16px;
}

.activity-form textarea {
    min-height: 90px;
}

.activity-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

@media (max-width: 640px) {
    .activity-popover {
        position: static;
        width: 100%;
        margin-top: 0.6rem;
    }
    .activity-actions {
        width: 100%;
    }
}

.field-notes {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.field-notes textarea {
    min-height: 190px;
    line-height: 1.55;
    font-size: 0.95rem;
    background: rgba(245, 248, 255, 0.96);
    border-color: rgba(44, 106, 220, 0.28);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
    font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
}

.note-composer {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.note-composer textarea {
    resize: vertical;
}

.note-composer-actions {
    display: flex;
    justify-content: flex-end;
}

.note-history {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.25rem;
}

.note-entry {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: var(--radius-sm);
    padding: 0.75rem 0.9rem;
    background: rgba(247, 250, 255, 0.82);
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.note-entry.is-editing {
    background: rgba(235, 243, 255, 0.86);
    border-color: rgba(44, 106, 220, 0.28);
}

.note-entry-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.note-author {
    font-weight: 600;
    color: rgba(15, 23, 42, 0.86);
}

.note-badge {
    background: rgba(44, 106, 220, 0.12);
    color: rgba(44, 106, 220, 0.88);
    border-radius: 999px;
    padding: 0.1rem 0.5rem;
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.note-entry-body {
    font-size: 0.9rem;
    line-height: 1.6;
    color: rgba(15, 23, 42, 0.9);
}

.note-empty-body {
    color: rgba(15, 23, 42, 0.5);
    font-style: italic;
}

.note-entry-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem;
    align-items: center;
}

.note-entry-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    font-size: 0.75rem;
    color: rgba(29, 37, 51, 0.6);
}

.note-entry-actions {
    display: flex;
    gap: 0.4rem;
}

.note-entry-editor {
    width: 100%;
    min-height: 130px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(44, 106, 220, 0.28);
    padding: 0.6rem 0.75rem;
    font-family: inherit;
    resize: vertical;
}

.note-entry-editor:focus {
    outline: none;
    border-color: rgba(44, 106, 220, 0.5);
    box-shadow: 0 0 0 3px rgba(44, 106, 220, 0.22);
}

.note-empty {
    font-size: 0.85rem;
    color: rgba(29, 37, 51, 0.6);
    font-style: italic;
}

.note-edited {
    color: rgba(29, 37, 51, 0.5);
}

.opportunity-form .field textarea {
    width: 100%;
    font: inherit;
    line-height: 1.52;
    resize: vertical;
}

.phase-field {
    background: var(--phase-tint);
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    padding: 0.8rem;
    box-shadow: inset 0 0 0 1px rgba(7, 19, 34, 0.08);
}

.phase-field label {
    color: rgba(7, 19, 34, 0.7);
}

.phase-field select {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--phase-accent);
    color: #071322;
    font-weight: 600;
    box-shadow: 0 6px 18px rgba(7, 19, 34, 0.08);
}

.phase-field select:focus {
    outline: none;
    border-color: var(--phase-accent);
    box-shadow: 0 0 0 3px rgba(7, 19, 34, 0.18);
    background: #ffffff;
}

.opportunity-contacts-field.has-company-warning {
    background: rgba(248, 192, 70, 0.18);
    border-radius: var(--radius-sm);
    box-shadow: inset 0 0 0 1px rgba(248, 192, 70, 0.45);
    padding: 0.6rem;
}

.opportunity-contacts-view {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.contact-chip-view {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(15, 23, 42, 0.08);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.contact-chip-view.is-primary {
    background: rgba(44, 106, 220, 0.14);
    border-color: rgba(44, 106, 220, 0.35);
}

.contact-chip-view:hover,
.contact-chip-view:focus-visible {
    background: rgba(42, 240, 166, 0.12);
    border-color: rgba(42, 240, 166, 0.45);
    box-shadow: 0 10px 24px rgba(42, 240, 166, 0.18);
    transform: translateY(-1px);
}

.opportunity-contacts-actions {
    display: flex;
    justify-content: flex-end;
}

.opportunity-contacts-editor {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.65);
    padding: 0.6rem 0.7rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.opportunity-contacts-editor.is-hidden {
    display: none;
}

.opportunity-contacts-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.contact-chip-edit {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-alt);
    font-size: 0.75rem;
}

.chip-info {
    display: flex;
    align-items: center;
    font-weight: 600;
    line-height: 1.2;
}

.chip-role,
.chip-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}

.chip-role {
    background: rgba(42, 240, 166, 0.15);
    color: #0a7053;
}

.chip-tag {
    background: rgba(109, 158, 255, 0.18);
    color: #2c3b8f;
}

.chip-make-primary {
    border: none;
    background: transparent;
    color: #2c6adc;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.15rem 0.35rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    margin-left: 0.3rem;
}

.chip-make-primary:hover,
.chip-make-primary:focus-visible {
    background: rgba(44, 106, 220, 0.12);
    color: #1f4ea3;
}

.contact-warning {
    margin: 0.2rem 0 0;
    font-size: 0.75rem;
    color: #7a5200;
}

.chip-remove {
    border: none;
    background: rgba(241, 70, 104, 0.12);
    color: #bf2f48;
    border-radius: 999px;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 600;
    line-height: 1;
}

.chip-remove:hover {
    background: rgba(241, 70, 104, 0.24);
}

.opportunity-contacts-search {
    position: relative;
}

.opportunity-contacts-search input {
    width: 100%;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-alt);
    color: var(--text);
    font: inherit;
}

.contact-search-results {
    margin-top: 0.35rem;
    list-style: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-alt);
    max-height: 160px;
    overflow-y: auto;
    padding: 0.3rem;
}

.contact-search-results.is-empty {
    border: none;
    padding: 0;
    background: transparent;
}

.contact-search-option {
    width: 100%;
    border: none;
    background: transparent;
    text-align: left;
    padding: 0.35rem 0.4rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.contact-search-option:hover {
    background: rgba(15, 23, 42, 0.08);
}

.contact-search-empty {
    padding: 0.35rem 0.4rem;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.option-name {
    font-size: 0.78rem;
    font-weight: 600;
}

.option-meta {
    font-size: 0.72rem;
    color: var(--text-dim);
}

.field-error {
    font-size: 0.72rem;
    color: var(--danger);
    min-height: 1em;
}

.field-error.is-success {
    color: #0c7d4f;
}

.field-error.is-error {
    color: var(--danger);
}

.field-hint {
    font-size: 0.72rem;
    color: var(--text-dim);
    margin-top: 0.4rem;
    min-height: 1em;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    padding: 0 0.4rem;
    margin-left: 0.5rem;
    border-radius: 999px;
    background: var(--accent);
    color: #03131b;
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 1.2;
}

.badge.is-hidden {
    display: none;
}

.text-muted {
    color: var(--text-muted);
}

.workspace-card {
    background: #ffffff;
    border: 1px solid rgba(15, 33, 55, 0.06);
    border-radius: 18px;
    padding: 2rem;
    margin-top: 1.5rem;
    box-shadow: 0 18px 44px rgba(12, 32, 58, 0.08);
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.workspace-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-bottom: 0.75rem;
}

.workspace-meta .meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 1rem;
    border-radius: 999px;
    background: rgba(243, 246, 252, 0.85);
    border: 1px solid rgba(15, 33, 55, 0.08);
    font-size: 0.82rem;
    color: rgba(11, 27, 45, 0.75);
    font-weight: 500;
}

.workspace-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.workspace-toolbar-status {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.9rem;
}

.workspace-toolbar-status > div {
    background: linear-gradient(135deg, rgba(42, 240, 166, 0.18), rgba(140, 79, 255, 0.12));
    border-radius: 16px;
    padding: 0.85rem 1rem;
    color: #0b2538;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.82rem;
    font-weight: 500;
}

.workspace-toolbar-status > div strong {
    font-size: 1.15rem;
    font-weight: 700;
}

.workspace-controls {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

.workspace-filter {
    display: inline-flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.workspace-filter select {
    font-size: 0.8rem;
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
    background: var(--surface-subtle);
    padding: 0.35rem 0.6rem;
    color: var(--text);
}

.workspace-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.workspace-section {
    background: #ffffff;
    border: 1px solid rgba(13, 51, 89, 0.08);
    border-radius: 18px;
    padding: 1.8rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    box-shadow: 0 14px 32px rgba(12, 32, 58, 0.06);
}

.workspace-section-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.workspace-section-header .section-caption {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.workspace-settings-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.workspace-settings-form.is-disabled {
    opacity: 0.55;
    pointer-events: none;
}

.workspace-toggle-field {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.75rem;
    align-items: flex-start;
    font-size: 0.9rem;
    font-weight: 600;
    color: rgba(11, 27, 45, 0.85);
}

.workspace-toggle-field input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 0.2rem;
    accent-color: var(--accent-purple);
}

.workspace-toggle-field .toggle-caption {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.78rem;
    font-weight: 400;
    color: var(--text-muted);
}

.workspace-lob-input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    align-items: end;
}

.workspace-lob-form-actions {
    display: flex;
    justify-content: flex-end;
}

.workspace-lob-form.is-disabled {
    opacity: 0.55;
    pointer-events: none;
}

.workspace-lob-row {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    border: 1px solid rgba(13, 51, 89, 0.12);
    border-radius: 12px;
    background: #f9fbff;
    margin-bottom: 0.9rem;
}

.workspace-lob-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

.workspace-lob-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: rgba(11, 27, 45, 0.72);
}

.workspace-lob-field input,
.workspace-lob-field select {
    border-radius: 10px;
    border: 1px solid rgba(13, 51, 89, 0.18);
    padding: 0.45rem 0.6rem;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.95);
}

.workspace-lob-row-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.workspace-lob-row-actions .danger {
    color: #b42318;
}

.lob-input-collection {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.lob-input-row {
    border: 1px solid rgba(13, 51, 89, 0.12);
    border-radius: 12px;
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.92);
}

.lob-input-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: baseline;
    font-size: 0.82rem;
    color: rgba(11, 27, 45, 0.75);
}

.lob-input-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: rgba(11, 27, 45, 0.92);
}

.lob-input-price,
.lob-input-frequency {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.lob-input-controls {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.lob-input-controls input[type="number"] {
    width: 120px;
    border-radius: 10px;
    border: 1px solid rgba(13, 51, 89, 0.18);
    padding: 0.4rem 0.6rem;
    font-size: 0.9rem;
}

.lob-input-preview {
    font-size: 0.78rem;
    color: rgba(11, 27, 45, 0.7);
    min-height: 1em;
}

.workspace-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.workspace-form-grid label {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-size: 0.82rem;
    color: rgba(11, 27, 45, 0.75);
    font-weight: 500;
}

.workspace-form-grid input,
.workspace-form-grid select {
    height: 44px;
    border-radius: 12px;
    border: 1px solid rgba(12, 32, 58, 0.14);
    background: rgba(243, 246, 252, 0.7);
    padding: 0 1rem;
    font-size: 0.95rem;
    transition: border 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.workspace-form-grid input:focus,
.workspace-form-grid select:focus {
    outline: none;
    border-color: rgba(140, 79, 255, 0.55);
    box-shadow: 0 0 0 3px rgba(140, 79, 255, 0.2);
    background: #ffffff;
}

.workspace-form-grid select {
    appearance: none;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="8" fill="none" viewBox="0 0 12 8"><path fill="%23102a44" fill-opacity="0.6" d="M1.41.59 6 5.17 10.59.59 12 2l-6 6-6-6L1.41.59Z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 0.9rem center;
    background-size: 12px 8px;
    padding-right: 2.4rem;
}


.workspace-actions {
    display: flex;
    justify-content: flex-end;
}

.workspace-actions .primary {
    min-width: 168px;
    height: 46px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.96rem;
}

.workspace-table-wrapper {
    overflow-x: auto;
    border-top: 1px solid rgba(12, 32, 58, 0.08);
}

.workspace-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    min-width: 680px;
}

.workspace-table thead th {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    padding-bottom: 0.85rem;
    color: rgba(11, 27, 45, 0.6);
    font-weight: 600;
}

.workspace-table tbody tr {
    transition: background 120ms ease;
}

.workspace-table tbody tr:hover {
    background: rgba(12, 32, 58, 0.04);
}

.workspace-table th,
.workspace-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border-subtle);
    text-align: left;
    vertical-align: middle;
}

.workspace-table td {
    font-size: 0.86rem;
}

.workspace-table .code-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: rgba(42, 240, 166, 0.16);
    color: #0b4a2f;
    font-weight: 600;
    font-size: 0.85rem;
}

.workspace-table .code-chip button {
    border: none;
    background: transparent;
    color: rgba(13, 51, 89, 0.6);
    font-size: 0.78rem;
    cursor: pointer;
    font-weight: 600;
}

.workspace-table .status-pill {
    padding: 0.28rem 0.75rem;
    border-radius: 999px;
    font-weight: 600;
    text-transform: capitalize;
}

.workspace-lob-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.workspace-lob-input-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.workspace-lob-input-row {
    display: flex;
    gap: 0.6rem;
    align-items: center;
}

.workspace-lob-input-row input {
    flex: 1;
    height: 42px;
    border-radius: 0.75rem;
    border: 1px solid rgba(12, 32, 58, 0.14);
    background: rgba(243, 246, 252, 0.7);
    padding: 0 0.9rem;
    font-size: 0.9rem;
    transition: border 160ms ease, box-shadow 160ms ease;
}

.workspace-lob-input-row input:focus {
    outline: none;
    border-color: rgba(140, 79, 255, 0.55);
    box-shadow: 0 0 0 3px rgba(140, 79, 255, 0.18);
    background: #fff;
}

.workspace-lob-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    min-height: 38px;
}

.workspace-lob-list.is-empty {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.workspace-lob-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    background: rgba(12, 32, 58, 0.08);
    color: rgba(12, 32, 58, 0.85);
    font-size: 0.82rem;
    font-weight: 600;
}

.workspace-lob-chip button {
    border: none;
    background: transparent;
    font-size: 0.75rem;
    color: rgba(12, 32, 58, 0.55);
    cursor: pointer;
}

.lob-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.lob-checkboxes label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border: 1px solid rgba(12, 32, 58, 0.16);
    border-radius: 999px;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    background: rgba(243, 246, 252, 0.7);
    cursor: pointer;
    transition: border 160ms ease, box-shadow 160ms ease;
}

.lob-checkboxes label input {
    accent-color: var(--accent);
}

.lob-checkboxes label:hover,
.lob-checkboxes label:focus-within {
    border-color: rgba(140, 79, 255, 0.45);
    box-shadow: 0 0 0 3px rgba(140, 79, 255, 0.12);
}

.workspace-table th {
    font-weight: 600;
    color: var(--text-muted);
    background: var(--surface-subtle);
}

.workspace-table td.is-nowrap {
    white-space: nowrap;
}

.workspace-table td .code-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    background: var(--surface-subtle);
    border: 1px solid var(--border-subtle);
    font-family: var(--font-mono);
}

.workspace-table td .code-chip button {
    border: none;
    background: transparent;
    color: var(--accent);
    font-size: 0.7rem;
    cursor: pointer;
    padding: 0;
}

.workspace-table td .code-chip button:hover {
    text-decoration: underline;
}

.workspace-table td .workspace-action-buttons {
    display: inline-flex;
    gap: 0.4rem;
}

.workspace-table td .workspace-action-buttons button {
    font-size: 0.72rem;
    padding: 0.25rem 0.6rem;
}

.workspace-note {
    margin-top: 0.35rem;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.workspace-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 1rem 0;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.workspace-table .status-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.72rem;
}

.status-pill.pending {
    background: rgba(255, 205, 86, 0.2);
    color: #a76b03;
}

.status-pill.approved,
.status-pill.accepted {
    background: rgba(42, 240, 166, 0.2);
    color: #0c7d4f;
}

.status-pill.expired {
    background: rgba(156, 163, 175, 0.2);
    color: #4b5563;
}

.status-pill.declined,
.status-pill.revoked {
    background: rgba(239, 68, 68, 0.18);
    color: #a12424;
}

.status-pill.not-configured {
    background: rgba(148, 163, 184, 0.2);
    color: #475569;
}

.status-pill.connected,
.status-pill.success {
    background: rgba(34, 197, 94, 0.2);
    color: #047857;
}

.status-pill.error-state,
.status-pill.integration-error {
    background: rgba(239, 68, 68, 0.2);
    color: #b91c1c;
}

.status-pill.testing,
.status-pill.pending-test {
    background: rgba(250, 204, 21, 0.2);
    color: #854d0e;
}

.opportunity-section.meeting-agent-callout {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    border: 1px dashed rgba(12, 32, 58, 0.18);
    background: linear-gradient(135deg, rgba(42, 240, 166, 0.12), rgba(108, 139, 255, 0.08));
}

.meeting-agent-callout-header {
    display: flex;
    justify-content: space-between;
    gap: 1.5rem;
    align-items: center;
}

.meeting-agent-callout .meeting-agent-hint {
    margin: 0;
    font-size: 0.82rem;
    color: rgba(15, 33, 55, 0.68);
}

.meeting-agent-callout button[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

.meeting-agent-panel {
    max-width: 620px;
    width: min(92vw, 620px);
    display: flex;
    flex-direction: column;
}

.meeting-agent-body {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.meeting-agent-step[hidden] {
    display: none !important;
}

.meeting-agent-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.meeting-agent-actions--review {
    justify-content: space-between;
    align-items: center;
}

.meeting-agent-actions--review .ghost {
    margin-left: auto;
}

.meeting-agent-error {
    color: #b91c1c;
    font-size: 0.85rem;
    margin: 0;
    display: none;
}

.meeting-agent-error:not(:empty) {
    display: block;
}

.meeting-agent-hint {
    font-size: 0.82rem;
    color: rgba(15, 33, 55, 0.6);
    margin: 0;
}

.meeting-agent-consent {
    display: flex;
    gap: 0.8rem;
    align-items: flex-start;
    font-size: 0.9rem;
    line-height: 1.4;
}

.meeting-agent-consent input[type="checkbox"] {
    margin-top: 0.25rem;
}

.meeting-agent-recording {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    align-items: flex-start;
}

.meeting-agent-timer {
    font-size: 2.1rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #0c7d4f;
}

.meeting-agent-status {
    font-size: 0.95rem;
    font-weight: 500;
    color: rgba(15, 33, 55, 0.82);
}

.meeting-agent-upload {
    font-size: 0.82rem;
    color: rgba(15, 33, 55, 0.58);
    margin: 0;
}

.meeting-agent-processing {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    text-align: center;
    padding: 1.5rem 1rem;
}

.meeting-agent-spinner {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 4px solid rgba(12, 32, 58, 0.12);
    border-top-color: rgba(12, 32, 58, 0.4);
    animation: meeting-agent-spin 0.9s linear infinite;
}

@keyframes meeting-agent-spin {
    to {
        transform: rotate(360deg);
    }
}

.meeting-agent-review {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.meeting-agent-recommended {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.meeting-agent-recommended h5 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: rgba(12, 32, 58, 0.9);
}

.meeting-agent-recommended-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.meeting-agent-card {
    border: 1px solid rgba(12, 32, 58, 0.12);
    border-radius: 14px;
    background: rgba(12, 32, 58, 0.04);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    box-shadow: 0 12px 28px rgba(12, 32, 58, 0.08);
}

.meeting-agent-card header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.meeting-agent-card header h6 {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 600;
}

.meeting-agent-card-status {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(12, 32, 58, 0.55);
}

.meeting-agent-card.is-scheduled {
    background: rgba(42, 240, 166, 0.12);
    border-color: rgba(42, 240, 166, 0.4);
}

.meeting-agent-card.is-scheduled .meeting-agent-card-status {
    color: #047857;
}

.meeting-agent-card fieldset {
    border: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.meeting-agent-card label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.8rem;
    color: rgba(12, 32, 58, 0.75);
}

.meeting-agent-card input,
.meeting-agent-card textarea {
    font-size: 0.85rem;
    border: 1px solid rgba(12, 32, 58, 0.18);
    border-radius: 10px;
    padding: 0.45rem 0.6rem;
    background: rgba(255, 255, 255, 0.92);
    color: #0d2137;
}

.meeting-agent-card textarea {
    resize: vertical;
    min-height: 70px;
}

.meeting-agent-card .meeting-agent-card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.meeting-agent-card .meeting-agent-card-actions button {
    min-width: 0;
}

.meeting-agent-card .field-error {
    margin: 0;
    color: #b91c1c;
    font-size: 0.75rem;
}

.meeting-agent-review-summary {
    background: rgba(12, 32, 58, 0.05);
    border-radius: 12px;
    padding: 1rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

.meeting-agent-review-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.meeting-agent-review-list {
    background: rgba(12, 32, 58, 0.05);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    list-style: disc;
    margin: 0;
    padding-left: 1.5rem;
}

.meeting-agent-review-list li {
    font-size: 0.88rem;
    color: rgba(12, 32, 58, 0.88);
    margin-bottom: 0.35rem;
}

.meeting-agent-review-list li:last-child {
    margin-bottom: 0;
}

.meeting-agent-transcript {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.meeting-agent-transcript-body {
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid rgba(12, 32, 58, 0.12);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    background: rgba(12, 32, 58, 0.03);
    font-size: 0.85rem;
    line-height: 1.4;
}

.meeting-agent-transcript-body p {
    margin: 0 0 0.6rem;
}

.meeting-agent-transcript-body p:last-child {
    margin-bottom: 0;
}

.meeting-agent-transcript-time {
    display: inline-block;
    min-width: 3.2rem;
    font-weight: 600;
    color: rgba(12, 32, 58, 0.6);
}

.status-pill.is-open {
    background: rgba(56, 189, 248, 0.18);
    color: #0369a1;
}

.status-pill.is-won {
    background: rgba(34, 197, 94, 0.2);
    color: #047857;
}

.status-pill.is-lost {
    background: rgba(248, 113, 113, 0.2);
    color: #b91c1c;
}

.workspace-table .is-actions {
    width: 140px;
}

@media (max-width: 780px) {
    .workspace-grid {
        grid-template-columns: 1fr;
    }

    .section-grid--triple,
    .section-grid--double {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }
}

.opportunity-form .field textarea {
    min-height: 110px;
    resize: vertical;
}

.opportunity-detail-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 1.8rem;
    padding-top: 1.4rem;
    border-top: 1px solid var(--border-subtle);
    flex-wrap: wrap;
}

.opportunity-detail-footer .button-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.detail-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    z-index: 30;
    opacity: 1;
    pointer-events: auto;
    transition: opacity 0.2s ease;
}

#contact-detail-overlay {
    z-index: 40;
}

.detail-overlay.is-hidden {
    opacity: 0;
    pointer-events: none;
}

.detail-overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(22, 30, 46, 0.4);
    backdrop-filter: blur(12px);
}

.detail-overlay-panel {
    position: relative;
    max-width: min(900px, 92vw);
    width: 100%;
    max-height: 88vh;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-strong);
    background: var(--bg-alt);
    box-shadow: 0 32px 80px rgba(15, 23, 42, 0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0.6rem;
}

.detail-overlay-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.6rem 1.8rem 0;
}

.detail-overlay-header h4 {
    font-size: 1.4rem;
}

.detail-overlay-caption {
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-top: 0.35rem;
}

.detail-overlay-body {
    padding: 2rem 2.4rem 2.2rem;
    overflow-y: auto;
}

.detail-overlay-panel .contact-detail-panel {
    border: none;
    padding: 0;
    background: transparent;
    box-shadow: none;
}

.detail-overlay-panel .contact-form-actions {
    justify-content: flex-end;
}

.activity-select-panel {
    display: grid;
    gap: 1rem;
}

.activity-select-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    text-align: left;
    cursor: pointer;
    transition: border 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
    background: rgba(255, 255, 255, 0.92);
}

.activity-select-card:hover,
.activity-select-card:focus-visible {
    border-color: rgba(44, 106, 220, 0.5);
    box-shadow: 0 18px 34px rgba(44, 106, 220, 0.16);
    outline: none;
    transform: translateY(-1px);
}

.activity-select-card h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.activity-select-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    font-size: 0.85rem;
    color: var(--text-dim);
}

.activity-select-pill {
    background: rgba(42, 106, 220, 0.14);
    color: #1f4fbf;
    border-radius: 999px;
    padding: 0.15rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.activity-create-panel {
    display: flex;
    flex-direction: column;
    gap: 1.6rem;
}

.activity-create-form {
    display: flex;
    flex-direction: column;
    gap: 1.6rem;
}

.activity-create-section h5 {
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(29, 37, 51, 0.6);
}

.activity-create-opportunity-info {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1rem 1.2rem;
    border: 1px solid rgba(31, 79, 191, 0.16);
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(44, 106, 220, 0.08), rgba(31, 79, 191, 0.04));
    box-shadow: 0 22px 48px rgba(15, 23, 42, 0.08);
}

.activity-create-opportunity-name {
    font-weight: 600;
    font-size: 1.05rem;
}

.activity-create-opportunity-meta {
    font-size: 0.85rem;
    color: var(--text-dim);
}

.activity-create-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.activity-create-grid .field {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.activity-create-grid label span {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(29, 37, 51, 0.68);
}

.activity-create-grid select,
.activity-create-grid input,
.activity-create-grid textarea {
    font-size: 0.95rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(15, 23, 42, 0.14);
    padding: 0.65rem 0.8rem;
    background: rgba(255, 255, 255, 0.9);
    transition: border 0.2s ease, box-shadow 0.2s ease;
}

.activity-create-grid select:focus,
.activity-create-grid input:focus,
.activity-create-grid textarea:focus {
    border-color: rgba(44, 106, 220, 0.65);
    box-shadow: 0 0 0 3px rgba(44, 106, 220, 0.18);
    outline: none;
}

.activity-create-grid textarea {
    min-height: 120px;
    resize: vertical;
}

.activity-create-grid .checkbox-field {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-top: 1.55rem;
}

.activity-create-grid .field-full {
    grid-column: 1 / -1;
}

.activity-create-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding-top: 0.5rem;
}

.table-card tr[data-opportunity-id] {
    cursor: pointer;
}

.table-card tr[data-opportunity-id]:hover {
    background: rgba(42, 240, 166, 0.08);
}

@media (max-width: 940px) {
    .contacts-layout {
        grid-template-columns: 1fr;
    }

    .contact-detail-panel {
        order: -1;
    }
}
.table-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 1.6rem 1.8rem 1.8rem;
    box-shadow: var(--shadow);
}

.table-card .section-header {
    margin-bottom: 1.55rem;
    align-items: flex-start;
    gap: 0.4rem;
}

.table-card .section-header h3 {
    margin: 0;
}

.table-card .section-header .caption {
    line-height: 1.35;
}

.phase-toggle-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1.05rem;
}

.phase-toggle-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    flex: 1 1 auto;
    min-width: 220px;
}

.phase-toggle-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.phase-toggle {
    border: 1px solid var(--border);
    background: var(--bg-alt);
    color: var(--text-dim);
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: transform 0.15s ease, border 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.phase-toggle span {
    display: block;
}

.phase-toggle-count {
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    opacity: 0.7;
    margin-top: 0.12rem;
}

.phase-toggle.is-active {
    transform: translateY(-1px);
    border-color: rgba(42, 240, 166, 0.35);
    color: var(--text);
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.08);
}

.table-wrapper {
    overflow-x: auto;
    margin: 0 -0.5rem;
    padding: 0 0.5rem;
}

.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 1rem;
}

.table-info {
    font-size: 0.85rem;
    color: var(--text-dim);
}

.table-pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.table-pagination-controls label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-dim);
}

.table-pagination-controls select {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 0.35rem 0.6rem;
    font: inherit;
}

.table-pagination-controls select:focus {
    outline: 2px solid rgba(42, 240, 166, 0.35);
    outline-offset: 1px;
}

.volume-cell {
    white-space: pre-line;
    font-size: 0.9rem;
    color: var(--text);
}

.data-table {
    width: 100%;
    min-width: 960px;
    border-collapse: separate;
    border-spacing: 0;
    color: var(--text);
}

.data-table thead th {
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    padding: 0.7rem 1rem 0.65rem;
    text-align: left;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    vertical-align: bottom;
    line-height: 1.2;
}

.data-table thead th.actions-column {
    text-align: center;
    width: 8rem;
}

.data-table thead th:first-child {
    padding-left: 1.1rem;
}

col.col-lob {
    width: 6.5rem;
}

col.col-phase {
    width: 8rem;
}

col.col-name {
    width: 13rem;
}

col.col-title {
    width: 12rem;
}

col.col-phone {
    width: 10rem;
}

col.col-company {
    width: 13rem;
}

col.col-value {
    width: 7.5rem;
}

col.col-notes {
    width: 16rem;
}

col.col-activity {
    width: 13rem;
}

col.col-volume {
    width: 9.5rem;
}


.data-table tbody tr {
    position: relative;
    transition: background 0.2s ease, transform 0.15s ease;
}

.data-table tbody td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.9rem;
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.82);
}

.data-table tbody tr td:first-child {
    padding-left: 1.1rem;
}

.data-table tbody tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.9);
}

.data-table tbody tr:hover td {
    background: var(--row-phase-hover, rgba(42, 240, 166, 0.12));
    color: var(--text);
}

.data-table tbody tr.is-in-route td {
    background: var(--row-phase-hover, rgba(42, 240, 166, 0.12));
    color: var(--text);
}

.data-table tbody tr.is-in-route:hover td {
    background: var(--row-phase-hover, rgba(42, 240, 166, 0.12));
}

.pipeline-actions {
    position: relative;
    text-align: center;
    vertical-align: middle;
}

.pipeline-action-group {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 2.25rem;
}

.pipeline-action {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pipeline-action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 999px;
    border: 1px solid rgba(44, 106, 220, 0.24);
    background: rgba(44, 106, 220, 0.08);
    color: #1f4fbf;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.pipeline-action-button:hover,
.pipeline-action-button:focus-visible {
    background: rgba(42, 240, 166, 0.18);
    border-color: rgba(42, 240, 166, 0.45);
    box-shadow: 0 14px 32px rgba(42, 240, 166, 0.24);
    outline: none;
    transform: translateY(-1px);
}

.pipeline-action-button.is-in-route {
    background: rgba(42, 240, 166, 0.25);
    border-color: rgba(42, 240, 166, 0.55);
    color: #046c4f;
}

.pipeline-action-icon {
    width: 1.4rem;
    height: 1.4rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    font-weight: 600;
    pointer-events: none;
}

.pipeline-action-icon svg {
    width: 1.15rem;
    height: 1.15rem;
}

.pipeline-action-tooltip {
    position: absolute;
    left: 50%;
    bottom: 110%;
    transform: translate(-50%, 6px);
    background: rgba(15, 23, 42, 0.92);
    color: #fff;
    padding: 0.35rem 0.6rem;
    border-radius: 999px;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.pipeline-action-button:hover + .pipeline-action-tooltip,
.pipeline-action-button:focus-visible + .pipeline-action-tooltip {
    opacity: 1;
    transform: translate(-50%, -2px);
}

.data-table td.numeric {
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}

.data-table td strong {
    color: var(--text);
}

.sortable {
    cursor: pointer;
    position: relative;
    padding-right: 1.8rem;
}

.sortable::before,
.sortable::after {
    content: "";
    position: absolute;
    right: 0.8rem;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    opacity: 0.45;
    transition: opacity 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.sortable::before {
    bottom: 45%;
    border-top: 5px solid var(--text-dim);
}

.sortable::after {
    top: 45%;
    border-bottom: 5px solid var(--text-dim);
}

.sortable[data-sort-direction="asc"]::after {
    opacity: 0.2;
}

.sortable[data-sort-direction="asc"]::before {
    border-top-color: var(--text);
    opacity: 1;
    transform: translateY(-1px);
}

.sortable[data-sort-direction="desc"]::before {
    opacity: 0.2;
}

.sortable[data-sort-direction="desc"]::after {
    border-bottom-color: var(--text);
    opacity: 1;
    transform: translateY(1px);
}

.management-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.6rem;
}

.manage-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 1.8rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.info-card ul {
    gap: 0.5rem;
}

.footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 2.4rem clamp(1.2rem, 4vw, 3rem) 3.4rem;
    color: var(--text-dim);
}

@media (max-width: 1100px) {
    .macro-funnel-wrapper {
        grid-template-columns: 1fr;
    }

    .macro-funnel-graphic {
        --funnel-base-width: min(320px, 100%);
    }
}

@media (max-width: 980px) {
    .board-wrapper {
        grid-template-columns: 1fr;
    }

    .phase-columns {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

@media (max-width: 720px) {
    .top-bar {
        flex-direction: column;
        gap: 0.9rem;
    }

    .hero {
        padding: 1.7rem;
    }

    .board-card,
    .macro-funnel-card {
        padding: 1.6rem;
    }

    .filters-row {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-actions {
        margin-left: 0;
        align-self: flex-end;
    }

    .phase-toggle-container {
        flex-direction: column;
        align-items: stretch;
    }

    .phase-toggle-actions {
        justify-content: flex-start;
    }

    .table-controls {
        flex-direction: column;
        align-items: flex-start;
    }

    .workspace-section {
        padding: 1.35rem;
        gap: 1rem;
    }

    .workspace-lob-input-grid {
        grid-template-columns: 1fr;
    }

    .workspace-lob-input-row {
        flex-direction: column;
        align-items: stretch;
    }

    .workspace-lob-input-row button {
        width: 100%;
    }

    .workspace-actions {
        justify-content: stretch;
    }

    .workspace-actions .primary {
        width: 100%;
    }

    .workspace-table-wrapper {
        overflow: visible;
    }

    .workspace-table {
        min-width: 0;
        border-collapse: separate;
    }

    .workspace-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        padding: 0;
        overflow: hidden;
        clip: rect(0 0 0 0);
        clip-path: inset(50%);
        border: 0;
    }

    .workspace-table tbody {
        display: grid;
        gap: 1rem;
    }

    .workspace-table tbody tr {
        display: grid;
        gap: 0.8rem;
        padding: 1rem 1.1rem;
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        background: var(--bg-card);
        box-shadow: var(--shadow);
    }

    .workspace-table tbody tr:hover {
        background: var(--bg-card);
    }

    .workspace-table th,
    .workspace-table td {
        border-bottom: none;
        padding: 0;
    }

    .workspace-table td {
        display: grid;
        grid-template-columns: minmax(0, 120px) minmax(0, 1fr);
        gap: 0.35rem;
        align-items: start;
    }

    .workspace-table td::before {
        content: attr(data-label);
        font-size: 0.72rem;
        font-weight: 600;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--text-dim);
    }

    .workspace-table td.is-actions {
        grid-template-columns: minmax(0, 1fr);
    }

    .workspace-table td.is-actions::before {
        display: none;
    }

    .workspace-table td.is-nowrap {
        grid-template-columns: minmax(0, 1fr);
    }

    .workspace-table td:not([data-label])::before {
        content: none;
    }

    .workspace-table td[colspan] {
        display: block;
        text-align: center;
        padding: 0.6rem 0;
        font-size: 0.85rem;
        color: var(--text-dim);
    }

    .workspace-table td[colspan]::before {
        display: none;
    }

    .workspace-table .code-chip {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        gap: 0.4rem;
        font-size: 0.82rem;
    }

    .workspace-table .code-chip button {
        flex-shrink: 0;
    }

    .workspace-table .status-pill {
        justify-self: flex-start;
    }

    .workspace-table td .workspace-action-buttons {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    .workspace-table td .workspace-action-buttons button {
        flex: 1 1 140px;
    }

    .macro-funnel-graphic {
        --funnel-base-width: min(300px, 100%);
    }

    .footer {
        flex-direction: column;
        align-items: flex-start;
    }
}
.todo-item.completed .todo-item-due {
    color: rgba(29, 37, 51, 0.55);
}
