/* Burrow 原型三页共用样式。
   视觉方向「账本纸」:淡绿账本纸底、白纸面板、墨色字;数字与日期一律等宽体(收据 / 税务发票的语法);
   状态只用三种语义色 —— 红 = 要你动手、琥珀 = 我们不确定、绿 = 核对过 —— 「缺」不用颜色,用虚线。
   页面自己的 <style> 放在这个文件之后,只写本页组件与对本页的覆盖。断点统一 900px。 */

@import url('https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:ital,wght@0,400;0,700;1,400&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  color-scheme: light;
  --page: #EBEFE7;      /* 账本纸 */
  --paper: #FFFFFF;
  --paper-2: #F4F6F1;
  --ink: #15181B;
  --ink-2: #545D66;     /* 次要文字,白底 6.7:1 */
  --rule: #C6CFC0;
  --rule-2: #E0E6DA;
  --act: #B9301A;       --act-bg: #F9E6E1;
  --unsure: #8F5F00;    --unsure-bg: #F8EED2;
  --ok: #1D6842;        --ok-bg: #DFEFE4;
  --main-max: 1100px;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Atkinson Hyperlegible", "PingFang SC", "Noto Sans CJK SC", system-ui, -apple-system, sans-serif;
  font-family: var(--sans);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: .15em; }
small { font-size: max(.83em, 12px); }
code { font-family: var(--mono); font-size: max(.82em, 12px); background: var(--paper-2); padding: .02rem .3rem; border-radius: 2px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- 外壳:桌面侧栏 ---------- */
.app-shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100vh; }
.sidebar { border-right: 1px solid var(--rule); padding: 1.4rem 1rem 1.25rem; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 1.75rem; }
.brand { display: flex; align-items: center; gap: .6rem; padding: 0 .6rem; }
.brand-mark { width: 28px; height: 28px; border: 2px solid var(--ink); border-radius: 50% 50% 4px 4px; display: inline-flex; align-items: center; justify-content: center; font: 600 .85rem var(--mono); }
.brand strong { font: 700 .95rem var(--mono); letter-spacing: .14em; text-transform: uppercase; }
.brand small { display: block; color: var(--ink-2); font-size: .78rem; letter-spacing: 0; }
.sidebar nav { display: grid; gap: .1rem; }
.sidebar nav a { color: var(--ink); text-decoration: none; padding: .5rem .6rem; min-height: 44px; border-radius: 3px; display: flex; justify-content: space-between; align-items: center; }
.sidebar nav a:hover { background: var(--paper); }
.sidebar nav a[aria-current="page"] { background: var(--paper); font-weight: 700; box-shadow: inset 3px 0 0 var(--ink); }
.sidebar nav a .count { font: 600 .75rem var(--mono); background: var(--ink); color: var(--paper); border-radius: 2px; padding: .05rem .4rem; }
.sidebar nav .sub { padding-left: 1.5rem; font-size: .9rem; color: var(--ink-2); }
.sidebar nav .sub[aria-current="page"] { color: var(--ink); }
.sidebar .tenant { margin-top: auto; font-size: .82rem; color: var(--ink-2); border-top: 1px solid var(--rule); padding: .9rem .6rem 0; }
.sidebar .tenant strong { color: var(--ink); display: block; }

main { padding: 1.5rem 2rem 6rem; max-width: var(--main-max); }
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { margin: 0; font-size: 1.5rem; font-weight: 700; letter-spacing: -.01em; }
.page-head .sub, .page-head .date { color: var(--ink-2); font-size: .9rem; }

/* ---------- 面板:白纸,细规线,近直角 ---------- */
.panel { background: var(--paper); border: 1px solid var(--rule); border-radius: 3px; }

/* ---------- 状态章:等宽小字 + 细框,像盖在纸上的章 ---------- */
.chip, .st { display: inline-block; font: 500 .75rem/1.3 var(--mono); letter-spacing: .02em; border: 1.5px solid currentColor; border-radius: 2px; padding: .12rem .4rem; white-space: nowrap; color: var(--ink-2); background: var(--paper); }
.chip.ok, .st.ok { color: var(--ok); }
.chip.unsure, .st.moved, .st.changed { color: var(--unsure); }
.chip.act, .st.missing { color: var(--act); }
.chip.muted, .st.private { color: var(--ink-2); border-style: solid; opacity: .8; }
.chip.missing { border-style: dashed; color: var(--ink-2); }
.chip.fill { background: currentColor; }
.chip.fill > span { color: var(--paper); }

