:root {
    --bg: #f4f6fb;
    --panel: #ffffff;
    --border: #e3e8f0;
    --text: #0f172a;
    --muted: #64748b;
    --accent: #2563eb;
    --accent-dark: #1d4ed8;
    --accent-soft: #dbeafe;
    --success: #16a34a;
    --success-soft: #dcfce7;
    --danger: #dc2626;
    --danger-soft: #fee2e2;
    --warning: #d97706;
    --warning-soft: #fef3c7;
    --radius: 14px;
    --shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
    --sidebar: #0b1222;
    --sidebar-2: #121d35;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
    color: var(--text);
    background: var(--bg);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
}

.mono,
code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

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

.link {
    font-size: 13px;
    text-decoration: none;
}

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

/* ---------- 布局 ---------- */

.shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 232px;
    flex: 0 0 232px;
    background: linear-gradient(165deg, var(--sidebar), var(--sidebar-2));
    color: #cbd5e1;
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 8px 22px;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 11px;
    background: linear-gradient(135deg, #3b82f6, #7c3aed);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.5px;
    box-shadow: 0 8px 18px rgba(59, 130, 246, 0.35);
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.brand-text strong {
    color: #fff;
    font-size: 15px;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand-text small {
    color: #94a3b8;
    font-size: 11.5px;
    letter-spacing: 1px;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
}

.nav a {
    display: block;
    padding: 10px 14px;
    border-radius: 10px;
    color: #9aa8bf;
    text-decoration: none;
    font-size: 13.5px;
    transition: background 0.15s, color 0.15s;
}

.nav a:hover {
    background: rgba(148, 163, 184, 0.12);
    color: #fff;
}

.nav a.active {
    background: rgba(59, 130, 246, 0.2);
    color: #fff;
    font-weight: 600;
    box-shadow: inset 3px 0 0 #60a5fa;
}

.sidebar-foot {
    margin-top: auto;
    padding: 16px 10px 0;
    font-size: 11.5px;
    color: #64748b;
}

.main {
    flex: 1;
    min-width: 0;
    padding: 0 34px 48px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 24px 0 16px;
    border-bottom: 1px solid var(--border);
}

.topbar-title h1 {
    margin: 0;
    font-size: 22px;
    letter-spacing: -0.2px;
}

.topbar-sub {
    display: block;
    margin-top: 2px;
    font-size: 12.5px;
    color: var(--muted);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
}

.user-name {
    font-size: 13px;
    color: var(--muted);
}

.content {
    padding-top: 20px;
}

.inline-form {
    display: inline-flex;
    margin: 0;
}

/* ---------- 提示 ---------- */

.flash {
    margin-top: 14px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13.5px;
    border-left: 4px solid transparent;
}

.flash-success {
    background: #ecfdf3;
    border-color: var(--success);
    color: #166534;
}

.flash-error {
    background: #fef2f2;
    border-color: var(--danger);
    color: #991b1b;
}

.flash-info {
    background: #eff6ff;
    border-color: var(--accent);
    color: #1e40af;
}

.flash-warn {
    background: #fffbeb;
    border-color: var(--warning);
    color: #92400e;
}

.alert {
    margin-bottom: 20px;
    padding: 13px 16px;
    border-radius: 10px;
    border-left: 4px solid transparent;
    font-size: 13.5px;
    line-height: 1.7;
}

.alert-warn {
    background: #fffbeb;
    border-color: var(--warning);
    color: #92400e;
}

.alert-info {
    background: #eff6ff;
    border-color: var(--accent);
    color: #1e3a8a;
}

/* ---------- 卡片与栅格 ---------- */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(196px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow);
}

.stat-card-accent {
    background: linear-gradient(135deg, #eff6ff, #f5f3ff);
    border-color: #c7d2fe;
}

.stat-label {
    font-size: 12.5px;
    color: var(--muted);
}

.stat-value {
    margin: 6px 0 4px;
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.stat-value-small {
    font-size: 13.5px;
    font-weight: 600;
    word-break: break-all;
    line-height: 1.5;
}

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

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

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.panel-head-line {
    border-top: 1px solid var(--border);
}

.panel-title {
    margin: 0;
    font-size: 15px;
    font-weight: 650;
}

.panel-body {
    padding: 20px;
}

.panel-body-flush {
    padding: 0;
}

.page-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.page-actions p {
    margin: 0;
    max-width: 720px;
}

/* ---------- 图表 ---------- */

.chart {
    display: flex;
    align-items: stretch;
    gap: 10px;
    height: 190px;
}

.chart-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    min-width: 0;
}

.chart-value {
    font-size: 11.5px;
    color: var(--muted);
    margin-bottom: 5px;
}

.chart-bar {
    width: 100%;
    height: 130px;
    display: flex;
    align-items: flex-end;
    background: #eef2f7;
    border-radius: 8px;
    overflow: hidden;
}

.chart-bar span {
    display: block;
    width: 100%;
    min-height: 3px;
    border-radius: 8px;
    background: linear-gradient(180deg, #60a5fa, #2563eb);
}

.chart-label {
    margin-top: 8px;
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
}

.rank-list {
    margin: 0;
    padding-left: 20px;
}

.rank-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px dashed var(--border);
}

.rank-list li:last-child {
    border-bottom: none;
}

.rank-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rank-count {
    font-size: 12.5px;
    color: var(--muted);
    white-space: nowrap;
}

/* ---------- 表格 ---------- */

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

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.table th {
    text-align: left;
    padding: 11px 14px;
    background: #f8fafc;
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table td {
    padding: 12px 14px;
    border-bottom: 1px solid #eef2f7;
    vertical-align: middle;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover {
    background: #fafcff;
}

.table .mono {
    font-size: 12.5px;
}

.table-compact th,
.table-compact td {
    padding: 9px 12px;
}

.table-clients th,
.table-clients td {
    padding-left: 8px;
    padding-right: 8px;
}

.nowrap {
    white-space: nowrap;
}

.cell-title {
    font-weight: 600;
}

.table .cell-title {
    white-space: nowrap;
}

.user-quota-full {
    color: var(--danger);
    font-weight: 600;
}

.cell-sub {
    margin-top: 2px;
    font-size: 12px;
    color: var(--muted);
}

.cell-sub.is-danger {
    color: var(--danger);
}

.table td.is-danger {
    color: var(--danger);
}

.table-users th,
.table-users td {
    padding-left: 7px;
    padding-right: 7px;
}

.table-users .col-check {
    width: 30px;
    text-align: center;
    padding-left: 6px;
    padding-right: 0;
}

.table-users .col-check input {
    width: 14px;
    height: 14px;
    cursor: pointer;
}

.bulk-bar {
    display: none;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
}

.bulk-bar.is-visible {
    display: flex;
}

.bulk-count {
    font-size: 12.5px;
    color: var(--muted);
}

.bulk-count strong {
    color: var(--text);
}

.bulk-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.bulk-group + .bulk-group {
    margin-left: auto;
}

.bulk-bar input[type="date"] {
    width: 138px;
}

.table-users .cell-code {
    max-width: 96px;
}

.table-users .cell-loc {
    max-width: 140px;
}

.table-users .cell-account {
    margin-top: 2px;
    font-size: 12.5px;
    color: var(--text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    white-space: nowrap;
}

.col-actions {
    white-space: nowrap;
}

.col-actions .inline-form + .inline-form {
    margin-left: 4px;
}

.table-users .code-inline {
    white-space: normal;
    word-break: break-all;
}

.cell-code {
    display: block;
    max-width: 150px;
    overflow-wrap: anywhere;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    line-height: 1.45;
}

.cell-loc {
    margin-top: 2px;
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    color: var(--muted);
}

.expiry-form {
    display: flex;
    align-items: center;
    gap: 4px;
}

.expiry-form input[type="date"] {
    width: 112px;
    padding: 4px 4px;
    font-size: 12px;
}

.cell-msg {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.col-actions {
    width: 1%;
    white-space: nowrap;
}

.action-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}

.empty {
    margin: 0;
    padding: 26px 20px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

.empty-state {
    text-align: center;
    padding: 54px 20px;
}

.empty-code {
    font-size: 52px;
    font-weight: 800;
    color: #cbd5e1;
    line-height: 1;
}

.empty-state h2 {
    margin: 12px 0 6px;
}

/* ---------- 徽标 ---------- */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.7;
    white-space: nowrap;
    margin: 1px 2px 1px 0;
}

.badge-green {
    background: var(--success-soft);
    color: #15803d;
}

.badge-red {
    background: var(--danger-soft);
    color: #b91c1c;
}

.badge-amber {
    background: var(--warning-soft);
    color: #b45309;
}

.badge-blue {
    background: var(--accent-soft);
    color: #1d4ed8;
}

.badge-gray {
    background: #f1f5f9;
    color: #475569;
}

/* ---------- 按钮 ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 9px;
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.4;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.05s;
}

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

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.25);
}

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

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

.btn-ghost:hover {
    border-color: #94a3b8;
    background: #f8fafc;
}

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

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

.btn-sm {
    padding: 6px 11px;
    font-size: 12.5px;
    border-radius: 8px;
}

.btn-block {
    width: 100%;
}

/* ---------- 表单 ---------- */

.field {
    margin-bottom: 16px;
}

.field:last-child {
    margin-bottom: 0;
}

.field label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="email"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    background: #fff;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

input[readonly] {
    background: #f8fafc;
}

textarea {
    resize: vertical;
    min-height: 90px;
}

.help {
    margin: 6px 0 0;
    font-size: 12.5px;
    color: var(--muted);
    line-height: 1.7;
}

.required {
    color: var(--danger);
}

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

.form-panel .panel-body {
    padding-bottom: 8px;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    background: #fbfdff;
}

.field-narrow {
    max-width: 340px;
}

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

.stack-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.input-with-btn {
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-with-btn input {
    flex: 1;
    min-width: 0;
}

.check-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.check-card {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 13px 14px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.check-card:hover {
    border-color: #93c5fd;
    background: #f8fbff;
}

.check-card input {
    margin: 0 0 4px;
}

.check-title {
    font-size: 13.5px;
    font-weight: 600;
}

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

.radio-row {
    display: flex;
    align-items: center;
    gap: 22px;
    flex-wrap: wrap;
}

.radio-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13.5px;
    cursor: pointer;
}

.expiry-date {
    margin-top: 10px;
    max-width: 240px;
}

.table-picker {
    margin-top: 14px;
    padding: 14px;
    border: 1px dashed #cbd5e1;
    border-radius: 11px;
    background: #f8fafc;
}

.table-picker.is-hidden {
    display: none;
}

.is-hidden {
    display: none !important;
}

.check-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px 14px;
    max-height: 280px;
    overflow: auto;
}

.check-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
}

.check-item input {
    margin: 0;
}

/* ---------- 新建 / 编辑授权 ---------- */

.form-page {
    max-width: 1080px;
    margin: 0 auto;
}

.form-intro {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 16px 20px;
    margin-bottom: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(120deg, #f8fbff, #ffffff 60%);
    box-shadow: var(--shadow);
}

.form-intro-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.form-intro-chip {
    flex: none;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: #1d4ed8;
    background: #e8f1ff;
}

.form-intro p {
    margin: 0;
    font-size: 13.5px;
    color: var(--muted);
    line-height: 1.6;
}

.form-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.form-section + .form-section {
    border-top: 1px solid var(--border);
}

.form-section-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 22px 24px 0;
}

.form-step {
    flex: none;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    background: linear-gradient(135deg, #3b82f6, #7c3aed);
    box-shadow: 0 6px 14px rgba(59, 130, 246, 0.25);
}

.form-section-title h2 {
    margin: 1px 0 3px;
    font-size: 15.5px;
    font-weight: 650;
}

.form-section-title p {
    margin: 0;
    font-size: 12.5px;
    color: var(--muted);
}

.form-section-body {
    padding: 20px 24px 26px 70px;
}

.form-section-body .help:last-child {
    margin-bottom: 0;
}

.permission-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 12px;
}

.permission-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.permission-card:hover {
    border-color: #93c5fd;
}

.permission-card input {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: var(--accent);
    cursor: pointer;
}

.permission-title {
    padding-right: 24px;
    font-size: 13.5px;
    font-weight: 600;
}

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

.permission-tag {
    align-self: flex-start;
    margin-top: 8px;
    padding: 3px 7px;
    border-radius: 6px;
    font-size: 10.5px;
    color: #475569;
    background: #f1f5f9;
}

.permission-card:has(input:checked) {
    border-color: #3b82f6;
    background: #f6faff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.permission-card:has(input:checked) .permission-title {
    color: #1d4ed8;
}

.permission-card:has(input:checked) .permission-tag {
    color: #1d4ed8;
    background: #e0edff;
}

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

.segmented-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.segmented-item:hover {
    border-color: #93c5fd;
}

.segmented-item input {
    margin: 3px 0 0;
    accent-color: var(--accent);
    cursor: pointer;
}

.segmented-text {
    display: block;
    min-width: 0;
}

.segmented-text strong {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
}

.segmented-text small {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: var(--muted);
}

.segmented-item:has(input:checked) {
    border-color: #3b82f6;
    background: #f6faff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.segmented-item:has(input:checked) strong {
    color: #1d4ed8;
}

.key-block {
    margin-top: 18px;
    padding: 14px 16px 4px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #f8fafc;
}

.key-block-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.key-block-title {
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--muted);
}

.picker-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
}

.picker-title {
    font-size: 12.5px;
    font-weight: 600;
    color: #475569;
}

.picker-count {
    margin-left: 4px;
    font-weight: 500;
    color: var(--muted);
}

.picker-all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--muted);
    cursor: pointer;
}

