:root {
    --bg: #07111f;
    --bg-alt: #0d1a2b;
    --bg-soft: #101f32;
    --panel: rgba(15, 30, 45, 0.9);
    --panel-strong: #102337;
    --card: #0d1d2d;
    --card-strong: #122a3d;
    --line: rgba(120, 168, 195, 0.18);
    --text: #ebf7ff;
    --muted: #8ea8bb;
    --accent: #4cd9ff;
    --accent-strong: #2bb8f0;
    --accent-soft: rgba(76, 217, 255, 0.14);
    --success: #7ef0bd;
    --shadow: 0 18px 45px rgba(2, 8, 18, 0.45);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(76, 217, 255, 0.12), transparent 30%),
        radial-gradient(circle at bottom right, rgba(76, 217, 255, 0.08), transparent 28%),
        var(--bg);
    color: var(--text);
    font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.app-shell {
    display: flex;
    min-height: 100vh;
    max-width: 1440px;
    margin: 0 auto;
    padding: 20px 18px 24px;
    gap: 22px;
}

.sidebar {
    position: sticky;
    top: 20px;
    width: 260px;
    min-height: calc(100vh - 40px);
    padding: 18px 14px;
    background: rgba(10, 19, 28, 0.9);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.sidebar-brand {
    padding: 8px 10px 18px;
    margin-bottom: 14px;
    border-bottom: 1px solid rgba(142, 168, 187, 0.12);
}

.sidebar-brand h1 {
    margin: 0;
    font-size: 1.1rem;
    letter-spacing: -0.04em;
}

.sidebar-nav {
    display: grid;
    gap: 10px;
    padding-top: 10px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: var(--muted);
    padding: 12px 14px;
    text-align: left;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(76, 217, 255, 0.08);
    border-color: rgba(76, 217, 255, 0.18);
    color: var(--text);
    transform: translateX(2px);
}

header,
main {
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 24px;
    padding-right: 24px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 32px;
    padding-bottom: 20px;
}

.brand-group {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(76, 217, 255, 0.25), rgba(76, 217, 255, 0.05));
    border: 1px solid rgba(76, 217, 255, 0.3);
    box-shadow: inset 0 0 25px rgba(76, 217, 255, 0.14);
    font-weight: 700;
    color: var(--accent);
}

header h1 {
    margin: 0;
    font-size: clamp(1.45rem, 2vw, 2rem);
    letter-spacing: -0.05em;
}

header p {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.filter-pill,
.status-dot {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(14, 24, 35, 0.8);
    color: var(--muted);
    font-size: 0.8rem;
}

.status-dot::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 12px rgba(126, 240, 189, 0.8);
}

.primary-btn,
.secondary-btn,
.icon-button {
    font: inherit;
}

.primary-btn {
    border: 1px solid rgba(76, 217, 255, 0.22);
    background: linear-gradient(135deg, rgba(76, 217, 255, 0.14), rgba(76, 217, 255, 0.05));
    color: var(--text);
    border-radius: 12px;
    padding: 10px 18px;
    font-weight: 600;
    cursor: pointer;
    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
    box-shadow: 0 10px 20px rgba(17, 133, 187, 0.12);
}

.primary-btn:hover,
.secondary-btn:hover,
.icon-button:hover {
    transform: translateY(-1px);
}

.add-lead-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.dashboard-shell {
    padding-top: 12px;
    padding-bottom: 32px;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 18px;
    margin-bottom: 22px;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--accent);
    font-size: 0.74rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-weight: 700;
}

.section-heading h2 {
    margin: 0;
    font-size: clamp(1.9rem, 3vw, 2.5rem);
    letter-spacing: -0.05em;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(220px, 1fr));
    gap: 22px;
}

.card {
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(17, 35, 52, 0.96), rgba(11, 22, 33, 0.95));
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 22px 20px 18px;
    box-shadow: var(--shadow);
    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.card::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), transparent);
}

.card:hover {
    transform: translateY(-2px);
    border-color: rgba(76, 217, 255, 0.34);
    box-shadow: 0 22px 50px rgba(2, 8, 18, 0.52);
}

.card-topline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
}

.card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: var(--accent-soft);
    border: 1px solid rgba(76, 217, 255, 0.18);
    color: var(--accent);
    font-weight: 700;
    font-size: 1.1rem;
}

.trend {
    display: inline-flex;
    align-items: center;
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    background: rgba(126, 240, 189, 0.1);
    color: var(--success);
}

