:root {
    --bg: #f6efe2;
    --bg-soft: #fcf7ee;
    --paper: #fffdf9;
    --line: #dfd3c0;
    --line-strong: #c2af93;
    --text: #33261b;
    --muted: #786a58;
    --accent: #d79f52;
    --accent-soft: #f2d9ab;
    --green: #84bb4d;
    --shadow: 0 18px 45px rgba(84, 59, 28, 0.08);
    --radius: 20px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--text);
    font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    overflow-x: hidden;
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.65), transparent 30%),
        linear-gradient(135deg, #f7f0e4 0%, #f4ebdd 42%, #efe5d6 100%);
}

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

.page-shell {
    min-height: 100vh;
}

.brand-card,
.sidebar-panel,
.hero-card,
.panel {
    border: 1px solid rgba(149, 121, 84, 0.16);
    background: rgba(255, 252, 246, 0.82);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.brand-card {
    display: flex;
    gap: 16px;
    align-items: center;
    padding: 0;
    min-width: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.brand-mark {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: linear-gradient(145deg, #eed29a, #cf9150);
    color: #fff;
    font-size: 28px;
    font-weight: 700;
    flex: 0 0 58px;
    box-shadow: 0 12px 24px rgba(181, 117, 58, 0.16);
}

.brand-copy {
    min-width: 0;
}

.brand-card h1 {
    font-size: clamp(1.9rem, 2.2vw, 2.7rem);
    line-height: 0.92;
    white-space: nowrap;
}

.eyebrow {
    margin: 0 0 6px;
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.brand-card h1,
.hero-card h2,
.panel-header h3 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
}

.sidebar-panel {
    margin-top: 18px;
    padding: 18px;
}

.sidebar-title {
    margin: 0 0 12px;
    font-weight: 700;
}

.steps {
    margin: 0;
    padding-left: 20px;
    line-height: 1.9;
}

.muted p:last-child {
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.8;
}

.main {
    padding: 26px;
    min-width: 0;
}

.hero-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 32px;
    align-items: center;
    padding: 30px 42px;
    min-width: 0;
}

.hero-brand {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: nowrap;
}

.hero-copy-block {
    min-width: 0;
}

.hero-copy-block h2 {
    font-size: clamp(1.45rem, 2vw, 2.2rem);
    line-height: 1.05;
    max-width: none;
    white-space: nowrap;
}

.hero-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    align-self: center;
    padding-top: 0;
}

.hero-copy {
    max-width: 760px;
    line-height: 1.8;
    color: var(--muted);
}

.hero-pill,
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 13px;
    background: #fff7ea;
    border: 1px solid #ead7b8;
    color: #8c6431;
}

.workspace-grid {
    margin-top: 24px;
    display: grid;
    grid-template-columns: minmax(280px, 0.72fr) minmax(0, 1.28fr);
    gap: 22px;
    align-items: start;
}

.panel {
    padding: 24px;
    min-width: 0;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-bottom: 18px;
    min-width: 0;
}

.grading-form,
.summary-grid {
    display: grid;
    gap: 16px;
}

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

.field span {
    font-weight: 600;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.76);
    color: var(--text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: #d39b53;
    box-shadow: 0 0 0 4px rgba(215, 159, 82, 0.15);
}

.field small {
    color: var(--muted);
    line-height: 1.6;
}

.button-primary,
.button-secondary {
    border: 0;
    border-radius: 14px;
    padding: 12px 18px;
    cursor: pointer;
    transition: transform 0.18s ease, opacity 0.18s ease, box-shadow 0.18s ease;
}

.link-button {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.button-primary {
    background: linear-gradient(145deg, #e4b36d, #cb8850);
    color: #fff;
    box-shadow: 0 12px 28px rgba(181, 117, 58, 0.22);
}

.button-secondary {
    background: #fffdfa;
    color: var(--text);
    border: 1px solid var(--line);
}

.button-primary:hover,
.button-secondary:hover {
    transform: translateY(-1px);
}

button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.notice,
.empty-state {
    margin-top: 18px;
    padding: 16px 18px;
    border-radius: 16px;
    border: 1px dashed #d9c7a8;
    background: rgba(255, 249, 240, 0.8);
    color: var(--muted);
}

.toolbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.hidden {
    display: none;
}

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

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

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

.score-item {
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.58);
}

.score-item span {
    font-size: 13px;
    color: var(--muted);
    font-weight: 600;
}

.report-canvas {
    margin-top: 24px;
    display: grid;
    gap: 24px;
}

.report-sheet {
    padding: 28px;
    border: 2px solid #b49870;
    border-radius: 22px;
    background: var(--paper);
}

.image-export-stage .report-sheet {
    margin: 0 auto;
    width: 794px;
    max-width: 100%;
    border-radius: 0;
    box-shadow: 0 18px 42px rgba(69, 49, 24, 0.12);
}

.report-title {
    margin: 0 0 14px;
    text-align: center;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 34px;
}

.report-meta {
    display: grid;
    gap: 0;
    margin-bottom: 8px;
}

.report-subsection {
    margin-bottom: 8px;
}

.report-subsection h3 {
    margin: 2px 0 4px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.15;
}

.report-score-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-top: 4px;
}

