:root {
  --bg: #f5f3ee;
  --surface: #fbfaf7;
  --surface-strong: #ffffff;
  --text: #181713;
  --muted: #77746d;
  --faint: #9a968e;
  --line: rgba(24, 23, 19, 0.105);
  --line-strong: rgba(24, 23, 19, 0.18);
  --accent: #8f6543;
  --accent-soft: rgba(143, 101, 67, 0.10);
  --danger: #9a4038;
  --success: #49634e;
  --warning: #8d692d;
  --font-body: "HarmonyOS Sans SC", "MiSans", "Noto Sans CJK SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", "Cascadia Mono", monospace;
  --radius-container: 10px;
  --radius-control: 6px;
  --shadow-float: 0 18px 55px rgba(41, 37, 31, 0.075);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --rail: 238px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100dvh; background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 14px; line-height: 1.55; text-rendering: optimizeLegibility; }
button, input, select, textarea { font: inherit; color: inherit; }
button { border: 0; }
a { color: inherit; }
[hidden] { display: none !important; }
::selection { background: rgba(143, 101, 67, 0.18); }

.skip-link { position: fixed; left: 16px; top: 12px; z-index: 1000; transform: translateY(-160%); background: var(--text); color: white; padding: 9px 12px; border-radius: var(--radius-control); text-decoration: none; transition: transform 180ms var(--ease); }
.skip-link:focus { transform: translateY(0); }

.app-shell { min-height: 100dvh; display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); }
.side-rail { position: sticky; top: 0; align-self: start; height: 100dvh; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 25px 20px 22px; z-index: 30; }
.brand { display: flex; align-items: center; min-height: 54px; }
.brand-link { display: flex; align-items: center; gap: 12px; text-decoration: none; min-width: 0; }
.brand-symbol { width: 38px; height: 38px; border: 1px solid var(--text); border-radius: 50%; display: grid; place-items: center; font-family: var(--font-mono); font-weight: 700; font-size: 12px; letter-spacing: -0.02em; }
.brand-copy { display: grid; min-width: 0; }
.brand-copy strong { font-size: 14px; letter-spacing: 0.02em; }
.brand-copy small { color: var(--muted); font-size: 11px; margin-top: 1px; }
.rail-toggle { display: none; }

.nav { margin-top: 47px; display: grid; gap: 1px; }
.nav-item { width: 100%; min-height: 41px; display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; text-align: left; background: transparent; color: var(--muted); border-radius: var(--radius-control); padding: 0 10px; cursor: pointer; transition: color 160ms ease, background 160ms ease, transform 160ms ease; }
.nav-item span { font-family: var(--font-mono); font-size: 9px; color: var(--faint); }
.nav-item b { font-weight: 500; }
.nav-item em { font-family: var(--font-mono); font-size: 10px; font-style: normal; color: var(--faint); }
.nav-item:hover { color: var(--text); background: rgba(24, 23, 19, 0.035); }
.nav-item:active { transform: translateY(1px); }
.nav-item.is-active { color: var(--text); background: var(--accent-soft); }
.nav-item.is-active span { color: var(--accent); }
.nav-item:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible { outline: 2px solid rgba(143, 101, 67, 0.58); outline-offset: 2px; }

.rail-meta { margin-top: auto; border-top: 1px solid var(--line); padding: 18px 10px 0; color: var(--faint); font-size: 10px; }
.rail-meta p { margin: 5px 0; }
.sync-state { display: flex; align-items: center; gap: 8px; color: var(--muted); margin-bottom: 10px; }
.sync-state i { width: 6px; height: 6px; border-radius: 50%; background: var(--success); }

.content-shell { min-width: 0; }
.topbar { height: 72px; position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; padding: 0 clamp(24px, 3.4vw, 54px); background: rgba(245, 243, 238, 0.94); border-bottom: 1px solid var(--line); }
.topbar-left, .topbar-actions { display: flex; align-items: center; gap: 10px; }
.breadcrumb { display: flex; align-items: center; gap: 9px; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.04em; color: var(--faint); text-transform: uppercase; }
.breadcrumb i { width: 18px; height: 1px; background: var(--line-strong); }
.breadcrumb b { color: var(--muted); font-weight: 500; }
.menu-btn { display: none; }
.icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; background: transparent; border-radius: var(--radius-control); cursor: pointer; transition: background 160ms ease, transform 160ms ease; }
.icon-btn:hover { background: rgba(24, 23, 19, 0.05); }
.icon-btn:active { transform: translateY(1px); }
.icon-btn svg { width: 17px; height: 17px; }
.text-btn { min-height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 10px; background: transparent; color: var(--muted); cursor: pointer; border-radius: var(--radius-control); transition: background 160ms ease, color 160ms ease, transform 160ms ease; }
.text-btn:hover { background: rgba(24, 23, 19, 0.05); color: var(--text); }
.text-btn:active { transform: translateY(1px); }
.play-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.profile-btn { height: 38px; display: flex; align-items: center; gap: 9px; padding: 0 8px 0 5px; background: transparent; cursor: pointer; border-radius: var(--radius-control); }
.profile-btn:hover { background: rgba(24, 23, 19, 0.04); }
.profile-btn span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--text); color: white; font-family: var(--font-mono); font-size: 9px; }
.profile-btn b { font-size: 12px; font-weight: 500; }

