:root {
    color-scheme: light;
    --bg: #f6f8fb;
    --panel: #ffffff;
    --line: #dbe3ee;
    --text: #172033;
    --muted: #65758b;
    --accent: #1473e6;
    --accent-dark: #0f5fbd;
    --ok-bg: #e8f6ee;
    --ok-text: #1f7a43;
    --shadow: 0 18px 42px rgba(20, 38, 67, 0.10);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", Arial, sans-serif;
    font-size: 15px;
}

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

button,
input {
    font: inherit;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 28px;
    min-height: 64px;
    padding: 0 32px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(14px);
}

.topbar-brand {
    font-weight: 800;
    letter-spacing: 0;
}

.topbar nav {
    display: flex;
    gap: 8px;
    flex: 1;
}

.topbar nav a {
    padding: 8px 12px;
    border-radius: 6px;
    color: var(--muted);
}

.topbar nav a.active,
.topbar nav a:hover {
    background: #edf4ff;
    color: var(--accent);
}

.ghost-button {
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--muted);
    padding: 8px 14px;
    cursor: pointer;
}

.page-shell {
    width: min(1180px, calc(100vw - 40px));
    margin: 34px auto 64px;
}

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

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

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

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

h1 {
    margin-bottom: 0;
    font-size: 30px;
    line-height: 1.2;
}

h2 {
    margin-bottom: 0;
    font-size: 18px;
}

.subheading {
    margin: 8px 0 0;
    color: var(--muted);
}

.primary-link,
.search-form button,
.login-form button,
.danger-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    min-height: 40px;
    padding: 0 16px;
    font-weight: 700;
    cursor: pointer;
}

.primary-link:hover,
.search-form button:hover,
.login-form button:hover {
    background: var(--accent-dark);
}

.login-form button:disabled {
    background: #7aa7e8;
    cursor: wait;
}

.primary-link.secondary {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--muted);
}

.primary-link.secondary:hover {
    background: #edf4ff;
    color: var(--accent);
}

.danger-button {
    background: #c2410c;
}

.danger-button:hover {
    background: #9a3412;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.metric-card,
.content-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.metric-card {
    padding: 20px;
}

.metric-card span {
    display: block;
    color: var(--muted);
    margin-bottom: 10px;
}

.metric-card strong {
    display: block;
    font-size: 32px;
    line-height: 1;
}

.content-panel {
    padding: 22px;
}

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.bar-chart {
    display: grid;
    grid-template-columns: repeat(7, minmax(46px, 1fr));
    align-items: end;
    gap: 16px;
    height: 250px;
}

.bar-item {
    display: grid;
    grid-template-rows: 24px 1fr 24px;
    gap: 8px;
    min-width: 0;
    height: 100%;
    text-align: center;
}

.bar-value,
.bar-label {
    color: var(--muted);
    font-size: 13px;
}

.bar-track {
    position: relative;
    overflow: hidden;
    align-self: stretch;
    border-radius: 6px;
    background: #edf2f7;
}

.bar-fill {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    min-height: 2px;
    background: linear-gradient(180deg, #38bdf8, var(--accent));
}

.search-form {
    display: flex;
    gap: 10px;
    width: min(520px, 100%);
}

.search-form input {
    flex: 1;
    min-width: 0;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0 12px;
    background: #fff;
}

.table-panel {
    padding: 0;
    overflow: hidden;
}

.table-summary {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
}

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

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

th,
td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
}

th {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    background: #fbfdff;
}

.strong-text {
    font-weight: 700;
}

.muted-text {
    color: var(--muted);
    font-size: 13px;
    margin-top: 3px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 9px;
    border-radius: 999px;
    background: var(--ok-bg);
    color: var(--ok-text);
    font-size: 13px;
    font-weight: 700;
}

.row-link {
    color: var(--accent);
    font-weight: 700;
}

.empty-state {
    height: 120px;
    color: var(--muted);
    text-align: center;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    padding: 16px 20px;
}

.pagination a {
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 8px 12px;
    background: #fff;
}

.pagination a.disabled {
    pointer-events: none;
    opacity: 0.45;
}

.detail-layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.profile-panel {
    display: grid;
    gap: 12px;
    justify-items: start;
}

.avatar-preview {
    display: grid;
    place-items: center;
    width: 96px;
    height: 96px;
    border-radius: 8px;
    background: #dceeff;
    color: var(--accent);
    font-size: 38px;
    font-weight: 800;
}

.avatar-preview.image {
    object-fit: cover;
}

.profile-panel p {
    color: var(--muted);
    word-break: break-word;
}

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

.detail-grid div {
    min-width: 0;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

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

dt {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 6px;
}

dd {
    margin: 0;
    word-break: break-word;
}

.login-page {
    min-height: 100vh;
    background: radial-gradient(circle at top left, #dceeff, transparent 35%), var(--bg);
}

.login-shell {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
}

.login-panel {
    width: min(420px, 100%);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
    padding: 32px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-weight: 800;
    margin-bottom: 18px;
}

.login-form {
    display: grid;
    gap: 16px;
    margin-top: 24px;
}

.login-form label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 14px;
}

.login-form input {
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0 12px;
    color: var(--text);
}

.form-error,
.form-success {
    margin: 0;
    font-size: 14px;
}

.form-error {
    color: #b42318;
}

.form-success {
    color: var(--ok-text);
}

@media (max-width: 820px) {
    .topbar {
        padding: 0 18px;
        gap: 14px;
    }

    .page-heading,
    .table-summary {
        align-items: stretch;
        flex-direction: column;
    }

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

    .page-actions .primary-link,
    .page-actions .danger-button {
        width: 100%;
    }

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

    .bar-chart {
        gap: 8px;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }
}
