:root {
    color-scheme: dark;
    --bg: #0d1218;
    --sidebar: #111820;
    --content: #171d25;
    --surface: #1b222b;
    --surface-2: #202833;
    --surface-3: #25303d;
    --border: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.11);
    --text: #f4f7fb;
    --muted: #8f98aa;
    --blue: #42c8ff;
    --blue-soft: rgba(66, 200, 255, 0.14);
    --green: #5fd59a;
    --green-soft: rgba(95, 213, 154, 0.14);
    --amber: #ffb553;
    --amber-soft: rgba(255, 181, 83, 0.14);
    --red: #ff7b83;
    --red-soft: rgba(255, 123, 131, 0.14);
    --radius-xl: 22px;
    --radius-lg: 16px;
    --radius-md: 12px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
    min-height: 100vh;
}

button,
input {
    font: inherit;
}

.hidden {
    display: none !important;
}

.eyebrow,
.field-label,
.sidebar__label {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.error-text,
.dialog__copy,
.user-row__meta,
.disk-row__meta,
.stat-card__label,
.topbar__copy,
.recent-user__meta {
    color: var(--muted);
}

.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card,
.sidebar,
.content,
.panel-card,
.dialog__card {
    background: var(--content);
    border: 1px solid var(--border);
}

.login-card {
    width: min(420px, calc(100vw - 40px));
    border-radius: 22px;
    padding: 24px;
}

.login-card h1,
.topbar h1,
.panel-card__head h3,
.dialog__card h3,
.sidebar__brand h2 {
    margin: 0;
    line-height: 1;
}

.login-card h1 {
    font-size: 34px;
    text-align: center;
}

.login-form {
    margin-top: 22px;
    display: grid;
    gap: 12px;
}

.field-block {
    display: grid;
    gap: 8px;
}

.field-block--full {
    grid-column: 1 / -1;
}

input {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--border-strong);
    border-radius: 16px;
    background: #0d1117;
    color: var(--text);
    padding: 15px 18px;
    outline: none;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

input:focus {
    border-color: rgba(66, 200, 255, 0.45);
    box-shadow: 0 0 0 3px rgba(66, 200, 255, 0.08);
}

.primary-btn,
.ghost-btn,
.nav-link,
.action-btn {
    appearance: none;
    border-radius: 14px;
    border: 1px solid var(--border-strong);
    min-height: 46px;
    padding: 11px 16px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.primary-btn:hover,
.ghost-btn:hover,
.nav-link:hover,
.action-btn:hover {
    transform: translateY(-1px);
}

.primary-btn {
    background: var(--amber-soft);
    border-color: rgba(255, 181, 83, 0.34);
    color: var(--amber);
}

.ghost-btn,
.nav-link,
.action-btn {
    background: var(--surface);
    color: var(--text);
}

.ghost-btn--danger,
.action-btn--danger {
    background: var(--red-soft);
    border-color: rgba(255, 123, 131, 0.22);
    color: var(--red);
}

.action-btn--warning {
    background: var(--amber-soft);
    border-color: rgba(255, 181, 83, 0.22);
    color: var(--amber);
}

.action-btn--success {
    background: var(--green-soft);
    border-color: rgba(95, 213, 154, 0.22);
    color: var(--green);
}

.login-actions {
    margin-top: 16px;
    display: flex;
}

.login-actions .primary-btn {
    width: 100%;
}

.error-text {
    margin: 12px 0 0;
    font-size: 13px;
}

.error-text:empty {
    display: none;
}

.panel-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 16px;
    padding: 16px;
}

.sidebar {
    border-radius: var(--radius-xl);
    padding: 18px 14px;
    background: #10171f;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: sticky;
    top: 16px;
    height: calc(100vh - 32px);
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 6px 0;
}

.sidebar__brand h2 {
    font-size: 24px;
}

.sidebar__dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(180deg, #63d8ff 0%, #2f93ef 100%);
}

.sidebar__group {
    display: grid;
    gap: 10px;
}

.sidebar__nav {
    display: grid;
    gap: 8px;
}

.nav-link {
    min-height: 42px;
    text-align: left;
    background: transparent;
    border-color: transparent;
    padding-inline: 14px;
}

.nav-link.is-active {
    background: rgba(66, 200, 255, 0.14);
    border-color: rgba(66, 200, 255, 0.24);
    color: #91e3ff;
}

.content {
    border-radius: var(--radius-xl);
    padding: 18px;
    min-height: calc(100vh - 32px);
    background: #161d24;
}

.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.topbar__title h1 {
    font-size: 30px;
}

.topbar__copy {
    margin: 6px 0 0;
    font-size: 13px;
}

.topbar__actions {
    display: flex;
    gap: 10px;
}

.section {
    display: none;
    gap: 14px;
}

.section.is-active {
    display: grid;
}

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

.stat-card,
.recent-user,
.user-row,
.disk-row {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.stat-card {
    padding: 14px 16px;
    display: grid;
    gap: 10px;
    min-height: 112px;
}

.stat-card--compact {
    min-height: 84px;
    padding: 12px 14px;
    grid-template-columns: 36px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
}

.stat-card__badge {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.stat-card__badge--blue {
    background: var(--blue-soft);
    color: var(--blue);
}

.stat-card__badge--green {
    background: var(--green-soft);
    color: var(--green);
}

.stat-card__badge--amber {
    background: var(--amber-soft);
    color: var(--amber);
}

.stat-card__badge--red {
    background: var(--red-soft);
    color: var(--red);
}

.stat-card__body {
    min-width: 0;
}

.stat-card__value {
    font-size: 22px;
    font-weight: 800;
    line-height: 1.05;
    margin-top: 6px;
}

.stat-card__label {
    font-size: 12px;
}

.panel-card {
    border-radius: var(--radius-xl);
    padding: 16px;
    background: #191f27;
}

.panel-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.panel-card__head h3 {
    font-size: 20px;
}

.panel-card--table {
    padding-bottom: 12px;
}

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

.form-grid,
.users-list,
.disk-list,
.dialog__fields,
.users-list--compact {
    display: grid;
    gap: 10px;
}

.users-list,
.disk-list {
    max-height: 68vh;
    overflow: auto;
    padding-right: 2px;
}

.users-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.users-toolbar__title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.users-toolbar__title h3 {
    margin: 0;
    font-size: 22px;
}

.users-toolbar__icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--blue-soft);
    color: var(--blue);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.users-toolbar__actions {
    display: flex;
    gap: 8px;
}

.ghost-btn--icon,
.primary-btn--icon {
    min-width: 52px;
    padding-inline: 12px;
}

.users-table {
    --users-columns: 180px 44px 116px 72px 72px 200px minmax(320px, 1fr);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    background: #171e26;
}

.disks-table {
    --disks-columns: 180px 120px 140px minmax(220px, 1fr) 420px;
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    background: #171e26;
}

.disks-table__head {
    display: grid;
    grid-template-columns: var(--disks-columns);
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.disks-table__head-cell {
    min-width: 0;
}

.disks-table__head-cell--disk {
    text-align: left;
}

.disks-table__head-cell--status,
.disks-table__head-cell--owner,
.disks-table__head-cell--usage {
    text-align: center;
}

.users-table__head {
    display: grid;
    grid-template-columns: var(--users-columns);
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.users-table__head-cell {
    min-width: 0;
}

.users-table__head-cell--user {
    text-align: left;
}

.users-table__head-cell--id,
.users-table__head-cell--status,
.users-table__head-cell--tariff,
.users-table__head-cell--expires,
.users-table__head-cell--usage {
    text-align: center;
}

.users-list {
    gap: 0;
    max-height: 70vh;
    overflow: auto;
    padding-right: 0;
}

.row-actions,
.dialog__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.row-actions {
    margin-top: 14px;
}

.user-row,
.disk-row {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.9fr) auto;
    gap: 16px;
    align-items: center;
    padding: 14px 16px;
}

.disk-row--table {
    grid-template-columns: var(--disks-columns);
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    background: transparent;
}

.disk-row--table:last-child {
    border-bottom: 0;
}

.user-row--table {
    grid-template-columns: var(--users-columns);
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    background: transparent;
}

.user-row--table:last-child {
    border-bottom: 0;
}

.user-row__cell,
.disk-row__cell {
    min-width: 0;
}

.user-row__cell--user {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-row__identity-copy {
    min-width: 0;
}

.user-row__cell--id,
.user-row__cell--tariff,
.user-row__cell--expires {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

.user-row__identity-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    flex: 0 0 10px;
}

.user-row__identity-dot--green {
    background: var(--green);
    animation: pulse-green 1.8s ease-in-out infinite;
}

.user-row__identity-dot--amber {
    background: var(--amber);
    animation: pulse-amber 1.8s ease-in-out infinite;
}

.user-row__identity-dot--red {
    background: var(--red);
    animation: pulse-red 1.8s ease-in-out infinite;
}

.user-row__title,
.disk-row__title {
    margin: 0;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-row__meta,
.disk-row__meta {
    font-size: 12px;
    line-height: 1.5;
}

.disk-row__cell--status,
.disk-row__cell--owner,
.disk-row__cell--usage {
    display: flex;
    align-items: center;
    justify-content: center;
}

.disk-row__cell--actions {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.user-row__identity-copy .user-row__meta {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-row__cell--actions {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 128px;
    min-height: 28px;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-align: center;
    border: 1px solid var(--border);
}

.status-pill--green {
    background: var(--green-soft);
    border-color: rgba(95, 213, 154, 0.22);
    color: var(--green);
    animation: pulse-green-soft 1.9s ease-in-out infinite;
}

.status-pill--amber {
    background: var(--amber-soft);
    border-color: rgba(255, 181, 83, 0.22);
    color: var(--amber);
    animation: pulse-amber-soft 1.9s ease-in-out infinite;
}

.status-pill--red {
    background: var(--red-soft);
    border-color: rgba(255, 123, 131, 0.22);
    color: var(--red);
    animation: pulse-red-soft 1.9s ease-in-out infinite;
}

.role-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    min-width: 76px;
    padding: 8px 10px;
    border-radius: 14px;
    border: 1px solid var(--border-strong);
    font-size: 12px;
    font-weight: 700;
}

.role-pill--green {
    background: var(--green-soft);
    border-color: rgba(95, 213, 154, 0.22);
    color: var(--green);
}

.role-pill--blue {
    background: var(--blue-soft);
    border-color: rgba(66, 200, 255, 0.22);
    color: var(--blue);
}

.role-pill--user {
    min-width: 76px;
}

.user-row__cell--status {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-row__cell--usage {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.usage-stack {
    width: 100%;
    display: grid;
    gap: 8px;
    justify-items: center;
}

.usage-copy {
    font-size: 12px;
    color: var(--text);
    text-align: center;
    width: 100%;
}

.usage-bar {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: #10161d;
    overflow: hidden;
    border: 1px solid var(--border);
}

.usage-bar__fill {
    height: 100%;
    border-radius: inherit;
    background-size: 22px 100%;
    animation: usage-stripes 1.2s linear infinite;
}

.usage-bar__fill--green {
    background-image: linear-gradient(90deg, #119f79 0%, #2bd7a3 100%), repeating-linear-gradient(135deg, rgba(255,255,255,0.2) 0 8px, rgba(255,255,255,0.05) 8px 16px);
    background-blend-mode: screen;
}

.usage-bar__fill--amber {
    background-image: linear-gradient(90deg, #d9931b 0%, #ffbf5f 100%), repeating-linear-gradient(135deg, rgba(255,255,255,0.2) 0 8px, rgba(255,255,255,0.05) 8px 16px);
    background-blend-mode: screen;
}

.usage-bar__fill--red {
    background-image: linear-gradient(90deg, #d34d56 0%, #ff7b83 100%), repeating-linear-gradient(135deg, rgba(255,255,255,0.2) 0 8px, rgba(255,255,255,0.05) 8px 16px);
    background-blend-mode: screen;
}

.usage-empty {
    width: 100%;
    text-align: center;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
}

.user-row__cell--actions .action-btn,
.user-row__cell--actions .role-pill,
.disk-row__cell--actions .action-btn,
.topbar__actions .ghost-btn,
.dialog__actions .primary-btn,
.dialog__actions .ghost-btn,
.row-actions .primary-btn {
    min-height: 36px;
    padding: 8px 10px;
    font-size: 12px;
    white-space: nowrap;
    flex: 0 0 auto;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
}

.checkbox-row input {
    width: 16px;
    height: 16px;
    margin: 0;
    padding: 0;
    border-radius: 5px;
}

.dialog {
    position: fixed;
    inset: 0;
    background: rgba(7, 10, 14, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 100;
}

.dialog__card {
    width: min(520px, 100%);
    border-radius: 22px;
    padding: 20px;
    position: relative;
    background: #151b23;
}

.dialog__card h3 {
    font-size: 28px;
}

.dialog__copy {
    margin: 10px 0 0;
    font-size: 14px;
    line-height: 1.6;
}

.dialog__fields {
    margin-top: 16px;
}

.dialog__actions {
    margin-top: 16px;
}

.dialog__close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    font-size: 28px;
    cursor: pointer;
}

@keyframes pulse-green {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(95, 213, 154, 0.18); }
    50% { opacity: 0.68; box-shadow: 0 0 0 6px rgba(95, 213, 154, 0.04); }
}

@keyframes pulse-amber {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(255, 181, 83, 0.18); }
    50% { opacity: 0.68; box-shadow: 0 0 0 6px rgba(255, 181, 83, 0.04); }
}

@keyframes pulse-red {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(255, 123, 131, 0.18); }
    50% { opacity: 0.68; box-shadow: 0 0 0 6px rgba(255, 123, 131, 0.04); }
}

@keyframes pulse-green-soft {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.08); }
}

@keyframes pulse-amber-soft {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.08); }
}

@keyframes pulse-red-soft {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.08); }
}

@keyframes usage-stripes {
    0% { background-position: 0 0, 0 0; }
    100% { background-position: 0 0, 22px 0; }
}

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

    .users-table {
        --users-columns: 160px 40px 108px 64px 64px 180px minmax(300px, 1fr);
    }

    .disks-table {
        --disks-columns: 150px 108px 120px minmax(180px, 1fr) 320px;
    }

    .users-table__head,
    .user-row--table,
    .disks-table__head,
    .disk-row--table {
        gap: 10px;
    }

    .user-row,
    .disk-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .user-row__actions {
        justify-content: flex-start;
    }
}

@media (max-width: 1040px) {
    .panel-shell,
    .split-grid {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
    }

    .content {
        min-height: auto;
    }

    .users-list,
    .disk-list {
        max-height: none;
    }
}

@media (max-width: 760px) {
    .login-screen,
    .panel-shell,
    .dialog {
        padding: 12px;
    }

    .login-card,
    .sidebar,
    .content,
    .panel-card,
    .dialog__card {
        border-radius: 18px;
        padding: 14px;
    }

    .stats-grid,
    .users-list--compact {
        grid-template-columns: 1fr;
    }

    .users-toolbar,
    .topbar,
    .topbar__actions,
    .dialog__actions,
    .row-actions,
    .user-row__actions {
        flex-direction: column;
        align-items: stretch;
    }

    .users-toolbar__actions,
    .topbar__actions {
        width: 100%;
    }

    .users-table {
        overflow-x: auto;
    }

    .users-table__head,
    .user-row--table {
        min-width: 860px;
    }

    .topbar__actions .ghost-btn,
    .row-actions .primary-btn,
    .dialog__actions .primary-btn,
    .dialog__actions .ghost-btn,
    .user-row__actions .action-btn,
    .users-toolbar__actions .ghost-btn,
    .users-toolbar__actions .primary-btn {
        width: 100%;
    }

    .login-card h1,
    .topbar h1,
    .dialog__card h3,
    .sidebar__brand h2 {
        font-size: 28px;
    }
}
