/* 账台 —— 设计系统
   字号按微信尺度：正文 17 / 次要 14 / 辅助 13；数字用等宽表格数字对齐。
   移动端优先，≥980px 切桌面工作台。 */

:root {
  --bg: #f4f2ee;
  --surface: #ffffff;
  --surface-2: #faf8f5;
  --ink: #17201c;
  --ink-2: #4c5a53;
  --muted: #8a948e;
  --line: #e6e2da;
  --line-2: #d8d2c7;
  --primary: #1d6b4b;
  --primary-ink: #14523a;
  --primary-soft: #e8f2ec;
  --hot: #c2452d;
  --hot-soft: #fbeae5;
  --gold: #a3752a;
  --gold-soft: #f7f0e0;
  --blue: #2a6fa8;
  --blue-soft: #e9f1f8;
  --radius: 14px;
  --radius-s: 10px;
  --shadow: 0 1px 2px rgba(23, 32, 28, .05), 0 8px 24px -12px rgba(23, 32, 28, .18);
  --shadow-up: 0 -2px 0 rgba(23, 32, 28, .04), 0 -12px 32px -16px rgba(23, 32, 28, .22);
  --tab-h: 54px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --fs-body: 17px;
  --fs-sub: 14px;
  --fs-aux: 13px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans CJK SC",
               "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  font-size: var(--fs-body); line-height: 1.55;
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
}
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--primary); }
table { border-collapse: collapse; width: 100%; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* ------------------------------------------------------------ 启动与登录 */
.boot { position: fixed; inset: 0; display: grid; place-content: center; gap: 10px;
        background: var(--bg); z-index: 60; text-align: center; }
.boot-mark { font-size: 30px; font-weight: 700; letter-spacing: .18em; color: var(--primary); }
.boot-tip { font-size: var(--fs-aux); color: var(--muted); }

.login { min-height: 100dvh; display: grid; place-content: center; gap: 18px; padding: 28px;
         background: radial-gradient(120% 90% at 50% -10%, #e6f0e9 0%, var(--bg) 60%); }
.login-brand { text-align: center; }
.login-brand .seal { width: 62px; height: 62px; border-radius: 16px; background: var(--primary);
  color: #fff; font-size: 24px; font-weight: 700; display: grid; place-content: center; margin: 0 auto 12px;
  letter-spacing: .04em; box-shadow: var(--shadow); }
.login-brand h1 { font-size: 22px; }
.login-brand p { margin: 6px 0 0; font-size: var(--fs-sub); color: var(--ink-2); }
.login-card { background: var(--surface); border-radius: var(--radius); padding: 18px;
              box-shadow: var(--shadow); max-width: 380px; width: 100%; }
.login-card label { display: block; font-size: var(--fs-aux); color: var(--muted); margin: 0 0 6px; }
.login-card input { width: 100%; padding: 13px 14px; border: 1px solid var(--line-2);
                    border-radius: var(--radius-s); background: var(--surface-2); margin-bottom: 14px; }
.login-card input:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: transparent; }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 4px; }
.pinpad button { padding: 14px 0; border-radius: var(--radius-s); background: var(--surface-2);
                 border: 1px solid var(--line); font-size: 19px; font-weight: 600; }
.pinpad button:active { background: var(--primary-soft); }
.pinpad .del { color: var(--hot); font-size: 15px; }
.login-acc { font-size: var(--fs-aux); color: var(--muted); text-align: center; line-height: 1.9; }
.login-acc b { color: var(--ink-2); font-weight: 600; }

/* ------------------------------------------------------------ 外壳 */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; background: var(--surface);
          border-bottom: 1px solid var(--line); padding: 10px 14px; display: flex; align-items: center;
          gap: 10px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
.topbar .brand { font-weight: 700; letter-spacing: .12em; color: var(--primary); font-size: 15px; }
.topbar .who { margin-left: auto; display: flex; align-items: center; gap: 8px;
               font-size: var(--fs-aux); color: var(--ink-2); }
.scope-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px;
              background: var(--primary-soft); color: var(--primary-ink); border-radius: 999px;
              font-size: var(--fs-aux); font-weight: 600; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .8; }
.out { color: var(--muted); font-size: var(--fs-aux); padding: 4px 6px; }

.scroll { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; }
.page { padding: 14px 14px calc(var(--tab-h) + 22px + var(--safe-b)); max-width: 720px; margin: 0 auto; }
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; height: calc(var(--tab-h) + var(--safe-b));
          padding-bottom: var(--safe-b); background: rgba(255, 255, 255, .94);
          border-top: 1px solid var(--line); display: grid; grid-auto-flow: column; z-index: 25;
          backdrop-filter: blur(8px); }
.tabbar button { display: grid; place-content: center; gap: 2px; color: var(--muted); font-size: 11px; }
.tabbar button.on { color: var(--primary); font-weight: 650; }
.tabbar .glyph { font-size: 19px; line-height: 1; }