.view-root { width: min(1380px, 100%); margin: 0 auto; padding: 52px clamp(24px, 3.4vw, 54px) 88px; }
.view-enter { animation: viewIn 540ms var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.editorial-head { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); align-items: end; gap: 48px; padding-bottom: 38px; border-bottom: 1px solid var(--line-strong); }
.editorial-head .eyebrow { margin: 0 0 12px; font-family: var(--font-mono); font-size: 10px; color: var(--accent); letter-spacing: .08em; text-transform: uppercase; }
.editorial-head h1 { margin: 0; max-width: 800px; font-size: clamp(38px, 5.2vw, 74px); line-height: .98; letter-spacing: -0.055em; font-weight: 560; }
.editorial-head .summary { max-width: 520px; justify-self: end; color: var(--muted); font-size: 14px; }
.editorial-head .summary p { margin: 0 0 18px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.primary-btn { min-height: 40px; padding: 0 15px; background: var(--text); color: white; border-radius: var(--radius-control); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: opacity 160ms ease, transform 160ms ease, background 160ms ease; }
.primary-btn:hover { background: #2b2924; }
.primary-btn:active { transform: translateY(1px); }
.primary-btn:disabled { opacity: .45; cursor: not-allowed; }
.secondary-btn { min-height: 40px; padding: 0 14px; border: 1px solid var(--line-strong); background: transparent; border-radius: var(--radius-control); cursor: pointer; transition: background 160ms ease, transform 160ms ease; }
.secondary-btn:hover { background: rgba(24, 23, 19, .035); }
.secondary-btn:active { transform: translateY(1px); }

.metric-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--line-strong); }
.metric { padding: 28px 0 25px; border-right: 1px solid var(--line); }
.metric + .metric { padding-left: 26px; }
.metric:last-child { border-right: 0; }
.metric small { display: block; color: var(--muted); font-size: 11px; margin-bottom: 16px; }
.metric strong { font-family: var(--font-mono); font-size: clamp(26px, 2.4vw, 38px); letter-spacing: -0.045em; font-weight: 500; }
.metric strong em { font-family: var(--font-body); color: var(--muted); font-size: 12px; font-style: normal; margin-left: 7px; letter-spacing: 0; }
.metric .delta { margin-left: 9px; font-family: var(--font-mono); font-size: 10px; color: var(--success); }

.section { padding: 46px 0 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.section-head h2, .section-head h3 { margin: 0; font-size: 18px; letter-spacing: -0.02em; font-weight: 560; }
.section-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.section-index { font-family: var(--font-mono); font-size: 10px; color: var(--faint); }

.flow-rail { display: grid; grid-template-columns: repeat(8, minmax(0,1fr)); border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); }
.flow-stage { position: relative; min-height: 118px; padding: 19px 18px 17px 0; border-right: 1px solid var(--line); cursor: default; }
.flow-stage + .flow-stage { padding-left: 18px; }
.flow-stage:last-child { border-right: 0; }
.flow-stage span { display: block; font-family: var(--font-mono); font-size: 9px; color: var(--faint); }
.flow-stage strong { display: block; margin-top: 18px; font-size: 15px; font-weight: 500; }
.flow-stage em { position: absolute; bottom: 16px; right: 16px; font-family: var(--font-mono); font-size: 22px; font-style: normal; font-weight: 500; }
.flow-stage.is-hot::after { content: ""; position: absolute; left: 0; bottom: -1px; width: 100%; height: 2px; background: var(--accent); transform-origin: left; animation: stagePulse 1.6s var(--ease) infinite alternate; }
@keyframes stagePulse { from { transform: scaleX(.35); opacity: .45; } to { transform: scaleX(1); opacity: 1; } }

.split-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, .5fr); gap: 48px; }
.sticky-aside { position: sticky; top: 102px; align-self: start; }
.rule-block { border-top: 1px solid var(--line-strong); }

