:root {
    --bg: #f3f5fa;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --border: #e4e9f2;
    --border-strong: #d5dce8;
    --ink: #111827;
    --ink-soft: #334155;
    --muted: #64748b;
    --muted-2: #94a3b8;
    --brand: #2563eb;
    --brand-strong: #1d4ed8;
    --brand-soft: #eff4ff;
    --sidebar: #0b1220;
    --sidebar-2: #101a2e;
    --sidebar-ink: #c8d3e6;
    --sidebar-muted: #7c8cab;
    --success: #059669;
    --success-soft: #e8f7f1;
    --warning: #d97706;
    --warning-soft: #fef4e6;
    --danger: #dc2626;
    --danger-soft: #fdecec;
    --info: #0284c7;
    --info-soft: #e8f4fd;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 10px 28px rgba(15, 23, 42, .06);
    --shadow-soft: 0 1px 2px rgba(15, 23, 42, .04);
    --sidebar-width: 248px;
    --topbar-height: 72px;
    --font: "Segoe UI", "Microsoft YaHei", "Noto Sans SC", "PingFang SC", system-ui, -apple-system, sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--brand);
    text-decoration: none;
}

a:hover {
    color: var(--brand-strong);
}

h1, h2, h3, h4, h5 {
    color: var(--ink);
    font-weight: 650;
    letter-spacing: -.01em;
}

.mono {
    font-family: "Cascadia Code", "JetBrains Mono", Consolas, monospace;
    font-size: 12.5px;
}

.text-muted-2 {
    color: var(--muted) !important;
}

.nowrap {
    white-space: nowrap;
}

.truncate {
    max-width: 420px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.amount-pos {
    color: var(--success);
    font-weight: 600;
}

.amount-neg {
    color: var(--danger);
    font-weight: 600;
}

/* ---------- Shell ---------- */
.admin-shell {
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
    color: var(--sidebar-ink);
    border-right: 1px solid rgba(148, 163, 184, .12);
    transition: transform .22s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 22px 20px 18px;
    color: #fff;
    border-bottom: 1px solid rgba(148, 163, 184, .1);
}

.sidebar-brand:hover {
    color: #fff;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    color: #fff;
    background: linear-gradient(145deg, #3b82f6, #1d4ed8);
    box-shadow: 0 6px 16px rgba(37, 99, 235, .35);
    flex: 0 0 auto;
}

.brand-mark svg {
    width: 24px;
    height: 24px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.brand-text strong {
    font-size: 17px;
    letter-spacing: -.01em;
}

.brand-text small {
    margin-top: 3px;
    color: var(--sidebar-muted);
    font-size: 11px;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.sidebar-nav {
    flex: 1;
    padding: 14px 12px 18px;
    overflow-y: auto;
}

.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, .25);
    border-radius: 8px;
}

.nav-section {
    padding: 16px 12px 6px;
    color: #5f708f;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    margin: 2px 0;
    padding: 9px 12px;
    border-radius: 10px;
    color: var(--sidebar-ink);
    font-size: 13.5px;
    transition: background .15s ease, color .15s ease;
}

.sidebar-nav .nav-link:hover {
    color: #fff;
    background: rgba(148, 163, 184, .1);
}

.sidebar-nav .nav-link.active {
    color: #fff;
    background: linear-gradient(90deg, rgba(37, 99, 235, .95), rgba(59, 130, 246, .75));
    box-shadow: 0 6px 18px rgba(37, 99, 235, .25);
}

.nav-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    opacity: .9;
}

.sidebar-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 22px 20px;
    border-top: 1px solid rgba(148, 163, 184, .1);
    color: var(--sidebar-muted);
    font-size: 11.5px;
}

.dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--muted-2);
    flex: 0 0 auto;
}

.dot-success {
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, .15);
}

.dot-warning {
    background: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, .15);
}

.dot-danger {
    background: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, .15);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1035;
    background: rgba(15, 23, 42, .45);
    backdrop-filter: blur(2px);
}

