:root {
    --background: #071019;
    --surface: #0e1924;
    --surface-raised: #132230;
    --surface-soft: #182a39;
    --border: rgba(255, 255, 255, 0.08);
    --text: #edf4f8;
    --muted: #8fa4b4;
    --accent: #28c8ae;
    --accent-strong: #18aa94;
    --accent-soft: rgba(40, 200, 174, 0.12);
    --warning: #f0b35b;
    --danger: #ef6c75;
    --sidebar-width: 270px;
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

* {
    box-sizing: border-box;
}

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

body {
    background:
        radial-gradient(circle at top right, rgba(40, 200, 174, 0.08), transparent 30%),
        var(--background);
    color: var(--text);
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

button,
input {
    font: inherit;
}

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

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

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    display: flex;
    width: var(--sidebar-width);
    flex-direction: column;
    border-right: 1px solid var(--border);
    background: rgba(8, 18, 27, 0.98);
    box-shadow: 16px 0 60px rgba(0, 0, 0, 0.18);
}

.brand {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 25px 24px;
}

.brand-mark {
    display: grid;
    width: 46px;
    height: 46px;
    place-items: center;
    border: 1px solid rgba(40, 200, 174, 0.35);
    border-radius: 14px;
    background: linear-gradient(145deg, #1cc4aa, #087d72);
    box-shadow: 0 10px 30px rgba(24, 170, 148, 0.18);
    color: #ffffff;
    font-size: 15px;
    font-weight: 900;
    letter-spacing: -0.04em;
}

.brand-copy {
    display: flex;
    flex-direction: column;
}

.brand-copy strong {
    font-size: 14px;
    letter-spacing: 0.08em;
}

.brand-copy span {
    margin-top: 3px;
    color: var(--accent);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.17em;
}

.navigation {
    flex: 1;
    overflow-y: auto;
    padding: 4px 14px 20px;
}

.navigation-heading {
    margin: 22px 12px 8px;
    color: #627888;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.navigation-item {
    display: flex;
    min-height: 46px;
    align-items: center;
    gap: 12px;
    margin: 3px 0;
    padding: 10px 13px;
    border-radius: 11px;
    color: #a7bac7;
    font-size: 14px;
    transition: 160ms ease;
}

.navigation-item:hover {
    background: rgba(255, 255, 255, 0.045);
    color: #ffffff;
}

.navigation-item.active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 700;
}

.navigation-item.disabled {
    cursor: default;
    opacity: 0.55;
}

.navigation-item small {
    margin-left: auto;
    color: #627888;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.nav-symbol {
    display: inline-grid;
    width: 22px;
    place-items: center;
    font-size: 16px;
}

.sidebar-footer {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 12px 16px 18px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.025);
    color: var(--muted);
    font-size: 12px;
}

.sidebar-footer small {
    margin-left: auto;
    color: #5f7484;
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 5px rgba(40, 200, 174, 0.09);
}

.main-area {
    min-height: 100vh;
    margin-left: var(--sidebar-width);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    min-height: 74px;
    align-items: center;
    padding: 0 34px;
    border-bottom: 1px solid var(--border);
    background: rgba(7, 16, 25, 0.88);
    backdrop-filter: blur(18px);
}

.menu-button {
    display: none;
    border: 0;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font-size: 23px;
}

.topbar-heading {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.user-area {
    display: flex;
    align-items: center;
    gap: 13px;
    margin-left: auto;
}

.user-copy {
    display: flex;
    flex-direction: column;
    text-align: right;
}

.user-copy strong {
    font-size: 13px;
}

.user-copy span {
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
}

.user-avatar {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface-raised);
    color: var(--accent);
    font-weight: 800;
}

