:root {
  --ink: #102a2b; --muted: #607676; --line: #dce7e3; --surface: #fff;
  --soft: #f4f8f6; --brand: #116a59; --brand-dark: #0a4b3f; --accent: #dff4ec;
  --warn: #fff1d8; --danger: #a3352b;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: #edf3f0; font: 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
main { max-width: 1440px; margin: 0 auto; padding: 30px 26px 70px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 12px 0 24px; border-bottom: 1px solid #cbdad5; }
.account-actions { display: flex; flex-wrap: wrap; gap: 8px; }
h1 { margin: 0; font-size: clamp(28px, 4vw, 42px); letter-spacing: -.04em; }
h2 { margin: 0; font-size: 21px; }
h3 { margin: 0 0 12px; font-size: 16px; }
p { margin: 0; }
.eyebrow, .section-kicker { margin: 0 0 4px; color: var(--brand); font-weight: 750; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.subtitle, .section-head > p, #live-note { color: var(--muted); }
#notice { min-height: 24px; margin: 10px 0; color: #245b50; font-weight: 600; }
#notice.error { color: var(--danger); }
.identity-row { display: flex; justify-content: space-between; gap: 16px; margin: 10px 0; }
#identity { font-weight: 750; }
.panel, .summary-grid article, .login { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 7px 24px rgba(24, 64, 54, .035); }
.panel { margin-top: 16px; padding: 20px; scroll-margin-top: 12px; }
.login { max-width: 420px; padding: 24px; }
.password-panel { max-width: 760px; }
.password-panel form { grid-template-columns: repeat(3, minmax(150px, 1fr)) auto; align-items: end; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin-bottom: 16px; }
.summary-grid { display: grid; grid-template-columns: repeat(8, minmax(120px, 1fr)); gap: 10px; }
.summary-grid article { padding: 14px; min-height: 94px; display: flex; flex-direction: column; justify-content: space-between; }
.summary-grid span { color: var(--muted); }
.summary-grid strong { font-size: 28px; }
.summary-grid .success { background: #e8f8f1; border-color: #bfe4d6; }
.summary-grid .warning { background: var(--warn); border-color: #f0d8a8; }
.section-nav { position: sticky; top: 0; z-index: 3; display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: rgba(237, 243, 240, .94); backdrop-filter: blur(8px); }
.section-nav a { color: var(--brand-dark); text-decoration: none; font-weight: 700; padding: 6px 10px; border-radius: 7px; }
.section-nav a:hover { background: var(--accent); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.cards > section, .settings-grid > section { padding: 16px; border: 1px solid var(--line); border-radius: 11px; background: var(--soft); }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(280px, 1fr)); gap: 12px; }
form { display: grid; gap: 10px; align-content: start; }
label { display: grid; gap: 5px; color: #294342; font-weight: 600; }
small { color: var(--muted); font-weight: 400; }
code { padding: 1px 5px; border-radius: 4px; background: #e8efec; }
input, select, button, textarea { min-width: 0; border: 1px solid #b9cec6; border-radius: 8px; padding: 9px 11px; color: inherit; background: white; font: inherit; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(17, 106, 89, .13); border-color: var(--brand); }
button { border-color: var(--brand); background: var(--brand); color: white; cursor: pointer; font-weight: 750; }
button:hover { background: var(--brand-dark); }
.button-link { display: inline-block; margin-top: 8px; border: 1px solid var(--brand); border-radius: 8px; padding: 7px 11px; color: white; background: var(--brand); text-decoration: none; font-weight: 750; }
.button-link:hover { background: var(--brand-dark); }
.ghost, #logout { background: white; color: var(--brand); }
textarea { width: 100%; resize: vertical; }
fieldset { display: grid; gap: 10px; min-width: 0; border: 0; margin: 0; padding: 0; }
fieldset:disabled { opacity: .6; }
.inline-form { display: grid; grid-template-columns: 1.2fr 1.2fr .6fr 1fr 1fr 1.6fr auto; align-items: end; margin-bottom: 16px; padding: 13px; border-radius: 10px; background: var(--soft); }
.customer-filters { display: grid; grid-template-columns: 1.5fr repeat(3, 1fr) auto; gap: 10px; align-items: end; margin-bottom: 12px; }
.template-grid { grid-template-columns: repeat(3, 1fr); }
.template-grid button { grid-column: 1 / -1; justify-self: end; }
.profile-form { grid-template-columns: repeat(6, minmax(150px, 1fr)); margin-bottom: 16px; }
.profile-form .wide { grid-column: span 4; }
.profile-form button { align-self: end; }
.quota-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.check { display: flex; grid-template-columns: auto 1fr; align-items: center; }
.check input { min-width: auto; }
.compact { max-width: 220px; }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; }
.table-select { min-width: 112px; padding: 6px 8px; }
th, td { padding: 9px 10px; border-bottom: 1px solid #e5eeeb; }
th { background: #f0f6f3; color: #3c5855; font-size: 12px; letter-spacing: .03em; }
tbody tr:hover { background: #f8fbfa; }
.category-badges { display: flex; flex-wrap: wrap; gap: 7px; }
.category { padding: 4px 9px; border-radius: 999px; font-weight: 750; }
.category-a { background: #dff4ec; color: #075e4b; }
.category-b { background: #e6f0fb; color: #245982; }
.category-c { background: #fff0d6; color: #855912; }
.category-d { background: #f1e8e6; color: #7b413a; }
.ocr-layout { display: grid; grid-template-columns: minmax(260px, .8fr) minmax(420px, 1.4fr); gap: 18px; align-items: start; }
#ocr-preview { display: block; width: 100%; max-height: 620px; object-fit: contain; border: 1px solid var(--line); border-radius: 10px; background: #f7faf8; }
#ocr-progress { padding: 12px 0; color: var(--muted); }
#ocr-result-form { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
#ocr-result-form .wide, #ocr-result-form button { grid-column: 1 / -1; }
output { overflow-wrap: anywhere; }
#xiaoman-import-result { white-space: pre-wrap; padding: 12px; border: 1px solid #e2c98e; border-radius: 8px; background: #fff8e8; color: #513d12; }
[hidden] { display: none !important; }
@media (max-width: 1100px) {
  .summary-grid { grid-template-columns: repeat(4, 1fr); }
  .inline-form, .profile-form { grid-template-columns: repeat(2, 1fr); }
  .profile-form .wide { grid-column: span 2; }
  .template-grid { grid-template-columns: 1fr; }
  .ocr-layout { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  main { padding: 18px 12px 50px; }
  .topbar, .section-head, .identity-row { align-items: flex-start; flex-direction: column; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .settings-grid, .inline-form, .profile-form, .quota-row { grid-template-columns: 1fr; }
  .customer-filters { grid-template-columns: 1fr; }
  .profile-form .wide { grid-column: auto; }
  .section-nav { position: static; }
  .password-panel form { grid-template-columns: 1fr; }
}
