:root {
    --bg: #f4f6fa;
    --surface: #ffffff;
    --surface-soft: #f8fafc;

    --ink: #172033;
    --muted: #718096;

    --navy: #111827;
    --navy-2: #1f2937;

    --primary: #4f46e5;
    --primary-soft: #eef2ff;

    --success: #15803d;
    --success-soft: #ecfdf3;

    --danger: #b42318;
    --danger-soft: #fef3f2;

    --border: #e5e7eb;

    --shadow:
        0 12px 34px rgba(15, 23, 42, .08);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    color: var(--ink);
    background: var(--bg);
}

button,
input {
    font: inherit;
}

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


/* LOGIN */

.login-page {
    background:
        linear-gradient(
            135deg,
            #111827 0%,
            #312e81 100%
        );
}

.login-shell {
    min-height: 100vh;

    display: grid;
    grid-template-columns:
        minmax(320px, 1fr)
        minmax(380px, 520px);
}

.login-brand {
    padding: 70px;

    display: flex;
    flex-direction: column;
    justify-content: center;

    color: white;
}

.login-logo {
    width: 68px;
    height: 68px;

    border-radius: 20px;

    display: grid;
    place-items: center;

    background: white;
    color: #312e81;

    font-size: 32px;
    font-weight: 900;

    box-shadow:
        0 20px 50px rgba(0,0,0,.2);
}

.login-brand h1 {
    margin:
        24px 0 10px;

    font-size:
        clamp(40px, 5vw, 70px);

    letter-spacing: -.05em;
}

.login-brand p {
    max-width: 520px;

    margin:
        0 0 28px;

    font-size: 20px;
    line-height: 1.5;

    color:
        rgba(255,255,255,.72);
}

.login-feature {
    width: fit-content;

    padding: 8px 12px;
    margin: 4px 0;

    border:
        1px solid rgba(255,255,255,.15);

    border-radius: 999px;

    background:
        rgba(255,255,255,.06);

    color:
        rgba(255,255,255,.82);
}

.login-panel {
    min-height: 100vh;

    padding: 32px;

    display: grid;
    place-items: center;

    background:
        rgba(255,255,255,.97);
}

.login-card {
    width: 100%;
    max-width: 420px;
}

.login-card h2 {
    margin:
        6px 0 6px;

    font-size: 32px;

    letter-spacing: -.035em;
}

.login-card form {
    display: grid;
    gap: 10px;

    margin-top: 28px;
}

.login-card label {
    margin-top: 7px;

    font-size: 13px;
    font-weight: 800;
}

.login-card input {
    width: 100%;

    padding: 14px 15px;

    border:
        1px solid #d6dae2;

    border-radius: 12px;

    outline: none;

    background: white;
}

.login-card input:focus {
    border-color: var(--primary);

    box-shadow:
        0 0 0 4px rgba(79,70,229,.10);
}

.primary-button {
    margin-top: 12px;

    border: 0;
    border-radius: 12px;

    padding: 15px 18px;

    background: var(--primary);
    color: white;

    font-weight: 900;

    cursor: pointer;
}

.login-security {
    margin-top: 24px;

    padding-top: 20px;

    border-top:
        1px solid var(--border);

    color: var(--muted);

    font-size: 12px;
}


/* LAYOUT */

.app-shell {
    min-height: 100vh;
    display: block;
}

.sidebar {
    position: fixed;

    inset:
        0 auto 0 0;

    width: 260px;

    padding: 24px 18px;

    display: flex;
    flex-direction: column;

    color: white;

    background:
        linear-gradient(
            180deg,
            var(--navy),
            #161d31
        );
}

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

    padding:
        4px 8px 26px;
}

.brand-mark {
    width: 42px;
    height: 42px;

    border-radius: 13px;

    display: grid;
    place-items: center;

    background:
        linear-gradient(
            135deg,
            #818cf8,
            #4f46e5
        );

    font-weight: 900;
    font-size: 20px;
}

.brand-name {
    font-size: 19px;
    font-weight: 900;

    letter-spacing: -.02em;
}

.brand-subtitle {
    margin-top: 2px;

    color:
        rgba(255,255,255,.5);

    font-size: 11px;
}

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

.nav-item {
    padding: 12px 13px;

    border-radius: 10px;

    color:
        rgba(255,255,255,.78);

    font-size: 14px;
    font-weight: 700;
}

.nav-item:hover {
    color: white;

    background:
        rgba(255,255,255,.07);
}

.nav-item.disabled {
    opacity: .35;
    cursor: default;
}