.table-tools { display: flex; align-items: center; gap: 8px; }
.search-inline { width: 250px; display: flex; align-items: center; border-bottom: 1px solid var(--line-strong); }
.search-inline input { width: 100%; height: 38px; padding: 0 4px; border: 0; outline: 0; background: transparent; }
.search-inline input::placeholder { color: var(--faint); }
.filter-select { height: 38px; border: 0; border-bottom: 1px solid var(--line-strong); background: transparent; outline: 0; padding: 0 28px 0 4px; color: var(--muted); }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 10px 10px 10px 0; text-align: left; font-family: var(--font-mono); font-size: 9px; color: var(--faint); font-weight: 500; letter-spacing: .03em; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.data-table td { padding: 17px 10px 17px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tbody tr { transition: background 150ms ease; }
.data-table tbody tr:hover { background: rgba(24, 23, 19, .022); }
.data-table .id { font-family: var(--font-mono); font-size: 11px; }
.data-table .main-cell b { display: block; font-weight: 520; }
.data-table .main-cell small { display: block; color: var(--muted); margin-top: 2px; }
.data-table .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.row-action { min-height: 30px; padding: 0 7px; color: var(--muted); background: transparent; cursor: pointer; border-radius: var(--radius-control); }
.row-action:hover { background: rgba(24,23,19,.05); color: var(--text); }

.status { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; font-size: 11px; color: var(--muted); }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.status.good::before { background: var(--success); }
.status.warn::before { background: var(--warning); }
.status.bad::before { background: var(--danger); }
.status.accent::before { background: var(--accent); }

.ledger-aside { border-top: 1px solid var(--line-strong); padding-top: 16px; }
.ledger-aside .overline { font-family: var(--font-mono); font-size: 9px; color: var(--faint); }
.ledger-aside h3 { margin: 14px 0 8px; font-family: var(--font-mono); font-size: 24px; letter-spacing: -0.04em; font-weight: 500; }
.ledger-aside > p { color: var(--muted); margin: 0 0 26px; }
.ledger-list { border-top: 1px solid var(--line); }
.ledger-item { padding: 15px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 72px 1fr auto; gap: 14px; align-items: start; }
.ledger-item time { font-family: var(--font-mono); font-size: 9px; color: var(--faint); }
.ledger-item b { font-size: 12px; font-weight: 520; }
.ledger-item p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.ledger-item strong { font-family: var(--font-mono); font-size: 11px; font-weight: 500; }

.order-list { border-top: 1px solid var(--line-strong); }
.order-line { min-height: 84px; display: grid; grid-template-columns: 132px minmax(180px, 1fr) minmax(180px, .8fr) 140px 112px 30px; gap: 18px; align-items: center; border-bottom: 1px solid var(--line); padding: 10px 0; transition: background 160ms ease; }
.order-line:hover { background: rgba(24, 23, 19, .022); }
.order-line .order-id { font-family: var(--font-mono); font-size: 10px; }
.order-line b { font-weight: 520; }
.order-line small { color: var(--muted); }
.order-line .price { font-family: var(--font-mono); font-size: 11px; }

.work-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); border-top: 1px solid var(--line-strong); }
.work-item { min-height: 215px; padding: 24px 26px 24px 0; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); cursor: pointer; transition: background 160ms ease, transform 160ms ease; }
.work-item:nth-child(even) { border-right: 0; padding-left: 26px; }
.work-item:hover { background: rgba(24,23,19,.025); }
.work-item:active { transform: translateY(1px); }
.work-top { display: flex; justify-content: space-between; gap: 16px; }
.work-top .id { font-family: var(--font-mono); font-size: 11px; }
.work-item h3 { margin: 34px 0 5px; font-size: 20px; font-weight: 530; letter-spacing: -.025em; }
.work-item > p { margin: 0; color: var(--muted); }
.work-meta { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 28px; }
.work-meta span { color: var(--faint); font-size: 10px; }
.work-meta b { display: block; margin-top: 4px; font-family: var(--font-mono); font-size: 11px; font-weight: 500; }