.report-score-chip {
    padding: 8px 10px;
    border: 1px solid #d7c29f;
    border-radius: 14px;
    background: #fff8ee;
}

.report-score-chip strong,
.report-score-chip span {
    display: block;
}

.report-score-chip span {
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 2px;
}

.report-advice-panel {
    margin-top: 0;
    padding: 14px 16px;
    border: 1px solid #dbc39f;
    border-radius: 18px;
    background: transparent;
}

.report-advice-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 10px;
}

.report-advice-list li {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
}

.report-advice-index {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: linear-gradient(145deg, #e4b36d, #c9894f);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    box-shadow: 0 6px 14px rgba(181, 117, 58, 0.16);
}

.report-advice-body {
    font-size: 14px;
    line-height: 1.7;
    color: #403123;
}

.report-advice-section .report-section-title {
    margin-bottom: 12px;
}

.report-meta p {
    margin: 0 0 4px;
    font-size: 15px;
    line-height: 1.26;
}

.report-meta p:last-child {
    margin-bottom: 0;
}

.report-section-card {
    display: grid;
    align-content: start;
    margin-top: 12px;
}

.report-section-title {
    margin: 10px 0 10px;
    text-align: center;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 24px;
    font-weight: 500;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    overflow: hidden;
    border: 2px solid #2c241b;
}

.report-table th,
.report-table td {
    border: 1.5px solid #2c241b;
    padding: 5px 6px;
    vertical-align: top;
}

.report-table th {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 14px;
    text-align: center;
}

.report-table td:first-child,
.report-table th:first-child {
    width: 54%;
}

.report-table select,
.report-table input {
    width: 100%;
    border: 0;
    background: transparent;
    padding: 0;
}

.report-table td {
    font-size: 12px;
    line-height: 1.28;
}

.topic-text {
    margin-bottom: 4px;
}

.topic-translation {
    font-size: 11px;
    color: #6e5440;
    border-top: 1px dashed rgba(90, 70, 48, 0.25);
    padding-top: 3px;
}

.level-radio {
    display: grid;
    place-items: center;
    min-height: 28px;
}

.level-radio input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.level-radio span {
    width: 18px;
    height: 18px;
    border-radius: 999px;
    border: 2px solid #a8957d;
    background: #fffdf8;
    display: inline-block;
}

.level-radio.is-checked span,
.level-radio input:checked + span {
    box-shadow: inset 0 0 0 3px #fffdf8;
}

.level-radio.level-developing.is-checked span,
.level-radio.level-developing input:checked + span {
    background: #e88762;
    border-color: #d06a43;
}

.level-radio.level-satisfied.is-checked span,
.level-radio.level-satisfied input:checked + span {
    background: #f4c04d;
    border-color: #dcaa31;
}

.level-radio.level-excellent.is-checked span,
.level-radio.level-excellent input:checked + span {
    background: #78bf57;
    border-color: #5ea03f;
}

.theme-amber th {
    background: linear-gradient(180deg, #ffca4e, #efaf1b);
}

.theme-green th {
    background: linear-gradient(180deg, #8fce57, #69b33c);
}

.preview-panel {
    min-width: 0;
}

.form-panel {
    min-width: 0;
}

input[type="file"] {
    overflow: hidden;
}

.admin-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    padding: 22px;
    gap: 22px;
}

.admin-sidebar {
    padding: 18px;
    border: 1px solid rgba(149, 121, 84, 0.16);
    background: rgba(255, 252, 246, 0.82);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.admin-sidebar .brand-card {
    gap: 12px;
    padding: 0;
}

.admin-sidebar .brand-mark {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
    border-radius: 14px;
    font-size: 22px;
}

.admin-sidebar .eyebrow {
    margin-bottom: 4px;
    font-size: 11px;
    letter-spacing: 0.08em;
}

.admin-sidebar .brand-card h1 {
    font-size: 1.9rem;
    line-height: 0.98;
}

.admin-nav {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.admin-nav-item {
    width: 100%;
    border: 1px solid rgba(149, 121, 84, 0.16);
    border-radius: 16px;
    padding: 14px 16px;
    text-align: left;
    background: rgba(255, 255, 255, 0.72);
    color: var(--text);
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.admin-nav-item.active {
    background: linear-gradient(145deg, #f5deb2, #efc785);
    border-color: #d39b53;
}

.admin-nav-item:hover {
    transform: translateY(-1px);
}

.admin-main {
    display: grid;
    gap: 18px;
}

.admin-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 8px 6px;
}

.admin-topbar h2 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
}

.admin-card {
    padding: 28px;
    border: 1px solid rgba(149, 121, 84, 0.16);
    background: rgba(255, 252, 246, 0.9);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.admin-form {
    margin-top: 18px;
}

.notice.compact {
    margin-top: 0;
}

.provider-layout {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: 20px;
    margin-top: 18px;
}

.template-builder-layout {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: 20px;
    margin-top: 18px;
}

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

.template-summary-card {
    min-height: 420px;
}

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

.summary-chip {
    display: grid;
    gap: 8px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.72);
}

.summary-chip.full {
    grid-column: 1 / -1;
}

.summary-chip span {
    color: var(--muted);
    font-size: 13px;
}

.summary-chip strong {
    font-size: 15px;
    line-height: 1.5;
}

.template-section-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.section-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    padding: 8px 12px;
    background: #fff7ea;
    border: 1px solid #ead7b8;
    color: #6d522d;
    font-size: 13px;
}

.muted-pill {
    background: rgba(255, 255, 255, 0.72);
    border-color: var(--line);
    color: var(--muted);
}

.provider-list-panel,
.provider-form {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.62);
}

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

.provider-list-toolbar h4 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
}

.provider-list {
    display: grid;
    gap: 12px;
}

.provider-item {
    display: grid;
    gap: 10px;
}

.provider-card {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px;
    text-align: left;
    background: rgba(255, 253, 250, 0.85);
    cursor: pointer;
}

.provider-item.selected .provider-card {
    border-color: #d39b53;
    box-shadow: 0 0 0 4px rgba(215, 159, 82, 0.12);
}

.provider-card-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
}

