:root {
    color-scheme: light;
    --bg: #f3f6f4;
    --surface: #ffffff;
    --text: #17221d;
    --muted: #607068;
    --line: #dce5df;
    --brand: #146c4a;
    --brand-dark: #0b4a31;
    --accent: #d8efe4;
    --danger: #b42318;
    --success: #217a4d;
    font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at top right, #dcefe6 0, transparent 34rem),
        var(--bg);
    min-height: 100vh;
}

a {
    color: var(--brand-dark);
}

.topbar {
    min-height: 68px;
    padding: 0 5vw;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--line);
}

.brand {
    color: var(--text);
    font-size: 1.1rem;
    font-weight: 800;
    text-decoration: none;
}

.user-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--muted);
    font-size: 0.92rem;
}

.user-nav form {
    margin: 0;
}

.link-button {
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--brand-dark);
    cursor: pointer;
    font: inherit;
    text-decoration: underline;
}

.page-shell {
    width: min(1120px, 90vw);
    margin: 0 auto;
    padding: 4.5rem 0;
}

.hero {
    max-width: 720px;
    margin-bottom: 2rem;
}

h1 {
    margin: 0.4rem 0 0.8rem;
    font-size: clamp(2rem, 5vw, 3.6rem);
    letter-spacing: -0.045em;
    line-height: 1.05;
}

.hero p,
.content-card p,
.auth-card p {
    color: var(--muted);
    line-height: 1.75;
}

.eyebrow {
    color: var(--brand) !important;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.78rem;
    font-weight: 800;
}

.eyebrow.danger {
    color: var(--danger) !important;
}

.eyebrow.success {
    color: var(--success) !important;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.module-card {
    min-height: 150px;
    padding: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: 0 18px 50px rgba(32, 70, 51, 0.08);
    text-decoration: none;
    transition: transform 160ms ease, border-color 160ms ease;
}

.module-card:hover {
    transform: translateY(-3px);
    border-color: #93bca8;
}

.module-card strong,
.module-card small {
    display: block;
}

.module-card strong {
    margin: 0.2rem 0 0.7rem;
    font-size: 1.25rem;
}

.module-card small {
    color: var(--muted);
    line-height: 1.6;
}

.module-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 14px;
    background: var(--accent);
    color: var(--brand-dark);
    font-size: 1.4rem;
    font-weight: 800;
}

.auth-card,
.content-card,
.empty-state {
    width: min(520px, 100%);
    margin: 2rem auto;
    padding: clamp(1.5rem, 5vw, 2.5rem);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: 0 22px 70px rgba(32, 70, 51, 0.1);
}

.auth-card.wide {
    width: min(680px, 100%);
}

.auth-card h1,
.content-card h1 {
    font-size: clamp(1.9rem, 5vw, 2.8rem);
}

.stack-form {
    display: grid;
    gap: 0.7rem;
    margin-top: 1.5rem;
}

.stack-form label {
    margin-top: 0.45rem;
    font-size: 0.9rem;
    font-weight: 700;
}

.stack-form input,
.stack-form select,
.stack-form textarea {
    width: 100%;
    min-height: 46px;
    padding: 0.7rem 0.8rem;
    border: 1px solid #becbc3;
    border-radius: 10px;
    background: white;
    color: var(--text);
    font: inherit;
}

.stack-form input:focus {
    outline: 3px solid rgba(20, 108, 74, 0.16);
    border-color: var(--brand);
}

.button {
    min-height: 46px;
    margin-top: 0.7rem;
    padding: 0.72rem 1.1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--brand);
    border-radius: 11px;
    background: var(--brand);
    color: white;
    cursor: pointer;
    font: inherit;
    font-weight: 750;
    text-decoration: none;
}

.button:hover {
    background: var(--brand-dark);
}

.button.secondary {
    background: transparent;
    color: var(--brand-dark);
}

.muted,
.help-text {
    color: var(--muted);
}

.help-text {
    font-size: 0.82rem;
    line-height: 1.5;
}

.help-text ul {
    margin: 0.2rem 0 0;
    padding-left: 1.25rem;
}

.errorlist,
.form-error {
    color: var(--danger) !important;
}