.logout-button {
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.logout-button:hover {
    border-color: rgba(239, 108, 117, 0.35);
    color: var(--danger);
}

.page-content {
    width: min(1500px, 100%);
    margin: 0 auto;
    padding: 38px 36px 54px;
}

.welcome-panel {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 30px;
    margin-bottom: 28px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--accent);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.welcome-panel h1 {
    margin: 0;
    font-size: clamp(28px, 3vw, 42px);
    letter-spacing: -0.045em;
}

.welcome-panel p:not(.eyebrow) {
    max-width: 700px;
    margin: 10px 0 0;
    color: var(--muted);
    line-height: 1.6;
}

.system-badge {
    display: flex;
    align-items: center;
    gap: 11px;
    white-space: nowrap;
    padding: 13px 16px;
    border: 1px solid rgba(40, 200, 174, 0.18);
    border-radius: 12px;
    background: var(--accent-soft);
    color: #bfece4;
    font-size: 12px;
    font-weight: 700;
}

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

.metric-card,
.panel {
    border: 1px solid var(--border);
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.025), transparent),
        var(--surface);
    box-shadow: var(--shadow);
}

.metric-card {
    min-height: 170px;
    padding: 22px;
    border-radius: 16px;
}

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

.metric-label {
    color: #b7c7d1;
    font-size: 13px;
    font-weight: 700;
}

.metric-icon {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 12px;
    font-weight: 900;
}

.metric-value {
    display: block;
    margin-top: 18px;
    font-size: 35px;
    letter-spacing: -0.05em;
}

.metric-card p {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
    gap: 16px;
    margin-top: 16px;
}

.panel {
    min-height: 360px;
    padding: 24px;
    border-radius: 16px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
}

.panel-header h2 {
    margin: 0;
    font-size: 19px;
}

.empty-state {
    display: flex;
    min-height: 260px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 30px;
    color: var(--muted);
    text-align: center;
}

.empty-state-icon {
    display: grid;
    width: 52px;
    height: 52px;
    place-items: center;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 900;
}

.empty-state h3 {
    margin: 18px 0 7px;
    color: var(--text);
    font-size: 15px;
}

.empty-state p {
    max-width: 420px;
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
}

.quick-link-list {
    margin-top: 20px;
}

.quick-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 9px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.018);
    transition: 160ms ease;
}

.quick-link:hover {
    border-color: rgba(40, 200, 174, 0.25);
    background: var(--accent-soft);
    transform: translateY(-1px);
}

.quick-link div {
    display: flex;
    flex-direction: column;
}

.quick-link strong {
    font-size: 13px;
}

.quick-link span:not(.quick-link-arrow) {
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.4;
}

.quick-link-arrow {
    color: var(--accent);
    font-size: 18px;
}

/* Login */

.login-body {
    min-height: 100vh;
}

.login-layout {
    display: grid;
    min-height: 100vh;
    grid-template-columns: minmax(420px, 1.1fr) minmax(440px, 0.9fr);
}

.login-brand-panel {
    position: relative;
    display: flex;
    align-items: center;
    overflow: hidden;
    padding: 70px;
    background:
        linear-gradient(135deg, rgba(7, 16, 25, 0.84), rgba(7, 16, 25, 0.98)),
        radial-gradient(circle at 20% 20%, rgba(40, 200, 174, 0.27), transparent 36%);
}

.login-brand-panel::before {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
    background-size: 42px 42px;
    content: "";
}

.login-brand-content {
    position: relative;
    z-index: 2;
    width: min(650px, 100%);
    margin: auto;
}

.brand-large {
    padding: 0;
}

.login-introduction {
    margin-top: 90px;
}

.login-introduction h1 {
    max-width: 630px;
    margin: 0;
    font-size: clamp(40px, 5.4vw, 76px);
    line-height: 1.03;
    letter-spacing: -0.055em;
}

.login-introduction > p:last-child {
    max-width: 580px;
    margin: 25px 0 0;
    color: #a5b8c4;
    font-size: 17px;
    line-height: 1.75;
}

.login-feature-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 45px;
}

.login-feature-list span {
    padding: 10px 13px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.028);
    color: #b8c7d0;
    font-size: 11px;
    font-weight: 700;
}

.login-form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 40px;
    background: #f1f5f7;
    color: #15222d;
}

.login-card {
    width: min(430px, 100%);
    padding: 42px;
    border: 1px solid rgba(12, 29, 42, 0.08);
    border-radius: 22px;
    background: #ffffff;
    box-shadow: 0 25px 80px rgba(13, 32, 47, 0.13);
}