.picker-all input {
    margin: 0;
    accent-color: var(--accent);
}

.limit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
    margin-top: 20px;
}

.input-suffix {
    display: flex;
    align-items: stretch;
    border: 1px solid #d7dfea;
    border-radius: 9px;
    background: #fff;
    overflow: hidden;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.input-suffix:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.input-suffix input {
    flex: 1;
    min-width: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.input-suffix input:focus {
    box-shadow: none;
}

.input-suffix span {
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    border-left: 1px solid #e2e8f0;
    background: #f8fafc;
    font-size: 12.5px;
    color: var(--muted);
    white-space: nowrap;
}

.form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 24px;
    border-top: 1px solid var(--border);
    background: #fbfdff;
}

.form-footer-hint {
    margin: 0;
    max-width: 560px;
    font-size: 12.5px;
    color: var(--muted);
    line-height: 1.6;
}

.form-footer-actions {
    display: flex;
    flex: none;
    gap: 10px;
}

.filter-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    align-items: end;
}

.filter-form .field {
    margin-bottom: 0;
}

/* ---------- 代码与密钥 ---------- */

.code-inline {
    padding: 2px 6px;
    border-radius: 5px;
    background: #f1f5f9;
    font-size: 12.5px;
    word-break: break-all;
}

.table .code-inline {
    white-space: nowrap;
    word-break: normal;
}

