:root {
    --bg: #071120;
    --panel-line: rgba(143, 164, 199, .18);
    --input: #0b1830;
    --button: #416a9d;
    --button-hover: #4c79b0;
    --text: #eef4ff;
    --muted: #9aa8bd;
    --link: #21a2ff;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }

body {
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 50% 38%, rgba(67, 106, 157, .66) 0, rgba(41, 70, 113, .48) 18%, rgba(13, 28, 54, .96) 46%, #071120 78%),
        #071120;
    font: 16px/1.45 Arial, Helvetica, sans-serif;
    overflow: hidden;
}

body.is-dashboard {
    background: #071120;
    overflow: auto;
}

.page {
    min-height: 100svh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-shell {
    width: min(100%, 354px);
    display: grid;
    justify-items: center;
    gap: 26px;
}

.brand {
    display: grid;
    justify-items: center;
    gap: 5px;
    color: rgba(255, 255, 255, .88);
    text-align: center;
}

.brand-logo {
    width: 43px;
    height: 43px;
    display: block;
    object-fit: contain;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .34));
}

.brand-text {
    display: grid;
    gap: 0;
    line-height: .92;
    letter-spacing: -.03em;
}

.brand-text strong {
    color: rgba(255, 255, 255, .76);
    font-size: 16px;
    font-weight: 500;
}

.brand-text em {
    color: #fff;
    font-size: 16px;
    font-style: italic;
    font-weight: 800;
    transform: translateX(20px);
}

.login-card {
    width: 100%;
    min-height: 413px;
    padding: 30px 32px 26px;
    border: 1px solid var(--panel-line);
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(37, 63, 101, .62), rgba(14, 26, 50, .76));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 28px 80px rgba(0, 0, 0, .22);
}

.login-card h1 {
    margin: 0 0 26px;
    font-size: 21px;
    line-height: 1.15;
    font-weight: 800;
    text-align: center;
    letter-spacing: -.02em;
}

.field {
    display: grid;
    gap: 5px;
    margin-bottom: 23px;
}

label {
    color: rgba(230, 236, 247, .78);
    font-size: 15px;
    font-weight: 700;
}

input {
    width: 100%;
    height: 46px;
    border: 1px solid rgba(255, 255, 255, .03);
    border-radius: 8px;
    padding: 0 16px;
    color: #fff;
    background: var(--input);
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    outline: 0;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, .36);
    transition: border-color .16s ease, box-shadow .16s ease;
}

input::placeholder { color: rgba(255, 255, 255, .42); }
input:focus {
    border-color: rgba(91, 154, 219, .72);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, .36), 0 0 0 4px rgba(33, 162, 255, .13);
}

.password-control { position: relative; }
.password-control input { padding-right: 48px; }

button {
    width: 100%;
    height: 48px;
    margin: 3px 0 21px;
    border: 0;
    border-radius: 11px;
    color: #fff;
    background: var(--button);
    font: inherit;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 9px 18px rgba(0, 0, 0, .22);
    transition: background .16s ease, transform .16s ease;
}

button:hover {
    background: var(--button-hover);
    transform: translateY(-1px);
}

.toggle-password {
    position: absolute;
    right: 9px;
    bottom: 7px;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    margin: 0;
    border: 0;
    border-radius: 8px;
    color: rgba(255, 255, 255, .62);
    background: transparent;
    box-shadow: none;
    padding: 0;
    font-size: 0;
}

.toggle-password:hover {
    color: #fff;
    background: rgba(255, 255, 255, .07);
    transform: none;
}

.toggle-password svg {
    width: 18px;
    height: 18px;
}

.actions {
    display: grid;
    gap: 5px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    text-align: center;
}

.actions p { margin: 0; }

.alert {
    margin: -8px 0 16px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 128, 128, .28);
    border-radius: 8px;
    color: #ffd6d6;
    background: rgba(159, 36, 36, .22);
    font-size: 13px;
    font-weight: 700;
    text-align: center;
}

.alert.is-success {
    border-color: rgba(101, 255, 171, .24);
    color: #c9ffdf;
    background: rgba(18, 136, 58, .2);
}

a {
    color: var(--link);
    font-weight: 800;
    text-decoration: none;
}

a:hover { text-decoration: underline; }

.certificate {
    display: grid;
    grid-template-columns: 31px 1fr;
    align-items: center;
    gap: 12px;
    min-width: 191px;
    padding: 13px 22px;
    border: 1px solid rgba(143, 164, 199, .13);
    border-radius: 14px;
    color: #fff;
    background: rgba(26, 39, 66, .62);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04), 0 18px 52px rgba(0, 0, 0, .18);
}

