:root {
    --navy-1000: #031327;
    --navy-950: #05182f;
    --navy-900: #072443;
    --navy-850: #0a3158;

    --blue-700: #006ad8;
    --blue-600: #087ff0;
    --blue-500: #1498f5;
    --blue-400: #38b8ff;

    --surface: #ffffff;
    --surface-soft: #f7f9fc;
    --surface-blue: #f3f8ff;
    --background: #f3f6fa;

    --text: #152033;
    --text-soft: #6b778b;
    --text-faint: #8e9aab;

    --border: #e0e6ef;
    --border-strong: #d3dce8;

    --green: #159b72;
    --green-bg: #def7ec;

    --red: #c34150;
    --red-bg: #fde7ea;

    --amber: #b57413;
    --amber-bg: #fff2d7;

    --shadow-sm:
        0 5px 18px rgba(12, 35, 64, .05);

    --shadow-md:
        0 15px 40px rgba(12, 35, 64, .08);

    --sidebar-width: 238px;

    --radius-sm: 9px;
    --radius-md: 13px;
    --radius-lg: 18px;
}

* {
    box-sizing: border-box;
}

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

body {
    background: var(--background);
    color: var(--text);

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

    font-size: 14px;
}

a {
    color: inherit;
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

img {
    max-width: 100%;
}

/* =========================================================
   LOGIN / SETUP
   ========================================================= */

.auth-screen {
    min-height: 100vh;

    display: grid;

    grid-template-columns:
        minmax(430px, 48%)
        minmax(430px, 1fr);
}

.auth-brand {
    position: relative;

    overflow: hidden;

    min-height: 100vh;

    padding:
        clamp(44px, 7vw, 82px);

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

    color: white;

    background:
        radial-gradient(
            circle at 20% 12%,
            rgba(38, 174, 255, .32),
            transparent 28%
        ),
        radial-gradient(
            circle at 85% 70%,
            rgba(0, 94, 215, .28),
            transparent 34%
        ),
        linear-gradient(
            145deg,
            #03142d 0%,
            #082c58 55%,
            #075ca1 100%
        );
}

.auth-brand::after {
    content: "";

    position: absolute;

    width: 560px;
    height: 560px;

    border-radius: 50%;

    right: -280px;
    bottom: -220px;

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

.brand-display {
    position: relative;
    z-index: 1;

    margin-bottom: 52px;
}

.auth-logo {
    width: min(560px, 94%);
    max-height: 145px;

    object-fit: contain;
    object-position: left center;
}

.fallback-brand {
    display: flex;
    align-items: center;
    gap: 17px;
}

.fallback-brand span {
    width: 74px;
    height: 74px;

    display: grid;
    place-items: center;

    border-radius: 20px;

    background:
        linear-gradient(
            135deg,
            #005ed2,
            #38bcff
        );

    font-size: 40px;
    font-weight: 950;
}

.fallback-brand strong {
    font-size: 40px;
    letter-spacing: -.045em;
}

.eyebrow,
.section-label {
    display: inline-block;

    font-size: 11px;
    font-weight: 850;

    letter-spacing: .14em;

    text-transform: uppercase;
}

.eyebrow {
    color: #7bd2ff;
}

.eyebrow.dark {
    color: var(--text-soft);
}

.section-label {
    color: var(--blue-600);
}

.auth-brand h1 {
    position: relative;
    z-index: 1;

    max-width: 640px;

    margin: 16px 0 22px;

    font-size:
        clamp(42px, 5vw, 64px);

    line-height: 1.04;

    letter-spacing: -.045em;
}

.auth-brand p {
    position: relative;
    z-index: 1;

    max-width: 560px;

    margin: 0;

    color: #d1dce9;

    font-size: 17px;

    line-height: 1.7;
}

.auth-form-wrap {
    display: grid;
    place-items: center;

    padding: 48px 28px;
}

.auth-card {
    width: min(510px, 100%);

    padding: 42px;

    background: white;

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

    border-radius: 22px;

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

.auth-card h2 {
    margin: 9px 0 8px;

    font-size: 30px;

    letter-spacing: -.035em;
}

.muted {
    margin: 0 0 28px;

    color: var(--text-soft);

    line-height: 1.6;
}

/* =========================================================
   FORMS
   ========================================================= */

label {
    display: grid;
    gap: 8px;

    margin-bottom: 17px;
}

label > span {
    font-size: 12px;
    font-weight: 750;
}

input[type="text"],
input[type="password"],
input[type="email"],
select {
    width: 100%;

    min-height: 43px;

    padding: 10px 13px;

    outline: 0;

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

    border-radius: 8px;

    background: white;

    color: var(--text);
}

input:focus,
select:focus {
    border-color: var(--blue-500);

    box-shadow:
        0 0 0 3px
        rgba(20, 152, 245, .10);
}

/* =========================================================
   BUTTONS
   ========================================================= */

.button-primary,
.button-secondary,
.button-ghost,
.button-light {
    border: 0;

    border-radius: 8px;

    padding: 11px 17px;

    font-weight: 750;

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

.button-primary {
    width: 100%;

    color: white;

    background:
        linear-gradient(
            135deg,
            var(--blue-700),
            var(--blue-500)
        );

    box-shadow:
        0 7px 17px
        rgba(0, 116, 231, .18);
}

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

.button-auto {
    width: auto;
}

.button-secondary,
.button-light {
    color: var(--navy-850);

    background: #eef4fa;
}

.button-ghost {
    color: var(--text-soft);

    background: white;

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

/* =========================================================
   FEEDBACK
   ========================================================= */

.alert,
.page-alert {
    border-radius: 10px;

    padding: 12px 14px;

    font-size: 13px;
}

.alert {
    margin-bottom: 18px;
}

.page-alert {
    margin: 20px 0;
}

.alert-success {
    color: #126b50;

    background: var(--green-bg);

    border: 1px solid #bce9d8;
}

.alert-error {
    color: #932f3a;

    background: var(--red-bg);

    border: 1px solid #f3ccd2;
}

/* =========================================================
   APP SHELL
   ========================================================= */

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

    display: grid;

    grid-template-columns:
        var(--sidebar-width)
        minmax(0, 1fr);
}

.sidebar {
    position: sticky;

    top: 0;

    height: 100vh;

    padding: 18px 13px;

    display: flex;
    flex-direction: column;

    color: white;

    background:
        linear-gradient(
            180deg,
            #04162d 0%,
            #062342 55%,
            #062038 100%
        );

    box-shadow:
        6px 0 24px
        rgba(4, 25, 48, .06);
}

.sidebar-brand {
    min-height: 72px;

    padding: 6px 9px 18px;

    display: flex;
    align-items: center;

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

.sidebar-brand img {
    width: 100%;
    max-height: 54px;

    object-fit: contain;
    object-position: left center;
}

.sidebar-brand-fallback {
    display: flex;
    align-items: center;

    gap: 10px;
}

.sidebar-brand-fallback span {
    width: 40px;
    height: 40px;

    display: grid;
    place-items: center;

    border-radius: 10px;

    background:
        linear-gradient(
            135deg,
            #006bdd,
            #36baff
        );

    font-size: 22px;
    font-weight: 950;
}

.sidebar-brand-fallback strong {
    font-size: 17px;
}

.sidebar-nav {
    display: grid;

    gap: 4px;

    padding-top: 20px;
}

.nav-link {
    min-height: 43px;

    padding: 10px 12px;

    display: flex;
    align-items: center;

    gap: 11px;

    border-radius: 8px;

    color: #afbdd0;

    text-decoration: none;

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

.nav-link > span:first-child {
    width: 22px;

    display: inline-grid;
    place-items: center;

    color: #7bcbff;
}

.nav-link:hover {
    color: white;

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

.nav-link.active {
    color: white;

    background:
        linear-gradient(
            90deg,
            rgba(0,128,246,.92),
            rgba(0,107,218,.72)
        );

    box-shadow:
        0 7px 18px
        rgba(0, 97, 202, .20);
}

.sidebar-footer {
    margin-top: auto;

    padding: 18px 10px 5px;

    display: grid;

    gap: 3px;

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

.sidebar-footer strong {
    font-size: 11px;
}

.sidebar-footer small {
    color: #718297;

    font-size: 10px;
}

/* =========================================================
   MAIN AREA
   ========================================================= */

.platform-main {
    min-width: 0;
}

.topbar {
    min-height: 76px;

    padding: 0 28px;

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

    gap: 25px;

    background: white;

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

.topbar-left {
    display: flex;
    align-items: center;

    gap: 22px;
}

.topbar-title {
    display: grid;

    gap: 2px;
}

.topbar-title strong {
    font-size: 14px;
}

.topbar-title span {
    color: var(--text-soft);

    font-size: 11px;
}

.global-search {
    width: min(360px, 30vw);

    position: relative;
}

.global-search input {
    min-height: 38px;

    padding-left: 35px;

    background: #f7f9fc;
}

.global-search span {
    position: absolute;

    left: 12px;
    top: 50%;

    transform: translateY(-50%);

    color: var(--text-faint);
}

.user-zone {
    display: flex;
    align-items: center;

    gap: 10px;
}

.user-avatar {
    width: 38px;
    height: 38px;

    display: grid;
    place-items: center;

    border-radius: 50%;

    color: white;

    font-weight: 900;

    background:
        linear-gradient(
            135deg,
            var(--blue-700),
            var(--blue-400)
        );
}

.user-meta {
    display: grid;

    min-width: 120px;
}

.user-meta strong {
    font-size: 12px;
}

.user-meta small {
    color: var(--text-soft);

    font-size: 10px;
}

.workspace {
    padding: 28px;
}

/* =========================================================
   PAGE HEADERS
   ========================================================= */

.page-heading {
    margin-bottom: 20px;

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

    gap: 24px;
}

.page-heading h1,
.page-heading h2 {
    margin: 5px 0 5px;

    font-size: 30px;

    letter-spacing: -.035em;
}

.page-heading p {
    margin: 0;

    color: var(--text-soft);
}

/* =========================================================
   DASHBOARD
   ========================================================= */

.hero-card {
    margin-bottom: 18px;

    padding: 25px;

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

    gap: 30px;

    background:
        radial-gradient(
            circle at 90% 12%,
            rgba(31, 165, 255, .14),
            transparent 30%
        ),
        white;

    border:
        1px solid #dbe8f4;

    border-radius: var(--radius-lg);

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

.hero-card h2 {
    margin: 8px 0 6px;

    font-size: 26px;

    letter-spacing: -.035em;
}

.hero-card p {
    margin: 0;

    color: var(--text-soft);
}

.status-pill {
    display: inline-flex;
    align-items: center;

    gap: 8px;

    color: var(--green);

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

    letter-spacing: .08em;
}

.status-dot {
    width: 7px;
    height: 7px;

    border-radius: 50%;

    background: #23c58c;

    box-shadow:
        0 0 0 4px
        rgba(35,197,140,.12);
}

.stats-grid {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 14px;

    margin-bottom: 18px;
}

.stat-card {
    min-height: 116px;

    padding: 17px;

    background: white;

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

    border-radius: var(--radius-md);
}

.stat-top {
    display: flex;
    align-items: center;
    justify-content: space-between;

    color: var(--text-soft);

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

.stat-icon {
    width: 31px;
    height: 31px;

    display: grid;
    place-items: center;

    border-radius: 8px;

    color: var(--blue-600);

    background: #edf6ff;
}

.stat-card strong {
    display: block;

    margin: 7px 0 3px;

    color: var(--navy-900);

    font-size: 28px;

    letter-spacing: -.04em;
}

.stat-card small {
    color: var(--text-soft);

    font-size: 10px;
}

.dashboard-grid {
    display: grid;

    grid-template-columns:
        minmax(0, 1.65fr)
        minmax(280px, .8fr);

    gap: 17px;
}

/* =========================================================
   PANELS
   ========================================================= */

.panel {
    background: white;

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

    border-radius: var(--radius-md);

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

.panel-body {
    padding: 19px;
}

.panel-header {
    padding: 17px 19px;

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

    gap: 20px;

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

.panel-header h3 {
    margin: 2px 0 0;

    font-size: 16px;
}

.panel-link {
    color: var(--blue-600);

    font-size: 11px;

    text-decoration: none;
}

/* =========================================================
   TABLES / LISTS
   ========================================================= */

.table-toolbar {
    padding: 14px 17px;

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

    gap: 14px;

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

.segmented {
    display: flex;

    gap: 5px;
}

.segment {
    padding: 7px 11px;

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

    border-radius: 7px;

    background: white;

    color: var(--text-soft);

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

.segment.active {
    color: var(--blue-700);

    border-color: #b9dcff;

    background: #eef7ff;
}

.data-table {
    width: 100%;

    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 14px;

    text-align: left;

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

    font-size: 11px;
}

.data-table th {
    color: var(--text-soft);

    background: #fbfcfe;

    font-weight: 750;
}

.data-table tbody tr:hover {
    background: #fafcff;
}

.entity-cell {
    display: flex;
    align-items: center;

    gap: 10px;
}

.entity-avatar {
    width: 32px;
    height: 32px;

    flex: 0 0 32px;

    display: grid;
    place-items: center;

    border-radius: 9px;

    color: white;

    font-weight: 850;

    background:
        linear-gradient(
            135deg,
            #0b6ddd,
            #22a9f4
        );
}

.entity-copy {
    display: grid;

    gap: 2px;
}

.entity-copy strong {
    font-size: 11px;
}

.entity-copy span {
    color: var(--text-soft);

    font-size: 9px;
}

.badge {
    display: inline-flex;
    align-items: center;

    min-height: 24px;

    padding: 4px 9px;

    border-radius: 7px;

    font-size: 10px;
    font-weight: 750;
}

.badge-active {
    color: #087452;
    background: var(--green-bg);
}

.badge-inactive {
    color: #9d3541;
    background: var(--red-bg);
}

.badge-neutral {
    color: #58677b;
    background: #edf1f6;
}

.system-list {
    list-style: none;

    margin: 0;

    padding: 0;
}

.system-list li {
    min-height: 46px;

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

    gap: 15px;

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

.system-list li:last-child {
    border-bottom: 0;
}

.system-list span {
    color: var(--text-soft);

    font-size: 11px;
}

.system-list strong {
    font-size: 11px;
}

.text-ok {
    color: var(--green);
}

/* =========================================================
   EMPTY / PLACEHOLDER
   ========================================================= */

.empty-state {
    min-height: 260px;

    padding: 35px;

    display: grid;
    place-items: center;
    align-content: center;

    text-align: center;

    color: var(--text-soft);
}

.empty-icon {
    width: 54px;
    height: 54px;

    margin-bottom: 12px;

    display: grid;
    place-items: center;

    border-radius: 14px;

    color: var(--blue-600);

    background: #eef7ff;

    font-size: 24px;
}

.empty-state h4 {
    margin: 0 0 6px;

    color: var(--text);

    font-size: 16px;
}

.empty-state p {
    margin: 0;

    max-width: 440px;

    line-height: 1.55;
}

/* =========================================================
   BRANDING
   ========================================================= */

.branding-form {
    display: grid;

    gap: 17px;
}

.branding-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 16px;
}

.upload-card {
    overflow: hidden;

    background: white;

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

    border-radius: var(--radius-md);
}

.upload-preview {
    height: 190px;

    padding: 18px;

    display: grid;
    place-items: center;

    background:
        linear-gradient(
            135deg,
            #f9fbfd,
            #eef3f8
        );

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

.upload-preview img {
    width: 100%;
    height: 100%;

    object-fit: contain;
}

.upload-placeholder {
    width: 100%;
    height: 100%;

    display: grid;
    place-items: center;

    border:
        1px dashed #bcc7d5;

    border-radius: 10px;

    background: white;

    color: var(--text-faint);
}

.upload-body {
    padding: 18px;
}

.upload-body h3 {
    margin: 0 0 5px;

    font-size: 15px;
}

.upload-body p {
    margin: 0 0 12px;

    color: var(--text-soft);

    font-size: 11px;

    line-height: 1.5;
}

.dimension-note {
    margin-bottom: 14px;

    padding: 9px 10px;

    border-radius: 8px;

    background: #eef7ff;

    color: #32648f;

    font-size: 10px;

    line-height: 1.5;
}

.file-label {
    margin: 0;

    padding: 10px;

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

    border-radius: 8px;

    background: #fbfcfe;
}

.save-bar {
    position: sticky;

    bottom: 15px;

    z-index: 20;

    padding: 14px 17px;

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

    gap: 20px;

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

    backdrop-filter:
        blur(12px);

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

    border-radius: 12px;

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

.save-bar div {
    display: grid;

    gap: 3px;
}

.save-bar strong {
    font-size: 12px;
}

.save-bar span {
    color: var(--text-soft);

    font-size: 10px;
}

/* =========================================================
   PLACEHOLDER MODULE
   ========================================================= */

.module-placeholder {
    min-height: 460px;
}

.module-preview-grid {
    display: grid;

    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 14px;

    margin-top: 16px;
}

.module-preview-card {
    min-height: 130px;

    padding: 18px;

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

    border-radius: var(--radius-md);

    background: white;
}

.module-preview-card strong {
    display: block;

    margin-bottom: 6px;

    font-size: 13px;
}

.module-preview-card span {
    color: var(--text-soft);

    font-size: 11px;

    line-height: 1.5;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

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

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

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

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

@media (max-width: 840px) {
    .auth-screen {
        grid-template-columns: 1fr;
    }

    .auth-brand {
        min-height: auto;

        padding: 40px 25px;
    }

    .auth-brand h1 {
        font-size: 39px;
    }

    .platform-shell {
        display: block;
    }

    .sidebar {
        position: static;

        width: 100%;
        height: auto;
        min-height: auto;

        padding: 10px;
    }

    .sidebar-brand,
    .sidebar-footer {
        display: none;
    }

    .sidebar-nav {
        display: flex;

        overflow-x: auto;

        padding: 0;
    }

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

    .topbar {
        min-height: 68px;

        padding: 0 16px;
    }

    .global-search {
        display: none;
    }

    .workspace {
        padding: 20px 16px 30px;
    }

    .user-meta {
        display: none;
    }
}

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

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

    .auth-form-wrap {
        padding: 20px 13px;
    }

    .auth-card {
        padding: 28px 20px;
    }

    .page-heading,
    .hero-card,
    .save-bar {
        flex-direction: column;
        align-items: flex-start;
    }
}