.code-block {
    margin: 0 0 14px;
    padding: 16px;
    border-radius: 11px;
    background: #0b1222;
    color: #dbe5f4;
    font-size: 12.5px;
    line-height: 1.7;
    overflow: auto;
    white-space: pre;
    tab-size: 4;
}

.code-block code {
    font-family: inherit;
    color: inherit;
}

.key-block {
    margin-bottom: 18px;
}

.key-block:last-child {
    margin-bottom: 0;
}

.key-label {
    margin-bottom: 6px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--muted);
}

.key-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.key-value {
    flex: 1;
    min-width: 0;
    display: block;
    padding: 11px 13px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #f8fafc;
    font-size: 13px;
    word-break: break-all;
    line-height: 1.5;
}

.key-secret {
    background: #fff7ed;
    border-color: #fdba74;
    color: #9a3412;
}

/* ---------- 列表与分页 ---------- */

.detail-list {
    display: grid;
    grid-template-columns: 140px minmax(0, 1fr);
    gap: 12px 18px;
    margin: 0;
    font-size: 13.5px;
}

.detail-list dt {
    color: var(--muted);
}

.detail-list dd {
    margin: 0;
    word-break: break-all;
}

.bullet-list,
.step-list {
    margin: 0;
    padding-left: 20px;
}