.sidebar-user {
    margin-top: auto;

    padding: 16px;

    border:
        1px solid rgba(255,255,255,.08);

    border-radius: 14px;

    background:
        rgba(255,255,255,.04);
}

.user-label {
    color:
        rgba(255,255,255,.45);

    font-size: 10px;
    font-weight: 900;

    letter-spacing: .12em;
}

.user-name {
    margin:
        5px 0 12px;

    font-weight: 800;
}

.logout-button {
    width: 100%;

    padding: 9px;

    border:
        1px solid rgba(255,255,255,.12);

    border-radius: 9px;

    background:
        transparent;

    color:
        rgba(255,255,255,.75);

    cursor: pointer;
}

.main {
    min-width: 0;
    width: calc(100% - 260px);
    margin-left: 260px;
}

.topbar {
    min-height: 78px;

    padding:
        17px 28px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    background:
        rgba(255,255,255,.94);

    border-bottom:
        1px solid var(--border);

    position: sticky;
    top: 0;
    z-index: 10;

    backdrop-filter: blur(15px);
}

.topbar-title {
    font-size: 18px;
    font-weight: 900;
}

.topbar-subtitle {
    margin-top: 2px;

    font-size: 11px;
    color: var(--muted);
}

.status-online {
    display: flex;
    align-items: center;
    gap: 7px;

    padding: 7px 10px;

    border-radius: 999px;

    background:
        var(--success-soft);

    color:
        var(--success);

    font-size: 11px;
    font-weight: 800;
}

.status-online span {
    width: 7px;
    height: 7px;

    border-radius: 50%;

    background: var(--success);
}

.content {
    max-width: 1500px;

    margin: 0 auto;

    padding: 28px;
}


/* COMPONENTS */

.hero {
    padding: 32px;

    border-radius: 22px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;

    color: white;

    background:
        linear-gradient(
            135deg,
            #111827 0%,
            #312e81 100%
        );

    box-shadow: var(--shadow);
}

.hero h1 {
    margin:
        5px 0 8px;

    font-size:
        clamp(26px, 3vw, 38px);

    letter-spacing: -.04em;
}

.hero p {
    max-width: 720px;

    margin: 0;

    color:
        rgba(255,255,255,.68);
}

.hero-badge {
    flex: 0 0 auto;

    padding: 10px 14px;

    border:
        1px solid rgba(255,255,255,.15);

    border-radius: 999px;

    background:
        rgba(255,255,255,.08);

    font-size: 11px;
    font-weight: 900;
}

.hero-badge.success {
    background:
        rgba(34,197,94,.14);
}

.hero-badge.danger {
    background:
        rgba(239,68,68,.14);
}

.eyebrow {
    color: var(--primary);

    font-size: 10px;
    font-weight: 900;

    letter-spacing: .14em;
}

.eyebrow.light {
    color:
        rgba(255,255,255,.56);
}

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

    gap: 16px;

    margin:
        20px 0;
}

.metric-card {
    padding: 20px;

    border:
        1px solid var(--border);

    border-radius: 16px;

    background: white;

    box-shadow:
        0 5px 18px rgba(15,23,42,.035);
}

.metric-label {
    color: var(--muted);

    font-size: 12px;
    font-weight: 700;
}

.metric-value {
    margin:
        8px 0 2px;

    font-size: 32px;
    font-weight: 900;

    letter-spacing: -.04em;
}

.metric-detail {
    color: var(--muted);

    font-size: 11px;
}

.section-card {
    margin-top: 18px;

    padding: 22px;

    border:
        1px solid var(--border);

    border-radius: 18px;

    background: white;

    box-shadow:
        0 6px 22px rgba(15,23,42,.04);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 18px;
}

.section-header h2 {
    margin:
        4px 0 0;

    font-size: 21px;

    letter-spacing: -.025em;
}

.count-pill {
    min-width: 32px;

    padding: 6px 10px;

    border-radius: 999px;

    text-align: center;

    background:
        var(--primary-soft);

    color:
        var(--primary);

    font-weight: 900;
}

.company-grid {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 15px;
}

.company-card {
    padding: 18px;

    border:
        1px solid var(--border);

    border-radius: 15px;

    background:
        var(--surface-soft);

    transition:
        transform .15s ease,
        border-color .15s ease,
        box-shadow .15s ease;
}

.company-card:hover {
    transform:
        translateY(-2px);

    border-color:
        #c7d2fe;

    box-shadow:
        0 12px 28px rgba(15,23,42,.07);
}

.company-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px;
}

.company-code {
    color: var(--primary);

    font-size: 10px;
    font-weight: 900;

    letter-spacing: .12em;
}

