:root {
  --bg: #f3f5fa;
  --card: #ffffff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #6b7a90;
  --line: #e4e9f2;
  --accent: #2563eb;
  --accent-soft: #eaf0ff;
  --cash: #0ea371;
  --cash-soft: #e6f7f0;
  --liab: #e0483f;
  --liab-soft: #fdeceb;
  --net: #3b5bdb;
  --warn: #b45309;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);
  --radius: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button { cursor: pointer; }

.hidden { display: none !important; }

/* ---------------- 登录 ---------------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1200px 500px at 15% -10%, #dfe9ff 0%, transparent 60%),
    radial-gradient(900px 400px at 100% 0%, #e6f7f0 0%, transparent 55%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 36px 32px 30px;
  border: 1px solid rgba(255, 255, 255, 0.7);
}

.login-logo {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: linear-gradient(135deg, #2563eb, #0ea371);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 22px;
  margin-bottom: 18px;
}

.login-card h1 {
  font-size: 21px;
  margin: 0 0 6px;
  letter-spacing: 0.2px;
}

.login-card p.sub {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 13px;
}

.field { margin-bottom: 14px; }

.field label {
  display: block;
  font-size: 12.5px;
  color: var(--ink-2);
  margin-bottom: 6px;
  font-weight: 600;
}

.input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfe;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.input:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.05s, box-shadow 0.15s;
}

.btn:hover { background: #f7f9fd; border-color: #d3dbe9; }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover { background: #1d4fd8; border-color: #1d4fd8; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: #eef2f9; color: var(--ink-2); }

.btn-danger { color: var(--liab); border-color: #f3cdca; background: #fff; }
.btn-danger:hover { background: var(--liab-soft); }

.btn-block { width: 100%; padding: 12px; }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }

.form-error {
  margin-top: 12px;
  background: var(--liab-soft);
  color: #a3281f;
  border: 1px solid #f6d3d0;
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 13px;
}

.login-hint {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15.5px;
  letter-spacing: 0.2px;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, #2563eb, #0ea371);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 15px;
}

.spacer { flex: 1; }

.role-badge {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #1e46b8;
  font-weight: 600;
  white-space: nowrap;
}

.role-badge.viewer { background: #f1f5f9; color: #475569; }

.synced {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
}

/* ---------------- 布局 ---------------- */
.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 22px 64px;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 26px 0 12px;
  flex-wrap: wrap;
}

.head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.section-head h2 {
  font-size: 15px;
  margin: 0;
  letter-spacing: 0.2px;
}

.section-head .hint {
  font-size: 12.5px;
  color: var(--muted);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------------- KPI ---------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.kpi {
  padding: 18px 18px 16px;
  position: relative;
  overflow: hidden;
}

.kpi .kpi-label {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot.cash { background: var(--cash); }
.dot.liab { background: var(--liab); }
.dot.net { background: var(--net); }
.dot.muted { background: #cbd5e1; }

.kpi .kpi-value {
  font-size: 25px;
  font-weight: 700;
  margin: 7px 0 4px;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}

.kpi .kpi-foot {
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.delta-up { color: var(--liab); font-weight: 600; }
.delta-down { color: var(--cash); font-weight: 600; }
.delta-flat { color: var(--muted); font-weight: 600; }
.delta-good { color: var(--cash); font-weight: 600; }
.delta-bad { color: var(--liab); font-weight: 600; }

/* ---------------- 图表 ---------------- */
.chart-card { padding: 18px 14px 10px; }

.chart-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 6px 4px;
  flex-wrap: wrap;
}

.chart-title { font-weight: 700; font-size: 14.5px; }

.chart-legend {
  display: flex;
  gap: 14px;
  margin-left: auto;
  flex-wrap: wrap;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--ink-2);
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  user-select: none;
}

.legend-item:hover { background: #f4f7fd; }

.legend-item.off {
  opacity: 0.38;
  text-decoration: line-through;
}

.legend-swatch {
  width: 14px;
  height: 3px;
  border-radius: 2px;
}

.chart-box { position: relative; }

.chart-svg { width: 100%; height: auto; display: block; }

.chart-tip {
  position: absolute;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.94);
  color: #fff;
  padding: 9px 11px;
  border-radius: 9px;
  font-size: 12px;
  line-height: 1.6;
  transform: translate(-50%, -100%);
  white-space: nowrap;
  z-index: 5;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.28);
}

.chart-tip .tip-month { font-weight: 700; margin-bottom: 2px; }

.chart-tip .tip-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  font-variant-numeric: tabular-nums;
}

