:root {
    color-scheme: light;
    --bg: #f6f8fb;
    --surface: rgba(255, 255, 255, .82);
    --surface-strong: #ffffff;
    --ink: #111827;
    --muted: #667085;
    --line: rgba(17, 24, 39, .09);
    --brand: #0f766e;
    --brand-2: #2563eb;
    --brand-3: #e11d48;
    --soft: rgba(15, 118, 110, .11);
    --shadow: 0 24px 70px rgba(15, 23, 42, .10);
    --radius: 8px;
    --radius-lg: 14px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0b1020;
    --surface: rgba(16, 24, 40, .78);
    --surface-strong: #101828;
    --ink: #f8fafc;
    --muted: #98a2b3;
    --line: rgba(255, 255, 255, .11);
    --soft: rgba(45, 212, 191, .12);
    --shadow: 0 24px 70px rgba(0, 0, 0, .30);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background:
        radial-gradient(circle at top left, rgba(15, 118, 110, .14), transparent 34rem),
        radial-gradient(circle at 80% 10%, rgba(37, 99, 235, .10), transparent 32rem),
        var(--bg);
    color: var(--ink);
}

body {
    min-height: 100vh;
    margin: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
}

.auth-shell {
    display: grid;
    place-items: center;
    padding: 28px;
}

.auth-grid {
    width: min(1120px, 100%);
    display: grid;
    grid-template-columns: 1.25fr .75fr;
    gap: 24px;
    align-items: stretch;
}

.auth-brand,
.login-panel,
.panel,
.metric-card,
.pipeline-card,
.person-card,
.plan-card,
.tenant-card {
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    backdrop-filter: blur(20px);
}

.auth-brand {
    min-height: 680px;
    padding: 48px;
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    overflow: hidden;
    position: relative;
}

.auth-brand::before {
    content: "";
    position: absolute;
    inset: 36px;
    border: 1px solid var(--line);
    border-radius: 18px;
    pointer-events: none;
}