.admin-main {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin-left: var(--sidebar-width);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: var(--topbar-height);
    padding: 12px 28px;
    background: rgba(255, 255, 255, .86);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
}

.sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    color: var(--ink-soft);
}

.sidebar-toggle svg {
    width: 20px;
    height: 20px;
}

.topbar-title {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar-title h1 {
    margin: 0;
    font-size: 19px;
    font-weight: 650;
}

.topbar-sub {
    margin-top: 1px;
    color: var(--muted-2);
    font-size: 11.5px;
    letter-spacing: .04em;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-left: auto;
}

.env-pill {
    padding: 4px 10px;
    border: 1px solid #d7e3fb;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand-strong);
    font-size: 11px;
    font-weight: 650;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.admin-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 14px;
    border-left: 1px solid var(--border);
}

.admin-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(145deg, #dbeafe, #bfdbfe);
    color: #1e40af;
    font-weight: 700;
}

.admin-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.admin-meta strong {
    font-size: 13px;
}

.admin-meta small {
    color: var(--muted);
    font-size: 11px;
}

.logout-form {
    margin: 0;
}

.content {
    flex: 1;
    width: 100%;
    max-width: 1480px;
    margin: 0 auto;
    padding: 26px 28px 34px;
}

.admin-footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    max-width: 1480px;
    width: 100%;
    margin: 0 auto;
    padding: 0 28px 22px;
    color: var(--muted-2);
    font-size: 11.5px;
}

.admin-alert {
    margin-bottom: 18px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    box-shadow: var(--shadow-soft);
}

/* ---------- Page scaffolding ---------- */
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.page-head h2 {
    margin: 0;
    font-size: 22px;
}

.page-head p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.panel + .panel {
    margin-top: 20px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 17px 20px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.panel-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 650;
}

.panel-header .sub {
    color: var(--muted);
    font-size: 12px;
}

.panel-body {
    padding: 20px;
}

.panel-body-tight {
    padding: 0;
}

.panel-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    background: var(--surface-soft);
    flex-wrap: wrap;
}

/* ---------- Buttons ---------- */
.btn {
    border-radius: 9px;
    font-size: 13px;
    font-weight: 550;
}

.btn-primary {
    background: var(--brand);
    border-color: var(--brand);
    box-shadow: 0 4px 12px rgba(37, 99, 235, .18);
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--brand-strong);
    border-color: var(--brand-strong);
}

.btn-outline-secondary {
    color: var(--ink-soft);
    border-color: var(--border-strong);
    background: #fff;
}

.btn-outline-secondary:hover {
    color: var(--ink);
    background: var(--surface-soft);
    border-color: #c3ccda;
}

.btn-danger-soft {
    color: var(--danger);
    border: 1px solid #f7c9c9;
    background: var(--danger-soft);
}

.btn-danger-soft:hover {
    color: #fff;
    background: var(--danger);
    border-color: var(--danger);
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 8px;
}

.btn:disabled,
.btn.disabled {
    opacity: .55;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-quiet {
    padding: 3px 8px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
}

.btn-quiet:hover {
    color: var(--brand);
    background: var(--brand-soft);
}

/* ---------- Stat cards ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    position: relative;
    padding: 18px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.stat-card::after {
    content: "";
    position: absolute;
    inset: auto -30px -46px auto;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(37, 99, 235, .09), transparent 68%);
}

.stat-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.stat-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 550;
}

.stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--brand-soft);
    color: var(--brand);
}

.stat-icon svg {
    width: 18px;
    height: 18px;
}

.stat-value {
    margin-top: 12px;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
}

.stat-hint {
    margin-top: 6px;
    color: var(--muted-2);
    font-size: 11.5px;
}

.stat-hint strong {
    color: var(--success);
}

/* ---------- Tables ---------- */
.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    font-size: 13px;
}

.admin-table thead th {
    padding: 11px 14px;
    background: var(--surface-soft);
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 650;
    letter-spacing: .04em;
    text-align: left;
    white-space: nowrap;
}

.admin-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid #eef2f7;
    color: var(--ink-soft);
    vertical-align: middle;
}