.provider-card-main p {
    margin: 8px 0 0;
    color: var(--muted);
    word-break: break-all;
}

.provider-card-actions {
    display: flex;
    gap: 8px;
}

.small-button {
    padding: 8px 12px;
    font-size: 13px;
}

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

.test-result-panel {
    min-height: 110px;
}

.test-result-panel.success {
    border-style: solid;
    border-color: rgba(90, 156, 71, 0.35);
    background: rgba(237, 248, 232, 0.92);
    color: #315226;
}

.test-result-panel.error {
    border-style: solid;
    border-color: rgba(185, 96, 76, 0.35);
    background: rgba(255, 241, 236, 0.92);
    color: #7b2e22;
}

.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    place-items: center;
    padding: 24px;
    background: rgba(41, 28, 16, 0.42);
    backdrop-filter: blur(8px);
}

.modal-backdrop.is-open {
    display: grid;
}

.modal-card {
    width: min(920px, 100%);
    max-height: calc(100vh - 48px);
    overflow: auto;
    padding: 24px;
    border: 1px solid rgba(149, 121, 84, 0.16);
    background: rgba(255, 252, 246, 0.98);
    border-radius: 24px;
    box-shadow: 0 22px 60px rgba(63, 44, 24, 0.18);
}

.modal-large {
    width: min(980px, 100%);
}

.export-modal-card {
    display: grid;
    gap: 18px;
}

.export-modal-header {
    margin-bottom: 0;
}

.export-modal-notice {
    margin-top: 0;
}

.image-export-stage-wrap {
    max-height: calc(100vh - 230px);
    overflow: auto;
    padding: 20px;
    border: 1px solid rgba(149, 121, 84, 0.16);
    border-radius: 20px;
    background: #ffffff;
}

.image-export-stage {
    min-height: 240px;
    background: #ffffff;
}

.image-export-stage,
.image-export-stage * {
    background-image: none;
}

.image-export-stage .report-sheet,
.image-export-stage .report-meta,
.image-export-stage .report-subsection,
.image-export-stage .report-section-card,
.image-export-stage .report-advice-panel {
    background: #ffffff;
    box-shadow: none;
}

.image-export-stage.is-loading {
    display: grid;
    place-items: center;
    color: var(--muted);
}

.template-list {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.template-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.7);
}

.template-item h4,
.template-item p {
    margin: 0;
}

.template-item p {
    margin-top: 8px;
    color: var(--muted);
}

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

    .hero-card {
        grid-template-columns: 1fr;
        padding: 28px;
    }

    .hero-brand {
        gap: 12px;
    }

    .hero-actions {
        justify-content: flex-start;
        padding-top: 0;
    }

    .admin-topbar {
        align-items: start;
        flex-direction: column;
    }

    .provider-layout {
        grid-template-columns: 1fr;
    }

    .template-builder-layout {
        grid-template-columns: 1fr;
    }

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

    .report-sections-grid {
        grid-template-columns: 1fr;
    }

    .image-export-stage .report-sheet {
        width: 100%;
    }
}

@media (max-width: 1360px) {
    .hero-card {
        padding: 30px 34px;
    }

    .workspace-grid {
        grid-template-columns: minmax(260px, 0.78fr) minmax(0, 1.22fr);
    }
}