.mobile-login-brand {
    display: none;
}

.login-card h2 {
    margin: 0;
    font-size: 32px;
    letter-spacing: -0.045em;
}

.login-subtitle {
    margin: 10px 0 30px;
    color: #708391;
    font-size: 14px;
    line-height: 1.6;
}

.form-alert {
    margin-bottom: 20px;
    padding: 13px 14px;
    border: 1px solid rgba(239, 108, 117, 0.25);
    border-radius: 10px;
    background: rgba(239, 108, 117, 0.08);
    color: #a43c46;
    font-size: 12px;
    line-height: 1.5;
}

.login-form {
    display: flex;
    flex-direction: column;
}

.login-form label {
    margin: 0 0 8px;
    color: #425563;
    font-size: 12px;
    font-weight: 800;
}

.login-form input {
    height: 50px;
    margin-bottom: 20px;
    padding: 0 14px;
    border: 1px solid #ccd7dd;
    border-radius: 10px;
    outline: none;
    background: #fafcfd;
    color: #15222d;
}

.login-form input:focus {
    border-color: var(--accent-strong);
    box-shadow: 0 0 0 4px rgba(40, 200, 174, 0.11);
}

.primary-button {
    min-height: 52px;
    margin-top: 4px;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, #1dc8ad, #078d7f);
    box-shadow: 0 12px 30px rgba(24, 170, 148, 0.2);
    color: #ffffff;
    cursor: pointer;
    font-weight: 800;
}

.primary-button:hover {
    filter: brightness(1.04);
}

.login-security-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    margin-top: 25px;
    color: #71838e;
    font-size: 11px;
}

.login-footer {
    margin-top: 25px;
    color: #8797a2;
    font-size: 11px;
}

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

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

    .login-layout {
        grid-template-columns: 1fr;
    }

    .login-brand-panel {
        display: none;
    }

    .mobile-login-brand {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-bottom: 35px;
        color: #15222d;
    }
}

@media (max-width: 780px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 180ms ease;
    }

    .sidebar-open .sidebar {
        transform: translateX(0);
    }

    .main-area {
        margin-left: 0;
    }

    .menu-button {
        display: block;
        margin-right: 16px;
    }

    .topbar {
        padding: 0 18px;
    }

    .topbar-heading,
    .user-copy {
        display: none;
    }

    .page-content {
        padding: 25px 18px 40px;
    }

    .welcome-panel {
        align-items: flex-start;
        flex-direction: column;
    }

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

    .login-form-panel {
        padding: 22px;
    }

    .login-card {
        padding: 30px 24px;
    }
}

/* Integrated systems */

.system-page {
    display: flex;
    min-height: calc(100vh - 150px);
    flex-direction: column;
}

.system-page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 20px;
}

.system-page-header h1 {
    margin: 0;
    font-size: 32px;
    letter-spacing: -0.045em;
}

.system-page-header p:not(.eyebrow) {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.system-page-actions {
    display: flex;
    gap: 10px;
}

.secondary-button,
.frame-refresh-button {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-raised);
    color: var(--text);
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
}

.secondary-button:hover,
.frame-refresh-button:hover {
    border-color: rgba(40, 200, 174, 0.35);
    background: var(--accent-soft);
    color: var(--accent);
}

.system-frame-shell {
    display: flex;
    min-height: 720px;
    flex: 1;
    overflow: hidden;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #ffffff;
    box-shadow: var(--shadow);
}

.system-frame-toolbar {
    display: flex;
    min-height: 54px;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.system-frame-toolbar > div {
    display: flex;
    align-items: center;
    gap: 10px;
}

.system-frame-toolbar strong {
    font-size: 12px;
}

.system-frame {
    width: 100%;
    min-height: 720px;
    flex: 1;
    border: 0;
    background: #ffffff;
}

@media (max-width: 780px) {
    .system-page-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .system-page-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .secondary-button {
        flex: 1;
    }

    .system-frame-shell,
    .system-frame {
        min-height: 680px;
    }
}