.admin-table tbody tr:hover {
    background: #f9fbff;
}

.admin-table tbody tr:last-child td {
    border-bottom: 0;
}

.admin-table .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.admin-table .actions {
    text-align: right;
    white-space: nowrap;
}

.admin-table .actions .btn + .btn,
.admin-table .actions form + form,
.admin-table .actions form + .btn {
    margin-left: 4px;
}

.table-empty {
    padding: 0;
}

.table-meta {
    color: var(--muted);
    font-size: 12px;
}

.cell-main {
    color: var(--ink);
    font-weight: 550;
}

.cell-sub {
    margin-top: 2px;
    color: var(--muted-2);
    font-size: 11.5px;
}

.inline-form {
    display: inline;
    margin: 0;
}

/* ---------- Badges ---------- */
.badge-soft {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 650;
    line-height: 1.5;
    white-space: nowrap;
}

.badge-soft-success {
    color: #047857;
    background: var(--success-soft);
}

.badge-soft-warning {
    color: #b45309;
    background: var(--warning-soft);
}

.badge-soft-danger {
    color: #b91c1c;
    background: var(--danger-soft);
}

.badge-soft-info {
    color: #0369a1;
    background: var(--info-soft);
}

.badge-soft-muted {
    color: #475569;
    background: #f1f5f9;
}

.badge-soft-brand {
    color: var(--brand-strong);
    background: var(--brand-soft);
}

.badge-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
}

/* ---------- Filters / forms ---------- */
.filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: #fbfcfe;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 130px;
}

.filter-field label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
}

.filter-field .form-control,
.filter-field .form-select {
    min-width: 130px;
}

.filter-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.form-label {
    margin-bottom: 5px;
    color: var(--ink-soft);
    font-size: 12.5px;
    font-weight: 600;
}

.form-control,
.form-select {
    border-color: var(--border-strong);
    border-radius: 9px;
    color: var(--ink);
    font-size: 13px;
    min-height: 38px;
}

.form-control:focus,
.form-select:focus {
    border-color: #93b4f7;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.form-control::placeholder {
    color: #a7b2c3;
}

.form-text {
    color: var(--muted-2);
    font-size: 11.5px;
}

.form-check-input:checked {
    background-color: var(--brand);
    border-color: var(--brand);
}

.form-card {
    max-width: 980px;
}

.form-section {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.form-section:last-of-type {
    border-bottom: 0;
}

.form-section h4 {
    margin: 0 0 4px;
    font-size: 14px;
}

.form-section > p {
    margin: 0 0 16px;
    color: var(--muted);
    font-size: 12px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 18px;
}

.form-grid .span-2 {
    grid-column: span 2;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    background: var(--surface-soft);
    border-top: 1px solid var(--border);
}

.required::after {
    content: " *";
    color: var(--danger);
}

.check-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 22px;
    padding-top: 4px;
}

.form-check-label {
    font-size: 13px;
    color: var(--ink-soft);
}

.switch-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
}

.sensitive-note {
    padding: 10px 12px;
    border: 1px dashed #f0c9c9;
    border-radius: 9px;
    background: #fff8f8;
    color: #9f1239;
    font-size: 12px;
}

.hint-box {
    padding: 12px 14px;
    border: 1px solid #dbe7fb;
    border-radius: 10px;
    background: var(--brand-soft);
    color: #1e40af;
    font-size: 12.5px;
}

.warning-box {
    padding: 12px 14px;
    border: 1px solid #f5dfb2;
    border-radius: 10px;
    background: var(--warning-soft);
    color: #92400e;
    font-size: 12.5px;
}

/* ---------- Tabs ---------- */
.admin-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    margin-bottom: 18px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: #fff;
    width: fit-content;
}

.admin-tabs a {
    padding: 7px 14px;
    border-radius: 8px;
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 600;
}

.admin-tabs a.active {
    color: var(--brand-strong);
    background: var(--brand-soft);
}

/* ---------- Pagination ---------- */
.admin-pager {
    margin: 0;
    gap: 3px;
}