.card h3 {
    margin: 0;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.88rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.metric-value {
    margin: 18px 0 12px;
    font-size: clamp(2rem, 3vw, 2.6rem);
    font-weight: 700;
    letter-spacing: -0.06em;
    line-height: 1.1;
}

.card small {
    display: block;
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.5;
}

.lead-panel {
    margin-top: 26px;
    background: linear-gradient(180deg, rgba(15, 31, 45, 0.92), rgba(12, 24, 35, 0.96));
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 24px 20px 18px;
}

.lead-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.lead-panel-header h3 {
    margin: 0;
    font-size: 1.05rem;
    letter-spacing: -0.03em;
}

.status-inline {
    display: inline-flex;
    align-items: center;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(76, 217, 255, 0.08);
    border: 1px solid rgba(76, 217, 255, 0.15);
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 600;
}

.lead-list {
    display: grid;
    gap: 12px;
}

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    border: 1px dashed rgba(142, 168, 187, 0.28);
    border-radius: 18px;
    padding: 18px;
    color: var(--muted);
    text-align: center;
    background: rgba(8, 18, 28, 0.45);
}

.lead-item {
    display: grid;
    grid-template-columns: minmax(180px, 1.8fr) minmax(180px, 1.4fr) auto;
    gap: 18px;
    align-items: center;
    background: rgba(11, 22, 33, 0.8);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 18px 18px;
}

.lead-item.selected {
    border-color: rgba(76, 217, 255, 0.5);
    box-shadow: 0 0 0 1px rgba(76, 217, 255, 0.2);
    background: rgba(14, 25, 36, 0.95);
}

.lead-main h4 {
    margin: 0 0 6px;
    font-size: 1.1rem;
    letter-spacing: -0.03em;
}

.lead-main p {
    margin: 0;
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 600;
}

.lead-meta {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 0.82rem;
}

.lead-meta strong {
    color: var(--text);
    font-weight: 600;
}

.lead-badge-wrap {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.lead-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.status-new {
    background: rgba(76, 217, 255, 0.12);
    border: 1px solid rgba(76, 217, 255, 0.35);
    color: var(--accent);
}

.status-contacted {
    background: rgba(255, 179, 71, 0.12);
    border: 1px solid rgba(255, 179, 71, 0.35);
    color: #ffc76a;
}

.status-qualified {
    background: rgba(126, 240, 189, 0.12);
    border: 1px solid rgba(126, 240, 189, 0.35);
    color: var(--success);
}

.status-proposal {
    background: rgba(170, 122, 255, 0.12);
    border: 1px solid rgba(170, 122, 255, 0.35);
    color: #c3a6ff;
}

.status-won {
    background: rgba(96, 255, 169, 0.12);
    border: 1px solid rgba(96, 255, 169, 0.35);
    color: #8ef7c1;
}

.status-lost {
    background: rgba(255, 110, 110, 0.12);
    border: 1px solid rgba(255, 110, 110, 0.35);
    color: #ff8d8d;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: grid;
    place-items: center;
    transition: opacity 0.2s ease;
}

.modal.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 7, 14, 0.7);
    backdrop-filter: blur(4px);
}

.modal-dialog {
    position: relative;
    width: min(720px, calc(100vw - 32px));
    background: linear-gradient(180deg, rgba(15, 28, 40, 0.98), rgba(9, 19, 28, 0.98));
    border: 1px solid rgba(76, 217, 255, 0.2);
    border-radius: 24px;
    box-shadow: 0 24px 60px rgba(1, 6, 13, 0.6);
    padding: 22px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
    letter-spacing: -0.04em;
}

.modal-eyebrow {
    margin-bottom: 8px;
}

.icon-button {
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(9, 17, 21, 0.8);
    color: var(--text);
    cursor: pointer;
    font-size: 1.6rem;
    line-height: 1;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 18px;
}

label {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 600;
}

label span {
    color: var(--muted);
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid rgba(142, 168, 187, 0.18);
    background: rgba(10, 19, 27, 0.9);
    color: var(--text);
    border-radius: 12px;
    padding: 12px 14px;
    font: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: rgba(76, 217, 255, 0.7);
    box-shadow: 0 0 0 3px rgba(76, 217, 255, 0.09);
}

.full-width {
    grid-column: 1 / -1;
}

textarea {
    resize: vertical;
    min-height: 110px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 22px;
}