.brand-mark {
    width: 40px;
    height: 40px;
    display: inline-grid;
    place-items: center;
    border-radius: 10px;
    background: linear-gradient(135deg, #0f766e, #2563eb);
    color: #fff;
    font-weight: 800;
    box-shadow: 0 14px 32px rgba(37, 99, 235, .28);
}

.auth-brand .brand-mark {
    position: absolute;
    top: 48px;
    left: 48px;
}

.eyebrow,
.panel-kicker {
    margin: 0 0 10px;
    color: var(--brand);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0;
    font-weight: 800;
}

.auth-brand h1 {
    max-width: 680px;
    margin: 0;
    font-size: clamp(44px, 7vw, 88px);
    line-height: .95;
    letter-spacing: 0;
}

.lead {
    max-width: 640px;
    color: var(--muted);
    font-size: 18px;
    line-height: 1.7;
}

.auth-highlights {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 28px;
}

.auth-highlights span,
.live-pill,
mark {
    border: 1px solid var(--line);
    background: var(--soft);
    color: var(--brand);
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.login-panel {
    border-radius: 20px;
    padding: 34px;
    align-self: center;
}

.login-panel h2,
.panel h2,
.pipeline-card h2,
.person-card h2,
.plan-card h2 {
    margin: 0;
    font-size: 22px;
    letter-spacing: 0;
}

.login-panel form {
    display: grid;
    gap: 16px;
    margin-top: 26px;
}

label {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

input {
    width: 100%;
    border: 1px solid var(--line);
    background: var(--surface-strong);
    color: var(--ink);
    border-radius: var(--radius);
    padding: 13px 14px;
    outline: none;
}

input:focus {
    border-color: rgba(37, 99, 235, .48);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .10);
}

.alert {
    margin-top: 18px;
    padding: 12px 14px;
    border-radius: var(--radius);
    background: rgba(225, 29, 72, .10);
    border: 1px solid rgba(225, 29, 72, .22);
    color: #be123c;
}

.primary-button,
.ghost-button,
.icon-button {
    border: 0;
    cursor: pointer;
    border-radius: var(--radius);
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.primary-button {
    background: linear-gradient(135deg, #0f766e, #2563eb);
    color: #fff;
    font-weight: 800;
    padding: 0 18px;
    box-shadow: 0 16px 34px rgba(37, 99, 235, .23);
}

.primary-button.small {
    min-height: 36px;
}

.ghost-button,
.icon-button {
    color: var(--ink);
    background: var(--surface-strong);
    border: 1px solid var(--line);
    padding: 0 14px;
    font-weight: 750;
}

.icon-button {
    width: 42px;
    padding: 0;
}

.notif-dot {
    color: #e11d48;
}

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

.app-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 22px;
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo strong {
    display: block;
}

.logo small,
.tenant-card small {
    display: block;
    color: var(--muted);
}

.sidebar nav {
    display: grid;
    gap: 6px;
}

.sidebar nav a {
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    border-radius: var(--radius);
    color: var(--muted);
    font-weight: 750;
}

.sidebar nav a.is-active,
.sidebar nav a:hover {
    background: var(--surface-strong);
    color: var(--ink);
    box-shadow: 0 10px 30px rgba(15, 23, 42, .07);
}

.nav-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: currentColor;
    opacity: .55;
}

.tenant-card {
    margin-top: auto;
    border-radius: var(--radius-lg);
    padding: 16px;
}

.tenant-card span {
    color: var(--muted);
    font-size: 12px;
}

.workspace {
    padding: 24px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
}

.topbar h1 {
    margin: 0;
    font-size: clamp(28px, 4vw, 42px);
    letter-spacing: 0;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-box {
    min-width: 340px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0 12px;
    background: var(--surface);
}

.search-box input {
    border: 0;
    background: transparent;
    box-shadow: none;
    padding-inline: 0;
}

.metric-grid,
.card-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.metric-card {
    border-radius: var(--radius-lg);
    padding: 18px;
    min-height: 172px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.metric-card div {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.metric-card span,
.metric-card p,
.list-row span,
.deal-card span,
.person-card p,
.plan-card p {
    color: var(--muted);
}

.metric-card strong {
    display: block;
    margin-top: 8px;
    font-size: 29px;
    letter-spacing: 0;
}

.metric-card em {
    align-self: flex-start;
    font-style: normal;
    font-weight: 800;
    border-radius: 999px;
    padding: 7px 10px;
}

.metric-card p {
    margin: auto 0 0;
    line-height: 1.5;
}

.emerald em { background: rgba(15, 118, 110, .12); color: #0f766e; }
.blue em { background: rgba(37, 99, 235, .12); color: #2563eb; }
.rose em { background: rgba(225, 29, 72, .12); color: #e11d48; }
.amber em { background: rgba(217, 119, 6, .14); color: #b45309; }

.dashboard-grid,
.split-grid,
.security-grid,
.triple-grid {
    display: grid;
    grid-template-columns: 1.65fr 1fr;
    gap: 14px;
    margin-top: 14px;
}

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

.module-hero {
    margin-bottom: 14px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    padding: 22px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    background: linear-gradient(135deg, rgba(15, 118, 110, .12), rgba(37, 99, 235, .08)), var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(20px);
}

.module-hero h2 {
    margin: 0;
    max-width: 900px;
    font-size: clamp(24px, 3vw, 38px);
    line-height: 1.12;
    letter-spacing: 0;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.panel {
    border-radius: var(--radius-lg);
    padding: 18px;
}

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

.panel-header a {
    color: var(--brand-2);
    font-weight: 800;
    font-size: 13px;
}

.chart {
    height: 280px;
    display: flex;
    align-items: end;
    gap: 12px;
    padding: 20px 6px 4px;
    border-radius: var(--radius);
    background:
        linear-gradient(to top, var(--line) 1px, transparent 1px) 0 0 / 100% 25%,
        rgba(255, 255, 255, .22);
}

.bar-pair {
    flex: 1;
    min-width: 14px;
    display: flex;
    align-items: end;
    gap: 4px;
}

.bar {
    flex: 1;
    border-radius: 999px 999px 3px 3px;
    display: block;
}

.bar.revenue {
    background: linear-gradient(to top, #0f766e, #2dd4bf);
}

.bar.collection {
    background: linear-gradient(to top, #2563eb, #93c5fd);
}

.ai-panel {
    display: grid;
    gap: 12px;
}

.insight {
    display: grid;
    grid-template-columns: 48px 1fr;
    gap: 12px;
    align-items: start;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .34);
}

.insight > span {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--soft);
    color: var(--brand);
    font-weight: 900;
}

.insight p {
    margin: 5px 0 0;
    color: var(--muted);
    line-height: 1.5;
}

.list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 0;
    border-top: 1px solid var(--line);
}

.list-row.compact {
    padding: 11px 0;
}

.list-row:first-of-type {
    border-top: 0;
}

.list-row span {
    display: block;
    margin-top: 4px;
    font-size: 13px;
}

.positive { color: #0f766e; }
.negative { color: #e11d48; }

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

.pipeline-card,
.person-card,
.plan-card {
    border-radius: var(--radius-lg);
    padding: 16px;
}

.pipeline-card > strong {
    display: block;
    margin-bottom: 16px;
    font-size: 24px;
}

.deal-card {
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-strong);
    margin-top: 10px;
}

.deal-card span,
.person-card span {
    display: block;
    margin-top: 6px;
    font-size: 13px;
}

.data-table {
    display: grid;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.coverage-list,
.timeline,
.integration-grid {
    display: grid;
    gap: 10px;
}

.coverage-row,
.progress-row,
.timeline-item,
.integration-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-strong);
    padding: 13px;
}

.coverage-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.coverage-row span,
.progress-row span,
.integration-card span,
.integration-card p {
    display: block;
    color: var(--muted);
    margin-top: 5px;
    line-height: 1.45;
}

.progress-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 160px;
    gap: 12px;
    align-items: center;
}

.progress-row.large {
    grid-template-columns: minmax(0, 1fr) minmax(180px, 42%);
    margin-bottom: 10px;
}

.progress {
    height: 10px;
    border-radius: 999px;
    background: rgba(15, 23, 42, .08);
    overflow: hidden;
}

.progress i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #0f766e, #2563eb);
}

.timeline-item {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 12px;
    align-items: start;
}

.timeline-item > span {
    display: inline-flex;
    justify-content: center;
    padding: 7px 10px;
    border-radius: 999px;
    background: var(--soft);
    color: var(--brand);
    font-weight: 900;
    font-size: 12px;
}

.timeline-item p {
    margin: 5px 0 0;
    color: var(--muted);
}

.integration-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.integration-card {
    min-height: 132px;
}

.table-row {
    display: grid;
    grid-template-columns: 1fr 1.5fr 1.2fr 1fr .9fr;
    gap: 12px;
    padding: 14px;
    border-top: 1px solid var(--line);
    align-items: center;
}

.table-row:first-child {
    border-top: 0;
}

.table-head {
    color: var(--muted);
    background: rgba(15, 23, 42, .04);
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 900;
}

mark.danger {
    background: rgba(225, 29, 72, .10);
    color: #e11d48;
}

.person-card,
.plan-card {
    display: grid;
    gap: 10px;
}

.avatar {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, #0f766e, #2563eb);
    color: #fff;
    font-weight: 900;
}

meter {
    width: 100%;
    height: 10px;
}

.plan-card > span {
    justify-self: start;
    color: var(--brand);
    font-weight: 900;
}

.plan-card strong {
    font-size: 34px;
}

.plan-card small {
    color: var(--muted);
    font-size: 14px;
}

.check-list {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.check-list span,
.feature-list li {
    padding: 12px;
    border-radius: var(--radius);
    background: var(--surface-strong);
    border: 1px solid var(--line);
}

.feature-list {
    display: grid;
    gap: 8px;
    margin: 6px 0 0;
    padding: 0;
    list-style: none;
}

.feature-list li {
    padding: 9px 10px;
    color: var(--muted);
    font-size: 13px;
}

code {
    display: block;
    margin: 16px 0;
    padding: 14px;
    border-radius: var(--radius);
    background: #111827;
    color: #d1fae5;
    overflow: auto;
}

.command-palette {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: start center;
    padding-top: 80px;
    background: rgba(15, 23, 42, .30);
    backdrop-filter: blur(6px);
}

.palette-box {
    width: min(520px, calc(100vw - 32px));
    border-radius: var(--radius-lg);
    background: var(--surface-strong);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    padding: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

[hidden] {
    display: none !important;
}

@media (max-width: 1180px) {
    .metric-grid,
    .card-grid,
    .kanban-grid,
    .triple-grid,
    .integration-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 920px) {
    .auth-grid,
    .app-shell,
    .dashboard-grid,
    .split-grid,
    .security-grid,
    .triple-grid {
        grid-template-columns: 1fr;
    }

    .module-hero {
        align-items: stretch;
        flex-direction: column;
    }

    .auth-brand {
        min-height: 520px;
        padding: 34px;
    }

    .sidebar {
        position: static;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .sidebar nav {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .topbar,
    .top-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .search-box {
        min-width: 0;
    }
}

@media (max-width: 640px) {
    .auth-shell,
    .workspace,
    .sidebar {
        padding: 14px;
    }

    .auth-brand,
    .login-panel,
    .panel,
    .metric-card,
    .pipeline-card,
    .person-card,
    .plan-card {
        border-radius: 12px;
    }

    .metric-grid,
    .card-grid,
    .kanban-grid,
    .integration-grid,
    .sidebar nav {
        grid-template-columns: 1fr;
    }

    .progress-row,
    .progress-row.large,
    .timeline-item {
        grid-template-columns: 1fr;
    }

    .table-row {
        grid-template-columns: 1fr;
    }

    .table-head {
        display: none;
    }

    .chart {
        gap: 7px;
    }
}