.admin-pager .page-link {
    min-width: 32px;
    padding: 5px 9px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--ink-soft);
    font-size: 12px;
    text-align: center;
    background: transparent;
}

.admin-pager .page-item:not(.active):not(.disabled) .page-link:hover {
    background: var(--brand-soft);
    color: var(--brand-strong);
}

.admin-pager .page-item.active .page-link {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.admin-pager .page-item.disabled .page-link {
    color: #b7c0cf;
    background: transparent;
}

/* ---------- Empty state ---------- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 54px 20px;
    text-align: center;
    color: var(--muted);
}

.empty-state svg {
    width: 40px;
    height: 40px;
    margin-bottom: 6px;
    color: #b8c5d9;
}

.empty-state strong {
    color: var(--ink-soft);
    font-size: 14px;
}

.empty-state p {
    margin: 0;
    max-width: 460px;
    font-size: 12px;
    color: var(--muted-2);
}

/* ---------- Dashboard chart ---------- */
.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
    gap: 20px;
    margin-top: 20px;
}

.chart-box {
    padding: 10px 20px 18px;
}

.chart-box svg {
    width: 100%;
    height: auto;
    display: block;
    overflow: visible;
}

.chart-grid-line {
    stroke: #edf1f7;
    stroke-width: 1;
}

.chart-line {
    fill: none;
    stroke: var(--brand);
    stroke-width: 2.4;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.chart-area {
    fill: url(#chartFill);
}

.chart-dot {
    fill: #fff;
    stroke: var(--brand);
    stroke-width: 2;
}

.chart-label {
    fill: #94a3b8;
    font-size: 10px;
    font-family: var(--font);
}

.chart-value {
    fill: #334155;
    font-size: 10px;
    font-family: var(--font);
    font-weight: 600;
}

.chart-legend {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 20px 16px;
    color: var(--muted);
    font-size: 11.5px;
}

.legend-swatch {
    display: inline-block;
    width: 9px;
    height: 9px;
    margin-right: 6px;
    border-radius: 3px;
    background: var(--brand);
}

.dist-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px 20px 20px;
}

.dist-row {
    display: grid;
    grid-template-columns: 84px 1fr 42px;
    align-items: center;
    gap: 10px;
    font-size: 12px;
}

.dist-name {
    color: var(--ink-soft);
    font-weight: 550;
}

.dist-track {
    display: block;
    height: 8px;
    border-radius: 999px;
    background: #eef2f8;
    overflow: hidden;
}

.dist-bar {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #60a5fa, #2563eb);
}

.dist-count {
    text-align: right;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.audit-mini {
    display: flex;
    flex-direction: column;
}

.audit-mini-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid #eef2f7;
}

.audit-mini-row:last-child {
    border-bottom: 0;
}

.audit-mini-dot {
    width: 8px;
    height: 8px;
    margin-top: 6px;
    border-radius: 50%;
    background: var(--brand);
    flex: 0 0 auto;
}

.audit-mini-body {
    min-width: 0;
    flex: 1;
}

.audit-mini-body strong {
    font-size: 12.5px;
    font-weight: 600;
}

.audit-mini-body p {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 11.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.audit-mini-time {
    color: var(--muted-2);
    font-size: 10.5px;
    white-space: nowrap;
}

.health-list {
    display: grid;
    gap: 10px;
    padding: 18px 20px 20px;
}

.health-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-soft);
    font-size: 12.5px;
}

.health-item span:first-child {
    color: var(--ink-soft);
}

/* ---------- Detail / key-value ---------- */
.kv-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 26px;
}

.kv-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px dashed #edf1f7;
    font-size: 12.5px;
}

.kv-row:last-child {
    border-bottom: 0;
}

.kv-row span:first-child {
    color: var(--muted);
    flex: 0 0 auto;
}

.kv-row span:last-child {
    color: var(--ink-soft);
    text-align: right;
    word-break: break-all;
}

/* ---------- Login / setup ---------- */
.auth-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(420px, .95fr);
    min-height: 100vh;
    background: #f3f5fa;
}