/* ---------- 按钮:一种尺寸;实底 = 确认类,描边 = 其他 ---------- */
.btn { border: 1.5px solid var(--ink); background: var(--ink); color: var(--paper); border-radius: 3px; min-height: 44px; padding: .35rem 1rem; font-size: .92rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: .3rem; }
.btn:hover { background: #2B3238; border-color: #2B3238; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.ghost { background: var(--paper); color: var(--ink); border-color: var(--rule); }
.btn.ghost:hover { border-color: var(--ink); background: var(--paper); }

/* ---------- 表单 ---------- */
select, input:not([type=checkbox]):not([type=radio]) { border: 1px solid var(--rule); border-radius: 3px; padding: .35rem .5rem; background: var(--paper); min-height: 44px; }
input[type=checkbox], input[type=radio] { width: 22px; height: 22px; accent-color: var(--ink); }
.empty-state { background: var(--paper); border: 1px dashed var(--ink-2); border-radius: 3px; padding: 1.25rem; color: var(--ink-2); font-size: .95rem; }
.empty-state a { color: var(--ink); }
.empty-state[hidden] { display: none; }
select:hover, input:hover { border-color: var(--ink-2); }
input[type=date], input[type=number], input[inputmode=decimal] { font-family: var(--mono); font-size: .9rem; }

/* ---------- 对话框 ---------- */
dialog { border: 1px solid var(--rule); border-radius: 3px; padding: 0; max-width: min(720px, 94vw); width: 100%; box-shadow: 0 24px 60px rgba(21, 24, 27, .28); color: var(--ink); }
dialog::backdrop { background: rgba(21, 24, 27, .5); }

/* ---------- 手机:底栏替代侧栏(今日 / 待处理 / 拍照 / 档案 / 设置;报表是桌面与导出的事,手机上从档案页进) ---------- */
.tabbar { display: none; }
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  main { padding: 1rem 1rem 6rem; }
  .btn { min-height: 44px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; background: var(--paper); border-top: 1px solid var(--rule); padding: .35rem 0 calc(.35rem + env(safe-area-inset-bottom)); z-index: 10; }
  .tabbar a { color: var(--ink-2); text-decoration: none; text-align: center; font-size: .7rem; white-space: nowrap; display: grid; gap: .15rem; justify-items: center; padding-top: .25rem; position: relative; }
  .tabbar a[aria-current="page"] { color: var(--ink); font-weight: 700; }
  .tabbar a[aria-current="page"]::before { content: ""; position: absolute; top: -.35rem; left: 30%; right: 30%; height: 2px; background: var(--ink); }
  .tabbar .glyph { font-size: 1.15rem; line-height: 1; }
  .tabbar .capture .glyph { width: 52px; height: 52px; border-radius: 50%; background: var(--ink); color: var(--paper); display: grid; place-items: center; margin-top: -1.5rem; font-size: 1.4rem; box-shadow: 0 2px 8px rgba(21,24,27,.3); }
}

/* ---------- 共用:提示条、原型场景开关(非产品) ---------- */
.toast { position: fixed; left: 50%; bottom: 5.5rem; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: .6rem 1rem; border-radius: 3px; font-size: .88rem; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 20; }
.toast.show { opacity: 1; }
.proto-switch { position: fixed; right: 1rem; bottom: 1rem; background: var(--paper); border: 1px dashed var(--ink-2); border-radius: 3px; padding: .5rem .75rem; font-size: .78rem; z-index: 5; display: grid; gap: .3rem; }
.proto-switch strong { font: 600 .7rem var(--mono); letter-spacing: .08em; color: var(--ink-2); }
.proto-switch label { display: flex; gap: .4rem; align-items: center; }
.proto-switch .reset { border: 1px solid var(--rule); background: var(--paper); border-radius: 2px; font-size: .72rem; padding: .15rem .4rem; color: var(--ink-2); justify-self: start; }
@media (max-width: 900px) { .proto-switch { bottom: 4.6rem; right: .5rem; } }
@media print { .proto-switch, .toast { display: none !important; } }

