:root {
    --bg: #f6f7f9;
    --panel: #ffffff;
    --panel-soft: #f1f5f3;
    --ink: #17211c;
    --muted: #65746e;
    --line: #dfe6e2;
    --brand: #176b5b;
    --brand-strong: #0d4f44;
    --blue: #2563eb;
    --amber: #b7791f;
    --red: #b42318;
    --shadow: 0 14px 36px rgba(17, 24, 39, .08);
    color-scheme: light;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    letter-spacing: 0;
}

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

button {
    cursor: pointer;
}

.boot-screen,
.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.boot-mark {
    display: inline-flex;
    width: 76px;
    height: 76px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--brand);
    color: #fff;
    font-weight: 800;
    margin-bottom: 14px;
}

.auth-card {
    width: min(440px, 100%);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 28px;
}

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

.brand-logo {
    width: 44px;
    height: 44px;
    display: inline-grid;
    place-items: center;
    border-radius: 8px;
    background: var(--brand);
    color: #fff;
    font-weight: 800;
}

.brand-title {
    margin: 0;
    font-size: 20px;
}

.brand-subtitle,
.muted {
    color: var(--muted);
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
    background: #14231e;
    color: #dce8e3;
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.sidebar .brand-row {
    padding: 0 8px;
    margin-bottom: 4px;
}

.sidebar .brand-logo {
    background: #e8fbf4;
    color: #0e4f43;
}

.sidebar .brand-title {
    color: #fff;
}

.nav {
    display: grid;
    gap: 4px;
}

.nav-button {
    width: 100%;
    min-height: 42px;
    border: 0;
    border-radius: 8px;
    color: #dce8e3;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    text-align: left;
}

.nav-button:hover,
.nav-button.active {
    background: rgba(255, 255, 255, .11);
    color: #fff;
}

.main {
    min-width: 0;
    display: grid;
    grid-template-rows: auto 1fr;
}

.topbar {
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, .82);
    backdrop-filter: blur(8px);
}

.topbar h1 {
    margin: 0;
    font-size: 18px;
}

.userbox {
    display: flex;
    align-items: center;
    gap: 12px;
}

.content {
    padding: 24px;
    overflow: auto;
}

.page {
    max-width: 1280px;
    margin: 0 auto;
}

.question-band {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 18px;
}

.question-band h2 {
    margin: 0 0 8px;
    font-size: 28px;
}

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

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

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

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

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}

.entry-card {
    min-height: 190px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.entry-card h3,
.card h3 {
    margin: 0 0 8px;
    font-size: 17px;
}

.entry-card p,
.card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.65;
}

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

.metric {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
}

.metric strong {
    display: block;
    font-size: 22px;
    margin-top: 8px;
}

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

.section-title h2 {
    margin: 0;
    font-size: 20px;
}

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

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

.field label {
    color: #34463e;
    font-size: 14px;
    font-weight: 650;
}

.label-with-help {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
}

.help-tip {
    position: relative;
    display: inline-flex;
    width: 18px;
    height: 18px;
    align-items: center;
    justify-content: center;
    border: 1px solid #9fb4aa;
    border-radius: 999px;
    color: #426158;
    background: #f7fbf9;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    cursor: help;
}

.help-bubble {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    z-index: 20;
    width: min(300px, 70vw);
    padding: 10px 12px;
    border: 1px solid #cbd8d2;
    border-radius: 8px;
    background: #13231e;
    color: #fff;
    box-shadow: var(--shadow);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.55;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(4px);
    transition: opacity .15s ease, transform .15s ease;
}

.help-tip:hover .help-bubble,
.help-tip:focus .help-bubble {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.field input,
.field select,
.field textarea {
    width: 100%;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    border-radius: 8px;
    min-height: 40px;
    padding: 10px 12px;
    outline: none;
}

.field textarea {
    min-height: 128px;
    resize: vertical;
    line-height: 1.6;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(23, 107, 91, .14);
}

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

.btn {
    min-height: 40px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.btn:hover {
    border-color: #b9c7c0;
}

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

.btn.primary:hover {
    background: var(--brand-strong);
}

.btn.danger {
    color: var(--red);
}

.btn.ghost {
    background: transparent;
    color: inherit;
}

.btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.pill {
    display: inline-flex;
    min-height: 24px;
    align-items: center;
    border-radius: 999px;
    padding: 0 9px;
    background: var(--panel-soft);
    color: #2d5f50;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.pill.amber {
    background: #fff4d6;
    color: var(--amber);
}

.pill.blue {
    background: #e7efff;
    color: var(--blue);
}

.pill.red {
    background: #fff0ed;
    color: var(--red);
}

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

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

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

th {
    color: #40534b;
    background: #f8faf9;
    font-size: 13px;
}

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

.click-row {
    cursor: pointer;
}

.click-row:hover td {
    background: #f7fbf9;
}

.report-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr);
    gap: 16px;
}

.result-panel {
    background: #fbfdfc;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}

.result-panel h3 {
    margin: 0 0 10px;
}

.result-panel ol,
.result-panel ul {
    padding-left: 20px;
    line-height: 1.7;
}

.notice {
    border: 1px solid #f3d9a4;
    background: #fff9eb;
    color: #6f4b12;
    border-radius: 8px;
    padding: 12px 14px;
    line-height: 1.6;
}

.error {
    border: 1px solid #f0b8b1;
    background: #fff4f2;
    color: var(--red);
    border-radius: 8px;
    padding: 12px 14px;
}

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

.svg-icon {
    width: 18px;
    height: 18px;
    flex: none;
}

.mobile-nav {
    display: none;
}

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

    .sidebar {
        display: none;
    }

    .mobile-nav {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        padding: 10px 16px;
        border-bottom: 1px solid var(--line);
        background: #fff;
    }

    .mobile-nav .nav-button {
        width: auto;
        min-width: max-content;
        background: #f4f7f6;
        color: var(--ink);
    }

    .grid-4,
    .grid-3,
    .grid-2,
    .metric-strip,
    .report-layout {
        grid-template-columns: 1fr;
    }

    .topbar {
        padding: 0 16px;
    }

    .content {
        padding: 16px;
    }
}

@media (max-width: 560px) {
    .topbar {
        height: auto;
        min-height: 64px;
        align-items: flex-start;
        flex-direction: column;
        padding: 12px 16px;
        gap: 10px;
    }

    .userbox {
        width: 100%;
        justify-content: space-between;
    }

    .question-band h2 {
        font-size: 23px;
    }

    .auth-card,
    .question-band,
    .card {
        padding: 16px;
    }
}