.shield {
    width: 23px;
    height: 27px;
    display: grid;
    place-items: center;
}

.shield svg {
    width: 23px;
    height: 27px;
    display: block;
}

.certificate strong {
    display: block;
    font-size: 14px;
    line-height: 1.08;
}

.certificate span {
    display: block;
    color: rgba(255, 255, 255, .68);
    font-size: 12px;
    line-height: 1.1;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: none;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 50% 36%, rgba(67, 106, 157, .62) 0, rgba(41, 70, 113, .4) 24%, rgba(7, 17, 32, .94) 68%),
        rgba(7, 17, 32, .88);
}

.modal-backdrop.is-open { display: grid; }

.user-modal {
    width: min(100%, 430px);
    display: grid;
    justify-items: center;
    gap: 20px;
}

.modal-card {
    width: 100%;
    padding: 26px 32px 24px;
    border: 1px solid var(--panel-line);
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(37, 63, 101, .74), rgba(14, 26, 50, .86));
    box-shadow: 0 34px 90px rgba(0, 0, 0, .38);
}

.modal-card h2 {
    margin: 0 0 20px;
    font-size: 23px;
    text-align: center;
}

.modal-card .field { margin-bottom: 14px; }
.modal-card input {
    height: 39px;
    border-radius: 9px;
}

.modal-actions {
    display: grid;
    gap: 14px;
    margin-top: 20px;
}

.modal-actions button {
    margin: 0;
    height: 44px;
    border-radius: 10px;
}

.modal-actions .cancel-button {
    background: #2a303b;
    box-shadow: none;
}

.modal-actions .cancel-button:hover { background: #343b49; }

.dashboard {
    width: 100%;
    min-height: 100svh;
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    background: #071120;
    color: var(--text);
}

.sidebar {
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 28px;
    padding: 28px 18px 22px;
    border-right: 1px solid rgba(59, 96, 143, .35);
    background: #091426;
}

.side-logo {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 24px;
}

.side-logo img {
    width: 31px;
    height: 31px;
    object-fit: contain;
}

.side-logo strong {
    font-size: 14px;
    letter-spacing: -.04em;
}

.menu-title {
    margin: 18px 10px 8px;
    color: #66758c;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.nav-link {
    height: 34px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 11px;
    border-radius: 8px;
    color: #d9e5f7;
    font-size: 13px;
    font-weight: 700;
}

.nav-link svg {
    width: 16px;
    height: 16px;
    color: #d9e5f7;
}

.nav-link.is-active {
    background: rgba(55, 82, 122, .38);
    color: #fff;
}

.nav-link .chev {
    margin-left: auto;
    color: #7f8ba0;
}

.sidebar-bottom {
    display: grid;
    gap: 20px;
}

.cert-mini {
    display: grid;
    grid-template-columns: 34px 1fr;
    align-items: center;
    gap: 10px;
    padding: 13px;
    border: 1px solid rgba(143, 164, 199, .13);
    border-radius: 8px;
    background: rgba(255, 255, 255, .03);
    color: #fff;
}

.cert-mini span {
    color: #8f9cb2;
    font-size: 11px;
}

.user-strip {
    display: grid;
    grid-template-columns: 34px 1fr 24px;
    align-items: center;
    gap: 10px;
    color: #fff;
}

.avatar {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, #c58bff, #e0b184);
    font-size: 13px;
    font-weight: 800;
}

.user-strip strong {
    display: block;
    font-size: 12px;
    line-height: 1.2;
}

.user-strip span {
    display: block;
    color: #8f9cb2;
    font-size: 11px;
}

.logout-icon {
    display: grid;
    place-items: center;
    color: #9fb0c7;
}

.dash-main {
    min-width: 0;
    padding: 30px 28px;
}

.dash-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 22px;
    margin-bottom: 28px;
}

.dash-top h1 {
    margin: 0;
    font-size: 25px;
    line-height: 1.1;
}

