:root {
    --bg: #f4f7fb;
    --panel: #ffffff;
    --line: #dce4ef;
    --text: #243447;
    --muted: #6d7f92;
    --primary: #17b6a4;
    --primary-dark: #119181;
    --blue: #2e90ff;
    --orange: #ffb11b;
    --red: #ff6b6b;
    --shadow: 0 22px 48px rgba(25, 54, 88, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    color: var(--text);
    background:
        radial-gradient(circle at top right, rgba(23, 182, 164, 0.12), transparent 25%),
        linear-gradient(180deg, #f9fbfe 0%, var(--bg) 100%);
}

.login-body {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background:
        linear-gradient(rgba(15, 23, 42, 0.32), rgba(15, 23, 42, 0.32)),
        radial-gradient(circle at top, rgba(23, 182, 164, 0.16), transparent 24%),
        #eef3f9;
}

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

.page-shell {
    max-width: 1760px;
    margin: 0 auto;
    padding: 18px 22px 22px;
}

.hero,
.panel,
.stat-card,
.modal-card {
    background: var(--panel);
    border: 1px solid rgba(220, 228, 239, 0.9);
    box-shadow: var(--shadow);
}

.hero {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    padding: 16px 18px;
    border-radius: 20px;
}

.hero-compact {
    justify-content: flex-end;
    padding: 10px 14px;
}

.eyebrow {
    margin: 0 0 8px;
    font-size: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--primary);
}

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

.hero h1 {
    font-size: 34px;
    margin-bottom: 12px;
}

.hero-copy {
    max-width: 760px;
    color: var(--muted);
    line-height: 1.65;
}

.hero-side {
    width: auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.token-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: var(--muted);
}

.auth-panel {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.72);
    white-space: nowrap;
}

.auth-label {
    color: var(--muted);
    font-size: 12px;
    margin-right: 2px;
}

.auth-panel strong {
    font-size: 14px;
    line-height: 1;
}

.hero-actions,
.toolbar-actions,
.toolbar-meta,
.pager,
.form-actions,
.inline-grid {
    display: flex;
    gap: 10px;
    align-items: center;
}

.inline-grow {
    flex: 1 1 auto;
}

.import-defaults {
    display: grid;
    grid-template-columns: 180px 180px minmax(280px, 1fr);
    gap: 12px;
    align-items: end;
}

.import-defaults label {
    min-width: 0;
}

.form-hint {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
    margin-top: -4px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    margin: 8px 0 10px;
}

