:root {
    color-scheme: light;
    --bg: #f4f7fb;
    --panel: #ffffff;
    --line: #d8e0ea;
    --text: #172033;
    --muted: #667085;
    --primary: #136f63;
    --primary-dark: #0f574e;
    --accent: #b42318;
    --soft: #eef6f4;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
}

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

.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(10px);
}

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

.brand {
    font-weight: 800;
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-size: 13px;
}

.topbar nav a {
    color: var(--muted);
    font-weight: 700;
    font-size: 14px;
}

.container {
    width: min(1180px, calc(100% - 32px));
    margin: 24px auto 56px;
}

.page-head,
.toolbar,
.record-card,
.form-panel,
.auth-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    padding: 24px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 8px;
    font-size: 28px;
}

.muted {
    color: var(--muted);
}

.stat {
    min-width: 150px;
    padding: 16px;
    background: var(--soft);
    border-radius: 8px;
}

.stat span,
.detail-grid span,
.note-block span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.stat strong {
    font-size: 32px;
}

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

.search {
    display: flex;
    flex: 1;
    gap: 10px;
}

input,
textarea {
    width: 100%;
    border: 1px solid #cfd8e3;
    border-radius: 8px;
    padding: 11px 12px;
    color: var(--text);
    font: inherit;
    background: #fff;
}

textarea {
    resize: vertical;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-weight: 800;
    white-space: nowrap;
    cursor: pointer;
}

.btn.primary {
    background: var(--primary);
    color: #fff;
}

.btn.primary:hover {
    background: var(--primary-dark);
}

.btn.secondary {
    background: #edf2f7;
    color: var(--text);
}

.btn.ghost {
    border-color: var(--line);
    background: #fff;
    color: var(--muted);
}

.btn.danger,
.alert.danger {
    background: #fef3f2;
    color: var(--accent);
    border-color: #fecdca;
}

.btn.small {
    min-height: 34px;
    padding: 0 10px;
    font-size: 13px;
}

.records {
    display: grid;
    gap: 14px;
}

.list-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.vps-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.vps-table th,
.vps-table td {
    padding: 11px 14px;
    border-bottom: 1px solid #edf2f7;
    text-align: left;
    vertical-align: top;
}

.vps-table th {
    background: #f8fafc;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.vps-table tbody tr:hover {
    background: #fbfcfe;
}

.vps-table tr:last-child td {
    border-bottom: 0;
}

.vps-table th:nth-child(1),
.vps-table td:nth-child(1) {
    width: 170px;
}

.vps-table th:nth-child(2),
.vps-table td:nth-child(2) {
    width: 190px;
}

.vps-table th:nth-child(3),
.vps-table td:nth-child(3) {
    width: 130px;
}

.vps-table th:nth-child(4),
.vps-table td:nth-child(4) {
    width: 150px;
}

.vps-table th:nth-child(6),
.vps-table td:nth-child(6) {
    width: 132px;
}

.vps-table td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table-ip {
    font-family: Consolas, Monaco, monospace;
    font-size: 17px;
    font-weight: 800;
}

.table-game {
    font-weight: 800;
}

.table-phone {
    color: var(--text);
    font-weight: 700;
}

.table-note {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.45;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
}

.table-actions {
    align-items: flex-start;
    justify-content: flex-end;
}

.compact-list {
    display: grid;
    gap: 6px;
}

.compact-head,
.compact-row {
    display: grid;
    grid-template-columns: 180px minmax(180px, 1fr) minmax(140px, 1fr) 160px 150px;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 8px 12px;
}