/* ---------- 入口弹层(票 04):桌面居中对话框,手机底部抽屉 ---------- */
.cap-side { margin: 0 .6rem; width: calc(100% - 1.2rem); min-height: 40px; font-size: .9rem; }
.capture-dlg { max-width: min(560px, 94vw); }
.cap { padding: 1.25rem; display: grid; gap: 1rem; }
.cap-head h2 { margin: 0 0 .2rem; font-size: 1.1rem; }
.cap-head .sub { color: var(--ink-2); font-size: .85rem; }
.cap-grid { display: grid; gap: .5rem; }
.cap-opt { display: flex; gap: .8rem; align-items: center; text-align: left; width: 100%; background: var(--paper); border: 1px solid var(--rule); border-radius: 3px; padding: .75rem .9rem; min-height: 64px; cursor: pointer; }
.cap-opt:hover, .cap-opt.over { border-color: var(--ink); background: var(--paper-2); }
.cap-opt .ico { font-size: 1.4rem; width: 2rem; text-align: center; flex: none; }
.cap-opt b { display: block; font-size: 1rem; }
.cap-opt small { color: var(--ink-2); font-size: .8rem; }
.cap-grid.cam .cap-big { flex-direction: column; justify-content: center; min-height: 150px; background: var(--ink); color: var(--paper); border-color: var(--ink); text-align: center; gap: .2rem; }
.cap-grid.cam .cap-big .ico { font-size: 2.2rem; width: auto; }
.cap-grid.cam .cap-big small { color: rgba(255,255,255,.75); }
.cap-grid.cam .cap-big:hover { background: #2B3238; }
.cap-two { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.cap-two .cap-opt { flex-direction: column; align-items: flex-start; gap: .3rem; min-height: 0; }
.cap-mail { margin: 0; font-size: .82rem; color: var(--ink-2); }
.cap-mail .soon, .cap .soon { font: 500 .65rem/1.3 var(--mono); border: 1.5px dashed var(--rule); padding: .05rem .3rem; border-radius: 2px; margin-left: .35rem; color: var(--ink-2); white-space: nowrap; }
.cap-form h3 { margin: 0 0 .6rem; font-size: 1rem; }
.cap-form .fields { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem .9rem; }
.cap-form label { display: grid; gap: .15rem; font-size: .78rem; color: var(--ink-2); }
.cap-form input, .cap-form select { width: 100%; }
.cap-form .note { font-size: .82rem; color: var(--ink-2); margin: .6rem 0; }
.cap-form .doc-actions { display: flex; gap: .5rem; }
.cap-queue { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule-2); font-size: .85rem; }
.cap-queue li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .6rem; align-items: center; padding: .45rem 0; border-bottom: 1px solid var(--rule-2); }
.cap-queue .what { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cap-queue .where { color: var(--ink-2); font: .75rem var(--mono); white-space: nowrap; }
.cap-foot { display: flex; justify-content: space-between; gap: .5rem; }
@media (max-width: 900px) {
  .capture-dlg { max-width: 100%; width: 100%; margin: auto 0 0; border-radius: 8px 8px 0 0; border-bottom: 0; }
  .cap { padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom)); }
  .cap-form .fields { grid-template-columns: 1fr; }
  .cap-queue li { grid-template-columns: auto minmax(0, 1fr); }
  .cap-queue .where { grid-column: 2; }
  .cap-foot { flex-direction: column-reverse; }
}
.row .sig.manual { color: var(--ink-2); }

/* ---------- 详情抽屉(票 08):左原图、右字段与审计链;待处理与档案共用 ---------- */
.drawer-dlg { max-width: min(980px, 94vw); }
.drawer { display: grid; grid-template-columns: minmax(0, .9fr) minmax(320px, 1.1fr); max-height: 88vh; }
.dr-img { background: var(--paper-2); padding: 1rem; border-right: 1px solid var(--rule); display: grid; align-content: start; gap: .8rem; overflow: auto; }
.dr-img svg { width: 100%; max-height: 52vh; height: auto; }
.dr-img .big-thumb { background: var(--paper); border: 1px solid var(--rule); padding: 1rem; display: grid; place-items: center; }
.dr-img .big-thumb svg { max-height: 52vh; width: auto; }
.dr-img .note { margin: 0; color: var(--ink-2); font-size: .8rem; }
.legend { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; font-size: .85rem; }
.legend li { display: flex; gap: .5rem; align-items: center; }
.legend i { width: 18px; height: 12px; border: 2px solid var(--ink); display: inline-block; flex: none; }
.legend i.l2 { border-style: dashed; }
.legend i.l3 { border-style: dotted; }
.legend i.l4 { border-style: double; border-width: 3px; }
.dr-side { padding: 1.25rem; display: grid; gap: .9rem; align-content: start; overflow: auto; }
.dr-head h2 { margin: 0; font-size: 1.1rem; }
.dr-head .sub { margin: .1rem 0 0; color: var(--ink-2); font: .8rem var(--mono); word-break: break-all; }
.dr-side h3 { margin: 0; font-size: .8rem; font-weight: 400; color: var(--ink-2); letter-spacing: .02em; }
.kv { display: grid; grid-template-columns: 6.5em minmax(0, 1fr); gap: .45rem .8rem; margin: 0; font-size: .88rem; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; word-break: break-all; }
.kv dd select { max-width: 100%; }
.kv dd .mix { display: inline-flex; gap: .3rem; align-items: center; margin-left: .4rem; font-size: .85rem; }
.kv dd .mix input { width: 4.4em; }
.kv dd .mix .remember { color: var(--ink-2); font-size: .75rem; }
.timeline { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule-2); font-size: .85rem; }
.timeline li { display: grid; grid-template-columns: 7em minmax(0, 1fr); gap: .6rem; padding: .35rem 0; border-bottom: 1px solid var(--rule-2); }
.timeline time { color: var(--ink-2); font: .78rem var(--mono); }
.dr-side .note { font-size: .8rem; color: var(--ink-2); margin: 0; }
.dr-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.dr-actions .grow { flex: 1; }
.dr-actions .hint { font-size: .8rem; color: var(--ink-2); flex-basis: 100%; }
@media (max-width: 900px) {
  .drawer { grid-template-columns: 1fr; }
  .dr-img { border-right: 0; border-bottom: 1px solid var(--rule); }
  .dr-img svg { max-height: 40vh; }
  .kv { grid-template-columns: 1fr; }
  .timeline li { grid-template-columns: 1fr; gap: .1rem; }
}

/* ---------- 动效降级 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- 打印 ---------- */
@media print {
  body { background: #fff; }
  .sidebar, .tabbar, .btn, dialog { display: none !important; }
  .app-shell { display: block; }
  main { padding: 0; max-width: none; }
}