.stats-grid-compact {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.stat-card {
    border-radius: 14px;
    padding: 10px 14px 8px;
    min-height: 58px;
}

.stat-card span {
    display: block;
    color: var(--muted);
    margin-bottom: 6px;
    font-size: 12px;
}

.stat-card strong {
    font-size: 18px;
    line-height: 1;
}

.panel {
    border-radius: 20px;
    padding: 16px;
    margin-bottom: 14px;
}

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

.panel-head h2 {
    font-size: 20px;
    line-height: 1.1;
}

.hint {
    color: var(--muted);
    font-size: 12px;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(9, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 9px 12px;
    background: #fff;
    color: var(--text);
    font-size: 13px;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 4px rgba(23, 182, 164, 0.12);
}

.btn {
    border: 0;
    border-radius: 10px;
    padding: 9px 14px;
    cursor: pointer;
    transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
    font-size: 13px;
    line-height: 1.2;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.btn-secondary {
    color: #fff;
    background: linear-gradient(135deg, #1aa9ff 0%, #1772f8 100%);
}

.btn-info {
    color: #fff;
    background: #2e90ff;
}

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

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

.btn-ghost {
    background: #eef4fb;
    color: var(--text);
}

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

.toolbar-meta {
    margin-left: auto;
    font-size: 13px;
}

.table-shell {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 16px;
    min-height: 460px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1320px;
}

th,
td {
    padding: 10px 12px;
    border-bottom: 1px solid #edf2f8;
    text-align: left;
    vertical-align: middle;
    font-size: 13px;
}

th {
    background: #fbfdff;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.checkbox-col {
    width: 40px;
}

.link-cell {
    color: #1880ff;
    text-decoration: none;
}

.link-cell:hover {
    text-decoration: underline;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.status-idle,
.status-ready {
    color: #0f8b6d;
    background: rgba(21, 173, 118, 0.12);
}

.status-assigned {
    color: #1565c0;
    background: rgba(46, 144, 255, 0.12);
}

.status-success {
    color: #16794d;
    background: rgba(22, 121, 77, 0.12);
}

.status-relogin {
    color: #9a4f00;
    background: rgba(255, 163, 26, 0.18);
}

.status-failed,
.status-blocked,
.status-deleted {
    color: #cb3838;
    background: rgba(255, 107, 107, 0.14);
}

.status-expired,
.status-disabled {
    color: #9d6500;
    background: rgba(255, 177, 27, 0.16);
}

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

.success-text {
    color: #0f8b6d;
}

.danger-text {
    color: #cb3838;
}

.empty-row {
    text-align: center;
    color: var(--muted);
    padding: 80px 16px;
}

.table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    font-size: 13px;
}

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

pre {
    margin: 0;
    padding: 12px 14px;
    background: #0f172a;
    color: #dbeafe;
    border-radius: 12px;
    overflow: auto;
    font-size: 12px;
    line-height: 1.55;
}

.modal {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
    background: rgba(10, 23, 41, 0.55);
    z-index: 1000;
}

.hidden {
    display: none;
}

.modal-card {
    width: min(680px, 100%);
    border-radius: 18px;
    padding: 18px;
}

.modal-card.wide {
    width: min(920px, 100%);
}

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

.close-btn {
    background: transparent;
    border: 0;
    font-size: 24px;
    cursor: pointer;
}

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

.modal-form label {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.full-row {
    grid-column: 1 / -1;
}

.login-shell {
    width: min(460px, calc(100vw - 32px));
}

.login-card {
    border-radius: 20px;
    padding: 28px 26px;
}

.login-brand {
    margin-bottom: 10px;
    color: var(--primary);
    font-size: 13px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.login-card h1 {
    margin-bottom: 16px;
    font-size: 32px;
}

.login-copy {
    margin-bottom: 18px;
    color: var(--muted);
    line-height: 1.6;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.login-form label {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.remember-check {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 8px !important;
    color: var(--muted);
    font-size: 13px;
}

.remember-check input {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    margin: 0;
}

.login-submit {
    margin-top: 2px;
    width: 100%;
}

.login-message {
    min-height: 18px;
    font-size: 12px;
    line-height: 1.4;
}

.list-panel {
    padding: 18px 18px 14px;
}

.list-panel .panel-head {
    margin-bottom: 10px;
}

.list-panel h2 {
    font-size: 22px;
}

.list-panel .hint {
    font-size: 11px;
}

.list-panel .filters-grid + .toolbar {
    margin-top: 2px;
}

.list-panel .btn {
    min-height: 40px;
}

.list-panel .toolbar-actions {
    flex-wrap: wrap;
}

.list-panel .toolbar-meta label {
    gap: 8px;
    display: inline-flex;
    align-items: center;
}

.api-docs-compact {
    padding: 14px 16px;
}

.api-docs-compact .panel-head h2 {
    font-size: 18px;
}

.api-docs-compact .hint {
    font-size: 11px;
}

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

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

    .hero {
        flex-direction: column;
    }

    .hero-side {
        width: 100%;
    }

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

    .table-shell {
        min-height: 360px;
    }
}

@media (max-width: 760px) {
    .page-shell {
        padding: 16px;
    }

    .stats-grid,
    .filters-grid,
    .docs-grid,
    .modal-form,
    .import-defaults {
        grid-template-columns: 1fr;
    }

    .toolbar,
    .table-footer,
    .toolbar-meta,
    .hero-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-side,
    .auth-panel {
        flex-direction: column;
        align-items: stretch;
        white-space: normal;
    }

    .table-shell {
        min-height: 280px;
    }
}