.compact-head {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.compact-row {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.compact-row > span,
.compact-row > a {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.compact-primary strong {
    font-family: Consolas, Monaco, monospace;
    font-size: 18px;
}

.compact-game {
    font-weight: 800;
}

.compact-actions {
    justify-content: flex-end;
}

.record-card {
    padding: 18px;
}

.record-main,
.columns,
.form-head,
.form-actions {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.form-head {
    align-items: flex-start;
    margin-bottom: 18px;
}

.form-head-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ip-line {
    font-family: Consolas, Monaco, monospace;
    font-size: 24px;
    font-weight: 800;
}

.meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
    color: var(--muted);
}

.actions {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

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

.detail-grid div,
.columns > div,
.note-block {
    min-width: 0;
    padding: 14px;
    background: #f8fafc;
    border: 1px solid #edf2f7;
    border-radius: 8px;
}

.detail-grid strong,
li {
    overflow-wrap: anywhere;
}

.columns > div {
    width: 50%;
}

.columns h3 {
    margin-bottom: 10px;
    font-size: 16px;
}

ol {
    margin: 0;
    padding-left: 20px;
}

.note-block {
    margin-top: 14px;
}

.note-block p {
    margin-bottom: 14px;
    white-space: normal;
}

.form-panel,
.auth-panel {
    padding: 24px;
}

.auth-panel {
    width: min(440px, 100%);
    margin: 8vh auto;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

label span {
    display: block;
    margin-bottom: 7px;
    color: var(--muted);
    font-weight: 800;
    font-size: 13px;
}

.wide {
    grid-column: 1 / -1;
}

input[readonly],
textarea[readonly] {
    background: #f8fafc;
    color: #475467;
}

.user-layout {
    display: grid;
    grid-template-columns: minmax(360px, 0.9fr) minmax(420px, 1.1fr);
    gap: 16px;
    margin-top: 16px;
}

.compact-page-head {
    align-items: center;
}

fieldset.permissions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

fieldset.permissions legend {
    padding: 0 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.permissions label,
.inline-check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.permissions input,
.inline-check input {
    width: auto;
}

.permissions label span,
.inline-check span {
    margin: 0;
    color: var(--text);
    font-size: 14px;
    text-transform: none;
}

.user-list {
    display: grid;
    gap: 8px;
}

.user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid #edf2f7;
    border-radius: 8px;
}

.user-row small,
.user-row span {
    display: block;
    margin-top: 4px;
    color: var(--muted);
}

.status {
    align-self: center;
    padding: 7px 9px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 800;
}

.status.on {
    background: #ecfdf3;
    color: #027a48;
}

.status.off {
    background: #f2f4f7;
    color: #667085;
}

.alert,
.empty {
    margin-bottom: 16px;
    padding: 13px 14px;
    border-radius: 8px;
    border: 1px solid #badbcc;
    background: #ecfdf3;
    color: #027a48;
    font-weight: 700;
}

.empty {
    margin: 0;
    background: #fff;
    color: var(--muted);
    border-color: var(--line);
}

@media (max-width: 760px) {
    .topbar,
    .page-head,
    .toolbar,
    .record-main,
    .columns,
    .form-head,
    .form-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .search,
    .actions {
        flex-wrap: wrap;
    }

    .detail-grid,
    .form-grid,
    .user-layout {
        grid-template-columns: 1fr;
    }

    .list-panel {
        background: transparent;
        border: 0;
        overflow: visible;
    }

    .vps-table,
    .vps-table thead,
    .vps-table tbody,
    .vps-table tr,
    .vps-table td {
        display: block;
        width: 100%;
    }

    .vps-table thead {
        display: none;
    }

    .vps-table tr {
        margin-bottom: 10px;
        padding: 12px;
        background: var(--panel);
        border: 1px solid var(--line);
        border-radius: 8px;
    }

    .vps-table td {
        display: grid;
        grid-template-columns: 96px minmax(0, 1fr);
        gap: 10px;
        padding: 7px 0;
        border: 0;
        white-space: normal;
    }

    .vps-table td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 12px;
        font-weight: 800;
        text-transform: uppercase;
    }

    .table-actions {
        justify-content: flex-start;
    }

    .compact-head {
        display: none;
    }

    .compact-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .compact-actions {
        justify-content: flex-start;
    }

    .columns > div {
        width: 100%;
    }
}