.auth-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 54px 58px;
    background:
        radial-gradient(900px 420px at 12% -10%, rgba(59, 130, 246, .28), transparent 60%),
        radial-gradient(700px 500px at 100% 110%, rgba(79, 70, 229, .2), transparent 60%),
        linear-gradient(150deg, #0b1220 0%, #101a2e 55%, #131f38 100%);
    color: #dbe4f3;
    overflow: hidden;
}

.auth-panel::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: linear-gradient(rgba(148, 163, 184, .06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, .06) 1px, transparent 1px);
    background-size: 42px 42px;
    pointer-events: none;
    mask-image: linear-gradient(180deg, rgba(0,0,0,.35), transparent 70%);
}

.auth-brand {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-mark-lg {
    width: 50px;
    height: 50px;
    border-radius: 14px;
}

.brand-mark-lg svg {
    width: 30px;
    height: 30px;
}

.auth-brand h1 {
    margin: 0;
    color: #fff;
    font-size: 24px;
    letter-spacing: -.02em;
}

.auth-brand p {
    margin: 2px 0 0;
    color: #8ea1c2;
    font-size: 11px;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.auth-copy {
    position: relative;
    z-index: 1;
    max-width: 470px;
}

.auth-copy h2 {
    margin: 0 0 14px;
    color: #fff;
    font-size: 34px;
    line-height: 1.25;
    letter-spacing: -.025em;
}

.auth-copy p {
    margin: 0;
    color: #a5b4cc;
    font-size: 14px;
    line-height: 1.8;
}

.auth-points {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 9px;
    color: #9fb0c9;
    font-size: 12px;
}

.auth-points i {
    margin-right: 8px;
}

.auth-form-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 28px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 34px 34px 30px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, .12);
}

.auth-card h2 {
    margin: 0 0 6px;
    font-size: 22px;
}

.auth-card > p {
    margin: 0 0 24px;
    color: var(--muted);
    font-size: 12.5px;
}

.auth-foot {
    margin: 22px 0 0;
    color: var(--muted-2);
    font-size: 11px;
}

/* ---------- Misc ---------- */
.breadcrumb-mini {
    margin: 0 0 6px;
    color: var(--muted-2);
    font-size: 11px;
    letter-spacing: .04em;
}

.summary-strip {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-soft);
    font-size: 12px;
    color: var(--muted);
}

.summary-strip strong {
    color: var(--ink);
    font-size: 14px;
    margin-left: 4px;
}

.code-block {
    padding: 14px 16px;
    border-radius: 10px;
    background: #0f172a;
    color: #d7e2f5;
    font-family: "Cascadia Code", Consolas, monospace;
    font-size: 12px;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre;
}

.detail-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.detail-list li {
    padding: 9px 0;
    border-bottom: 1px dashed #edf1f7;
    color: var(--ink-soft);
    font-size: 12.5px;
}

.detail-list li:last-child {
    border-bottom: 0;
}

.modal-content {
    border: 0;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .22);
}

.modal-header {
    border-bottom-color: var(--border);
}

.modal-footer {
    border-top-color: var(--border);
}

@media (max-width: 1199.98px) {
    .stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-open .sidebar-overlay {
        display: block;
    }

    .admin-main {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: inline-flex;
    }

    .topbar {
        padding: 10px 18px;
    }

    .content {
        padding: 20px 18px 28px;
    }

    .admin-footer {
        padding: 0 18px 18px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-panel {
        display: none;
    }

    .auth-form-wrap {
        min-height: 100vh;
    }
}

@media (max-width: 640px) {
    .stat-grid {
        grid-template-columns: 1fr;
    }

    .form-grid,
    .kv-grid {
        grid-template-columns: 1fr;
    }

    .form-grid .span-2 {
        grid-column: span 1;
    }

    .topbar-title h1 {
        font-size: 17px;
    }

    .topbar-sub,
    .env-pill,
    .admin-meta {
        display: none;
    }

    .filter-actions {
        margin-left: 0;
    }
}
