/* 314° ERP — 品牌：橙色渐变 / 黑 / 白；字体：阿里巴巴普惠体 3.0 */
@font-face {
  font-family: "PuHuiTi";
  src: local("Alibaba PuHuiTi 3.0 55 Regular"), local("AlibabaPuHuiTi-3-55-Regular"),
       url("/fonts/AlibabaPuHuiTi-3-55-Regular.woff2") format("woff2");
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: "PuHuiTi";
  src: local("Alibaba PuHuiTi 3.0 85 Bold"), local("AlibabaPuHuiTi-3-85-Bold"),
       url("/fonts/AlibabaPuHuiTi-3-85-Bold.woff2") format("woff2");
  font-weight: 700; font-display: swap;
}
@font-face {
  font-family: "PuHuiTi";
  src: local("Alibaba PuHuiTi 3.0 115 Black"), local("AlibabaPuHuiTi-3-115-Black"),
       url("/fonts/AlibabaPuHuiTi-3-115-Black.woff2") format("woff2");
  font-weight: 900; font-display: swap;
}

:root {
  --ink: #0d0d0f;
  --ink-2: #17171a;
  --ink-3: #232328;
  --paper: #ffffff;
  --bg: #f5f4f1;
  --line: #e7e5e0;
  --line-2: #d9d6cf;
  --text: #16161a;
  --muted: #7c7a74;
  --o1: #ffb238;
  --o2: #ff7a00;
  --o3: #ff4b0f;
  --grad: linear-gradient(135deg, var(--o1) 0%, var(--o2) 48%, var(--o3) 100%);
  --grad-soft: linear-gradient(135deg, #fff4e3 0%, #ffe6d2 100%);
  --ok: #138a52;
  --warn: #c76a00;
  --bad: #d4351c;
  --r: 14px;
  --font: "PuHuiTi", "Alibaba PuHuiTi 3.0", "Alibaba PuHuiTi", -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --shadow: 0 1px 2px rgba(13,13,15,.04), 0 8px 24px -12px rgba(13,13,15,.12);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
.num, td.n, th.n { font-variant-numeric: tabular-nums; text-align: right; }
a { color: inherit; }
[hidden] { display: none !important; }

/* ---------- logo ---------- */
.mark { display: inline-grid; place-items: center; background: var(--grad); color: var(--ink); border-radius: 22%; font-weight: 900; letter-spacing: -.04em; line-height: 1; position: relative; overflow: hidden; }
.mark::after { content: ""; position: absolute; inset: 0; background: radial-gradient(120% 80% at 15% 0%, rgba(255,255,255,.45), transparent 55%); pointer-events: none; }
.mark span { position: relative; z-index: 1; transform: translateY(.02em); }
.mark sup { font-size: .5em; vertical-align: .55em; margin-left: .02em; }
.mark-sm { width: 40px; height: 40px; font-size: 15px; }
.mark-lg { width: 132px; height: 132px; font-size: 46px; border-radius: 30px; }
.mark-xl { width: 260px; height: 260px; font-size: 92px; border-radius: 58px; box-shadow: 0 30px 80px -20px rgba(255,90,0,.55); }

/* ---------- login ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { background: var(--ink); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: center; align-items: center; position: relative; overflow: hidden; }
.auth-art::before { content: ""; position: absolute; width: 720px; height: 720px; right: -260px; bottom: -300px; background: radial-gradient(circle, rgba(255,122,0,.35), transparent 62%); }
.auth-art .brand-line { display: flex; align-items: center; gap: 12px; font-weight: 700; letter-spacing: .02em; position: relative; }
.auth-art .hero { position: relative; }
.auth-art h1 { font-size: 44px; line-height: 1.15; margin: 36px 0 12px; font-weight: 900; letter-spacing: -.01em; }
.auth-art h1 em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-art p { color: #a9a7a1; max-width: 420px; margin: 0; }
.auth-art .foot { color: #6f6d68; font-size: 12px; position: relative; }
.auth-form { display: grid; place-items: center; padding: 40px; background: var(--paper); }
.auth-form form { width: 100%; max-width: 360px; }
.auth-form h2 { font-size: 26px; margin: 0 0 6px; font-weight: 900; }
.auth-form .sub { color: var(--muted); margin: 0 0 28px; }
.demo-accounts { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 18px; }
.demo-accounts .lbl { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.demo-accounts .chips { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.chip-btn { text-align: left; border: 1px solid var(--line); background: var(--paper); border-radius: 12px; padding: 10px 12px; cursor: pointer; transition: .15s; }
.chip-btn:hover { border-color: var(--o2); box-shadow: 0 0 0 3px rgba(255,122,0,.12); }
.chip-btn b { display: block; font-size: 13px; }
.chip-btn small { color: var(--muted); font-size: 11.5px; }

/* ---------- forms ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.input, select.input, textarea.input { width: 100%; height: 42px; border: 1px solid var(--line-2); border-radius: 10px; padding: 0 12px; background: var(--paper); outline: none; transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; min-height: 120px; padding: 10px 12px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }
.input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(255,122,0,.18); }
.input.sm { height: 34px; border-radius: 8px; padding: 0 8px; }
.input.qty { width: 84px; text-align: right; }
.input.money { width: 120px; text-align: right; }
.input[readonly] { background: #faf9f7; color: var(--muted); }
.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.row > .field { flex: 1; min-width: 160px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--paper); cursor: pointer; font-weight: 700; white-space: nowrap; transition: .15s; }
.btn svg, .x-btn svg { width: 18px; height: 18px; flex: none; }
.btn:hover { border-color: var(--ink); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--grad); border: 0; color: var(--ink); box-shadow: 0 6px 18px -8px rgba(255,90,0,.7); }
.btn-primary:hover { filter: brightness(1.05); box-shadow: 0 8px 22px -8px rgba(255,90,0,.85); }
.btn-dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-dark:hover { background: var(--ink-3); }
.btn-danger { color: var(--bad); border-color: #f0c4bc; }
.btn-danger:hover { border-color: var(--bad); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: rgba(0,0,0,.05); border-color: transparent; }
.btn-sm { height: 32px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { height: 52px; font-size: 16px; border-radius: 12px; padding: 0 22px; }
.btn-block { width: 100%; }

/* ---------- app shell ---------- */
.app { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
#root { min-height: 100vh; }
.side { background: var(--ink); color: #d8d6d0; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side-brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 18px; }
.side-brand .t { color: #fff; font-weight: 900; font-size: 17px; letter-spacing: .02em; line-height: 1.1; }
.side-brand .t small { display: block; font-weight: 400; font-size: 11px; color: #85837d; letter-spacing: .12em; margin-top: 3px; }
.wh-card { margin: 4px 14px 14px; padding: 12px 14px; border-radius: 12px; background: var(--ink-2); border: 1px solid #26262b; }
.wh-card .k { font-size: 11px; color: #85837d; letter-spacing: .08em; }
.wh-card .v { color: #fff; font-weight: 700; display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--grad); box-shadow: 0 0 0 3px rgba(255,122,0,.18); flex: none; }
.nav { padding: 0 10px; flex: 1; }
.nav .grp { font-size: 11px; letter-spacing: .14em; color: #6b6964; padding: 14px 12px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; text-decoration: none; color: #c9c7c1; font-weight: 500; position: relative; }
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .8; }
.nav a:hover { background: var(--ink-2); color: #fff; }
.nav a.on { background: var(--ink-3); color: #fff; }
.nav a.on::before { content: ""; position: absolute; left: -10px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--grad); }
.nav a.on svg { opacity: 1; color: var(--o2); }
.nav a .kbd { margin-left: auto; font-size: 10.5px; color: #6b6964; border: 1px solid #333; border-radius: 5px; padding: 0 5px; }
.me { margin: 12px 14px 16px; padding: 12px; border-radius: 12px; background: var(--ink-2); display: flex; gap: 10px; align-items: center; cursor: pointer; border: 1px solid #26262b; }
.me:hover { border-color: #3a3a40; }
.avatar { width: 36px; height: 36px; border-radius: 10px; background: #2b2b31; color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.me .n { color: #fff; font-weight: 700; font-size: 13px; }
.me .r { font-size: 11.5px; color: #8e8c86; display: flex; gap: 6px; align-items: center; }
.me .out { margin-left: auto; color: #8e8c86; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 16px; padding: 18px 32px; background: rgba(245,244,241,.85); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 20; border-bottom: 1px solid transparent; }
.top.scrolled { border-bottom-color: var(--line); }
.top h1 { font-size: 24px; margin: 0; font-weight: 900; letter-spacing: -.01em; }
.top .sub { color: var(--muted); font-size: 12.5px; }
.top .spacer { flex: 1; }
.seg { display: inline-flex; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; cursor: pointer; font-weight: 700; color: var(--muted); }
.seg button.on { background: var(--ink); color: #fff; }
.clock { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12.5px; text-align: right; line-height: 1.3; }
.clock b { color: var(--text); display: block; font-size: 14px; }
.menu-btn { display: none; }
.view { padding: 8px 32px 48px; }

/* ---------- cards / tiles ---------- */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 16px 18px 0; }
.card-h h3 { margin: 0; font-size: 15px; font-weight: 700; }
.card-h .spacer { flex: 1; }
.card-b { padding: 16px 18px 18px; }
.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g2 { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
.g2e { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.tile { padding: 18px; border-radius: var(--r); background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.tile .k { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.tile .v { font-size: 28px; font-weight: 900; margin-top: 6px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.tile .v small { font-size: 13px; font-weight: 700; color: var(--muted); margin-right: 4px; }
.tile .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tile.hero { background: var(--grad); border: 0; color: var(--ink); }
.tile.hero .k, .tile.hero .s, .tile.hero .v small { color: rgba(13,13,15,.7); }
.tile.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.tile.dark .k, .tile.dark .s, .tile.dark .v small { color: #8e8c86; }
.lock { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); background: #f1efeb; border-radius: 6px; padding: 1px 6px; }

/* ---------- table ---------- */
.tbl-wrap { overflow: auto; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; }
.tbl th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; background: var(--paper); }
.tbl th.n, .tbl td.n { text-align: right; }
.tbl td { padding: 11px 12px; border-bottom: 1px solid #f0eee9; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover td { background: #fbfaf8; }
.tbl .name { font-weight: 700; }
.tbl .meta { font-size: 12px; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 42px 0; }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 2px 9px; background: #f1efeb; color: #555; white-space: nowrap; }
.pill.ok { background: #e6f5ed; color: var(--ok); }
.pill.warn { background: #fff1de; color: var(--warn); }
.pill.bad { background: #fde9e5; color: var(--bad); }
.pill.dark { background: var(--ink); color: #fff; }
.pill.or { background: var(--grad); color: var(--ink); }
.t-SALE { background: #fff1de; color: #b35a00; }
.t-RETURN { background: #fde9e5; color: var(--bad); }
.t-PURCHASE, .t-OPENING { background: #e6f5ed; color: var(--ok); }
.t-TRANSFER { background: #e8eefc; color: #2449b8; }
.t-ADJUST { background: #f1ebfb; color: #6a3fb5; }
.t-VOID { background: var(--ink); color: #fff; }
.voided { text-decoration: line-through; opacity: .55; }
.delta-p { color: var(--ok); font-weight: 700; }
.delta-n { color: var(--bad); font-weight: 700; }

/* ---------- toolbar ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .input { width: auto; min-width: 140px; }
.toolbar .search { flex: 1; min-width: 220px; }
.toolbar .spacer { flex: 1; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; color: var(--muted); }

/* ---------- entry (POS) ---------- */
.entry { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.scan { position: relative; }
.scan .input { height: 56px; font-size: 17px; padding-left: 52px; border-radius: 14px; border-width: 2px; border-color: var(--ink); }
.scan svg.ic { position: absolute; left: 17px; top: 17px; width: 22px; height: 22px; color: var(--o2); }
.scan .hint { position: absolute; right: 14px; top: 17px; font-size: 11.5px; color: var(--muted); border: 1px solid var(--line-2); border-radius: 6px; padding: 1px 7px; }
.drop { position: absolute; left: 0; right: 0; top: 62px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 20px 40px -12px rgba(0,0,0,.2); z-index: 30; max-height: 360px; overflow: auto; }
.drop button { display: flex; width: 100%; gap: 12px; align-items: center; text-align: left; border: 0; background: none; padding: 10px 14px; cursor: pointer; border-bottom: 1px solid #f3f1ed; }
.drop button:hover, .drop button.hl { background: #fff6ea; }
.drop .q { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.lines-card { margin-top: 14px; min-height: 280px; }
.summary { position: sticky; top: 92px; }
.summary .total { font-size: 34px; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.summary .kv { display: flex; justify-content: space-between; color: var(--muted); padding: 4px 0; }
.summary .kv b { color: var(--text); font-variant-numeric: tabular-nums; }
.pay-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 14px; }
.pay-grid button { border: 1px solid var(--line-2); background: var(--paper); border-radius: 10px; padding: 9px 4px; cursor: pointer; font-size: 12.5px; font-weight: 700; }
.pay-grid button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.x-btn { border: 0; background: none; color: #b5b2ab; cursor: pointer; font-size: 18px; padding: 4px 8px; border-radius: 6px; }
.x-btn:hover { color: var(--bad); background: #fde9e5; }
.flash { animation: flash .6s ease; }
@keyframes flash { from { background: #fff1de; } to { background: transparent; } }
.banner { border-radius: 12px; padding: 12px 14px; display: flex; gap: 10px; align-items: flex-start; font-size: 13px; margin-bottom: 14px; }
.banner.info { background: var(--grad-soft); color: #7a3a00; }
.banner.warn { background: #fde9e5; color: #8f2312; }
.banner.ok { background: #e6f5ed; color: #0c5c36; }

/* ---------- chart ---------- */
.bars { display: flex; align-items: flex-end; gap: 12px; height: 180px; padding-top: 10px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bars .col { width: 100%; max-width: 44px; border-radius: 8px 8px 3px 3px; background: #ece9e3; position: relative; min-height: 3px; transition: height .4s; }
.bars .b.today .col { background: var(--grad); }
.bars .lab { font-size: 11.5px; color: var(--muted); }
.bars .val { font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- modal / toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(13,13,15,.45); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 100; padding: 20px; animation: fade .15s; }
.modal { background: var(--paper); border-radius: 18px; width: 100%; max-width: 560px; max-height: calc(100vh - 40px); overflow: auto; box-shadow: 0 40px 80px -20px rgba(0,0,0,.4); animation: pop .18s; }
.modal.wide { max-width: 860px; }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 18px 22px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--paper); z-index: 2; }
.modal-h h3 { margin: 0; font-size: 17px; font-weight: 900; flex: 1; }
.modal-b { padding: 20px 22px; }
.modal-f { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 22px 20px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.toasts { position: fixed; right: 24px; bottom: 24px; display: grid; gap: 10px; z-index: 200; }
.toast { background: var(--ink); color: #fff; border-radius: 12px; padding: 12px 16px; box-shadow: 0 20px 40px -12px rgba(0,0,0,.4); display: flex; gap: 10px; align-items: center; max-width: 420px; animation: pop .2s; }
.toast.err { background: #2a0f0a; border-left: 4px solid var(--bad); }
.toast.ok::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--grad); flex: none; }
.kv-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 18px; margin-bottom: 18px; }
.kv-grid .k { font-size: 12px; color: var(--muted); }
.kv-grid .v { font-weight: 700; }

/* ---------- print ---------- */
#print { display: none; }
@media print {
  body > *:not(#print) { display: none !important; }
  #print { display: block; color: #000; }
  @page { margin: 12mm; }
  body.p80 #print { width: 72mm; font-size: 11px; }
}
.pdoc { font-family: var(--font); color: #000; }
.pdoc .ph { display: flex; align-items: center; gap: 14px; border-bottom: 3px solid #000; padding-bottom: 10px; margin-bottom: 12px; }
.pdoc .ph .mark { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.pdoc .ph h2 { margin: 0; font-size: 20px; font-weight: 900; }
.pdoc .ph .r { margin-left: auto; text-align: right; font-size: 12px; }
.pdoc table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.pdoc th, .pdoc td { border-bottom: 1px solid #bbb; padding: 6px 4px; text-align: left; font-size: 12px; }
.pdoc .tot { text-align: right; font-size: 16px; font-weight: 900; }
.pdoc .legal { margin-top: 18px; font-size: 10.5px; border: 1px dashed #777; padding: 6px 8px; }
.pdoc .sign { display: flex; gap: 40px; margin-top: 28px; font-size: 12px; }
.pdoc .sign div { flex: 1; border-top: 1px solid #000; padding-top: 4px; }
body.p80 .pdoc .ph { flex-direction: column; align-items: flex-start; gap: 6px; }
body.p80 .pdoc .ph .r { margin-left: 0; text-align: left; }
body.p80 .pdoc .sign { display: none; }
body.p80 .pdoc .hide80 { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) { .g4 { grid-template-columns: repeat(2, 1fr); } .entry { grid-template-columns: minmax(0, 1fr); } .summary { position: static; } }
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 272px; z-index: 90; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 20px 0 60px rgba(0,0,0,.4); }
  .menu-btn { display: inline-flex; }
  .top { padding: 14px 16px; flex-wrap: wrap; }
  .view { padding: 8px 16px 40px; }
  .g2, .g2e { grid-template-columns: minmax(0, 1fr); }
  .g4 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .tile .v { font-size: 22px; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { padding: 32px; min-height: 280px; }
  .auth-art h1 { font-size: 30px; margin-top: 20px; }
  .clock { display: none; }
  .kv-grid { grid-template-columns: 1fr 1fr; }
}