.bullet-list li,
.step-list li {
    margin: 8px 0;
    line-height: 1.75;
}

.sub-title {
    margin: 22px 0 10px;
    font-size: 14px;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    background: #fbfdff;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font-size: 12.5px;
    text-decoration: none;
}

.page-link:hover {
    border-color: #93c5fd;
}

.page-link.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    font-weight: 600;
}

.page-gap {
    color: var(--muted);
    padding: 0 2px;
}

/* ---------- 登录页 ---------- */

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        linear-gradient(rgba(15, 23, 42, 0.025) 1px, transparent 1px) 0 0 / 38px 38px,
        linear-gradient(90deg, rgba(15, 23, 42, 0.025) 1px, transparent 1px) 0 0 / 38px 38px,
        radial-gradient(circle at 12% 14%, rgba(59, 130, 246, 0.16) 0, rgba(59, 130, 246, 0) 44%),
        radial-gradient(circle at 88% 6%, rgba(124, 58, 237, 0.16) 0, rgba(124, 58, 237, 0) 40%),
        radial-gradient(circle at 72% 94%, rgba(14, 165, 233, 0.1) 0, rgba(14, 165, 233, 0) 46%),
        #f4f6fb;
    padding: 32px 20px;
}

.login-wrap {
    width: 100%;
    max-width: 968px;
}

