* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: #18212f;
    background: linear-gradient(180deg, #f4f8fc 0%, #edf2f8 100%);
}

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

code,
pre {
    font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

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

.login-card {
    width: min(460px, 100%);
    background: #fff;
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 18px 56px rgba(20, 34, 58, 0.15);
}

.login-card h1 {
    margin-top: 0;
}

.login-form,
.filters,
.form-grid {
    display: grid;
    gap: 16px;
}

.login-form label,
.filters label,
.form-grid label {
    display: grid;
    gap: 8px;
    font-size: 14px;
    color: #4b5b73;
}

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

input,
select,
textarea {
    width: 100%;
    border: 1px solid #d7e0ea;
    border-radius: 12px;
    padding: 10px 12px;
    background: #fff;
}

textarea {
    resize: vertical;
}

.btn,
.link-btn {
    border: 0;
    border-radius: 12px;
    padding: 10px 14px;
    cursor: pointer;
    background: #eef3f8;
    color: #18212f;
}

.btn-primary {
    background: linear-gradient(135deg, #1f6feb, #0a84ff);
    color: #fff;
}

.btn-block {
    width: 100%;
}

.danger {
    color: #c0392b;
}

.alert {
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.alert-error {
    background: #fdeaea;
    color: #a72828;
}

.login-tip {
    margin-top: 16px;
    color: #6a7688;
    font-size: 13px;
}

.admin-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: linear-gradient(180deg, #122033, #172a40);
    color: #e7edf7;
    padding: 28px 20px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 30px;
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #1f6feb, #2ea043);
    font-weight: 700;
}

.brand p {
    margin: 4px 0 0;
    color: #96a7be;
    font-size: 13px;
}

.sidebar-nav {
    display: grid;
    gap: 8px;
}

.sidebar-nav a {
    padding: 12px 14px;
    border-radius: 12px;
    color: #d7e3f3;
}

.sidebar-nav a.active,
.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.1);
}

.content {
    padding: 28px;
}

.page-header h1,
.section-header h2 {
    margin: 0;
}

.page-header p {
    color: #66758b;
}

.card-grid,
.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 18px;
}

.card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(17, 30, 48, 0.08);
    margin-bottom: 18px;
}

.stat-card strong {
    display: block;
    margin-top: 12px;
    font-size: 30px;
    color: #0d1b2a;
}

.quick-links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.quick-link {
    padding: 14px 16px;
    background: #f1f6fb;
    border-radius: 14px;
}

.filters {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    align-items: end;
}

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

.span-2 {
    grid-column: span 2;
}

.form-actions {
    display: flex;
    gap: 12px;
}

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

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

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 12px 10px;
    border-bottom: 1px solid #edf1f6;
    vertical-align: top;
    font-size: 14px;
}

th {
    color: #63748b;
    font-weight: 600;
}

.amount {
    color: #b54708;
    font-weight: 700;
}

.badge {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 999px;
    background: #edf4ff;
    color: #185abc;
    font-size: 12px;
}

.badge-warning {
    background: #fff3cd;
    color: #8a5a00;
}

.row-warning {
    background: #fffaf0;
}

.muted {
    color: #66758b;
    margin: 6px 0 0;
    font-size: 13px;
}

.actions {
    white-space: nowrap;
}

.link-btn {
    display: inline-block;
    padding: 0;
    margin-right: 8px;
    background: transparent;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 16px;
}

.empty {
    text-align: center;
    color: #76869c;
    padding: 24px 0;
}

.detail-dialog {
    width: min(1000px, 94vw);
    border: 0;
    border-radius: 18px;
    padding: 0;
}

.dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid #edf1f6;
}

.dialog-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 20px;
}

.detail-dialog pre {
    min-height: 360px;
    margin: 0;
    padding: 16px;
    border-radius: 12px;
    background: #0d1117;
    color: #e6edf3;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.chart-grid .card {
    min-height: 360px;
}

.chart-grid canvas {
    width: 100% !important;
    height: 280px !important;
}

@media (max-width: 960px) {
    .admin-shell {
        grid-template-columns: 1fr;
    }

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

    .content {
        padding: 18px;
    }

    .form-grid,
    .dialog-columns {
        grid-template-columns: 1fr;
    }

    .span-2 {
        grid-column: auto;
    }
}
