:root {
  color-scheme: light;
  --ink: #17231f;
  --muted: #64716b;
  --paper: #f6f4ee;
  --surface: #fffdf8;
  --line: #dcded6;
  --green: #195f49;
  --green-dark: #0f4535;
  --mint: #dcece4;
  --orange: #ed6b3a;
  --shadow: 0 22px 60px rgba(25, 57, 47, .09);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--paper); }
button, input, select { font: inherit; }
a { color: inherit; text-decoration: none; }

.topbar { height: 84px; padding: 0 max(28px, calc((100vw - 1180px)/2)); display: flex; align-items: center; justify-content: space-between; background: rgba(255,253,248,.94); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; backdrop-filter: blur(12px); }
.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark, .auth-mark { display: grid; place-items: center; width: 42px; height: 42px; background: var(--green); color: white; border-radius: 12px 4px 12px 4px; font-weight: 800; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; letter-spacing: .04em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 11px; }
nav { display: flex; align-items: center; gap: 24px; font-size: 14px; }
nav a { color: var(--muted); padding: 30px 0 27px; border-bottom: 3px solid transparent; }
nav a.active { color: var(--green); border-color: var(--green); font-weight: 700; }
.nav-button { border: 0; background: transparent; color: var(--muted); cursor: pointer; }

.page-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 70px 0 84px; }
.hero { max-width: 850px; margin-bottom: 44px; }
.hero.compact { margin-bottom: 34px; }
.eyebrow { margin: 0 0 14px; color: var(--orange); font-weight: 800; font-size: 12px; letter-spacing: .18em; }
.hero h1, .auth-card h1 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: clamp(38px, 5.2vw, 66px); line-height: 1.08; letter-spacing: -.035em; }
.hero.compact h1 { font-size: clamp(34px, 4.2vw, 54px); }
.hero > p:not(.eyebrow), .auth-card > p { max-width: 720px; color: var(--muted); line-height: 1.75; font-size: 16px; }
.data-meta { display: inline-flex; margin-top: 8px; padding: 9px 14px; border-radius: 999px; background: var(--mint); color: var(--green-dark); font-size: 13px; font-weight: 650; }