.login-card {
    display: grid;
    grid-template-columns: 1.02fr 0.98fr;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(15, 23, 42, 0.14);
}

/* 左侧视觉面板 */

.login-visual {
    position: relative;
    min-height: 604px;
    background: #0b1222;
    overflow: hidden;
    display: flex;
}

.login-visual-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 42%;
    opacity: 0.92;
    transform: scale(1.02);
}

.login-visual::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(8, 13, 28, 0.76) 0%,
        rgba(8, 13, 28, 0.18) 32%,
        rgba(8, 13, 28, 0.34) 60%,
        rgba(8, 13, 28, 0.9) 100%
    );
}

.login-visual-inner {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 40px 40px 32px;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.login-brand .brand-text strong {
    color: var(--text);
}

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

.login-brand--onDark .brand-text strong {
    color: #fff;
}

.login-brand--onDark .brand-text small {
    color: rgba(203, 213, 225, 0.72);
}

.login-visual-copy {
    margin-top: auto;
}

.login-visual-copy h2 {
    margin: 0 0 12px;
    font-size: 30px;
    line-height: 1.3;
    letter-spacing: -0.4px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 18px rgba(2, 6, 23, 0.4);
}

.login-visual-copy p {
    margin: 0 0 24px;
    max-width: 330px;
    font-size: 13.5px;
    line-height: 1.8;
    color: rgba(226, 232, 240, 0.8);
}

.login-features {
    list-style: none;
    margin: 0 0 30px;
    padding: 0;
    display: grid;
    gap: 12px;
}

.login-features li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: rgba(226, 232, 240, 0.92);
}

.lf-dot {
    flex: 0 0 auto;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    box-shadow: 0 0 10px rgba(96, 165, 250, 0.9);
}

.login-visual-foot {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
    font-size: 10.5px;
    letter-spacing: 1.6px;
    color: rgba(148, 163, 184, 0.66);
}

/* 右侧表单面板 */

.login-form {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(36px, 4.6vw, 58px) clamp(30px, 4.4vw, 54px);
}

