:root {
    --app-bg:
        radial-gradient(circle at 12% 18%, rgba(77, 246, 210, 0.12), transparent 24%),
        radial-gradient(circle at 88% 12%, rgba(103, 184, 255, 0.18), transparent 22%),
        radial-gradient(circle at 50% 82%, rgba(56, 189, 248, 0.1), transparent 26%),
        linear-gradient(135deg, #040814 0%, #08111f 45%, #03060d 100%);
    --panel-bg: rgba(8, 16, 31, 0.82);
    --panel-bg-soft: rgba(255, 255, 255, 0.04);
    --panel-border: rgba(148, 163, 184, 0.18);
    --panel-line: rgba(148, 163, 184, 0.12);
    --text-strong: #f7fbff;
    --text-main: #d6e2f0;
    --text-muted: #91a2b7;
    --cyan: #4df6d2;
    --sky: #67b8ff;
    --violet: #7c7cff;
    --danger: #ff667f;
    --warning: #ffc14d;
    --success: #39d98a;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    font-family: "Space Grotesk", sans-serif;
    color: var(--text-strong);
    background: var(--app-bg);
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 72px 72px;
    opacity: 0.32;
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 50% 0%, rgba(103, 184, 255, 0.08), transparent 34%);
    pointer-events: none;
    z-index: 0;
}

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

.sidebar,
.dashboard-main,
.mobile-nav,
.modal {
    position: relative;
    z-index: 1;
}

.sidebar {
    position: fixed;
    top: 18px;
    left: 18px;
    bottom: 18px;
    width: 286px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 22px 18px;
    border: 1px solid var(--panel-border);
    border-radius: 28px;
    background: rgba(6, 12, 24, 0.78);
    backdrop-filter: blur(22px);
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.28);
    overflow-y: auto;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(77, 246, 210, 0.5), rgba(103, 184, 255, 0.5));
}

.logo {
    margin: 0;
    font-family: "Orbitron", sans-serif;
    font-size: 1.65rem;
    letter-spacing: 0.04em;
}

.logo::before {
    content: "ST";
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    margin-right: 12px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(77, 246, 210, 0.18), rgba(103, 184, 255, 0.18));
    border: 1px solid rgba(103, 184, 255, 0.22);
    color: var(--cyan);
    font-size: 0.9rem;
    vertical-align: middle;
}

.user-box {
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid var(--panel-line);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
}

