:root {
    color-scheme: light;
    --page: #f4f3f0;
    --surface: #fff;
    --ink: #252326;
    --muted: #777579;
    --line: #e5e3e0;
    --accent: #a41d49;
    --accent-active: #7f1538;
    --ok: #456959;
    --warn: #99602e;
    font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
    font-size: 15px;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--page); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-underline-offset: .2em; }
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid #a41d49; outline-offset: 3px; }
p { margin: 0; line-height: 1.6; }
h1, h2 { margin: 0; line-height: 1.25; }
h1 { font-size: clamp(2rem, 3.2vw, 2.65rem); letter-spacing: -.035em; font-weight: 650; }
h2 { font-size: 1.21rem; font-weight: 650; }
.secondary { color: var(--muted); }
[hidden] { display: none !important; }
.icon { width: 1.15em; height: 1.15em; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.topbar { background: #fff; border-bottom: 1px solid #e8e6e3; }
.topbar-inner, .workspace { width: min(1180px, calc(100% - 80px)); margin-inline: auto; }
.topbar-inner { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand, .session-actions { display: flex; align-items: center; gap: 12px; }
.brand { text-decoration: none; color: var(--ink); font-weight: 650; letter-spacing: .02em; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; color: var(--accent); font-size: 22px; }
.session-actions { gap: 18px; }
.account { color: var(--muted); overflow-wrap: anywhere; font-size: .84rem; }
.account-link { color: var(--ink); font-size: .85rem; text-decoration: none; white-space: nowrap; }
.account-link:hover { color: var(--accent); }
.workspace { padding-block: 40px 70px; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 20px; margin-bottom: 31px; }
.page-heading .secondary { margin-top: 9px; font-size: .94rem; }
.eyebrow, .section-number { color: #918b8c; font-size: .75rem; letter-spacing: .05em; }
.eyebrow { margin-bottom: 10px; }
.section-number { margin-bottom: 8px; color: var(--accent); }
.panel { background: var(--surface); border: 1px solid var(--line); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 42px; padding: 10px 16px; border: 1px solid transparent; border-radius: 4px; font-weight: 600; font-size: .88rem; line-height: 1.3; text-decoration: none; white-space: nowrap; }
.button-primary { background: var(--accent); color: #fff; }
.button-primary:hover { background: var(--accent-active); }
.button-secondary { background: #fff; border-color: #dedbd9; color: var(--ink); }
.button-secondary:hover { background: #f8f7f5; border-color: #c9c5c3; }
.button-quiet, .button-text { background: transparent; color: var(--accent); }
.button-quiet:hover, .button-text:hover { color: var(--accent-active); text-decoration: underline; }
.button-text { padding: 6px 8px; min-height: 34px; font-weight: 500; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 25px; background: #fff; border: 1px solid var(--line); }
.metric { padding: 17px 27px 18px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric p { color: var(--muted); font-size: .8rem; margin-bottom: 6px; }
.metric strong { font-family: inherit; font-weight: 500; font-size: 1.9rem; line-height: 1; font-variant-numeric: tabular-nums; }
.metric span { margin-left: 7px; color: #a39e9d; font-size: .8rem; }
.editor-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(270px, .8fr); gap: 20px; align-items: stretch; }
.form-panel, .template-panel { padding: 29px; }
.section-copy { margin-top: 8px; font-size: .87rem; }
.generate-form { margin-top: 31px; }
.layout-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.field { display: grid; align-content: start; gap: 9px; min-width: 0; }
.field label { font-weight: 600; font-size: .87rem; }
.field input { min-width: 0; width: 100%; min-height: 45px; padding: 10px 12px; color: var(--ink); background: #fff; border: 1px solid #dcd9d7; border-radius: 4px; }
.field input:focus { border-color: var(--accent); }
.field small { color: #979193; font-size: .74rem; line-height: 1.5; }
.input-unit { display: flex; align-items: center; border: 1px solid #dcd9d7; border-radius: 4px; background: white; }
.input-unit:focus-within { border-color: var(--accent); }
.input-unit input { border: 0; background: transparent; outline: none; }
.input-unit span { padding: 0 12px; color: #969092; font-size: .8rem; white-space: nowrap; }
.sheet-summary { display: flex; align-items: end; justify-content: space-between; gap: 15px; margin-top: 33px; padding: 21px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.summary-label, .sheet-summary small { display: block; color: var(--muted); font-size: .8rem; }
.sheet-summary strong { display: block; margin: 7px 0 5px; font-family: inherit; font-size: clamp(1.45rem, 2.3vw, 1.8rem); font-weight: 500; line-height: 1.2; font-variant-numeric: tabular-nums; }
.sheet-summary em { font-family: "PingFang SC", sans-serif; font-size: .8rem; font-style: normal; color: var(--muted); }
.summary-rule { color: #979193; font-size: .76rem; line-height: 1.8; text-align: right; }
.form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; margin-top: 22px; }
.form-actions .button { min-width: 170px; justify-content: space-between; }
.form-actions span { color: #999294; font-size: .78rem; }
.template-heading { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.status-text { color: var(--accent); font-size: .75rem; padding: 4px 0; }
.preview-stage { display: grid; place-items: center; min-height: 200px; margin: 22px 0 18px; padding: 15px; background: #f3f4f2; }
.preview-stage img { display: block; width: 126px; max-width: 100%; height: auto; box-shadow: 0 5px 18px #23212418; }
.template-meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: .82rem; }
.template-meta span { color: var(--muted); }
.template-meta strong { font-weight: 600; }
.template-hint { margin-top: 9px; font-size: .75rem; color: #a19b9b; }
.list-panel { overflow: hidden; margin-top: 20px; }
.list-heading { display: flex; justify-content: space-between; align-items: end; gap: 18px; padding: 24px 27px; }
.list-heading > .secondary { font-size: .8rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; text-align: left; }
table th, table td { padding: 15px 19px; border-top: 1px solid var(--line); vertical-align: middle; }
table th:first-child { padding-left: 27px; }
thead { background: #faf9f7; color: var(--muted); }
thead th { font-weight: 500; white-space: nowrap; }
tbody th { font-weight: 600; overflow-wrap: anywhere; }
.date-cell, .uses-cell { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.action-cell { width: 1%; white-space: nowrap; }
.action-cell form { margin: 0; }
.empty-state { padding: 36px 27px; color: var(--muted); border-top: 1px solid var(--line); }
.empty-state a { display: inline-block; margin-top: 7px; }
.pagination { display: flex; justify-content: center; gap: 16px; padding: 15px; border-top: 1px solid var(--line); font-size: .87rem; }
.pagination span { color: var(--muted); }
.serial { overflow-wrap: anywhere; }
.row-note { display: block; margin-top: 4px; color: var(--muted); font-size: .78rem; font-weight: 400; }
.back-link { display: inline-flex; align-items: center; gap: 7px; margin-bottom: 25px; color: var(--muted); font-size: .84rem; text-decoration: none; }
.back-link:hover { color: var(--accent); }
.heading-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.sheet-panel { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.45fr); column-gap: 45px; row-gap: 18px; padding: 28px; }
.sheet-intro .secondary { margin-top: 10px; font-size: .86rem; max-width: 320px; }
.proof-note { margin-top: 11px; color: #9b5b31; font-size: .78rem; }
.sheet-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: end; gap: 12px; }
.sheet-form .button { min-height: 45px; }
.sheet-measure { grid-column: 1 / -1; font-size: .83rem; color: var(--muted); }
.sheet-measure span { margin: 0 5px; color: #c8c2bf; }
.sheet-footnote { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 16px; color: #969092; font-size: .78rem; }
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; white-space: nowrap; }
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag-warm { color: var(--warn); }
.tag-ok { color: var(--ok); }
.notice, .copy-status { margin-bottom: 16px; border: 1px solid; padding: 11px 14px; font-size: .88rem; }
.notice-error { background: #fff4f5; color: #8e2440; border-color: #efdadd; }
.notice-success, .copy-status { background: #f1f7f3; color: #436b51; border-color: #d9e8dd; }
.copy-status { margin-top: 12px; overflow-wrap: anywhere; }
.login-layout { min-height: calc(100svh - 68px); display: grid; place-items: center; padding: 45px 20px; }
.login-panel { width: min(100%, 425px); padding: 36px; }
.section-icon { color: var(--accent); font-size: 20px; }
.login-panel h1 { margin-top: 22px; font-size: 1.9rem; }
.login-panel .secondary { margin-top: 10px; }
.login-panel .notice { margin: 17px 0 0; }
.login-form { display: grid; gap: 20px; margin-top: 28px; }
.login-button { justify-content: space-between; min-height: 46px; margin-top: 2px; }
.problem-back { margin-top: 20px; }
.account-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.account-panel { padding: 28px; }
.account-panel > .secondary { margin-top: 8px; font-size: .86rem; }
.account-form { display: grid; gap: 20px; margin-top: 26px; }
.account-form .button { justify-self: start; min-width: 136px; margin-top: 2px; }
.account-list { margin-top: 20px; }
.account-list-heading { display: flex; justify-content: space-between; align-items: center; padding: 22px 28px; }
.account-list-heading .secondary { font-size: .8rem; }
.account-item { display: flex; align-items: center; gap: 12px; padding: 15px 28px; border-top: 1px solid var(--line); overflow-wrap: anywhere; font-size: .88rem; }
.account-item span { color: var(--muted); font-size: .78rem; white-space: nowrap; }
@media (max-width: 850px) {
    .topbar-inner, .workspace { width: calc(100% - 40px); }
    .workspace { padding-top: 28px; }
    .editor-grid { grid-template-columns: minmax(0, 1fr); }
    .template-panel { display: grid; grid-template-columns: 1fr 160px; column-gap: 20px; }
    .template-heading { align-self: start; }
    .preview-stage { grid-column: 2; grid-row: 1 / 4; margin: 0; min-height: 190px; }
    .template-meta { align-self: end; }
    .sheet-panel { grid-template-columns: 1fr; }
    .sheet-footnote { grid-column: 1; }
    .code-table { min-width: 760px; }
    .account-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 540px) {
    .topbar-inner, .workspace { width: calc(100% - 28px); }
    .topbar-inner { min-height: 62px; }
    .session-actions { gap: 5px; }
    .account { max-width: 7ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .account-link { padding-inline: 5px; font-size: .8rem; }
    .metric { padding: 15px 12px; }
    .metric strong { font-size: 1.5rem; }
    .metric p { font-size: .75rem; }
    .form-panel, .template-panel, .sheet-panel { padding: 22px 19px; }
    .layout-fields { grid-template-columns: 1fr; gap: 18px; }
    .sheet-summary { margin-top: 23px; }
    .summary-rule { display: none; }
    .template-panel { grid-template-columns: 1fr 135px; }
    .preview-stage { min-height: 175px; padding: 10px; }
    .preview-stage img { width: 100px; }
    .template-meta { display: grid; gap: 5px; }
    .list-heading { padding: 22px 19px; }
    .list-heading > .secondary { display: none; }
    table th:first-child { padding-left: 19px; }
    .sheet-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sheet-form .button { grid-column: 1 / -1; }
    .heading-actions { width: 100%; }
    .heading-actions .button { flex: 1; }
    .login-panel { padding: 26px; }
    .account-panel { padding: 22px 19px; }
    .account-list-heading, .account-item { padding-inline: 19px; }
}