.price-shell { width: min(1500px, calc(100% - 40px)); padding-top: 50px; }
.price-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.price-heading h1, .price-heading p { margin: 0; }
.price-heading h1 { font: 700 clamp(38px, 4vw, 56px)/1.1 Georgia, "Songti SC", serif; }
.price-heading > div > p:last-child { margin-top: 12px; color: var(--muted); }
.workbook-panel { padding: 0; overflow: hidden; }
.sheet-tabs { display: flex; gap: 4px; padding: 14px 16px 0; overflow-x: auto; background: #eff2ec; border-bottom: 1px solid var(--line); scrollbar-width: thin; }
.sheet-tabs button { flex: 0 0 auto; min-width: 120px; max-width: 240px; padding: 12px 18px; overflow: hidden; border: 1px solid transparent; border-bottom: 0; border-radius: 10px 10px 0 0; background: transparent; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font: 700 13px/1.2 inherit; cursor: pointer; }
.sheet-tabs button:hover { color: var(--green); background: rgba(255,255,255,.55); }
.sheet-tabs button.active { position: relative; margin-bottom: -1px; background: var(--surface); color: var(--green-dark); border-color: var(--line); }
.sheet-tabs button.active::after { position: absolute; right: 16px; bottom: 5px; left: 16px; height: 2px; background: var(--green); content: ""; }
.sheet-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 24px 18px; }
.sheet-toolbar h2, .sheet-toolbar p { margin: 0; }
.sheet-toolbar h2 { font-size: 22px; }
.sheet-toolbar p { margin-top: 5px; color: var(--muted); font-size: 12px; }
.sheet-position { padding: 6px 10px; border-radius: 999px; background: var(--mint); color: var(--green-dark); font-size: 12px; font-weight: 700; white-space: nowrap; }
.sheet-notice { margin: 0 24px 16px; padding: 11px 14px; border: 1px solid #ead8a4; border-radius: 9px; background: #fff8df; color: #735c1f; font-size: 12px; line-height: 1.6; }
.sheet-table-wrap { max-height: 68vh; overflow: auto; border-top: 1px solid var(--line); background: white; }
.price-table { min-width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; }
.price-table th, .price-table td { min-width: 120px; max-width: 360px; padding: 10px 12px; border-right: 1px solid #e2e6df; border-bottom: 1px solid #e2e6df; background: white; text-align: left; vertical-align: top; white-space: pre-wrap; overflow-wrap: anywhere; }
.price-table thead th { position: sticky; top: 0; z-index: 3; min-width: 120px; padding: 8px 12px; background: #edf3ee; color: #50615a; text-align: center; font-size: 11px; }
.price-table .row-number, .price-table .table-corner { position: sticky; left: 0; z-index: 2; min-width: 54px; width: 54px; max-width: 54px; background: #f2f4f0; color: #728079; text-align: center; font-weight: 600; }
.price-table .table-corner { top: 0; z-index: 4; }
.price-table tbody tr:nth-child(even) td { background: #fbfcfa; }
.price-table td.number-cell { text-align: right; font-variant-numeric: tabular-nums; }
.table-loading, .table-empty { min-height: 360px; display: grid; place-content: center; gap: 8px; padding: 40px; color: var(--muted); text-align: center; }
.table-empty strong { color: var(--ink); font-size: 18px; }
.table-empty span { font-size: 13px; }
.table-empty.error strong { color: #a4352d; }

.query-grid, .admin-layout { display: grid; grid-template-columns: 390px 1fr; gap: 24px; align-items: start; }
.admin-layout { grid-template-columns: 1.25fr .75fr; }
.panel { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 20px; padding: 28px; }
.panel-heading { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.panel-heading > span { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--green); color: var(--green); border-radius: 50%; font-size: 12px; font-weight: 800; }
.panel-heading h2, .panel-heading p { margin: 0; }
.panel-heading h2 { font-size: 20px; }
.panel-heading p { margin-top: 4px; color: var(--muted); font-size: 12px; }

label { display: grid; gap: 8px; margin-bottom: 20px; color: #34433d; font-size: 13px; font-weight: 700; }
input, select { width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid #cfd5d1; border-radius: 10px; background: white; color: var(--ink); outline: none; }
input:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(25,95,73,.12); }
.checkbox-row { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.checkbox-row input { width: 19px; min-height: 19px; accent-color: var(--green); }
.checkbox-row strong, .checkbox-row small { display: block; }
.checkbox-row small { color: var(--muted); margin-top: 3px; font-weight: 400; }
.primary-button { width: 100%; min-height: 52px; border: 0; border-radius: 10px; padding: 0 18px; display: flex; justify-content: space-between; align-items: center; background: var(--green); color: white; font-weight: 800; cursor: pointer; transition: transform .15s ease, background .15s ease; }
.primary-button:hover { transform: translateY(-1px); background: var(--green-dark); }
.primary-button:disabled { opacity: .55; cursor: wait; }
.form-note { color: var(--muted); font-size: 12px; line-height: 1.6; }

.result-panel { min-height: 470px; }
.empty-state { min-height: 340px; display: grid; place-content: center; text-align: center; color: var(--muted); }
.empty-state[hidden], .result-list[hidden] { display: none; }
.empty-state h3, .empty-state p { margin: 8px 0 0; }
.empty-icon { width: 66px; height: 66px; display: grid; place-items: center; margin: 0 auto 10px; border-radius: 50%; background: var(--mint); color: var(--green); font: 700 28px Georgia, serif; }
.empty-icon.error { color: #9d3027; background: #f7dedb; }
.result-list { display: grid; gap: 16px; }
.quote-card { border: 1px solid var(--line); border-radius: 14px; padding: 20px; background: white; }
.quote-card.best { border-color: var(--green); box-shadow: inset 4px 0 var(--green); }
.quote-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.quote-head h3, .quote-head p { margin: 0; }
.quote-head h3 { font-size: 18px; }
.quote-head p { margin-top: 5px; color: var(--muted); font-size: 12px; }
.quote-head > strong { color: var(--green); font-family: Georgia, serif; font-size: 28px; white-space: nowrap; }
.best-tag { display: inline-block; margin-bottom: 7px; padding: 3px 7px; border-radius: 4px; background: var(--orange); color: white; font-size: 10px; font-weight: 800; }
.quote-breakdown { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 18px 0; padding: 14px; background: #f5f7f3; border-radius: 10px; }
.quote-breakdown small, .quote-breakdown b { display: block; }
.quote-breakdown small { color: var(--muted); font-size: 10px; }
.quote-breakdown b { margin-top: 4px; font-size: 13px; }
.rate-note { margin: 8px 0; padding-left: 10px; border-left: 2px solid var(--orange); color: var(--muted); font-size: 12px; line-height: 1.5; }
.quote-card footer { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; }

.drop-zone { min-height: 280px; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1.5px dashed #aebbb4; border-radius: 14px; background: #f8f9f5; cursor: pointer; text-align: center; }
.drop-zone:hover { border-color: var(--green); background: #f1f7f3; }
.drop-zone.dragging { border-color: var(--green); background: #e3f1e9; box-shadow: 0 0 0 4px rgba(26, 105, 80, .12); transform: translateY(-2px); }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.upload-icon { font-size: 38px; color: var(--green); }
.drop-zone strong { margin-top: 9px; font-size: 17px; }
.drop-zone small { margin-top: 6px; color: var(--muted); font-weight: 400; }
.drop-zone em { margin-top: 20px; color: var(--orange); font-style: normal; font-size: 12px; }
.upload-panel .primary-button { margin-top: 18px; }
.message { min-height: 20px; margin: 14px 0 0; color: var(--muted); font-size: 13px; }
.message.error { color: #a4352d; }
.message.success { color: var(--green); font-weight: 700; }
.status-panel dl { margin: 0; }
.status-panel dl > div { display: grid; grid-template-columns: 100px 1fr; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.status-panel dt { color: var(--muted); font-size: 12px; }
.status-panel dd { margin: 0; font-weight: 700; font-size: 13px; word-break: break-all; }
.rule-box { margin-top: 22px; padding: 18px; border-radius: 12px; background: var(--mint); color: var(--green-dark); font-size: 12px; }
.rule-box ul { margin: 10px 0 0; padding-left: 18px; line-height: 1.9; }

.auth-page { display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 15%, #e5efe9 0, transparent 36%), var(--paper); }
.auth-card { width: min(470px, 100%); padding: 42px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.auth-card h1 { font-size: 42px; }
.auth-mark { margin: 42px 0 22px; }
.back-link { color: var(--muted); font-size: 13px; }
.auth-card form { margin-top: 28px; }
body > footer { padding: 24px; border-top: 1px solid var(--line); color: var(--muted); text-align: center; font-size: 12px; }

@media (max-width: 820px) {
  .topbar { height: auto; min-height: 74px; padding: 14px 20px; align-items: flex-start; }
  nav { gap: 14px; }
  nav a { padding: 10px 0; border-bottom-width: 2px; }
  .brand small { display: none; }
  .page-shell { width: min(100% - 24px, 680px); padding-top: 44px; }
  .query-grid, .admin-layout { grid-template-columns: 1fr; }
  .hero h1 { font-size: 40px; }
  .price-heading { align-items: flex-start; flex-direction: column; }
  .price-table th, .price-table td { min-width: 105px; }
  .quote-breakdown { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 520px) {
  .topbar { flex-direction: column; gap: 10px; }
  nav { width: 100%; justify-content: flex-start; overflow-x: auto; }
  .panel { padding: 20px; }
  .quote-head { flex-direction: column; }
  .quote-card footer { flex-direction: column; }
  .auth-card { padding: 28px; }
}
