:root {
    --background: #070b14;
    --background-secondary: #0d1422;
    --surface: rgba(20, 29, 46, 0.92);
    --surface-strong: #151f31;
    --surface-hover: #1c2940;
    --border: rgba(148, 163, 184, 0.16);
    --text: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --primary: #38bdf8;
    --primary-strong: #0284c7;
    --success: #22c55e;
    --danger: #ef4444;
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
    --topbar-height: 72px;
    --bottom-nav-height: 74px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--background);
}

body {
    min-height: 100%;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(
            circle at top right,
            rgba(14, 165, 233, 0.14),
            transparent 34rem
        ),
        radial-gradient(
            circle at bottom left,
            rgba(59, 130, 246, 0.1),
            transparent 30rem
        ),
        var(--background);
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    -webkit-font-smoothing: antialiased;
}

button,
a,
input,
textarea {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

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

button {
    color: inherit;
}

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

.topbar {
    position: fixed;
    z-index: 40;
    top: 0;
    right: 0;
    left: 0;
    display: flex;
    height: calc(var(--topbar-height) + env(safe-area-inset-top, 0px));
    align-items: center;
    justify-content: space-between;
    padding:
        env(safe-area-inset-top, 0px)
        18px
        0;
    border-bottom: 1px solid var(--border);
    background: rgba(7, 11, 20, 0.88);
    backdrop-filter: blur(18px);
}

.icon-button,
.profile-button,
.sidebar-close,
.text-button {
    border: 0;
    cursor: pointer;
}

.icon-button {
    display: flex;
    width: 42px;
    height: 42px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--surface);
}

.icon-button span {
    width: 18px;
    height: 2px;
    border-radius: 10px;
    background: var(--text);
}

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