.mobile-layout { display: grid; grid-template-columns: minmax(300px, .75fr) minmax(360px, 1.25fr); gap: 80px; align-items: start; }
.mobile-notes { padding-top: 20px; }
.mobile-notes h2 { font-size: clamp(34px, 4vw, 58px); line-height: 1.03; letter-spacing: -.05em; margin: 0 0 20px; font-weight: 540; }
.mobile-notes > p { color: var(--muted); max-width: 520px; }
.step-list { margin-top: 46px; border-top: 1px solid var(--line-strong); }
.step { padding: 18px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 38px minmax(0,1fr) auto; align-items: baseline; gap: 12px; }
.step span { font-family: var(--font-mono); font-size: 9px; color: var(--faint); }
.step b { font-weight: 520; }
.step em { font-size: 10px; color: var(--muted); font-style: normal; }
.step.is-active em { color: var(--accent); }
.phone-stage { display: flex; justify-content: center; position: sticky; top: 105px; }
.phone { width: 390px; min-height: 760px; background: #eeece6; border: 1px solid var(--line-strong); border-radius: 28px; padding: 10px; box-shadow: 0 22px 70px rgba(51,45,37,.075); }
.phone-inner { min-height: 738px; background: var(--surface-strong); border-radius: 20px; overflow: hidden; display: flex; flex-direction: column; }
.phone-bar { height: 58px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.phone-bar b { font-size: 13px; font-weight: 520; }
.phone-bar small { font-family: var(--font-mono); color: var(--faint); font-size: 9px; }
.phone-body { flex: 1; padding: 23px 20px; }
.phone-screen-title small { color: var(--muted); font-size: 11px; }
.phone-screen-title h3 { font-size: 26px; letter-spacing: -.04em; margin: 6px 0 0; font-weight: 540; }
.scan-area { margin-top: 38px; height: 320px; border: 1px solid var(--line-strong); display: grid; place-items: center; position: relative; overflow: hidden; }
.scan-corners { width: 168px; height: 168px; position: relative; }
.scan-corners::before, .scan-corners::after { content: ""; position: absolute; inset: 0; border: 1px solid var(--line-strong); }
.scan-corners::after { inset: 18px; border-color: var(--accent); opacity: .55; }
.scan-line { position: absolute; left: 17%; right: 17%; top: 50%; height: 1px; background: var(--accent); animation: scan 1.8s var(--ease) infinite alternate; }
@keyframes scan { from { transform: translateY(-88px); opacity: .3; } to { transform: translateY(88px); opacity: 1; } }
.phone-actions { margin-top: 18px; display: grid; gap: 9px; }
.phone-btn { min-height: 46px; width: 100%; border-radius: var(--radius-control); cursor: pointer; background: var(--text); color: white; }
.phone-btn.secondary { background: var(--bg); color: var(--text); border: 1px solid var(--line-strong); }
.phone-field { display: grid; gap: 7px; margin: 18px 0; }
.phone-field span { font-size: 11px; color: var(--muted); }
.phone-field input, .phone-field select { height: 44px; width: 100%; border: 1px solid var(--line-strong); background: white; border-radius: var(--radius-control); padding: 0 11px; outline: 0; font-size: 16px; }
.photo-proof { min-height: 84px; border: 1px dashed var(--line-strong); display: flex; justify-content: space-between; align-items: center; padding: 14px; }
.photo-proof b { font-size: 12px; }
.photo-proof small { display: block; color: var(--muted); margin-top: 3px; }
.success-mark { width: 58px; height: 58px; border-radius: 50%; background: var(--accent-soft); display: grid; place-items: center; color: var(--accent); font-size: 22px; margin: 65px 0 22px; }
.receipt { margin-top: 28px; border-top: 1px solid var(--line-strong); }
.receipt div { display: flex; justify-content: space-between; gap: 20px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.receipt span { color: var(--muted); }
.receipt b { font-family: var(--font-mono); font-weight: 500; }

.quality-layout { display: grid; grid-template-columns: minmax(280px, .58fr) minmax(0, 1.42fr); gap: 56px; }
.queue { border-top: 1px solid var(--line-strong); }
.queue-item { padding: 18px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.queue-item:hover b { color: var(--accent); }
.queue-item.is-selected b { color: var(--accent); }
.queue-item .id { font-family: var(--font-mono); font-size: 9px; color: var(--faint); }
.queue-item b { display: block; margin: 7px 0 2px; font-weight: 520; transition: color 150ms ease; }
.queue-item small { color: var(--muted); }
.quality-form { border-top: 1px solid var(--line-strong); }
.quality-title { padding: 20px 0 24px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 20px; }
.quality-title h3 { font-size: 26px; letter-spacing: -.035em; margin: 3px 0; font-weight: 540; }
.quality-title small, .quality-title p { margin: 0; color: var(--muted); }
.form-grid-editorial { display: grid; grid-template-columns: 1fr 1fr; gap: 0 26px; }
.field { display: grid; gap: 7px; padding: 15px 0; }
.field > span { color: var(--muted); font-size: 11px; }
.field input, .field select, .field textarea { width: 100%; min-height: 43px; border: 1px solid var(--line-strong); border-radius: var(--radius-control); background: var(--surface-strong); padding: 0 11px; outline: 0; transition: border-color 150ms ease, box-shadow 150ms ease; }
.field textarea { min-height: 90px; padding-top: 10px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: rgba(143,101,67,.55); box-shadow: 0 0 0 3px rgba(143,101,67,.08); }
.field.is-error input, .field.is-error select { border-color: rgba(154,64,56,.65); }
.field-error { min-height: 14px; color: var(--danger); font-size: 10px; }
.result-toggle { display: flex; gap: 7px; }
.result-toggle button { min-width: 78px; height: 38px; border: 1px solid var(--line-strong); border-radius: var(--radius-control); background: transparent; cursor: pointer; }
.result-toggle button.is-active { color: white; background: var(--text); border-color: var(--text); }
.form-actions-line { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line-strong); display: flex; justify-content: flex-end; gap: 8px; }

.inventory-hero { display: grid; grid-template-columns: 1.2fr .8fr; gap: 48px; border-bottom: 1px solid var(--line-strong); padding-bottom: 36px; }
.inventory-total small { color: var(--muted); }
.inventory-total strong { display: block; margin-top: 14px; font-family: var(--font-mono); font-size: clamp(48px, 7.2vw, 96px); line-height: .92; font-weight: 470; letter-spacing: -.07em; }
.inventory-total strong em { font-family: var(--font-body); font-size: 16px; font-style: normal; color: var(--muted); margin-left: 12px; letter-spacing: 0; }
.inventory-breakdown { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; align-self: end; }
.inventory-breakdown div { padding: 13px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; }
.inventory-breakdown span { color: var(--muted); }
.inventory-breakdown b { font-family: var(--font-mono); font-size: 11px; font-weight: 500; }
.stock-ledger { border-top: 1px solid var(--line-strong); }
.stock-row { min-height: 72px; display: grid; grid-template-columns: 95px 1.25fr 1fr 1fr 130px 130px; align-items: center; gap: 16px; border-bottom: 1px solid var(--line); }
.stock-row time { font-family: var(--font-mono); color: var(--faint); font-size: 9px; }
.stock-row .qty { font-family: var(--font-mono); text-align: right; }
.stock-row .qty.in { color: var(--success); }
.stock-row .qty.out { color: var(--danger); }

.document-layout { display: grid; grid-template-columns: minmax(0, .95fr) minmax(380px, 1.05fr); gap: 56px; }
.doc-list { border-top: 1px solid var(--line-strong); }
.doc-row { padding: 18px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 112px 1fr auto; gap: 16px; align-items: center; cursor: pointer; }
.doc-row:hover b, .doc-row.is-selected b { color: var(--accent); }
.doc-row .id { font-family: var(--font-mono); color: var(--faint); font-size: 9px; }
.doc-row b { font-weight: 520; transition: color 150ms ease; }
.doc-row small { color: var(--muted); display: block; margin-top: 3px; }
.paper { background: white; border: 1px solid var(--line-strong); min-height: 650px; padding: 48px; box-shadow: 0 20px 60px rgba(51,45,37,.055); }
.paper-head { display: flex; justify-content: space-between; align-items: start; border-bottom: 2px solid var(--text); padding-bottom: 22px; }
.paper-head h2 { margin: 0; font-size: 24px; letter-spacing: -.03em; font-weight: 600; }
.paper-head p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.paper-head .paper-code { font-family: var(--font-mono); font-size: 10px; color: var(--muted); }
.paper-meta { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 30px; margin: 28px 0; }
.paper-meta div { border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.paper-meta span { color: var(--muted); font-size: 10px; display: block; }
.paper-meta b { display: block; margin-top: 5px; font-weight: 520; }
.paper-table { width: 100%; border-collapse: collapse; }
.paper-table th, .paper-table td { text-align: left; border-bottom: 1px solid var(--line); padding: 12px 6px 12px 0; }
.paper-table th { color: var(--muted); font-size: 10px; font-weight: 500; }
.paper-foot { margin-top: 56px; display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; }

.report-hero { display: grid; grid-template-columns: minmax(0,.72fr) minmax(0,1.28fr); gap: 60px; align-items: end; padding-bottom: 44px; border-bottom: 1px solid var(--line-strong); }
.loss-big small { color: var(--muted); }
.loss-big strong { display: block; font-family: var(--font-mono); font-size: clamp(62px, 9vw, 126px); line-height: .88; letter-spacing: -.08em; font-weight: 460; margin-top: 16px; }
.loss-big strong em { font-family: var(--font-body); font-style: normal; font-size: 20px; color: var(--muted); letter-spacing: 0; }
.loss-big p { color: var(--muted); max-width: 420px; }
.chart-wrap { min-height: 280px; position: relative; display: flex; align-items: end; }
.chart-wrap svg { width: 100%; height: 260px; overflow: visible; }
.chart-grid line { stroke: var(--line); stroke-width: 1; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.chart-area { fill: rgba(143,101,67,.06); }
.chart-labels { display: flex; justify-content: space-between; color: var(--faint); font-family: var(--font-mono); font-size: 8px; margin-top: 6px; }
.rank-lines { border-top: 1px solid var(--line-strong); }
.rank-line { min-height: 66px; display: grid; grid-template-columns: 36px 180px minmax(0,1fr) 90px; align-items: center; gap: 15px; border-bottom: 1px solid var(--line); }
.rank-line .rank { font-family: var(--font-mono); color: var(--faint); font-size: 9px; }
.rank-track { height: 2px; background: var(--line); }
.rank-track i { display: block; height: 100%; background: var(--accent); transform-origin: left; animation: rankGrow 700ms var(--ease) both; }
@keyframes rankGrow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.rank-line strong { font-family: var(--font-mono); font-size: 11px; text-align: right; }

.settings-list { border-top: 1px solid var(--line-strong); }
.setting-row { min-height: 108px; display: grid; grid-template-columns: 60px minmax(220px,.65fr) minmax(0,1fr) 90px; gap: 24px; align-items: center; border-bottom: 1px solid var(--line); }
.setting-row .no { font-family: var(--font-mono); font-size: 10px; color: var(--faint); }
.setting-row h3 { font-size: 17px; font-weight: 530; margin: 0; }
.setting-row p { color: var(--muted); margin: 0; max-width: 700px; }
.setting-row button { justify-self: end; }

.empty-state { padding: 70px 20px; text-align: center; border-bottom: 1px solid var(--line); }
.empty-state h3 { margin: 0 0 4px; font-size: 17px; font-weight: 540; }
.empty-state p { margin: 0; color: var(--muted); }

.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(30, 28, 24, .26); opacity: 0; transition: opacity 180ms ease; }
.overlay.is-visible { opacity: 1; }
.modal { position: fixed; z-index: 70; left: 50%; top: 50%; width: min(720px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); overflow: auto; transform: translate(-50%, -47%); opacity: 0; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-container); box-shadow: var(--shadow-float); transition: transform 220ms var(--ease), opacity 180ms ease; }
.modal.is-visible { transform: translate(-50%, -50%); opacity: 1; }
.modal-head { min-height: 92px; padding: 22px 24px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-head small { color: var(--muted); }
.modal-head h2 { margin: 4px 0 0; font-size: 20px; font-weight: 550; }
.order-form { padding: 14px 24px 22px; }
.field-row { display: grid; gap: 20px; }
.two-col { grid-template-columns: 1fr 1fr; }
.three-col { grid-template-columns: repeat(3, 1fr); }
.file-field { margin: 10px 0 18px; min-height: 78px; border: 1px dashed var(--line-strong); display: flex; align-items: center; justify-content: space-between; padding: 15px; cursor: pointer; border-radius: var(--radius-control); }
.file-field:hover { background: rgba(24,23,19,.022); }
.file-field div { display: flex; align-items: center; gap: 12px; }
.file-field .file-index { font-family: var(--font-mono); color: var(--accent); font-size: 9px; }
.file-field small { color: var(--muted); }
.modal-actions { border-top: 1px solid var(--line); padding-top: 18px; display: flex; justify-content: flex-end; gap: 8px; }
.button-loading { display: none; }
.primary-btn.is-loading .button-label { display: none; }
.primary-btn.is-loading .button-loading { display: inline; }

.drawer { position: fixed; top: 0; right: 0; width: min(520px, 100vw); height: 100dvh; z-index: 80; background: var(--surface); border-left: 1px solid var(--line-strong); box-shadow: -24px 0 70px rgba(50,44,36,.06); transform: translateX(104%); transition: transform 320ms var(--ease); }
.drawer.is-open { transform: translateX(0); }
.drawer-head { height: 90px; padding: 0 24px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.drawer-head small { color: var(--muted); }
.drawer-head h2 { margin: 3px 0 0; font-family: var(--font-mono); font-size: 18px; font-weight: 520; }
.drawer-body { height: calc(100dvh - 90px); overflow: auto; padding: 24px; }
.trace-summary { display: grid; grid-template-columns: repeat(3,1fr); border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); }
.trace-summary div { padding: 16px 12px 16px 0; border-right: 1px solid var(--line); }
.trace-summary div + div { padding-left: 12px; }
.trace-summary div:last-child { border-right: 0; }
.trace-summary span { color: var(--muted); font-size: 10px; }
.trace-summary b { display: block; margin-top: 5px; font-family: var(--font-mono); font-size: 11px; font-weight: 500; }
.qr-row { display: grid; grid-template-columns: 92px 1fr; gap: 20px; padding: 28px 0; border-bottom: 1px solid var(--line-strong); }
.qr-visual { width: 92px; height: 92px; border: 8px solid var(--text); background: repeating-linear-gradient(45deg, white 0 4px, var(--text) 4px 8px); box-shadow: inset 0 0 0 6px white; }
.qr-row h3 { margin: 3px 0 6px; font-size: 15px; font-weight: 540; }
.qr-row p { margin: 0; color: var(--muted); font-size: 11px; }
.trace-list { margin-top: 26px; border-top: 1px solid var(--line-strong); }
.trace-node { display: grid; grid-template-columns: 62px 12px 1fr; gap: 10px; padding: 17px 0; border-bottom: 1px solid var(--line); }
.trace-node time { font-family: var(--font-mono); font-size: 9px; color: var(--faint); }
.trace-node i { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); margin-top: 6px; }
.trace-node.is-done i { background: var(--success); }
.trace-node.is-now i { background: var(--accent); }
.trace-node b { font-weight: 520; }
.trace-node p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }

.search-panel { position: fixed; z-index: 90; left: 50%; top: 90px; width: min(650px, calc(100vw - 32px)); transform: translateX(-50%) translateY(-8px); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-container); box-shadow: var(--shadow-float); opacity: 0; transition: opacity 160ms ease, transform 200ms var(--ease); }
.search-panel.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.search-panel header { height: 46px; display: flex; align-items: center; justify-content: space-between; padding: 0 15px; color: var(--muted); border-bottom: 1px solid var(--line); font-size: 11px; }
kbd { font-family: var(--font-mono); font-size: 9px; background: var(--bg); border: 1px solid var(--line); padding: 2px 5px; border-radius: 4px; }
.search-box { height: 58px; display: flex; align-items: center; gap: 8px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.search-box span { color: var(--faint); font-size: 20px; }
.search-box input { flex: 1; height: 100%; border: 0; outline: 0; background: transparent; font-size: 16px; }
.search-results { max-height: 360px; overflow: auto; }
.search-result { width: 100%; display: grid; grid-template-columns: 96px 1fr auto; gap: 14px; align-items: center; min-height: 62px; padding: 10px 16px; background: transparent; border-bottom: 1px solid var(--line); text-align: left; cursor: pointer; }
.search-result:hover { background: rgba(24,23,19,.035); }
.search-result span { font-family: var(--font-mono); font-size: 9px; color: var(--faint); }
.search-result b { font-weight: 520; }
.search-result small { color: var(--muted); }

.toast-region { position: fixed; right: 22px; bottom: 22px; z-index: 120; display: grid; gap: 8px; }
.toast { width: min(360px, calc(100vw - 32px)); background: var(--text); color: white; border-radius: var(--radius-control); padding: 13px 15px; box-shadow: 0 14px 40px rgba(20,18,15,.13); animation: toastIn 300ms var(--ease) both; }
.toast b { display: block; font-weight: 520; }
.toast small { display: block; opacity: .7; margin-top: 2px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.demo-status { position: fixed; z-index: 55; left: calc(var(--rail) + 24px); bottom: 22px; background: var(--surface-strong); border: 1px solid var(--line-strong); box-shadow: var(--shadow-float); min-width: 310px; min-height: 46px; display: grid; grid-template-columns: 72px 1fr auto; align-items: center; gap: 11px; padding: 0 12px; border-radius: var(--radius-control); }
.demo-line { height: 2px; background: var(--line); overflow: hidden; }
.demo-line i { display: block; height: 100%; background: var(--accent); transform-origin: left; animation: demoLine 2.35s linear infinite; }
@keyframes demoLine { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.demo-status span { font-size: 11px; color: var(--muted); }
.demo-status button { background: transparent; color: var(--muted); cursor: pointer; font-size: 11px; }

@media (max-width: 1100px) {
  :root { --rail: 210px; }
  .editorial-head, .split-layout, .report-hero, .document-layout { gap: 34px; }
  .flow-rail { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .flow-stage:nth-child(4) { border-right: 0; }
  .flow-stage:nth-child(-n+4) { border-bottom: 1px solid var(--line); }
  .stock-row { grid-template-columns: 78px 1.1fr .9fr 100px 110px; }
  .stock-row > :nth-child(4) { display: none; }
}

@media (max-width: 840px) {
  :root { --rail: 238px; }
  .app-shell { display: block; }
  .side-rail { position: fixed; left: 0; top: 0; width: var(--rail); transform: translateX(-104%); transition: transform 260ms var(--ease); box-shadow: 18px 0 60px rgba(35,31,26,.08); }
  body.menu-open .side-rail { transform: translateX(0); }
  .rail-toggle, .menu-btn { display: inline-grid; }
  .rail-toggle { position: absolute; right: 10px; top: 10px; }
  .topbar { padding: 0 16px; }
  .breadcrumb { display: none; }
  .profile-btn b, #demoBtn { display: none; }
  .view-root { padding: 36px 16px 70px; }
  .editorial-head, .split-layout, .mobile-layout, .quality-layout, .inventory-hero, .document-layout, .report-hero { grid-template-columns: 1fr; gap: 32px; }
  .editorial-head .summary { justify-self: start; }
  .editorial-head h1 { font-size: clamp(40px, 12vw, 64px); }
  .metric-strip { grid-template-columns: 1fr 1fr; }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .flow-rail { grid-template-columns: 1fr 1fr; }
  .flow-stage:nth-child(n) { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding-left: 14px; }
  .flow-stage:nth-child(even) { border-right: 0; }
  .sticky-aside, .phone-stage { position: static; }
  .order-line { grid-template-columns: 105px minmax(0,1fr) 90px 30px; gap: 10px; }
  .order-line > :nth-child(3), .order-line > :nth-child(4) { display: none; }
  .work-grid { grid-template-columns: 1fr; }
  .work-item, .work-item:nth-child(even) { padding: 22px 0; border-right: 0; }
  .phone { width: min(390px, 100%); }
  .inventory-breakdown { grid-template-columns: 1fr; }
  .paper { padding: 28px 22px; min-height: 560px; }
  .setting-row { grid-template-columns: 42px 1fr auto; padding: 18px 0; gap: 12px; }
  .setting-row p { grid-column: 2 / -1; }
  .rank-line { grid-template-columns: 30px 118px minmax(0,1fr) 70px; }
  .demo-status { left: 16px; right: 16px; bottom: 16px; min-width: 0; }
}

@media (max-width: 560px) {
  .editorial-head { padding-bottom: 28px; }
  .editorial-head h1 { font-size: 42px; }
  .metric-strip { grid-template-columns: 1fr; }
  .metric, .metric + .metric { border-right: 0; border-bottom: 1px solid var(--line); padding: 22px 0; }
  .metric:last-child { border-bottom: 0; }
  .section { padding-top: 36px; }
  .section-head { align-items: start; flex-direction: column; }
  .table-tools { width: 100%; flex-wrap: wrap; }
  .search-inline { flex: 1; min-width: 180px; }
  .order-line { grid-template-columns: 94px 1fr 28px; }
  .order-line > :nth-child(5) { display: none; }
  .work-meta { grid-template-columns: 1fr 1fr; }
  .mobile-notes h2 { font-size: 40px; }
  .quality-title { display: block; }
  .quality-title .status { margin-top: 10px; }
  .form-grid-editorial, .two-col, .three-col { grid-template-columns: 1fr; gap: 0; }
  .stock-row { grid-template-columns: 68px 1fr 92px; gap: 8px; }
  .stock-row > :nth-child(3), .stock-row > :nth-child(4), .stock-row > :nth-child(5) { display: none; }
  .doc-row { grid-template-columns: 84px 1fr; }
  .doc-row > :last-child { display: none; }
  .paper-meta { grid-template-columns: 1fr; }
  .rank-line { grid-template-columns: 28px 95px 1fr; }
  .rank-line .rank-track { display: none; }
  .setting-row { grid-template-columns: 34px 1fr; }
  .setting-row button { grid-column: 2; justify-self: start; }
  .trace-summary { grid-template-columns: 1fr; }
  .trace-summary div, .trace-summary div + div { border-right: 0; border-bottom: 1px solid var(--line); padding: 12px 0; }
  .trace-summary div:last-child { border-bottom: 0; }
  .file-field { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: 0.001ms !important; }
}


@media print {
  body { background: white; }
  .side-rail, .topbar, .editorial-head, .document-layout > div:first-child, .toast-region, .demo-status { display: none !important; }
  .app-shell, .content-shell, .view-root, .document-layout { display: block !important; margin: 0 !important; padding: 0 !important; width: 100% !important; max-width: none !important; }
  #paperPreview { display: block !important; }
  .paper { border: 0; box-shadow: none; min-height: 0; padding: 24mm 18mm; }
}
