:root {
    color-scheme: light;
    --bg: #f4f6f7;
    --surface: #ffffff;
    --surface-muted: #f8fafb;
    --text: #1f292e;
    --muted: #66747c;
    --border: #d9e0e3;
    --primary: #087f74;
    --primary-dark: #05665e;
    --danger: #b43a3a;
    --danger-soft: #fff1f1;
    --success: #277446;
    --success-soft: #edf8f1;
    --warning: #8a6415;
    --shadow: 0 12px 30px rgba(28, 43, 49, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background: var(--bg);
    font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
    font-size: 14px;
    letter-spacing: 0;
}

a {
    color: inherit;
}

button,
input,
textarea {
    font: inherit;
    letter-spacing: 0;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 58px;
    padding: 0 28px;
    color: #fff;
    background: #16343a;
    border-bottom: 3px solid var(--primary);
}

.brand {
    font-size: 18px;
    font-weight: 700;
    text-decoration: none;
}

.topbar-actions,
.row-actions,
.form-actions,
.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-actions form,
.row-actions form {
    margin: 0;
}

.admin-name {
    color: #d9e5e7;
    text-decoration: none;
}

.admin-name:hover {
    color: #ffffff;
    text-decoration: underline;
}

.page-shell {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    padding: 30px 0 60px;
}

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

.page-heading {
    margin-bottom: 20px;
}

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

h1 {
    margin-bottom: 0;
    font-size: 26px;
    line-height: 1.3;
}

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

.eyebrow {
    margin-bottom: 5px;
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 700;
}

.back-link {
    display: inline-block;
    margin-bottom: 8px;
    color: var(--primary-dark);
    text-decoration: none;
}

.project-id,
.secondary-text {
    display: block;
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.section {
    margin-bottom: 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: var(--shadow);
}

.section-heading {
    padding: 20px 22px 0;
}

.form-section {
    padding: 22px;
}

.form-section .section-heading {
    padding: 0 0 20px;
}

.account-section {
    max-width: 620px;
}

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

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

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

th {
    color: #506067;
    background: var(--surface-muted);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

tbody tr:last-child td {
    border-bottom: 0;
}

.actions-column {
    width: 150px;
}

.project-link {
    color: #155e75;
    font-weight: 700;
    text-decoration: none;
}

.project-link:hover,
.back-link:hover {
    text-decoration: underline;
}

.button {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    padding: 8px 15px;
    color: var(--text);
    background: #fff;
    border: 1px solid #bdc8cc;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
}

.button:hover {
    background: #f1f4f5;
}

.button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.button-primary {
    color: #fff;
    background: var(--primary);
    border-color: var(--primary);
}

.button-primary:hover {
    background: var(--primary-dark);
}

.button-quiet {
    min-height: 32px;
    color: #fff;
    background: transparent;
    border-color: #60787d;
}

.button-small {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 12px;
}

.button-danger-quiet {
    color: var(--danger);
    background: var(--danger-soft);
    border-color: #ecc2c2;
}

.button-success-quiet {
    color: var(--success);
    background: var(--success-soft);
    border-color: #b9ddc5;
}

.button-wide {
    width: 100%;
}

.status,
.current-label {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
}

.status-enabled,
.current-label {
    color: var(--success);
    background: var(--success-soft);
}

.status-disabled {
    color: var(--muted);
    background: #edf0f1;
}

.current-label {
    margin-left: 8px;
}

.notice {
    margin-bottom: 18px;
    padding: 12px 14px;
    border: 1px solid;
    border-radius: 5px;
}

.notice-success {
    color: var(--success);
    background: var(--success-soft);
    border-color: #b9ddc5;
}

.notice-error {
    color: var(--danger);
    background: var(--danger-soft);
    border-color: #ecc2c2;
}

.form-stack {
    display: grid;
    gap: 18px;
}

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

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

label > span,
legend {
    display: block;
    margin-bottom: 7px;
    color: #39484e;
    font-weight: 700;
}

input[type="text"],
input[type="password"],
input[type="number"],
input:not([type]),
textarea {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    color: var(--text);
    background: #fff;
    border: 1px solid #bfcbd0;
    border-radius: 4px;
    outline: none;
}

textarea {
    resize: vertical;
}

input:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(8, 127, 116, 0.12);
}

fieldset {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 5px;
}

.check-field {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-weight: 600;
}

.check-field input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.upload-field input {
    width: 100%;
    padding: 9px;
    border: 1px dashed #9fadb2;
    border-radius: 4px;
    background: var(--surface-muted);
}

.upload-field small {
    display: block;
    margin-top: 7px;
    color: var(--muted);
}

.summary-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 22px;
    background: #20353a;
    border-radius: 6px;
    color: #fff;
}

.summary-strip div {
    padding: 16px 20px;
    border-right: 1px solid #476067;
}

.summary-strip div:last-child {
    border-right: 0;
}

.summary-strip span,
.summary-strip strong {
    display: block;
}

.summary-strip span {
    margin-bottom: 4px;
    color: #b8c9cd;
    font-size: 12px;
}

.summary-strip strong {
    font-size: 17px;
}

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

.empty-state.compact {
    padding: 34px 20px;
    color: var(--muted);
}

.empty-state.standalone {
    margin-top: 15vh;
}

.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: #e9eef0;
}

.auth-page .page-shell {
    width: 100%;
    max-width: 420px;
    margin: 0;
    padding: 40px 0;
}

.login-panel {
    padding: 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 4px solid var(--primary);
    border-radius: 6px;
    box-shadow: var(--shadow);
}

.login-heading {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.login-heading h1 {
    font-size: 22px;
}

.login-heading p {
    margin: 4px 0 0;
    color: var(--muted);
}

.brand-mark {
    display: grid;
    width: 46px;
    height: 46px;
    place-items: center;
    color: #fff;
    background: #16343a;
    border-radius: 6px;
    font-weight: 800;
}

code {
    color: #46545a;
    font-family: Consolas, monospace;
    font-size: 12px;
}

@media (max-width: 720px) {
    .topbar {
        padding: 0 16px;
    }

    .page-shell {
        width: min(100% - 24px, 1180px);
        padding-top: 20px;
    }

    .page-heading {
        align-items: flex-start;
    }

    h1 {
        font-size: 22px;
    }

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

    .summary-strip div {
        border-right: 0;
        border-bottom: 1px solid #476067;
    }

    .summary-strip div:last-child {
        border-bottom: 0;
    }

    .check-row,
    .form-actions {
        align-items: stretch;
        flex-direction: column;
    }

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

    .row-actions .button {
        width: 100%;
    }
}
