:root {
  --bg: #f7f1ea;
  --panel: #ffffff;
  --line: #eadfd5;
  --text: #2c211b;
  --muted: #7c695c;
  --brand: #c95722;
  --brand-d: #a74418;
  --ok: #76611f;
  --warn: #ae6509;
  --danger: #b23c35;
  --radius: 8px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }

/* 顶栏 */
.topbar {
  height: 52px; background: linear-gradient(135deg, #4b2d1a, #2b190f); color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 15px; font-weight: 600; margin: 0; letter-spacing: .3px; }
.topbar .who { font-size: 12px; color: #e9cbb5; display: flex; gap: 12px; align-items: center; }
.tabs { display: flex; gap: 2px; }
.tabs button {
  background: transparent; border: 0; color: #e9cbb5; padding: 8px 14px;
  border-radius: 6px 6px 0 0; cursor: pointer; font-size: 13px;
}
.tabs button.on { color: #fff; background: rgba(255,255,255,.12); }
.tabs button:hover { color: #fff; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 18px 20px 60px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 16px; overflow: hidden;
}
.card > header {
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.card > header h2 { margin: 0; font-size: 14px; font-weight: 600; }
.card .body { padding: 14px 16px; }
.spacer { flex: 1; }

label.f { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=password], input[type=month], input[type=number], select, textarea {
  border: 1px solid #d9c8bb; border-radius: 6px; padding: 7px 10px; background: #fff; width: 100%;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(201, 87, 34, .14); }
select { width: auto; min-width: 132px; }

.btn {
  border: 1px solid #d9c8bb; background: #fff; border-radius: 6px; padding: 7px 14px;
  cursor: pointer; white-space: nowrap; transition: .15s;
}
.btn:hover { border-color: #bda797; background: #fffaf6; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-d); }
.btn.ghost { border-color: transparent; color: var(--brand); background: transparent; padding: 4px 6px; }
.btn.ghost:hover { background: #fff0e4; }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); font-size: 13px; }
th { background: #fcf6f0; color: var(--muted); font-weight: 500; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:hover td { background: #fffaf5; }
tfoot td { font-weight: 600; background: #fcf5ee; }

.chip { display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 12px; border: 1px solid; }
.chip.draft { color: #746255; border-color: #decec2; background: #f8f2ec; }
.chip.issued { color: #b26a00; border-color: #f0c98a; background: #fdf6e8; }
.chip.viewed { color: #b95720; border-color: #edb990; background: #fff2e7; }
.chip.confirmed { color: var(--ok); border-color: #dfcc8d; background: #f7efd9; }
.chip.objection { color: var(--danger); border-color: #eeb4ad; background: #fdf0ee; }

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.grow { flex: 1; min-width: 120px; }
.hint { color: var(--muted); font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.danger-text { color: var(--danger); }
.ok-text { color: var(--ok); }

/* 弹窗 */
.mask {
  position: fixed; inset: 0; background: rgba(58,34,20,.52); display: flex;
  align-items: center; justify-content: center; padding: 20px; z-index: 60;
}
.modal {
  background: #fff; border-radius: 10px; width: 660px; max-width: 100%;
  max-height: 88vh; overflow: auto; box-shadow: 0 18px 48px rgba(0,0,0,.24);
}
.modal header { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.modal header h3 { margin: 0; font-size: 15px; }
.modal .body { padding: 16px 18px; }
.modal footer { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.itemline { display: grid; grid-template-columns: 1fr 130px; gap: 8px; align-items: center; margin-bottom: 8px; }
.itemline span { font-size: 13px; color: #5a4538; }
.itemline input { text-align: right; }
.totalbox {
  background: #fdf7f1; border: 1px solid var(--line); border-radius: 6px;
  padding: 10px 12px; margin-top: 10px; font-size: 13px;
}
.totalbox div { display: flex; justify-content: space-between; padding: 2px 0; }
.totalbox .net { font-weight: 700; font-size: 15px; color: var(--brand); }

/* 登录 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(145deg, #4b2d1a, #2b190f); }
.login-box { background: #fff; padding: 30px 28px; border-radius: 12px; width: 360px; }
.login-box h1 { margin: 0 0 4px; font-size: 18px; }
.login-box p { margin: 0 0 20px; color: var(--muted); font-size: 12px; }
.login-box .fld { margin-bottom: 12px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 28px;
  background: rgba(51,31,19,.95); color: #fff; padding: 10px 18px; border-radius: 8px;
  font-size: 13px; z-index: 99; opacity: 0; transition: .25s; pointer-events: none;
}
.toast.show { opacity: 1; bottom: 40px; }

.empty { padding: 36px 16px; text-align: center; color: var(--muted); font-size: 13px; }
.copybox { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.copybox input { flex: 1; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.portal-list { display: grid; gap: 12px; margin-top: 14px; }
.portal { border: 1px solid var(--line); border-radius: 8px; padding: 13px; background: #fffaf6; }
.portal h4 { margin: 0 0 2px; font-size: 14px; }
.portal .hint { margin: 0 0 10px; }
.portal textarea { font-size: 12px; resize: vertical; background: #fff; }