.messages {
    padding: 0.5rem 1rem;
    border-radius: 12px;
    background: var(--accent);
}

.breadcrumbs {
    margin-bottom: 1.4rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--muted);
    font-size: 0.88rem;
}

.breadcrumbs a {
    color: var(--brand-dark);
    text-decoration: none;
}

.page-heading,
.product-hero {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 2rem;
}

.page-heading h1,
.product-hero h1 {
    margin: 0.2rem 0 0.6rem;
    font-size: clamp(2.2rem, 5vw, 4rem);
}

.page-heading p,
.product-summary,
.variant-title,
.section-heading p {
    margin: 0;
    color: var(--muted);
    line-height: 1.65;
}

.result-pill,
.status-badge,
.scenario-badge,
.product-code {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 800;
}

.result-pill {
    padding: 0.65rem 0.9rem;
    color: var(--brand-dark);
    background: var(--accent);
    white-space: nowrap;
}

.filter-panel {
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 14px 40px rgba(32, 70, 51, 0.06);
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.9rem;
}

.field {
    display: grid;
    align-content: start;
    gap: 0.38rem;
}

.field-wide {
    grid-column: span 2;
}

.field label {
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--muted);
}

.field input,
.field select {
    width: 100%;
    min-height: 44px;
    padding: 0.66rem 0.75rem;
    border: 1px solid #becbc3;
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    font: inherit;
}

.field input:focus,
.field select:focus {
    outline: 3px solid rgba(20, 108, 74, 0.13);
    border-color: var(--brand);
}