.brand-logo {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 12px;
    color: #00131f;
    background: linear-gradient(135deg, #7dd3fc, #0ea5e9);
    font-size: 13px;
    font-weight: 900;
    letter-spacing: -0.5px;
    box-shadow: 0 10px 28px rgba(14, 165, 233, 0.3);
}

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

.brand-text strong {
    font-size: 15px;
    letter-spacing: 0.02em;
}

.brand-text small {
    margin-top: 1px;
    color: var(--text-secondary);
    font-size: 10px;
}

.profile-button {
    width: 42px;
    height: 42px;
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 50%;
    background: rgba(14, 165, 233, 0.13);
    font-size: 12px;
    font-weight: 800;
}

.sidebar {
    position: fixed;
    z-index: 60;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(86vw, 340px);
    padding:
        calc(18px + env(safe-area-inset-top, 0px))
        18px
        calc(18px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-105%);
    border-right: 1px solid var(--border);
    background: #0b111d;
    box-shadow: var(--shadow);
    transition: transform 180ms ease;
}

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

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header > div {
    display: flex;
    flex-direction: column;
}

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

.sidebar-header small {
    margin-top: 3px;
    color: var(--text-secondary);
    font-size: 11px;
}

.sidebar-close {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    color: var(--text-secondary);
    background: var(--surface);
    font-size: 25px;
}

.sidebar-navigation {
    display: grid;
    gap: 7px;
    margin-top: 24px;
}

.sidebar-link {
    display: flex;
    min-height: 52px;
    align-items: center;
    gap: 13px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: 14px;
    color: var(--text-secondary);
}

.sidebar-link:hover,
.sidebar-link.active {
    border-color: rgba(56, 189, 248, 0.22);
    color: var(--text);
    background: rgba(14, 165, 233, 0.1);
}

.sidebar-icon {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    color: var(--primary);
    font-size: 17px;
}

.sidebar-status {
    position: absolute;
    right: 18px;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    left: 18px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: var(--surface);
}

.sidebar-status > div {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.sidebar-status strong {
    font-size: 12px;
}

.sidebar-status small {
    margin-top: 3px;
    overflow: hidden;
    color: var(--text-secondary);
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-dot {
    width: 10px;
    height: 10px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.7);
}

.sidebar-overlay {
    position: fixed;
    z-index: 50;
    inset: 0;
    display: none;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(3px);
}

.sidebar-overlay.visible {
    display: block;
}

.main-content {
    width: min(100%, 1120px);
    margin: 0 auto;
    padding:
        calc(var(--topbar-height) + env(safe-area-inset-top, 0px) + 22px)
        16px
        calc(var(--bottom-nav-height) + var(--safe-bottom) + 30px);
}

.welcome-card {
    position: relative;
    overflow: hidden;
    padding: 28px 22px;
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: 25px;
    background:
        linear-gradient(
            145deg,
            rgba(14, 165, 233, 0.17),
            rgba(15, 23, 42, 0.78) 55%
        ),
        var(--surface);
    box-shadow: var(--shadow);
}

.welcome-card::after {
    position: absolute;
    top: -80px;
    right: -70px;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: rgba(56, 189, 248, 0.08);
    content: "";
}

.welcome-label,
.section-kicker {
    color: var(--primary);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.15em;
}

.welcome-card h1 {
    position: relative;
    z-index: 1;
    margin: 13px 0 10px;
    font-size: clamp(31px, 9vw, 52px);
    line-height: 1;
    letter-spacing: -0.05em;
}

.welcome-card p {
    position: relative;
    z-index: 1;
    max-width: 650px;
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.65;
}

.primary-action {
    position: relative;
    z-index: 1;
    display: inline-flex;
    min-height: 50px;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin-top: 24px;
    padding: 0 20px;
    border-radius: 15px;
    color: #00131f;
    background: linear-gradient(135deg, #7dd3fc, #0ea5e9);
    font-size: 13px;
    font-weight: 800;
    box-shadow: 0 14px 30px rgba(14, 165, 233, 0.22);
}

.section-block {
    margin-top: 30px;
}

.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 15px;
    padding: 0 3px;
}

.section-heading h2 {
    margin: 6px 0 0;
    font-size: 20px;
    letter-spacing: -0.03em;
}

.text-button {
    padding: 7px 2px;
    color: var(--primary);
    background: transparent;
    font-size: 12px;
    font-weight: 700;
}

.action-grid,
.status-grid {
    display: grid;
    gap: 11px;
}

.action-card {
    display: grid;
    width: 100%;
    min-height: 88px;
    grid-template-columns: 46px minmax(0, 1fr) 22px;
    align-items: center;
    gap: 13px;
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: 18px;
    color: var(--text);
    background: var(--surface);
    text-align: left;
    cursor: pointer;
    transition:
        transform 140ms ease,
        border-color 140ms ease,
        background 140ms ease;
}

.action-card:hover,
.action-card:active {
    transform: translateY(-1px);
    border-color: rgba(56, 189, 248, 0.35);
    background: var(--surface-hover);
}

.action-card-icon {
    display: grid;
    width: 46px;
    height: 46px;
    place-items: center;
    border: 1px solid rgba(56, 189, 248, 0.22);
    border-radius: 14px;
    color: var(--primary);
    background: rgba(14, 165, 233, 0.1);
    font-size: 20px;
}

.action-card strong {
    display: block;
    font-size: 14px;
}

.action-card p {
    margin: 5px 0 0;
    color: var(--text-secondary);
    font-size: 11px;
    line-height: 1.45;
}

.action-arrow {
    color: var(--text-muted);
    font-size: 25px;
}

.status-card {
    padding: 17px;
    border: 1px solid var(--border);
    border-radius: 17px;
    background: var(--surface);
}

.status-card-heading {
    display: flex;
    align-items: center;
    gap: 9px;
}

.status-card-heading strong {
    font-size: 13px;
}

.status-card p {
    margin: 9px 0 0 19px;
    color: var(--text-secondary);
    font-size: 11px;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
}

.status-indicator.online {
    background: var(--success);
    box-shadow: 0 0 11px rgba(34, 197, 94, 0.58);
}

.status-indicator.offline {
    background: var(--danger);
    box-shadow: 0 0 11px rgba(239, 68, 68, 0.58);
}

.bottom-navigation {
    position: fixed;
    z-index: 40;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    height: calc(var(--bottom-nav-height) + var(--safe-bottom));
    grid-template-columns: repeat(4, 1fr);
    padding: 6px 8px var(--safe-bottom);
    border-top: 1px solid var(--border);
    background: rgba(7, 11, 20, 0.94);
    backdrop-filter: blur(18px);
}

.bottom-link {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    border-radius: 13px;
    color: var(--text-muted);
    font-size: 9px;
    font-weight: 700;
}

.bottom-link.active {
    color: var(--primary);
    background: rgba(14, 165, 233, 0.09);
}

.bottom-icon {
    font-size: 19px;
    line-height: 1;
}

body.menu-open {
    overflow: hidden;
}

@media (min-width: 700px) {
    .main-content {
        padding-right: 28px;
        padding-left: 28px;
    }

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

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

    .welcome-card {
        padding: 42px;
    }
}

@media (min-width: 1024px) {
    .bottom-navigation {
        display: none;
    }

    .main-content {
        padding-bottom: 45px;
    }
}