/* ------------------------------------------------------------ 卡片与标题 */
.card { background: var(--surface); border-radius: var(--radius); padding: 16px;
        box-shadow: var(--shadow); margin-bottom: 12px; }
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.card-h { display: flex; align-items: baseline; gap: 8px; margin-bottom: 12px; }
.card-h h3 { font-size: 16px; }
.card-h .aux { margin-left: auto; font-size: var(--fs-aux); color: var(--muted); }
.sec-title { font-size: var(--fs-aux); color: var(--muted); letter-spacing: .06em;
             margin: 18px 2px 8px; font-weight: 600; }

/* 印章式标记：给涉税、锁定这类状态用，要像盖上去的章，不像小灰标签 */
.seal-badge { display: inline-block; padding: 3px 9px; border-radius: 6px; font-size: var(--fs-aux);
              font-weight: 700; letter-spacing: .04em; line-height: 1.5;
              border: 1.5px solid currentColor; background: transparent; }
.seal-green { color: var(--primary); }
.seal-red { color: var(--hot); }
.seal-gold { color: var(--gold); }
.seal-blue { color: var(--blue); }
.seal-grey { color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 6px 11px; border-radius: 999px;
        background: var(--surface-2); border: 1px solid var(--line); font-size: var(--fs-sub);
        color: var(--ink-2); white-space: nowrap; }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }

/* ------------------------------------------------------------ 今日小结 */
.hero { background: linear-gradient(160deg, var(--primary) 0%, #22785a 55%, #2c7f5e 100%);
        color: #fff; border-radius: 18px; padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.hero .lab { font-size: var(--fs-aux); opacity: .82; letter-spacing: .08em; }
.hero .big { font-size: 34px; font-weight: 700; letter-spacing: -.02em; margin: 2px 0 0; }
.hero .big small { font-size: 17px; font-weight: 500; opacity: .85; margin-left: 4px; }
.hero-row { display: flex; gap: 10px; margin-top: 14px; padding-top: 12px;
            border-top: 1px solid rgba(255, 255, 255, .22); }
.hero-row div { flex: 1; }
.hero-row .k { font-size: var(--fs-aux); opacity: .8; }
.hero-row .v { font-size: 17px; font-weight: 650; }
.hero-note { font-size: var(--fs-aux); opacity: .85; margin-top: 10px; line-height: 1.7; }

/* ------------------------------------------------------------ 录入 */
.dir-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; background: var(--surface-2);
           padding: 5px; border-radius: 12px; border: 1px solid var(--line); margin-bottom: 14px; }
.dir-seg button { padding: 11px 0; border-radius: 9px; font-size: 16px; font-weight: 600; color: var(--ink-2); }
.dir-seg button.on { background: var(--surface); box-shadow: var(--shadow); color: var(--ink); }
.dir-seg button.on.hot { color: var(--hot); }

.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 9px; }
.pick-grid.sheet-2 { grid-template-columns: repeat(2, 1fr); }
.pick { border: 1.5px solid var(--line); background: var(--surface); border-radius: 12px; padding: 11px 10px;
        text-align: left; transition: transform .06s; min-height: 62px; }