.filter-actions,
.detail-actions {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.filter-actions .button,
.detail-actions .button {
    margin-top: 0;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.product-card {
    min-width: 0;
    min-height: 310px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 16px 46px rgba(32, 70, 51, 0.07);
    text-decoration: none;
    transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.product-card:hover {
    transform: translateY(-3px);
    border-color: #8eb9a3;
    box-shadow: 0 20px 54px rgba(32, 70, 51, 0.12);
}

.product-card-top {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.product-code {
    padding: 0.34rem 0.58rem;
    color: var(--brand-dark);
    background: var(--accent);
    letter-spacing: 0.04em;
}

.status-badge {
    padding: 0.34rem 0.58rem;
    color: #41544a;
    background: #edf2ef;
}

.status-badge.warning {
    color: #8a4700;
    background: #fff0d6;
}

.product-meta {
    margin: 0 0 0.42rem;
    color: var(--muted);
    font-size: 0.8rem;
}

.product-card h2 {
    margin: 0;
    font-size: 1.15rem;
    line-height: 1.4;
}

.product-card h2 small {
    display: block;
    margin-top: 0.32rem;
    color: var(--brand);
    font-size: 0.8rem;
    font-weight: 750;
}

.product-facts,
.detail-grid {
    margin: 0;
}

.product-facts div {
    padding: 0.5rem 0;
    display: grid;
    grid-template-columns: 4.3rem minmax(0, 1fr);
    gap: 0.5rem;
    border-bottom: 1px solid #edf1ee;
}

.product-facts dt,
.detail-grid dt {
    color: var(--muted);
    font-size: 0.78rem;
}

.product-facts dd,
.detail-grid dd {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
}

.price-line {
    padding-top: 0.9rem;
    display: flex;
    align-items: baseline;
    gap: 0.32rem;
    border-top: 1px solid var(--line);
}

.price-line span {
    margin-right: auto;
    color: var(--muted);
    font-size: 0.78rem;
}

.price-line strong {
    color: var(--brand-dark);
    font-size: 1.35rem;
}

.price-line small {
    color: var(--muted);
}

.pagination {
    margin-top: 1.5rem;
    padding: 0.8rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: var(--muted);
}

.pagination a {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
    text-decoration: none;
}

.product-hero {
    align-items: stretch;
}

.product-hero > div {
    align-self: center;
}

.variant-title {
    margin-bottom: 0.4rem;
    color: var(--brand) !important;
    font-size: 1rem;
    font-weight: 800;
}

.price-card {
    min-width: 260px;
    padding: 1.25rem;
    display: grid;
    align-content: center;
    gap: 0.35rem;
    background: var(--brand-dark);
    color: white;
    border-radius: 18px;
    box-shadow: 0 20px 55px rgba(11, 74, 49, 0.18);
}

.price-card span,
.price-card small {
    color: #cce3d7;
}

.price-card strong {
    font-size: clamp(1.9rem, 4vw, 2.7rem);
}

.alert {
    margin-bottom: 1.3rem;
    padding: 1rem 1.15rem;
    border: 1px solid;
    border-radius: 14px;
}

.alert p {
    margin: 0.35rem 0 0;
    line-height: 1.6;
}

.warning-alert {
    color: #703d00;
    background: #fff5e3;
    border-color: #efc376;
}

.info-alert {
    color: #25453a;
    background: #eaf4ef;
    border-color: #b9d6c7;
}

.error-alert {
    color: #7a271a;
    background: #fef3f2;
    border-color: #fda29b;
}

.detail-section {
    margin-top: 1.25rem;
    padding: clamp(1.2rem, 3vw, 1.8rem);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
}

.section-heading {
    margin-bottom: 1rem;
}

.section-heading h2 {
    margin: 0.25rem 0 0.5rem;
    font-size: clamp(1.35rem, 3vw, 1.8rem);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    border-top: 1px solid var(--line);
    border-left: 1px solid var(--line);
}

.detail-grid div {
    min-width: 0;
    padding: 0.9rem;
    display: grid;
    gap: 0.28rem;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.detail-grid dd {
    font-weight: 650;
}

.spec-grid {
    display: grid;
    gap: 1rem;
}

.spec-card {
    padding: 1.15rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fbfcfb;
}

.spec-card h3 {
    margin: 0.75rem 0;
    font-size: 1rem;
}

.scenario-badge {
    padding: 0.32rem 0.6rem;
}

.scenario-badge.inquiry {
    color: #784300;
    background: #ffedc8;
}

.scenario-badge.tender {
    color: #1f4f86;
    background: #e4eefb;
}

.scenario-badge.delivery {
    color: var(--brand-dark);
    background: var(--accent);
}

.spec-content {
    color: #304039;
    line-height: 1.72;
    overflow-wrap: anywhere;
}

.spec-content p {
    margin: 0.4rem 0;
}

.notes-panel {
    color: #304039;
    line-height: 1.75;
}

.quote-heading {
    align-items: center;
}

.quote-form {
    display: grid;
    gap: 1rem;
}

.quote-form-section,
.result-section,
.result-hero {
    padding: clamp(1.2rem, 3vw, 1.8rem);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 14px 42px rgba(32, 70, 51, 0.06);
}

.quote-form-section .section-heading {
    max-width: 760px;
}

.quote-fields {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.9rem;
}

.quote-fields .field-error input,
.quote-fields .field-error select {
    border-color: var(--danger);
}

.conditional-panel {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px dashed #a9beb3;
    border-radius: 14px;
    background: #f8fbf9;
}

.conditional-panel.compact {
    max-width: 500px;
}

.conditional-panel[hidden] {
    display: none;
}

.check-group,
.option-grid {
    margin: 0 0 1rem;
    padding: 0;
    border: 0;
}

.check-group legend {
    margin-bottom: 0.65rem;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 800;
}

.check-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.check-group label,
.option-grid label {
    min-height: 46px;
    padding: 0.72rem 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #fff;
    cursor: pointer;
}

.check-group input,
.option-grid input {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--brand);
}

.option-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.7rem;
}

.quote-submit-bar {
    position: sticky;
    bottom: 0.8rem;
    z-index: 5;
    padding: 0.9rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border: 1px solid #91bba6;
    border-radius: 15px;
    background: rgba(238, 248, 243, 0.96);
    box-shadow: 0 16px 50px rgba(11, 74, 49, 0.16);
    backdrop-filter: blur(10px);
}

.quote-submit-bar strong,
.quote-submit-bar small {
    display: block;
}

.quote-submit-bar small {
    margin-top: 0.2rem;
    color: var(--muted);
}

.quote-submit-bar .button {
    min-width: 180px;
    margin: 0;
}

.quote-result {
    min-width: 0;
    margin-top: 2rem;
    display: grid;
    gap: 1rem;
}

.result-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    color: white;
    background: var(--brand-dark);
    border-color: var(--brand-dark);
}

.result-hero h2 {
    margin: 0.3rem 0 0.6rem;
    font-size: clamp(1.6rem, 4vw, 2.6rem);
}

.result-hero p {
    margin: 0;
    color: #d9e9e1;
    line-height: 1.7;
}

.result-total {
    min-width: 300px;
    display: grid;
    gap: 0.3rem;
    text-align: right;
}

.result-total span,
.result-total small {
    color: #c8dfd4;
}

.result-total strong {
    font-size: clamp(2rem, 5vw, 3.2rem);
}

.unified-warning {
    margin: 0;
}

.unified-warning p + p {
    padding-top: 0.55rem;
    border-top: 1px solid rgba(138, 71, 0, 0.15);
}

.result-section .section-heading {
    max-width: 820px;
}

.result-section,
.room-result,
.room-result-grid {
    min-width: 0;
}

.table-scroll {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.quote-table {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
    background: #fff;
}

.quote-table th,
.quote-table td {
    padding: 0.8rem;
    vertical-align: top;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

.quote-table th {
    color: #405047;
    background: #f4f8f5;
    font-size: 0.78rem;
    white-space: nowrap;
}

.quote-table td {
    color: #24332c;
    font-size: 0.88rem;
    line-height: 1.55;
}

.quote-table td small {
    display: block;
    margin-top: 0.2rem;
    color: var(--muted);
}

.quote-table .number {
    text-align: right;
    white-space: nowrap;
}

.quote-table tfoot th {
    color: var(--brand-dark);
    font-size: 0.92rem;
    background: var(--accent);
}

.quote-table .inquiry-row {
    background: #fffaf1;
}

.rule-details,
.spec-details {
    margin-top: 0.55rem;
}

.rule-details summary,
.spec-details summary {
    color: var(--brand-dark);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 750;
}

.rule-details p {
    margin: 0.45rem 0 0;
    color: var(--muted);
    font-size: 0.78rem;
}

.spec-details > div {
    width: min(620px, 70vw);
    max-height: 360px;
    margin-top: 0.7rem;
    padding: 0.8rem;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #f8faf9;
}

.spec-details p {
    margin: 0.35rem 0;
}

.room-result-grid {
    display: grid;
    gap: 0.8rem;
}

.room-result {
    border: 1px solid var(--line);
    border-radius: 13px;
    background: #fbfcfb;
    overflow: hidden;
}

.room-result > summary {
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    cursor: pointer;
    color: var(--brand-dark);
    font-weight: 800;
}

.room-result[open] > summary {
    border-bottom: 1px solid var(--line);
    background: var(--accent);
}

.room-result .table-scroll {
    border: 0;
    border-radius: 0;
}

.compact-table {
    min-width: 760px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 680px) {
    .topbar {
        padding: 0.8rem 5vw;
        align-items: flex-start;
        flex-direction: column;
    }

    .user-nav {
        width: 100%;
        gap: 0.75rem;
        flex-wrap: wrap;
    }

    .page-shell {
        padding: 2.5rem 0;
    }

    .module-grid {
        grid-template-columns: 1fr;
    }

    .module-card {
        min-height: 126px;
    }

    .page-heading,
    .product-hero {
        align-items: stretch;
        flex-direction: column;
        gap: 1rem;
    }

    .result-pill {
        align-self: flex-start;
    }

    .filter-grid {
        grid-template-columns: 1fr;
    }

    .field-wide {
        grid-column: span 1;
    }

    .filter-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .product-grid {
        grid-template-columns: 1fr;
    }

    .product-card {
        min-height: 288px;
    }

    .price-card {
        min-width: 0;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .quote-fields,
    .option-grid {
        grid-template-columns: 1fr;
    }

    .quote-submit-bar,
    .result-hero {
        align-items: stretch;
        flex-direction: column;
    }

    .quote-submit-bar {
        bottom: 0.4rem;
    }

    .quote-submit-bar .button {
        width: 100%;
    }

    .result-total {
        min-width: 0;
        text-align: left;
    }

    .check-group {
        display: grid;
    }

    .spec-details > div {
        width: 76vw;
    }
}

@media (min-width: 681px) and (max-width: 980px) {
    .filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .detail-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .quote-fields,
    .option-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