.dash-top p {
    margin: 4px 0 0;
    color: #8f9cb2;
    font-size: 12px;
    font-weight: 700;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-box {
    width: min(320px, 32vw);
    height: 36px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    border: 1px solid rgba(143, 164, 199, .08);
    border-radius: 8px;
    background: #050d1a;
    color: #7f8ba0;
    font-size: 12px;
}

.icon-button {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(143, 164, 199, .08);
    border-radius: 8px;
    background: #050d1a;
    color: #b8c4d5;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 18px;
    margin-bottom: 26px;
}

.stat-card,
.chart-card,
.recent-card {
    border-radius: 16px;
    background: #050d1a;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .02);
}

.stat-card {
    min-height: 122px;
    padding: 18px;
    position: relative;
}

.stat-card small {
    display: block;
    color: #b8c4d5;
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 22px;
}

.stat-card strong {
    display: block;
    font-size: 24px;
    line-height: 1;
}

.stat-card span {
    display: block;
    margin-top: 12px;
    color: #0fcb78;
    font-size: 11px;
    font-weight: 800;
}

.stat-card span.is-down { color: #ff4f60; }

.stat-icon {
    position: absolute;
    top: 17px;
    right: 17px;
    width: 31px;
    height: 31px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    color: #34a5ff;
    background: rgba(52, 165, 255, .24);
}

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

.chart-card,
.recent-card {
    min-height: 420px;
    padding: 18px;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 28px;
}

.card-head h2 {
    margin: 0;
    font-size: 14px;
}

.card-head a {
    color: #23a7ff;
    font-size: 11px;
}

.bars {
    height: 305px;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    align-items: end;
    gap: 24px;
    padding: 0 0 0 8px;
}

.bar-pair {
    height: 100%;
    display: flex;
    align-items: end;
    justify-content: center;
    gap: 0;
}

.bar {
    width: 52px;
    border-radius: 4px 4px 0 0;
    background: #31557f;
}

.bar.is-bright { background: #3190c9; }

.recent-list {
    display: grid;
    gap: 22px;
}

.sale-row {
    display: grid;
    grid-template-columns: 34px 1fr auto;
    align-items: center;
    gap: 10px;
}

.sale-avatar {
    width: 29px;
    height: 29px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(52, 165, 255, .24);
    color: #38a7ff;
}

.sale-row strong {
    display: block;
    color: #eaf2ff;
    font-size: 13px;
}

.sale-row small {
    display: block;
    color: #8390a4;
    font-size: 11px;
}

.sale-value {
    text-align: right;
    font-size: 12px;
    font-weight: 800;
}

.badge {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    color: #72ff9d;
    background: rgba(18, 136, 58, .35);
    font-size: 10px;
}

.badge.is-pending {
    color: #ffd24d;
    background: rgba(146, 105, 0, .35);
}

@media (max-width: 640px) {
    body { overflow: auto; }
    .page { padding: 34px 17px; }
    .login-shell { gap: 24px; }
    .login-card {
        min-height: auto;
        padding: 30px 24px 28px;
        border-radius: 22px;
    }
    .login-card h1 {
        margin-bottom: 26px;
        font-size: 22px;
    }
    label { font-size: 16px; }
    input, button { height: 50px; }
    button {
        margin-bottom: 24px;
        font-size: 17px;
    }
    .actions { font-size: 14px; }
}

@media (max-width: 1180px) {
    .dashboard { grid-template-columns: 82px minmax(0, 1fr); }
    .sidebar { padding-inline: 14px; }
    .side-logo strong,
    .menu-title,
    .nav-link span,
    .nav-link .chev,
    .cert-mini div,
    .user-strip div {
        display: none;
    }
    .nav-link {
        justify-content: center;
        padding: 0;
    }
    .cert-mini,
    .user-strip {
        grid-template-columns: 1fr;
        justify-items: center;
    }
    .logout-icon { display: none; }
    .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    body.is-dashboard { overflow: auto; }
    .dashboard { display: block; }
    .sidebar {
        min-height: auto;
        position: static;
        flex-direction: row;
        align-items: center;
        overflow-x: auto;
        padding: 12px;
        border-right: 0;
        border-bottom: 1px solid rgba(59, 96, 143, .35);
    }
    .side-nav,
    .sidebar-bottom {
        display: flex;
        align-items: center;
        gap: 8px;
    }
    .side-logo,
    .nav-link,
    .cert-mini,
    .user-strip {
        margin: 0;
        flex: 0 0 auto;
    }
    .dash-main { padding: 22px 16px; }
    .dash-top { display: grid; }
    .top-actions,
    .search-box { width: 100%; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .bars { gap: 12px; }
    .bar { width: 32px; }
}

@media (max-width: 560px) {
    .stats-grid { grid-template-columns: 1fr; }
    .chart-card,
    .recent-card { min-height: 320px; }
    .bars { height: 220px; }
}