.login-eyebrow {
    display: inline-block;
    margin-bottom: 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    background: linear-gradient(135deg, #3b82f6, #7c3aed);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.login-form h1 {
    margin: 0 0 6px;
    font-size: 26px;
    letter-spacing: -0.4px;
}

.login-form > .muted {
    margin: 0 0 22px;
    font-size: 13px;
}

.login-form .flash {
    margin: 0 0 16px;
}

.login-form .stack-form {
    margin-top: 4px;
}

.login-form-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 26px;
    padding-top: 16px;
    border-top: 1px dashed var(--border);
    font-size: 11.5px;
    color: var(--muted);
}

/* ---------- 安装向导 ---------- */

.install-wrap {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    padding: 40px 20px 60px;
}

.install-head {
    margin-bottom: 22px;
}

.install-head h1 {
    margin: 12px 0 6px;
    font-size: 26px;
    letter-spacing: -0.3px;
}

.install-head p {
    margin: 0;
    color: var(--muted);
}

.install-panel {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 26px;
    margin-bottom: 18px;
}

.install-panel h2 {
    margin: 0 0 16px;
    font-size: 16px;
}

.install-check {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.install-check li {
    padding: 8px 12px;
    border-radius: 8px;
    background: #f8fafc;
    font-size: 13px;
}

.install-check .ok {
    color: #15803d;
}

.install-check .bad {
    color: #b91c1c;
}

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

.install-foot {
    margin-top: 18px;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.8;
}

/* ---------- 响应式 ---------- */

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

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

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

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

@media (max-width: 900px) {
    .login-card {
        grid-template-columns: minmax(0, 1fr);
    }

    .login-visual {
        min-height: 172px;
    }

    .login-visual-img {
        object-position: 68% 44%;
    }

    .login-visual-inner {
        justify-content: center;
        padding: 22px 26px;
    }

    .login-visual-copy,
    .login-features,
    .login-visual-foot {
        display: none;
    }

    .login-form {
        justify-content: flex-start;
        width: 100%;
        max-width: 560px;
        margin: 0 auto;
    }
}

@media (max-width: 780px) {
    .shell {
        display: block;
    }

    .sidebar {
        width: auto;
        height: auto;
        position: static;
        padding: 16px;
    }

    .brand {
        padding-bottom: 14px;
    }

    .nav {
        flex-direction: row;
        overflow-x: auto;
        gap: 4px;
        padding-bottom: 4px;
    }

    .nav a {
        white-space: nowrap;
        padding: 8px 12px;
    }

    .sidebar-foot {
        display: none;
    }

    .main {
        padding: 0 16px 36px;
    }

    .topbar {
        flex-wrap: wrap;
        padding-top: 18px;
    }

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

    .page-actions {
        flex-direction: column;
        align-items: flex-start;
    }

    .detail-list {
        grid-template-columns: minmax(0, 1fr);
        gap: 4px;
    }

    .detail-list dd {
        margin-bottom: 10px;
    }

    .key-row {
        flex-direction: column;
        align-items: stretch;
    }

    .login-form {
        padding: 30px 24px 26px;
    }

    .form-intro {
        flex-direction: column;
        align-items: flex-start;
    }

    .form-intro-main {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .form-section-head {
        padding: 18px 18px 0;
    }

    .form-section-body {
        padding: 16px 18px 22px;
    }

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

    .form-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .form-footer-actions {
        justify-content: flex-end;
    }
}

@media (max-width: 520px) {
    .login-body {
        padding: 16px;
    }

    .login-card {
        border-radius: 18px;
    }

    .login-visual {
        min-height: 148px;
    }

    .login-visual-inner {
        padding: 18px 20px;
    }

    .login-form {
        padding: 26px 20px 22px;
    }

    .login-form h1 {
        font-size: 23px;
    }

    .login-form-foot {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .form-footer-actions {
        flex-direction: column;
    }

    .form-footer-actions .btn {
        width: 100%;
        justify-content: center;
    }
}