.company-card h3 {
    margin:
        5px 0 0;

    font-size: 19px;
}

.status {
    padding: 5px 8px;

    border-radius: 999px;

    font-size: 9px;
    font-weight: 900;
}

.status.active {
    background:
        var(--success-soft);

    color:
        var(--success);
}

.status.inactive {
    background:
        var(--danger-soft);

    color:
        var(--danger);
}

.company-metrics {
    display: grid;
    grid-template-columns:
        repeat(4, 1fr);

    gap: 8px;

    margin:
        18px 0;
}

.company-metrics div {
    padding: 10px;

    border-radius: 10px;

    background: white;
}

.company-metrics strong {
    display: block;

    font-size: 16px;
}

.company-metrics span {
    display: block;

    margin-top: 2px;

    color: var(--muted);

    font-size: 9px;
}

.subscription-line {
    padding-top: 12px;

    border-top:
        1px solid var(--border);

    color: var(--muted);

    font-size: 11px;
}

.subscription-line strong {
    color: var(--ink);
}

.open-company {
    margin-top: 14px;

    color: var(--primary);

    font-size: 12px;
    font-weight: 900;
}

.two-column {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0,1fr));

    gap: 18px;
}

.detail-list {
    display: grid;
    gap: 4px;
}

.detail-list > div {
    padding:
        11px 0;

    display: flex;
    justify-content: space-between;
    gap: 20px;

    border-bottom:
        1px solid var(--border);
}

.detail-list span {
    color: var(--muted);

    font-size: 12px;
}

.detail-list strong {
    text-align: right;

    font-size: 12px;
}

.billing-status {
    width: fit-content;

    padding: 8px 11px;

    border-radius: 999px;

    background:
        var(--success-soft);

    color:
        var(--success);

    font-size: 11px;
    font-weight: 900;
}

.billing-status.neutral {
    background:
        #f1f5f9;

    color:
        #475569;
}

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

    gap: 12px;
}

.module-card {
    min-height: 125px;

    padding: 16px;

    display: flex;
    flex-direction: column;

    border:
        1px solid var(--border);

    border-radius: 13px;

    background:
        var(--surface-soft);
}

.module-card strong {
    font-size: 14px;
}

.module-card span {
    margin-top: 5px;

    color: var(--muted);

    font-size: 11px;
}

.module-card small {
    margin-top: auto;

    color: var(--primary);

    font-weight: 800;
}

.back-link {
    display: inline-block;

    margin-bottom: 14px;

    color: var(--primary);

    font-size: 12px;
    font-weight: 800;
}

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

.alert {
    margin:
        0 0 15px;

    padding: 12px 14px;

    border-radius: 10px;

    font-size: 12px;
    font-weight: 700;
}

.alert.error {
    background:
        var(--danger-soft);

    color:
        var(--danger);
}

.alert.success {
    background:
        var(--success-soft);

    color:
        var(--success);
}

.empty-state {
    padding: 40px;

    text-align: center;

    color: var(--muted);
}


/* RESPONSIVE */

@media (
    max-width: 980px
) {

    .metrics-grid {
        grid-template-columns:
            repeat(2, 1fr);
    }

    .company-grid,
    .two-column {
        grid-template-columns:
            1fr;
    }

    .module-grid {
        grid-template-columns:
            repeat(2,1fr);
    }
}


@media (
    max-width: 760px
) {

    .app-shell {
        display: block;
    }

    .sidebar {
        position: static;

        width: 100%;
        height: auto;
    }

    .nav {
        display: flex;
        overflow-x: auto;
    }

    .nav-item {
        flex: 0 0 auto;
    }

    .sidebar-user {
        margin-top: 18px;
    }

    .main {
        margin-left: 0;
    
        width: 100%;
    }

    .topbar {
        position: static;
    }

    .content {
        padding: 16px;
    }

    .hero {
        padding: 22px;

        align-items: flex-start;
        flex-direction: column;
    }

    .metrics-grid {
        grid-template-columns:
            repeat(2,1fr);
    }

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

    .login-shell {
        display: block;
    }

    .login-brand {
        min-height: auto;

        padding:
            40px 25px;
    }

    .login-brand h1 {
        font-size: 42px;
    }

    .login-panel {
        min-height: auto;

        padding:
            40px 22px 60px;
    }
}


@media (
    max-width: 480px
) {

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

    .company-metrics {
        grid-template-columns:
            1fr 1fr;
    }

    .topbar {
        padding:
            15px 16px;
    }

    .status-online {
        display: none;
    }
}