.range-tabs {
  display: inline-flex;
  background: #eef2f9;
  padding: 3px;
  border-radius: 9px;
  gap: 2px;
}

.range-tabs button {
  border: none;
  background: transparent;
  padding: 5px 11px;
  border-radius: 7px;
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
}

.range-tabs button.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

/* ---------------- 表格 ---------------- */
.table-card { overflow: hidden; }

.table-scroll { overflow-x: auto; }

.swipe-hint {
  display: none;
  text-align: center;
  font-size: 11.5px;
  color: #9aa8bd;
  padding: 8px 0 10px;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

table.data th, table.data td {
  padding: 12px 14px;
  text-align: right;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

table.data th {
  background: #f8fafd;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.3px;
  position: sticky;
  top: 0;
}

table.data th:first-child, table.data td:first-child { text-align: left; }
table.data th.al, table.data td.al { text-align: left; }

table.data tbody tr:hover { background: #fafcff; }
table.data tbody tr.latest { background: #f6faff; }

table.data td.month-cell { font-weight: 700; }

table.data td.note-cell {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
  font-weight: 400;
}

.num-cash { color: var(--cash); font-weight: 600; }
.num-liab { color: var(--liab); font-weight: 600; }
.num-net { color: var(--net); font-weight: 700; }

.row-actions { display: inline-flex; gap: 6px; justify-content: flex-end; }

.row-actions .btn-link {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 7px;
}

.row-actions .btn-link:hover { background: var(--accent-soft); border-color: #c9d8ff; color: #1e46b8; }
.row-actions .btn-link.danger:hover { background: var(--liab-soft); border-color: #f3cdca; color: var(--liab); }

.icon-btn {
  border: 1px solid var(--line);
  background: #fff;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  color: var(--muted);
  font-size: 14px;
}

.icon-btn:hover { background: #f4f7fd; color: var(--ink); }
.icon-btn.danger:hover { background: var(--liab-soft); color: var(--liab); border-color: #f3cdca; }

.empty {
  padding: 54px 24px;
  text-align: center;
  color: var(--muted);
}

.empty h3 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 16px;
}

.empty p { margin: 0 auto 18px; max-width: 460px; font-size: 13.5px; }

/* ---------------- 构成 ---------------- */
.break-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.break-card { padding: 18px; }

.break-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.break-head .t { font-weight: 700; font-size: 14px; }
.break-head .s { font-size: 12.5px; color: var(--muted); }

.break-row { margin-bottom: 11px; }

.break-row .line1 {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  margin-bottom: 5px;
}

.break-row .line1 .name { color: var(--ink-2); }
.break-row .line1 .amt { font-variant-numeric: tabular-nums; font-weight: 600; }

.bar {
  height: 7px;
  border-radius: 4px;
  background: #eef2f9;
  overflow: hidden;
}

.bar > i {
  display: block;
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

.bar.cash > i { background: linear-gradient(90deg, #34c48f, var(--cash)); }
.bar.liab > i { background: linear-gradient(90deg, #f08b83, var(--liab)); }

.break-total {
  display: flex;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 13px;
  font-weight: 700;
}

/* ---------------- 弹窗 ---------------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow-y: auto;
}

.modal {
  width: 100%;
  max-width: 720px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.3);
  animation: pop 0.16s ease-out;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
}

@keyframes pop {
  from { opacity: 0; transform: translateY(8px) scale(0.99); }
  to { opacity: 1; transform: none; }
}

.modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 22px 12px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 { margin: 0; font-size: 16px; }
.modal-head .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.modal-body { padding: 18px 22px; overflow-y: auto; }
.modal-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fbfcfe;
  border-radius: 0 0 18px 18px;
}

.month-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.month-row .grow { flex: 1; min-width: 170px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.item-group {
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 12px;
  background: #fcfdff;
}

.item-group .ig-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
}

.ig-title { font-weight: 700; font-size: 13px; display: flex; align-items: center; gap: 7px; }

.ig-sum { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.item-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px 26px;
  gap: 7px;
  align-items: center;
  margin-bottom: 7px;
}

.item-line .input { padding: 8px 10px; font-size: 13px; }
.item-line .amt { text-align: right; font-variant-numeric: tabular-nums; }

.remove-item {
  border: none;
  background: transparent;
  color: #b8c2d1;
  font-size: 16px;
  line-height: 1;
  padding: 4px;
  border-radius: 6px;
}

.remove-item:hover { color: var(--liab); background: var(--liab-soft); }

.add-item {
  width: 100%;
  border: 1px dashed #ccd6e6;
  background: #fff;
  color: var(--muted);
  padding: 7px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 600;
}

.add-item:hover { border-color: var(--accent); color: var(--accent); background: #f7faff; }

.note-field { margin-top: 16px; }

.note-field textarea {
  resize: vertical;
  min-height: 62px;
}

.modal-error {
  margin-top: 12px;
  color: #a3281f;
  background: var(--liab-soft);
  border: 1px solid #f6d3d0;
  border-radius: 9px;
  padding: 8px 12px;
  font-size: 13px;
}

.meta-tip { font-size: 12px; color: var(--muted); }

/* ---------------- 提示条 ---------------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%) translateY(12px);
  background: #0f172a;
  color: #fff;
  padding: 11px 18px;
  border-radius: 11px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 200;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.32);
  max-width: min(520px, 90vw);
}

#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: #b3261e; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 900px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: 1fr; }
  .break-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .page { padding: 16px 14px 50px; }
  .topbar-inner { padding: 10px 12px; gap: 8px; }
  .brand { font-size: 13.5px; gap: 8px; }
  .brand-mark { width: 26px; height: 26px; font-size: 13px; border-radius: 8px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 14px; }
  .kpi .kpi-value { font-size: 18px; }
  .kpi .kpi-foot { font-size: 11.5px; }
  .synced { display: none; }
  .role-badge { font-size: 11px; padding: 3px 8px; }
  .modal { max-height: calc(100vh - 16px); }
  .modal-mask { padding: 8px; }

  .section-head { margin: 20px 0 10px; }
  .section-head h2 { white-space: nowrap; font-size: 14.5px; }
  .section-head .hint { display: none; }
  .head-actions { width: 100%; margin-top: 2px; }
  .head-actions .btn { flex: 1 1 0; padding: 8px 6px; font-size: 12.5px; }
  .range-tabs { margin-left: auto; }
  .range-tabs button { padding: 5px 9px; font-size: 12px; }
  .chart-card { padding: 14px 8px 6px; }
  .chart-legend { margin-left: 0; width: 100%; gap: 6px; }
  .legend-item { padding: 3px 6px; }
  table.data th, table.data td { padding: 10px; }
  .swipe-hint { display: block; }
}

/* ================= 2.0：多公司 / 多角色 / 锁定 / 日志 ================= */
.company-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color 0.15s, box-shadow 0.15s;
  max-width: 280px;
}

.company-switch:hover { border-color: #c9d6ea; box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08); }

.company-switch .cs-label {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.5px;
  flex: 0 0 auto;
}

.company-switch .company-select {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: transparent;
  outline: none;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  padding: 3px 2px;
  max-width: 190px;
  text-overflow: ellipsis;
  cursor: pointer;
}

.company-switch .cs-caret {
  font-size: 10px;
  color: var(--muted);
  line-height: 1;
  flex: 0 0 auto;
}

.tabs { display: flex; gap: 2px; margin-left: 6px; }

.tabs a {
  padding: 7px 13px;
  border-radius: 9px;
  color: var(--muted);
  font-weight: 600;
  font-size: 13.5px;
  text-decoration: none;
  white-space: nowrap;
}

.tabs a:hover { background: #eef2f9; color: var(--ink-2); }
.tabs a.active { background: var(--accent-soft); color: #1e46b8; }
.tabs a.hidden { display: none; }

.role-badge.role-cashier { background: #e6f7f0; color: #0a7f59; }
.role-badge.role-accountant { background: #eaf0ff; color: #1e46b8; }
.role-badge.role-admin { background: #fff3e0; color: #b45309; }
.role-badge.role-superadmin { background: #f3e8ff; color: #7c3aed; }

.chip {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.75;
  white-space: nowrap;
}

.chip.draft { background: #eef2f9; color: #55637a; }
.chip.verified { background: #eaf0ff; color: #1e46b8; }
.chip.locked { background: #fff1e6; color: #b45309; }
.chip.active { background: #e6f7f0; color: #0a7f59; }
.chip.closed { background: #f1f3f7; color: #8a97ab; }
.chip.current { background: var(--accent); color: #fff; }
.chip.danger { background: var(--liab-soft); color: var(--liab); }
.chip.role-cashier { background: #e6f7f0; color: #0a7f59; }
.chip.role-accountant { background: #eaf0ff; color: #1e46b8; }
.chip.role-admin { background: #fff3e0; color: #b45309; }
.chip.role-superadmin { background: #f3e8ff; color: #7c3aed; }

.loading { padding: 56px 20px; text-align: center; color: var(--muted); }

.banner {
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 14px;
  font-size: 13.5px;
  line-height: 1.6;
}

.locked-banner { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; }
.warn-banner { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }

.entry-card { padding: 16px 18px; margin-bottom: 14px; }

.entry-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.entry-head .t { font-weight: 700; font-size: 14.5px; }
.entry-head .s {
  margin-left: auto;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.entry-table .amt-input {
  width: 150px;
  text-align: right;
  padding: 8px 10px;
  font-variant-numeric: tabular-nums;
}

.entry-total {
  display: flex;
  justify-content: space-between;
  padding-top: 12px;
  margin-top: 6px;
  border-top: 1px dashed var(--line);
  font-size: 14px;
  font-weight: 700;
}

.entry-total b { font-variant-numeric: tabular-nums; }

.liab-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px 30px;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.entry-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 18px;
  flex-wrap: wrap;
}

.inline-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.inline-field .input { width: auto; padding: 7px 10px; }

.empty-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.pager {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  margin-top: 14px;
}

.pwd-box {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 20px;
  letter-spacing: 1px;
  text-align: center;
  padding: 18px;
  background: #f6f8fc;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  user-select: all;
}

.row-locked td { color: #8a97ab; }
.row-current td { background: #f6faff; }
td.num, th.num { text-align: right; }

.cur-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  background: #eef2f9;
  color: #55637a;
  vertical-align: 1px;
}

.cur-badge.cur-USD { background: #e6f7f0; color: #0a7f59; }
.cur-badge.cur-EUR { background: #eaf0ff; color: #1e46b8; }
.cur-badge.cur-HKD { background: #fff3e0; color: #b45309; }
.cur-badge.cur-CNY { background: #f1f3f7; color: #6b7a90; }

.acc-name { font-weight: 700; }
.entry-fx-note { margin-top: 8px; font-size: 12px; line-height: 1.6; }

.user-menu { position: relative; }

.user-menu .role-badge {
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.user-menu .menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 140px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 11px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.14);
  padding: 6px;
  z-index: 60;
}

.user-menu .menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}

.user-menu .menu button:hover { background: #f4f7fd; }
.user-menu .menu.hidden { display: none; }

@media (max-width: 980px) {
  .topbar-inner { flex-wrap: wrap; row-gap: 8px; }
  .tabs { order: 10; width: 100%; overflow-x: auto; margin-left: 0; padding-bottom: 2px; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .company-select { width: 160px; }
}

@media (max-width: 560px) {
  .topbar-inner .spacer { display: none; }
  .user-menu { order: 2; margin-left: auto; }
  .company-switch { order: 5; flex: 1 1 100%; min-width: 0; max-width: none; padding: 4px 10px; }
  .company-switch .company-select { max-width: none; font-size: 12.5px; }
  .tabs { order: 6; flex: 1 1 100%; }
  .brand-text { font-size: 12.5px; }
  .entry-card { padding: 14px; }
  .entry-head { flex-wrap: wrap; }
  .entry-head .s { margin-left: 0; width: 100%; font-size: 12.5px; }
  table.entry-table thead { display: none; }
  table.entry-table, table.entry-table tbody, table.entry-table tr, table.entry-table td { display: block; width: 100%; }
  table.entry-table tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
  table.entry-table td { border: none; padding: 2px 0; text-align: left; white-space: normal; }
  table.entry-table td:first-child { font-weight: 700; font-size: 13.5px; }
  table.entry-table td:nth-child(2) { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
  table.entry-table td:nth-child(2)::before { content: "本月余额"; color: var(--muted); font-size: 12px; white-space: nowrap; font-weight: 600; }
  table.entry-table .amt-input { flex: 1; width: auto; padding: 8px 10px; }
  table.entry-table td:nth-child(3) { font-size: 12px; margin-top: 4px; }
  table.entry-table td:nth-child(3)::before { content: "汇率 "; color: var(--muted); font-size: 12px; }
  table.entry-table td:nth-child(4) { font-size: 13px; margin-top: 2px; font-weight: 600; text-align: left; }
  table.entry-table td:nth-child(4)::before { content: "折合人民币 "; color: var(--muted); font-size: 12px; font-weight: 400; }
  table.entry-table td:nth-child(5) { text-align: left; font-size: 12px; margin-top: 2px; }
  .inline-field { width: 100%; }
  .inline-field .input { flex: 1; }
  .liab-row { grid-template-columns: minmax(0, 1fr) 108px 26px; }
  .entry-actions .btn { flex: 1 1 0; text-align: center; }
  .entry-actions .spacer { display: none; }
  .tabs a { padding: 6px 10px; font-size: 13px; }
}