.pick:active { transform: scale(.97); }
.pick .nm { font-size: var(--fs-body); font-weight: 600; line-height: 1.3; }
.pick .mt { font-size: 12px; color: var(--muted); margin-top: 3px; }
.pick.on { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.pick.on .mt { color: var(--primary-ink); }
.pick .bar { height: 3px; border-radius: 3px; margin-bottom: 8px; }

.amount-box { display: flex; align-items: baseline; gap: 6px; padding: 14px 2px 8px;
              border-bottom: 2px solid var(--line-2); }
.amount-box .cur { font-size: 21px; color: var(--ink-2); font-weight: 600; }
.amount-box .val { font-size: 38px; font-weight: 700; letter-spacing: -.02em; flex: 1; min-width: 0; }
.amount-box .val.empty { color: var(--muted); font-weight: 400; }
.amount-box .calc { font-size: var(--fs-aux); color: var(--muted); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.keypad button { height: 52px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
                 font-size: 23px; font-weight: 600; box-shadow: var(--shadow); }
.keypad button:active { background: var(--primary-soft); }
.keypad .fn { font-size: 15px; color: var(--ink-2); background: var(--surface-2); }
.keypad .ok { background: var(--primary); color: #fff; font-size: 17px; font-weight: 650; }
.keypad .ok:disabled { opacity: .45; }
.quick-amt { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 10px; }
.quick-amt button { padding: 7px 12px; border-radius: 999px; background: var(--surface-2);
                    border: 1px solid var(--line); font-size: var(--fs-sub); color: var(--ink-2); }

.fold { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 4px; }
.fold > summary { list-style: none; padding: 10px 0; font-size: var(--fs-sub); color: var(--ink-2);
                  display: flex; align-items: center; gap: 6px; cursor: pointer; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after { content: "更多"; margin-left: auto; color: var(--muted); font-size: var(--fs-aux); }
.fold[open] > summary::after { content: "收起"; }
.field { margin: 12px 0; }
.field > label { display: block; font-size: var(--fs-aux); color: var(--muted); margin-bottom: 6px; }
.field .row { display: flex; gap: 8px; align-items: center; }
.field input[type=text], .field input[type=number], .field input[type=date], .field select, .field textarea,
.inp { width: 100%; padding: 11px 12px; border: 1px solid var(--line-2); border-radius: var(--radius-s);
       background: var(--surface-2); font-size: var(--fs-body); }
.field textarea { min-height: 62px; resize: vertical; }
.inp:focus, .field :is(input, select, textarea):focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.hint { font-size: var(--fs-aux); color: var(--muted); line-height: 1.7; margin-top: 6px; }
.hint.warn { color: var(--gold); background: var(--gold-soft); padding: 9px 11px; border-radius: 9px;
             border-left: 3px solid var(--gold); }
.switch { display: flex; align-items: center; gap: 10px; font-size: var(--fs-sub); color: var(--ink-2); }
.switch .track { width: 44px; height: 26px; border-radius: 999px; background: var(--line-2); position: relative;
                 transition: .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
                        border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: .15s; }
.switch.on .track { background: var(--primary); }
.switch.on .track::after { left: 21px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 13px 18px;
       border-radius: 12px; background: var(--primary); color: #fff; font-weight: 650; font-size: var(--fs-body); }
.btn:active { opacity: .9; }
.btn.ghost { background: var(--surface); color: var(--ink-2); border: 1px solid var(--line-2); font-weight: 600; }
.btn.hot { background: var(--hot); }
.btn.sm { padding: 8px 13px; font-size: var(--fs-sub); border-radius: 9px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; }
.btn-row { display: flex; gap: 10px; margin-top: 14px; }
.btn-row .btn { flex: 1; }

/* ------------------------------------------------------------ 明细列表 */
.day-group { margin-bottom: 14px; }
.day-head { display: flex; align-items: baseline; gap: 8px; padding: 8px 2px; }
.day-head .d { font-size: var(--fs-sub); font-weight: 650; }
.day-head .t { margin-left: auto; font-size: var(--fs-aux); color: var(--muted); }
.tx { display: flex; align-items: center; gap: 11px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.tx:last-child { border-bottom: 0; }
.tx .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-content: center;
          font-size: 13px; font-weight: 700; color: #fff; flex: none; }
.tx .mid { flex: 1; min-width: 0; }
.tx .mid .l1 { font-size: var(--fs-body); font-weight: 600; overflow: hidden; text-overflow: ellipsis;
               white-space: nowrap; }
.tx .mid .l2 { font-size: var(--fs-aux); color: var(--muted); margin-top: 2px; }
.tx .right { text-align: right; flex: none; }
.tx .amt { font-size: 18px; font-weight: 650; }
.tx .amt.in { color: var(--primary-ink); }
.tx .amt.out { color: var(--hot); }
.tx .sub { font-size: 12px; color: var(--muted); }
.tx .sub.warn { color: var(--gold); }
.empty { text-align: center; color: var(--muted); font-size: var(--fs-sub); padding: 34px 12px; line-height: 1.9; }
.empty .big { font-size: 30px; opacity: .35; }

/* ------------------------------------------------------------ 条形与图 */
.bars { display: grid; gap: 11px; }
.bar-row .top { display: flex; align-items: baseline; gap: 8px; font-size: var(--fs-sub); }
.bar-row .top .v { margin-left: auto; font-weight: 650; }
.bar-row .top .pc { color: var(--muted); font-size: var(--fs-aux); min-width: 46px; text-align: right; }
.bar-row .track { height: 8px; border-radius: 6px; background: var(--surface-2); overflow: hidden; margin-top: 5px; }
.bar-row .fill { height: 100%; border-radius: 6px; }
.bar-row .neg { color: var(--hot); }
.spark { width: 100%; height: 84px; display: block; }
.spark .axis { stroke: var(--line-2); stroke-width: 1; }
.spark .line { fill: none; stroke: var(--primary); stroke-width: 2; }
.spark .area { fill: rgba(29, 107, 75, .12); }
.spark .neg-line { stroke: var(--hot); }
.spark .dot { fill: var(--primary); }

/* ------------------------------------------------------------ 弹层 / 抽屉 */
.mask { position: fixed; inset: 0; background: rgba(18, 26, 22, .42); z-index: 40;
        display: flex; align-items: flex-end; justify-content: center; animation: fade .16s; }
@keyframes fade { from { opacity: 0 } }
@keyframes up { from { transform: translateY(24px) } }
.sheet { background: var(--bg); width: 100%; max-width: 560px; max-height: 92dvh; overflow: auto;
         border-radius: 20px 20px 0 0; padding: 6px 16px calc(18px + var(--safe-b)); animation: up .18s; }
.sheet .grab { width: 38px; height: 4px; border-radius: 4px; background: var(--line-2); margin: 8px auto 4px; }
.sheet-h { display: flex; align-items: center; gap: 10px; padding: 8px 2px 12px; }
.sheet-h h3 { font-size: 17px; }
.sheet-h .x { margin-left: auto; padding: 6px 10px; color: var(--muted); font-size: 15px; }
.sheet .body { font-size: var(--fs-body); }
@media (min-width: 980px) {
  .mask { align-items: center; }
  .sheet { border-radius: 18px; max-width: 620px; padding: 18px 22px 22px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .4); }
}

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab-h) + 26px);
         background: rgba(23, 32, 28, .93); color: #fff; padding: 11px 18px; border-radius: 11px;
         font-size: var(--fs-sub); z-index: 70; max-width: 88vw; box-shadow: var(--shadow); }
.toast.bad { background: rgba(160, 44, 26, .95); }

/* ------------------------------------------------------------ 桌面工作台 */
@media (min-width: 980px) {
  body { font-size: 15px; }
  .desk { display: grid; grid-template-columns: 208px 1fr; min-height: 100dvh; }
  .side { background: #14261e; color: #cfe0d6; padding: 16px 12px; position: sticky; top: 0; height: 100dvh;
          display: flex; flex-direction: column; }
  .side .logo { font-size: 19px; font-weight: 700; letter-spacing: .14em; color: #fff; padding: 6px 10px 14px; }
  .side .logo span { display: block; font-size: 11px; letter-spacing: .02em; color: #86a595; font-weight: 400;
                     margin-top: 3px; }
  .side nav { display: grid; gap: 2px; }
  .side nav button { display: flex; align-items: center; gap: 9px; padding: 10px 11px; border-radius: 9px;
                     color: #b9cdbf; font-size: 14px; text-align: left; }
  .side nav button.on { background: #1f3b2e; color: #fff; font-weight: 600; }
  .side nav button:hover { background: #1b3428; }
  .side .foot { margin-top: auto; font-size: 12px; color: #7c9a8a; padding: 10px; line-height: 1.8; }
  .main { display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
  .crumbs { display: flex; align-items: center; gap: 12px; padding: 14px 22px; background: var(--surface);
            border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 15; }
  .crumbs h2 { font-size: 17px; }
  .crumbs .filters { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
  .crumbs select, .crumbs input { padding: 7px 9px; border: 1px solid var(--line-2); border-radius: 8px;
                                  background: var(--surface-2); font-size: 13px; }
  .wrap { padding: 20px 22px 40px; max-width: 1320px; }
  .grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
  .page { padding: 0; max-width: none; }
  .tabbar { display: none; }
  .kpi { background: var(--surface); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
  .kpi .k { font-size: var(--fs-aux); color: var(--muted); }
  .kpi .v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; }
  .kpi .d { font-size: 12px; margin-top: 3px; color: var(--ink-2); }
  .kpi .d.up { color: var(--primary); }
  .kpi .d.down { color: var(--hot); }
  .tbl { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
  .tbl table { font-size: 13px; }
  .tbl th { text-align: left; font-weight: 600; color: var(--muted); background: var(--surface-2);
            padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 12px; }
  .tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
  .tbl tr:last-child td { border-bottom: 0; }
  .tbl tbody tr:hover { background: var(--surface-2); }
  .tbl .r { text-align: right; }
  .tbl tfoot td { font-weight: 700; background: #f3f6f3; }
  .tbl .scrollx { overflow-x: auto; }
  .hero { max-width: none; }
}

/* 移动端隐藏的桌面专用元素 */
.only-desk { display: none; }
@media (min-width: 980px) { .only-desk { display: block; } .only-mobile { display: none !important; } }

.note { font-size: var(--fs-aux); color: var(--ink-2); background: var(--blue-soft); padding: 11px 13px;
        border-radius: 10px; line-height: 1.75; border-left: 3px solid var(--blue); }
.note b { color: var(--ink); }
.money-pos { color: var(--primary); }
.money-neg { color: var(--hot); }
.strike { text-decoration: line-through; color: var(--muted); }

/* ------------------------------------------------------------ 打印（给客户的报表） */
@media print {
  body { background: #fff; font-size: 12px; }
  .side, .tabbar, .crumbs .filters, .btn, .topbar { display: none !important; }
  .desk { display: block; }
  .wrap { padding: 0; max-width: none; }
  .card, .tbl, .kpi { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .main { background: #fff; }
}
