:root {
    --bg: #f3ede1;
    --paper: rgba(255, 252, 244, 0.92);
    --ink: #1d2b26;
    --muted: #5a6c63;
    --line: rgba(29, 43, 38, 0.14);
    --accent: #2d6a4f;
    --accent-deep: #143d30;
    --accent-soft: #dfeee6;
    --warn: #c96d26;
    --danger: #b23a48;
    --shadow: 0 18px 50px rgba(25, 37, 31, 0.12);
    --radius: 22px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    color: var(--ink);
    background:
        radial-gradient(circle at top right, rgba(201, 109, 38, 0.14), transparent 26%),
        radial-gradient(circle at left 20%, rgba(45, 106, 79, 0.14), transparent 28%),
        linear-gradient(180deg, #f6f1e7 0%, #ede4d6 100%);
    font-family: "Microsoft YaHei UI", "PingFang SC", sans-serif;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(29, 43, 38, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(29, 43, 38, 0.02) 1px, transparent 1px);
    background-size: 24px 24px;
}

a {
    color: inherit;
    text-decoration: none;
}

.page-shell {
    width: min(1480px, calc(100% - 24px));
    margin: 10px auto 28px;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.topbar,
.panel,
.login-card,
.sheet-card,
.table-wrap {
    background: var(--paper);
    border: 1px solid rgba(255, 255, 255, 0.55);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.topbar {
    border-radius: 20px;
    padding: 10px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.brand {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.brand small {
    color: var(--muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-size: 12px;
}

.brand h1 {
    margin: 0;
    font-family: "STZhongsong", "Songti SC", serif;
    font-size: 24px;
    font-weight: 400;
    line-height: 1.2;
}

.topbar-actions,
.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.button,
button,
.link-button {
    appearance: none;
    border: 0;
    border-radius: 999px;
    padding: 12px 18px;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
    background: var(--accent);
    color: #fff;
    box-shadow: 0 10px 18px rgba(45, 106, 79, 0.18);
}

.button:hover,
button:hover,
.link-button:hover {
    transform: translateY(-1px);
}

.button.secondary,
button.secondary,
.link-button.secondary {
    background: rgba(29, 43, 38, 0.08);
    color: var(--ink);
    box-shadow: none;
}

.button.warn,
button.warn {
    background: var(--warn);
}

.button.danger,
button.danger {
    background: var(--danger);
}

.button.ghost,
button.ghost {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--ink);
    box-shadow: none;
}

.button.small,
button.small {
    padding: 8px 14px;
    font-size: 13px;
}

.button[disabled],
button[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.grid {
    display: grid;
    gap: 22px;
}

.grid.two {
    grid-template-columns: 1.05fr 0.95fr;
}

.panel {
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.panel h2,
.panel h3 {
    margin: 0 0 14px;
    font-family: "STZhongsong", "Songti SC", serif;
    font-weight: 400;
}

.modal-open {
    overflow: hidden;
}

.admin-modal[hidden] {
    display: none;
}

.admin-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 20px;
}

.admin-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(29, 43, 38, 0.42);
    backdrop-filter: blur(4px);
}

.admin-modal__card {
    position: relative;
    z-index: 1;
    width: min(720px, 100%);
    max-height: calc(100vh - 40px);
    overflow: auto;
    border-radius: 20px;
    padding: 24px;
    background: var(--paper);
    border: 1px solid rgba(255, 255, 255, 0.65);
    box-shadow: var(--shadow);
}

.admin-modal__actions {
    justify-content: flex-end;
    margin-top: 18px;
}

.muted {
    color: var(--muted);
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
}

.stat-card {
    border-radius: 18px;
    padding: 16px 18px;
    background: linear-gradient(135deg, rgba(45, 106, 79, 0.09), rgba(201, 109, 38, 0.07));
    border: 1px solid rgba(29, 43, 38, 0.08);
}

.stat-card strong {
    display: block;
    font-size: 24px;
    margin-top: 6px;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px 20px;
}

.login-card {
    width: min(460px, 100%);
    border-radius: 32px;
    overflow: hidden;
    display: block;
}

.login-hero {
    padding: 42px;
    background:
        linear-gradient(135deg, rgba(20, 61, 48, 0.92), rgba(45, 106, 79, 0.88)),
        linear-gradient(160deg, #17372c, #2d6a4f);
    color: #f8f3e7;
    position: relative;
}

.login-hero::after {
    content: "";
    position: absolute;
    inset: 18px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.login-hero small {
    letter-spacing: 0.15em;
    text-transform: uppercase;
    opacity: 0.7;
}

.login-hero h1 {
    margin: 14px 0 18px;
    font-family: "STZhongsong", "Songti SC", serif;
    font-size: 38px;
    font-weight: 400;
    line-height: 1.3;
}

.login-hero p {
    margin: 0 0 12px;
    color: rgba(248, 243, 231, 0.84);
    line-height: 1.8;
}

.login-form {
    padding: 34px 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 18px;
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field.full {
    grid-column: 1 / -1;
}

.inline-field-group {
    gap: 10px;
}

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

.inline-number-item {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.inline-number-item--compact {
    min-width: 220px;
}

.compact-number-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.compact-number-control {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px;
}

.compact-number-control span {
    color: var(--muted);
    font-size: 13px;
}

.field label,
.field-title {
    font-size: 14px;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.required-mark {
    color: var(--danger);
    font-weight: 700;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
textarea,
select {
    width: 100%;
    border: 1px solid rgba(29, 43, 38, 0.14);
    background: rgba(255, 255, 255, 0.75);
    border-radius: 16px;
    padding: 13px 14px;
    font-size: 14px;
    color: var(--ink);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea {
    min-height: 108px;
    resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
    border-color: rgba(45, 106, 79, 0.55);
    box-shadow: 0 0 0 4px rgba(45, 106, 79, 0.1);
}

.field-hint {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
}

.field-reference-image {
    margin: 4px 0 0;
    border: 1px solid rgba(29, 43, 38, 0.1);
    border-radius: 14px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.86);
}

.field-reference-image img {
    display: block;
    width: 100%;
    max-height: 260px;
    object-fit: contain;
}

.alert {
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(178, 58, 72, 0.1);
    color: var(--danger);
    border: 1px solid rgba(178, 58, 72, 0.14);
}

.table-wrap {
    border-radius: 20px;
    overflow: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

th,
td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
    text-align: center;
    font-size: 14px;
}

thead th {
    background: rgba(20, 61, 48, 0.06);
    color: var(--muted);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 1;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 12px;
    background: rgba(45, 106, 79, 0.1);
    color: var(--accent-deep);
}

.tag.draft {
    background: rgba(201, 109, 38, 0.14);
    color: #8a4f1d;
}

.tag.submitted {
    background: rgba(45, 106, 79, 0.14);
}

.topbar .button {
    padding: 9px 14px;
}

.sheet-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.sheet-sidebar {
    position: sticky;
    top: 6px;
    z-index: 8;
    border-radius: 16px;
    padding: 8px 12px;
    background: rgba(255, 252, 244, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.55);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px 10px;
    align-items: center;
}

.step-progress {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.step-progress-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 12px;
}

.progress-track {
    height: 5px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(29, 43, 38, 0.1);
}

.progress-track span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
    transition: width 0.22s ease;
}

.sheet-nav {
    display: flex;
    flex-direction: row;
    gap: 6px;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 2px 3px;
    scrollbar-width: thin;
}

.sheet-nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(29, 43, 38, 0.04);
    color: var(--ink);
    border: 1px solid rgba(29, 43, 38, 0.08);
    font-size: 12px;
    white-space: nowrap;
}

.sheet-sidebar .button-row {
    justify-content: flex-end;
}

.sheet-sidebar button {
    padding: 8px 13px;
    font-size: 13px;
}

.sheet-content {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.sheet-card {
    border-radius: var(--radius);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.questionnaire-card .sheet-header {
    display: none;
}

.sheet-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
}

.sheet-card h2 {
    margin: 0;
    font-family: "STZhongsong", "Songti SC", serif;
    font-size: 24px;
    font-weight: 400;
}

.sheet-section {
    border-radius: 22px;
    border: 1px solid rgba(29, 43, 38, 0.08);
    background: rgba(255, 255, 255, 0.6);
    padding: 22px;
}

.sheet-section + .sheet-section {
    margin-top: 16px;
}

.section-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.section-head h3 {
    margin: 0;
    font-family: "STZhongsong", "Songti SC", serif;
    font-size: 20px;
    font-weight: 400;
}

.section-desc {
    margin: 0 0 16px;
    color: var(--muted);
    line-height: 1.75;
}

.reference-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.reference-card {
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(29, 43, 38, 0.08);
    background: rgba(255, 255, 255, 0.8);
}

.reference-card img {
    display: block;
    width: 100%;
    height: auto;
    background: #fff;
}

.reference-card strong {
    display: block;
    padding: 10px 12px;
    font-size: 13px;
}

.option-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.option-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(29, 43, 38, 0.04);
    border: 1px solid transparent;
    cursor: pointer;
    transition: border-color 0.18s ease, background-color 0.18s ease;
}

.option-chip input {
    margin: 0;
}

.option-chip:has(input:checked) {
    border-color: rgba(45, 106, 79, 0.28);
    background: rgba(45, 106, 79, 0.1);
}

.option-group-vertical {
    flex-direction: column;
    align-items: stretch;
}

.choice-vertical-field .option-chip {
    width: 100%;
    border-radius: 12px;
    justify-content: flex-start;
    line-height: 1.55;
}

.upload-box {
    border: 1px dashed rgba(45, 106, 79, 0.3);
    border-radius: 18px;
    padding: 14px;
    background: rgba(223, 238, 230, 0.42);
}

.upload-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.upload-preview {
    margin-top: 12px;
}

.upload-preview img {
    max-width: 220px;
    max-height: 220px;
    display: block;
    border-radius: 14px;
    border: 1px solid rgba(29, 43, 38, 0.08);
    background: #fff;
}

.inline-note {
    font-size: 12px;
    color: var(--muted);
}

.toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 30;
    min-width: 220px;
    max-width: 360px;
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(20, 61, 48, 0.95);
    color: #fff;
    box-shadow: 0 12px 30px rgba(20, 61, 48, 0.28);
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.app-message-root {
    position: fixed;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    width: min(100vw - 24px, 460px);
    pointer-events: none;
}

.app-message {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 16px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    background: rgba(255, 252, 244, 0.96);
    color: var(--ink);
    box-shadow: 0 18px 40px rgba(29, 43, 38, 0.16);
    backdrop-filter: blur(12px);
    opacity: 0;
    transform: translateY(-12px) scale(0.98);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: auto;
}

.app-message.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.app-message__icon {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex: 0 0 10px;
    background: var(--accent);
    box-shadow: 0 0 0 5px rgba(45, 106, 79, 0.12);
}

.app-message__content {
    flex: 1;
    line-height: 1.6;
    word-break: break-all;
}

.app-message--success .app-message__icon {
    background: var(--accent);
    box-shadow: 0 0 0 5px rgba(45, 106, 79, 0.12);
}

.app-message--error .app-message__icon {
    background: var(--danger);
    box-shadow: 0 0 0 5px rgba(178, 58, 72, 0.12);
}

.app-message--warning .app-message__icon {
    background: var(--warn);
    box-shadow: 0 0 0 5px rgba(201, 109, 38, 0.12);
}

.app-message--info .app-message__icon {
    background: #4f7a6a;
    box-shadow: 0 0 0 5px rgba(79, 122, 106, 0.12);
}

.empty-state {
    padding: 18px;
    border-radius: 18px;
    color: var(--muted);
    background: rgba(29, 43, 38, 0.04);
    border: 1px dashed rgba(29, 43, 38, 0.12);
}

.table-wrap .button-row {
    justify-content: center;
}

.pager-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding-top: 6px;
}

.pager-summary {
    color: var(--muted);
    font-size: 14px;
}

.pager-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.pager-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.pager-form label {
    color: var(--muted);
    font-size: 14px;
}

.pager-form input[type="number"] {
    width: 88px;
    padding: 10px 12px;
    border-radius: 14px;
}

.button.is-disabled,
button.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    transform: none;
}

.admin-support-badge {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 1200;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 252, 244, 0.96);
    border: 1px solid rgba(29, 43, 38, 0.12);
    color: var(--ink);
    box-shadow: 0 14px 34px rgba(29, 43, 38, 0.14);
    backdrop-filter: blur(10px);
    font-size: 13px;
    cursor: default;
}

.admin-support-badge::after {
    content: attr(data-tooltip);
    position: absolute;
    right: 0;
    bottom: calc(100% + 12px);
    width: 290px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(20, 61, 48, 0.96);
    color: #f8f3e7;
    line-height: 1.7;
    box-shadow: 0 14px 34px rgba(20, 61, 48, 0.24);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}

.admin-support-badge:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

@media (max-width: 1080px) {
    .grid.two,
    .login-card {
        grid-template-columns: 1fr;
    }

    .sheet-layout {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .sheet-sidebar {
        top: 12px;
        padding: 8px 10px;
    }

    .sheet-nav {
        max-height: none;
    }
}

@media (max-width: 720px) {
    .page-shell {
        width: min(100% - 24px, 1380px);
    }

    .topbar,
    .panel,
    .sheet-card,
    .sheet-section,
    .login-form,
    .login-hero {
        padding: 14px;
    }

    .field-grid {
        grid-template-columns: 1fr;
    }

    .inline-number-grid {
        grid-template-columns: 1fr;
    }

    .topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .pager-bar,
    .pager-form {
        align-items: stretch;
    }

    .admin-support-badge {
        right: 12px;
        bottom: 12px;
    }

    .admin-support-badge::after {
        width: min(280px, calc(100vw - 32px));
    }

    .app-message-root {
        top: 12px;
        width: min(100vw - 20px, 460px);
    }
}

@media (max-width: 720px) {
    .sheet-layout {
        grid-template-columns: 1fr;
    }

    .sheet-sidebar {
        position: sticky;
        top: 0;
        z-index: 5;
        border-radius: 14px;
        grid-template-columns: 1fr;
    }

    .sheet-sidebar .button-row {
        justify-content: flex-start;
    }

    .sheet-nav {
        width: 100%;
    }
}

.sheet-nav a.active {
    background: var(--accent-soft);
    color: var(--accent-deep);
    border-color: rgba(45, 106, 79, 0.34);
    font-weight: 600;
}

body.collector-form-page {
    padding-bottom: 76px;
}

.collector-form-shell {
    width: min(1560px, calc(100% - 16px));
    margin: 6px auto 18px;
    padding-bottom: 0;
    gap: 6px;
}

.collector-form-shell .topbar {
    border-radius: 14px;
    padding: 6px 10px;
    gap: 8px;
}

.collector-form-shell .brand {
    min-width: 0;
    flex-direction: row;
    align-items: baseline;
    gap: 8px;
}

.collector-form-shell .brand small {
    flex: 0 0 auto;
    font-size: 10px;
    line-height: 1;
    letter-spacing: 0.03em;
}

.collector-form-shell .brand h1 {
    overflow: hidden;
    font-size: 20px;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.collector-form-shell .topbar-actions {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    gap: 6px;
}

.collector-form-shell .tag {
    padding: 2px 7px;
    font-size: 11px;
    line-height: 1.35;
}

.collector-form-shell .topbar .button {
    padding: 6px 10px;
    font-size: 12px;
    line-height: 1.2;
}

.collector-form-shell .sheet-layout {
    gap: 6px;
}

.collector-form-shell .sheet-sidebar {
    top: 4px;
    grid-template-columns: 160px minmax(0, 1fr) auto;
    gap: 5px 8px;
    border-radius: 12px;
    padding: 5px 8px;
}

.collector-form-shell .step-progress {
    grid-column: auto;
    gap: 2px;
}

.collector-form-shell .step-progress-meta {
    gap: 6px;
    font-size: 11px;
    line-height: 1.2;
}

.collector-form-shell .progress-track {
    height: 3px;
}

.collector-form-shell .sheet-nav {
    gap: 4px;
    padding: 0 2px 1px;
}

.collector-form-shell .sheet-nav a {
    padding: 4px 8px;
    font-size: 11px;
    line-height: 1.2;
}

.collector-form-shell .sheet-sidebar .button-row {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    gap: 5px;
}

.collector-form-shell .sheet-sidebar button {
    padding: 6px 10px;
    font-size: 12px;
    line-height: 1.2;
}

.collector-form-shell .sheet-content {
    gap: 10px;
}

.collector-form-shell .sheet-card {
    padding: 12px;
    gap: 8px;
}

.collector-form-shell .sheet-section {
    border-radius: 16px;
    padding: 16px;
}

.collector-form-shell .sheet-section + .sheet-section {
    margin-top: 10px;
}

body.collector-form-page .fixed-section-pager {
    position: fixed;
    left: 50%;
    bottom: 0;
    z-index: 30;
    width: min(1560px, calc(100% - 16px));
    margin-top: 0;
    padding: 8px 12px 10px;
    transform: translateX(-50%);
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-bottom: 0;
    border-radius: 22px 22px 0 0;
    background: rgba(255, 252, 244, 0.96);
    box-shadow: 0 -12px 34px rgba(25, 37, 31, 0.12);
    backdrop-filter: blur(12px);
}

body.collector-form-page .fixed-section-pager button {
    padding: 9px 22px;
    line-height: 1.2;
}

body.collector-form-page .fixed-section-pager [data-role="section-page"] {
    min-width: 150px;
    text-align: center;
    font-size: 16px;
}

@media (max-width: 1080px) {
    .collector-form-shell .topbar {
        flex-direction: row;
        align-items: center;
    }

    .collector-form-shell .sheet-sidebar {
        grid-template-columns: 1fr auto;
    }

    .collector-form-shell .step-progress {
        grid-column: 1 / -1;
    }
}

@media (max-width: 720px) {
    body.collector-form-page {
        padding-bottom: 78px;
    }

    .collector-form-shell {
        width: min(100% - 12px, 1380px);
        margin: 4px auto 12px;
        gap: 5px;
    }

    .collector-form-shell .topbar {
        padding: 5px 8px;
    }

    .collector-form-shell .brand small,
    .collector-form-shell .topbar-actions .tag:first-child {
        display: none;
    }

    .collector-form-shell .brand h1 {
        font-size: 17px;
    }

    .collector-form-shell .sheet-sidebar {
        padding: 5px 6px;
    }

    .collector-form-shell .sheet-card {
        padding: 8px;
    }

    .collector-form-shell .sheet-section {
        border-radius: 14px;
        padding: 12px;
    }

    body.collector-form-page .fixed-section-pager {
        width: calc(100% - 8px);
        padding: 7px 8px 9px;
        gap: 8px;
        border-radius: 16px 16px 0 0;
    }

    body.collector-form-page .fixed-section-pager button {
        padding: 8px 13px;
        font-size: 13px;
    }

    body.collector-form-page .fixed-section-pager [data-role="section-page"] {
        min-width: 108px;
        font-size: 13px;
    }
}

.section-pager {
    margin-top: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

.question-matrix {
    overflow-x: auto;
}

.question-matrix table {
    min-width: 720px;
}

.radio-matrix-group table {
    min-width: 640px;
}

.matrix-note-control {
    margin-top: 10px;
}

.question-detail-table {
    overflow-x: auto;
}

.question-detail-table table {
    min-width: 720px;
}

.question-detail-table th:first-child,
.question-detail-table td:first-child {
    width: 44%;
    text-align: left;
}

.detail-question {
    text-align: left;
}

.detail-question-label {
    line-height: 1.7;
}

.detail-note-control {
    margin-top: 10px;
}

.detail-answer {
    text-align: left;
}

.detail-answer-options {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px;
}

.detail-option-chip {
    width: auto;
    max-width: 100%;
    flex: 0 1 auto;
}

.option-chip span {
    min-width: 0;
    overflow-wrap: anywhere;
    line-height: 1.45;
}

.collector-form-shell .question-detail-table,
.collector-form-shell .question-matrix {
    max-width: 100%;
    overflow-x: visible;
}

.collector-form-shell .question-detail-table table,
.collector-form-shell .question-matrix table,
.collector-form-shell .radio-matrix-group table {
    width: 100%;
    min-width: 0;
    table-layout: auto;
}

.collector-form-shell .question-detail-table th,
.collector-form-shell .question-detail-table td,
.collector-form-shell .question-matrix th,
.collector-form-shell .question-matrix td {
    padding: 10px 12px;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.collector-form-shell .question-detail-table th:first-child,
.collector-form-shell .question-detail-table td:first-child,
.collector-form-shell .question-matrix th:first-child,
.collector-form-shell .question-matrix td:first-child {
    width: auto;
}

.collector-form-shell .question-detail-table th:last-child,
.collector-form-shell .question-detail-table td.detail-answer,
.collector-form-shell .question-matrix th:not(:first-child),
.collector-form-shell .question-matrix td:not(:first-child) {
    width: 1%;
}

.collector-form-shell .detail-answer {
    white-space: nowrap;
}

.collector-form-shell .detail-answer-options {
    display: flex;
    flex-wrap: wrap;
    width: max-content;
    max-width: min(52vw, 760px);
}

.collector-form-shell .detail-option-chip {
    width: auto;
    min-width: 0;
}

.collector-form-shell .detail-option-chip span {
    white-space: normal;
}

.collector-form-shell .detail-answer > input,
.collector-form-shell .detail-answer > textarea {
    width: min(420px, 52vw);
    max-width: 100%;
}

.question-matrix th:first-child,
.question-matrix td:first-child {
    width: 36%;
    text-align: left;
}

.matrix-option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
}

.matrix-option span {
    display: none;
}

@media (min-width: 721px) and (max-width: 1080px) {
    .page-shell {
        width: min(100% - 20px, 1380px);
    }

    .sheet-card,
    .sheet-section {
        padding: 18px;
    }

    .field-grid {
        gap: 14px;
    }

    .question-matrix table {
        min-width: 620px;
    }

    .collector-form-shell .question-detail-table th:first-child,
    .collector-form-shell .question-detail-table td:first-child,
    .collector-form-shell .question-matrix th:first-child,
    .collector-form-shell .question-matrix td:first-child {
        width: auto;
    }

    .collector-form-shell .question-detail-table table,
    .collector-form-shell .question-matrix table,
    .collector-form-shell .radio-matrix-group table {
        min-width: 0;
    }

    .collector-form-shell .detail-answer-options {
        max-width: min(48vw, 520px);
    }
}

@media (max-width: 720px) {
    .collector-form-shell .question-detail-table th:first-child,
    .collector-form-shell .question-detail-table td:first-child,
    .collector-form-shell .question-matrix th:first-child,
    .collector-form-shell .question-matrix td:first-child {
        width: auto;
    }

    .collector-form-shell .question-detail-table th,
    .collector-form-shell .question-detail-table td,
    .collector-form-shell .question-matrix th,
    .collector-form-shell .question-matrix td {
        padding: 8px;
    }

    .collector-form-shell .detail-answer-options {
        max-width: 52vw;
        gap: 6px;
    }

    .collector-form-shell .option-chip {
        padding: 8px 10px;
    }

    .collector-form-shell .detail-answer > input,
    .collector-form-shell .detail-answer > textarea {
        width: 52vw;
    }
}

.collector-form-shell .choice-matrix {
    overflow-x: visible;
    border-radius: 8px;
}

.collector-form-shell .choice-matrix table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

.collector-form-shell .choice-matrix thead th:first-child,
.collector-form-shell .choice-matrix tbody td:first-child {
    width: var(--choice-question-width, 40%);
    text-align: left;
}

.collector-form-shell .choice-matrix thead th:not(:first-child),
.collector-form-shell .choice-matrix tbody td:not(:first-child) {
    width: auto;
    text-align: center;
}

.collector-form-shell .choice-matrix thead th:not(:first-child) {
    padding-left: 6px;
    padding-right: 6px;
    font-size: 13px;
}

.collector-form-shell .choice-matrix th,
.collector-form-shell .choice-matrix td {
    padding: 12px 10px;
    word-break: normal;
}

.collector-form-shell .choice-matrix thead th {
    line-height: 1.45;
    white-space: normal;
    overflow-wrap: break-word;
}

.collector-form-shell .choice-matrix .matrix-question {
    line-height: 1.7;
    white-space: normal;
    overflow-wrap: break-word;
}

.collector-form-shell .choice-matrix .matrix-option {
    display: flex;
    width: 30px;
    height: 30px;
    margin: 0 auto;
    align-items: center;
    justify-content: center;
}

.collector-form-shell .choice-matrix .matrix-option input[type="radio"],
.collector-form-shell .choice-matrix .matrix-option input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin: 0;
}

.collector-form-shell .choice-matrix .matrix-reference-image {
    max-width: 260px;
}

.collector-form-shell .choice-matrix .matrix-reference-row td {
    padding: 8px 10px 16px;
    text-align: left;
}

.collector-form-shell .choice-matrix .matrix-reference-row .matrix-reference-image {
    max-width: none;
    width: 100%;
}

.matrix-dependent-fields {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    align-items: flex-end;
}

.matrix-dependent-item {
    min-width: 120px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.matrix-dependent-item label {
    font-size: 12px;
    color: var(--muted);
}

.matrix-dependent-item input,
.matrix-dependent-item textarea {
    padding: 8px 10px;
    border-radius: 10px;
}

.matrix-dependent-compact-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.matrix-dependent-control {
    display: grid;
    grid-template-columns: minmax(56px, 80px) auto;
    align-items: center;
    gap: 5px;
}

.matrix-dependent-control span {
    color: var(--muted);
    font-size: 12px;
}

@media (max-width: 720px) {
    .collector-form-shell .field-reference-image {
        width: 100%;
        max-width: none;
        margin-top: 10px;
    }

    .collector-form-shell .field-reference-image img {
        max-height: 76vh;
    }

    .collector-form-shell .choice-matrix .matrix-reference-image,
    .collector-form-shell .detail-reference-image {
        max-width: none;
    }

    .collector-form-shell .choice-matrix .matrix-reference-row td {
        padding: 8px 0 18px;
    }

    .collector-form-shell .choice-matrix thead th:first-child,
    .collector-form-shell .choice-matrix tbody td:first-child {
        width: 34%;
    }

    .collector-form-shell .choice-matrix th,
    .collector-form-shell .choice-matrix td {
        padding: 10px 12px;
    }

    .matrix-dependent-item {
        min-width: 96px;
    }

    .matrix-dependent-control {
        grid-template-columns: minmax(48px, 1fr) auto;
    }
}
