:root {
    color-scheme: light;
    --bg: #eff3ee;
    --surface: #ffffff;
    --surface-soft: #f7faf6;
    --line: #d7dfd5;
    --line-strong: #bcc8b9;
    --text: #223127;
    --muted: #667567;
    --accent: #2f6f57;
    --accent-strong: #235541;
    --accent-soft: #e5f1eb;
    --success: #23784f;
    --success-soft: #e5f4eb;
    --warn: #8f6513;
    --warn-soft: #f8efd9;
    --danger: #b25246;
    --danger-soft: #f8e7e4;
    --shadow: 0 12px 30px rgba(46, 60, 48, 0.08);
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

html[data-i18n-ready="0"] body {
    visibility: hidden;
}

body {
    line-height: 1.55;
}

a {
    color: inherit;
}

img {
    display: block;
    max-width: 100%;
}

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

button {
    cursor: pointer;
}

.shell {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 20px 32px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    backdrop-filter: blur(12px);
    background: rgba(239, 243, 238, 0.9);
    border-bottom: 1px solid rgba(188, 200, 185, 0.8);
}

.topbar-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    font-weight: 700;
    color: var(--text);
}

.brand img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

.nav {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

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

.nav a {
    text-decoration: none;
    color: var(--muted);
    padding: 8px 12px;
    border-radius: 8px;
}

.nav a.active {
    color: var(--accent-strong);
    background: var(--accent-soft);
}

.page-header {
    padding: 26px 0 18px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.page-title {
    margin: 0;
    font-size: 32px;
    line-height: 1.15;
}

.page-copy {
    margin: 8px 0 0;
    color: var(--muted);
    max-width: 720px;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.grid {
    display: grid;
    gap: 18px;
}

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

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

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.panel-header,
.panel-body,
.panel-footer {
    padding: 18px 20px;
}

.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--line);
}

.panel-title {
    margin: 0;
    font-size: 18px;
    line-height: 1.2;
}

.panel-subtitle {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.stack {
    display: grid;
    gap: 14px;
}

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

.stat {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

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

.stat-value {
    margin: 8px 0 0;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.kv {
    display: grid;
    gap: 12px;
}

.kv-row {
    display: flex;
    gap: 10px;
    justify-content: space-between;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.kv-row:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

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

.kv-value {
    text-align: right;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.status-pill,
.tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid transparent;
    white-space: nowrap;
}

.note-box {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface-soft);
    color: var(--muted);
}

.note-box.success {
    color: var(--success);
    background: var(--success-soft);
    border-color: #cce2d4;
}

.note-box.danger {
    color: var(--danger);
    background: var(--danger-soft);
    border-color: #e7c7c1;
}

.status-pill.success,
.tag.success {
    color: var(--success);
    background: var(--success-soft);
}

.status-pill.warn,
.tag.warn {
    color: var(--warn);
    background: var(--warn-soft);
}

.status-pill.danger,
.tag.danger {
    color: var(--danger);
    background: var(--danger-soft);
}

.status-pill.neutral,
.tag.neutral {
    color: var(--muted);
    background: #edf1ed;
}

.button {
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-weight: 600;
}

.button:hover {
    border-color: var(--accent);
}

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

.button.primary:hover {
    background: var(--accent-strong);
    border-color: var(--accent-strong);
}

.button.success {
    color: #ffffff;
    background: var(--success);
    border-color: var(--success);
}

.button.danger {
    color: #ffffff;
    background: var(--danger);
    border-color: var(--danger);
}

.button.ghost {
    background: transparent;
}

.button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.field {
    display: grid;
    gap: 8px;
}

.field label,
.field legend {
    margin: 0;
    font-size: 14px;
    color: var(--muted);
}

.input,
.select,
.textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
}

.textarea {
    min-height: 132px;
    resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
    outline: 2px solid rgba(47, 111, 87, 0.16);
    border-color: var(--accent);
}

.control-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.segmented {
    display: inline-flex;
    gap: 6px;
    flex-wrap: wrap;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.segmented button {
    min-height: 36px;
    padding: 0 14px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-weight: 600;
}

.segmented button.active {
    background: var(--accent-soft);
    color: var(--accent-strong);
}

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

.check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.check input {
    width: 16px;
    height: 16px;
    margin: 0;
}

.table-wrap {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
}

.table th,
.table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.table thead th {
    position: sticky;
    top: 0;
    background: var(--surface-soft);
    z-index: 1;
    font-size: 13px;
    color: var(--muted);
    font-weight: 700;
}

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

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

.empty {
    padding: 32px 20px;
    text-align: center;
    color: var(--muted);
}

.list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.list li + li {
    margin-top: 10px;
}

.activity-item {
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.activity-time {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 6px;
}

.row-builder {
    display: grid;
    gap: 12px;
}

.row-item {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.row-item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.hidden {
    display: none !important;
}

.modal {
    width: min(560px, calc(100vw - 24px));
    border: 0;
    padding: 0;
    border-radius: 8px;
    box-shadow: 0 20px 50px rgba(35, 48, 37, 0.18);
}

.modal::backdrop {
    background: rgba(28, 34, 30, 0.32);
}

.modal-card {
    background: var(--surface);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

.hero-card {
    display: grid;
    gap: 18px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: linear-gradient(135deg, #f8fbf8 0%, #eef5f0 100%);
}

.hero-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: 1.1fr 0.9fr;
}

.feature-list {
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
}

.feature-list li + li {
    margin-top: 8px;
}

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

.login-card {
    width: min(460px, 100%);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.login-head,
.login-body {
    padding: 22px;
}

.login-head {
    border-bottom: 1px solid var(--line);
    background: linear-gradient(135deg, #f7faf7 0%, #eef4f0 100%);
}

.login-title {
    margin: 0;
    font-size: 28px;
    line-height: 1.15;
}

.login-copy {
    margin: 10px 0 0;
    color: var(--muted);
}

.inline-hint {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.toast-stack {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 50;
    display: grid;
    gap: 10px;
    width: min(360px, calc(100vw - 32px));
}

.toast {
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: var(--shadow);
    animation: toast-in 0.18s ease;
}

.toast.success {
    border-color: #c9dfd2;
}

.toast.error {
    border-color: #ecc7c1;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 980px) {
    .grid.two,
    .grid.three,
    .stats,
    .field-grid,
    .checkbox-grid,
    .hero-grid {
        grid-template-columns: 1fr;
    }

    .page-header {
        padding-top: 22px;
    }
}

@media (max-width: 720px) {
    .shell,
    .topbar-inner {
        padding-left: 14px;
        padding-right: 14px;
    }

    .page-title {
        font-size: 28px;
    }

    .panel-header,
    .panel-body,
    .panel-footer {
        padding: 16px;
    }

    .login-head,
    .login-body,
    .hero-card {
        padding: 18px;
    }

    .kv-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .kv-value {
        text-align: left;
    }
}