.user-box::before {
    content: "Active profile";
    display: block;
    margin-bottom: 6px;
    color: var(--cyan);
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.user-name {
    display: block;
    color: var(--text-strong);
    font-weight: 700;
    font-size: 1.02rem;
}

.menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.menu a {
    display: flex;
    align-items: center;
    min-height: 54px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 18px;
    color: var(--text-main);
    font-weight: 600;
    transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

.menu a:hover {
    transform: translateX(4px);
    border-color: rgba(103, 184, 255, 0.16);
    background: rgba(103, 184, 255, 0.08);
}

.menu a.active {
    color: #02141d;
    background: linear-gradient(135deg, var(--cyan), #90fbff 50%, var(--sky));
    box-shadow: 0 16px 34px rgba(77, 246, 210, 0.18);
}

.logout-btn {
    margin-top: auto;
    min-height: 56px;
    border: 0;
    border-radius: 18px;
    font-family: "Space Grotesk", sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: #04111a;
    background: linear-gradient(135deg, #ffba08, #ff6b37 52%, #ff3d81);
    box-shadow: 0 18px 36px rgba(255, 107, 55, 0.22);
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.logout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 24px 42px rgba(255, 107, 55, 0.32);
}

.dashboard-main {
    margin-left: 330px;
    min-height: 100vh;
    padding: 26px 26px 40px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: calc(100% - 330px);
}

.dashboard-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 20px;
    align-items: stretch;
    padding: 28px;
    border: 1px solid var(--panel-border);
    border-radius: 30px;
    background:
        radial-gradient(circle at top right, rgba(103, 184, 255, 0.18), transparent 28%),
        linear-gradient(180deg, rgba(7, 16, 31, 0.86), rgba(4, 10, 20, 0.94));
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.24);
}

.dashboard-header h1 {
    margin: 0;
    font-family: "Orbitron", sans-serif;
    font-size: clamp(2rem, 4vw, 3.2rem);
    line-height: 1;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.dashboard-header p {
    max-width: 480px;
    margin: 12px 0 0;
    color: var(--text-muted);
    font-size: 1rem;
}

.dashboard-header .btn {
    align-self: center;
    min-width: 240px;
    width: auto;
}

.btn,
.btn-outline,
.btn.danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    padding: 0 24px;
    border-radius: 16px;
    border: 0;
    font-family: "Space Grotesk", sans-serif;
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
}

.btn,
.btn-primary {
    color: #03111c;
    background: linear-gradient(135deg, var(--violet), var(--sky) 56%, #2dc7e3);
    box-shadow: 0 16px 36px rgba(103, 184, 255, 0.22);
}

.btn-outline {
    color: var(--text-strong);
    border: 1px solid rgba(103, 184, 255, 0.22);
    background: rgba(255, 255, 255, 0.04);
}

.btn.danger {
    color: #07111a;
    background: linear-gradient(135deg, #ffc14d, #ff6b37 54%, #ff4b75);
}

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

.card {
    position: relative;
    border: 1px solid var(--panel-border);
    border-radius: 28px;
    padding: 22px;
    background:
        radial-gradient(circle at top right, rgba(103, 184, 255, 0.12), transparent 28%),
        linear-gradient(180deg, rgba(8, 16, 31, 0.82), rgba(5, 11, 21, 0.94));
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(130deg, transparent, rgba(77, 246, 210, 0.08), transparent 65%);
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

.card:hover::before {
    opacity: 1;
}

.label,
.section-header h3,
.card h3 {
    color: var(--text-strong);
    margin: 0;
}

.label {
    display: block;
    margin-bottom: 10px;
    color: var(--text-muted);
    font-size: 0.78rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.card h2 {
    margin: 0;
    font-family: "Orbitron", sans-serif;
    font-size: clamp(1.6rem, 2vw, 2.2rem);
    letter-spacing: 0.03em;
}

.badge {
    display: inline-flex;
    align-items: center;
    margin-top: 16px;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    border: 1px solid transparent;
}

.badge.success {
    color: var(--success);
    background: rgba(57, 217, 138, 0.12);
    border-color: rgba(57, 217, 138, 0.2);
}

.badge.warning {
    color: var(--warning);
    background: rgba(255, 193, 77, 0.12);
    border-color: rgba(255, 193, 77, 0.2);
}

.badge.danger {
    color: var(--danger);
    background: rgba(255, 102, 127, 0.12);
    border-color: rgba(255, 102, 127, 0.2);
}

.analytics-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.9fr);
    gap: 18px;
}

.analytics-grid .card,
.chart-card {
    min-height: 320px;
}

.chart-frame {
    position: relative;
    width: 100%;
    height: 320px;
    margin-top: 14px;
}

.transactions-grid,
.expense-list,
#incomeList {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.transaction-row,
.expense-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 18px;
    border: 1px solid var(--panel-line);
    border-radius: 20px;
    background: var(--panel-bg-soft);
    transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}

.transaction-row:hover,
.expense-card:hover {
    transform: translateY(-2px);
    border-color: rgba(103, 184, 255, 0.22);
    background: rgba(103, 184, 255, 0.08);
}

.transaction-row .income {
    color: var(--success);
    font-weight: 700;
}

.transaction-row .expense,
.danger {
    color: var(--danger);
    font-weight: 700;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.progress {
    height: 12px;
    margin: 14px 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: inherit;
    transition: width 0.5s ease;
}

.progress-bar.safe {
    background: linear-gradient(90deg, #39d98a, #7cffb0);
}

.progress-bar.warning {
    background: linear-gradient(90deg, #ffba08, #ffd56a);
}

.progress-bar.danger {
    background: linear-gradient(90deg, #ff667f, #ff7d55);
}

.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(1, 5, 14, 0.78);
    backdrop-filter: blur(10px);
}

.modal-content {
    width: min(420px, 100%);
    max-height: calc(100vh - 36px);
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 24px;
    border: 1px solid var(--panel-border);
    border-radius: 28px;
    background: linear-gradient(180deg, rgba(7, 16, 31, 0.94), rgba(3, 9, 17, 0.98));
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.3);
    overflow-y: auto;
}

.modal-content h3 {
    margin: 0 0 6px;
    font-family: "Orbitron", sans-serif;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.modal-actions {
    display: flex;
    gap: 12px;
}

input,
select,
.select {
    width: 100%;
    min-height: 48px;
    padding: 0 14px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-strong);
    font-family: "Space Grotesk", sans-serif;
}

input:focus,
select:focus {
    outline: none;
    border-color: rgba(103, 184, 255, 0.28);
    box-shadow: 0 0 0 4px rgba(103, 184, 255, 0.12);
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-top: 18px;
}

.switch {
    position: relative;
    display: inline-flex;
    width: 56px;
    height: 32px;
}

.switch input {
    display: none;
}

.slider {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    cursor: pointer;
}

.slider::before {
    content: "";
    position: absolute;
    top: 4px;
    left: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.25s ease;
}

.switch input:checked + .slider {
    background: linear-gradient(135deg, var(--violet), var(--sky));
}

.switch input:checked + .slider::before {
    transform: translateX(24px);
}

.color-options {
    display: flex;
    gap: 12px;
    margin-top: 18px;
}

.color {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.12);
    cursor: pointer;
}

.color.blue { background: #6366f1; }
.color.cyan { background: #22d3ee; }
.color.green { background: #22c55e; }
.color.pink { background: #ec4899; }

.danger-card .btn {
    margin-top: 16px;
}

.text-muted,
small.text-muted {
    color: var(--text-muted);
}

.mobile-nav {
    display: none;
}

.mobile-nav button {
    border: 0;
    cursor: pointer;
    font: inherit;
}

.card canvas {
    width: 100% !important;
    height: 100% !important;
    margin-top: 0;
}

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

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

@media (max-width: 920px) {
    .sidebar {
        position: static;
        width: calc(100% - 24px);
        height: auto;
        margin: 12px auto 0;
        border-radius: 22px;
    }

    .dashboard-main {
        margin-left: 0;
        width: 100%;
        padding: 16px 12px 92px;
    }

    .dashboard-header {
        grid-template-columns: 1fr;
        padding: 22px 18px;
    }

    .dashboard-header .btn {
        min-width: 0;
        width: 100%;
    }
}

@media (max-width: 720px) {
    .sidebar {
        display: none;
    }

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

    .dashboard-main {
        padding: 12px 12px 88px;
        gap: 16px;
    }

    .dashboard-header h1 {
        font-size: clamp(1.6rem, 8vw, 2.2rem);
    }

    .transaction-row,
    .expense-card,
    .setting-row,
    .modal-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .transaction-row > div,
    .expense-card > div {
        width: 100%;
    }

    .analytics-grid .card,
    .chart-card {
        min-height: 0;
    }

    .chart-frame {
        height: 260px;
    }

    .mobile-nav {
        position: fixed;
        right: 12px;
        bottom: 12px;
        left: 12px;
        display: flex;
        gap: 10px;
        padding: 12px;
        border: 1px solid var(--panel-border);
        border-radius: 22px;
        background: rgba(6, 12, 24, 0.88);
        backdrop-filter: blur(20px);
        z-index: 25;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .mobile-nav::-webkit-scrollbar {
        display: none;
    }

    .mobile-nav a,
    .mobile-nav button {
        flex: 0 0 auto;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 44px;
        min-width: 52px;
        padding: 0 14px;
        border-radius: 14px;
        background: rgba(255, 255, 255, 0.04);
        color: var(--text-main);
        font-size: 0.9rem;
        font-weight: 700;
        white-space: nowrap;
    }

    .mobile-nav a.active,
    .mobile-nav button.active {
        color: #04111a;
        background: linear-gradient(135deg, var(--cyan), #90fbff 50%, var(--sky));
    }

    .modal {
        padding: 12px;
        align-items: end;
    }

    .modal-content {
        width: 100%;
        padding: 18px;
        border-radius: 22px;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 1.25rem;
    }

    .logo::before {
        width: 36px;
        height: 36px;
        margin-right: 10px;
    }

    .menu a,
    .logout-btn {
        min-height: 50px;
    }

    .dashboard-header,
    .card {
        border-radius: 22px;
    }

    .dashboard-header p,
    .text-muted {
        font-size: 0.94rem;
    }

    .chart-frame {
        height: 220px;
    }

    .mobile-nav {
        gap: 8px;
        padding: 10px;
    }

    .mobile-nav a,
    .mobile-nav button {
        min-height: 40px;
        min-width: 48px;
        padding: 0 12px;
        font-size: 0.82rem;
    }
}