.secondary-btn {
    border: 1px solid rgba(142, 168, 187, 0.18);
    background: rgba(9, 17, 21, 0.7);
    color: var(--text);
    border-radius: 12px;
    padding: 10px 18px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.secondary-btn:hover {
    border-color: rgba(142, 168, 187, 0.35);
}

.lead-item {
    display: grid;
    grid-template-columns: minmax(180px, 1.8fr) minmax(180px, 1.4fr) auto;
    gap: 18px;
    align-items: center;
    background: rgba(11, 22, 33, 0.8);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 18px 18px;
}

.lead-item.selected {
    border-color: rgba(76, 217, 255, 0.5);
    box-shadow: 0 0 0 1px rgba(76, 217, 255, 0.2);
    background: rgba(14, 25, 36, 0.95);
}

.details-panel {
    margin-top: 26px;
    background: linear-gradient(180deg, rgba(15, 31, 45, 0.92), rgba(12, 24, 35, 0.96));
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 24px 20px 18px;
}

.details-panel.hidden {
    display: none;
}

.details-layout {
    display: grid;
    gap: 22px;
}

.details-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.details-header-row h3 {
    margin: 0;
    font-size: clamp(1.5rem, 2vw, 2rem);
    letter-spacing: -0.04em;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(200px, 1fr));
    gap: 16px;
}

.detail-item {
    display: grid;
    gap: 8px;
    padding: 14px 16px;
    border: 1px solid rgba(142, 168, 187, 0.16);
    border-radius: 16px;
    background: rgba(10, 19, 27, 0.7);
}

.detail-label {
    color: var(--muted);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.detail-item strong {
    font-size: 0.98rem;
    font-weight: 600;
    color: var(--text);
}

.notes-box {
    display: grid;
    gap: 8px;
    padding: 16px;
    border: 1px solid rgba(142, 168, 187, 0.16);
    border-radius: 16px;
    background: rgba(10, 19, 27, 0.7);
}

.notes-box p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.ai-panel {
    padding: 16px;
    background: rgba(9, 18, 24, 0.85);
    border: 1px solid rgba(76, 217, 255, 0.18);
    border-radius: 18px;
}

.ai-header h4 {
    margin: 0;
    font-size: 1.1rem;
    letter-spacing: -0.03em;
}

.ai-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.ai-metric {
    display: grid;
    gap: 8px;
    padding: 14px 16px;
    border: 1px solid rgba(142, 168, 187, 0.14);
    border-radius: 14px;
    background: rgba(9, 19, 27, 0.9);
}

.ai-metric span {
    color: var(--muted);
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.ai-metric strong {
    font-size: 1rem;
    line-height: 1.5;
}

.ai-metric.full-width {
    grid-column: 1 / -1;
}

.details-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.highlight {
    background: linear-gradient(135deg, rgba(76, 217, 255, 0.14), rgba(76, 217, 255, 0.05));
    border-color: rgba(76, 217, 255, 0.25);
}

.subtitle {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
    }
}

@media (max-width: 640px) {
    .topbar,
    .section-heading {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    header,
    main {
        padding-left: 18px;
        padding-right: 18px;
    }

    .lead-panel {
        padding: 18px 14px;
    }

    .lead-item {
        grid-template-columns: 1fr;
    }

    .lead-value {
        justify-self: start;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .secondary-btn,
    .primary-btn {
        width: 100%;
    }

    .details-grid,
    .ai-grid {
        grid-template-columns: 1fr;
    }

    .details-header-row,
    .details-actions {
        flex-direction: column;
        align-items: flex-start;
    }

    .details-actions .primary-btn,
    .details-actions .secondary-btn {
        width: 100%;
    }
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 18px;
    margin-bottom: 22px;
    padding-top: 12px;
}

.page-header h2 {
    margin: 0;
    font-size: clamp(1.9rem, 3vw, 2.5rem);
    letter-spacing: -0.05em;
}

.page-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 18px;
}

.placeholder-page {
    padding-top: 20px;
}

.placeholder-box {
    display: grid;
    gap: 18px;
    padding: 32px 28px;
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(15, 31, 45, 0.92), rgba(12, 24, 35, 0.96));
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.placeholder-box h2 {
    margin: 0;
    font-size: clamp(2rem, 3vw, 2.8rem);
    letter-spacing: -0.05em;
}

.placeholder-box p {
    margin: 0;
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.7;
}

.placeholder-box span {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(76, 217, 255, 0.18);
    background: rgba(76, 217, 255, 0.08);
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
