:root {
  --jp-blue: #1a56db;
  --jp-blue-light: #eef3fc;
  --jp-gray-bg: #f4f6f9;
  --jp-border: #e5e7eb;
  --jp-text: #1f2937;
  --jp-text-sub: #6b7280;
}

* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--jp-gray-bg);
  color: var(--jp-text);
}

/* ---------- Login ---------- */
.login-page {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f2f66 0%, #1a56db 55%, #3b7ce8 100%);
  padding: 16px;
}
.login-card {
  width: 380px;
  max-width: 100%;
  background: #fff;
  border-radius: 12px;
  padding: 36px 32px 28px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.login-title { text-align: center; margin-bottom: 4px; }
.login-title h1 { font-size: 20px; margin: 0 0 4px; color: var(--jp-blue); }
.login-title p { font-size: 13px; color: var(--jp-text-sub); margin: 0 0 24px; }
.login-hint { margin-top: 14px; font-size: 12px; color: var(--jp-text-sub); line-height: 1.8; background: var(--jp-blue-light); border-radius: 8px; padding: 10px 12px; }

/* ---------- Layout ---------- */
.layout { height: 100vh; display: flex; flex-direction: column; }
.topbar {
  height: 56px; flex: none; background: #fff; border-bottom: 1px solid var(--jp-border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 16px;
  position: relative; z-index: 20;
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--jp-blue); font-size: 16px; white-space: nowrap; }
.brand .sub { font-weight: 400; color: var(--jp-text-sub); font-size: 12px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.menu-toggle { display: none; }

.body-wrap { flex: 1; display: flex; min-height: 0; }
.sidebar {
  width: 200px; flex: none; background: #fff; border-right: 1px solid var(--jp-border);
  overflow-y: auto;
}
.main {
  flex: 1; overflow-y: auto; padding: 16px;
}
.page-card { background: #fff; border-radius: 10px; padding: 16px; box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
.page-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.page-header h2 { font-size: 17px; margin: 0; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar .grow { flex: 1; min-width: 160px; }

/* dashboard cards */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.stat-card { background: #fff; border-radius: 10px; padding: 18px; box-shadow: 0 1px 2px rgba(0,0,0,0.04); border-left: 4px solid var(--jp-blue); }
.stat-card .label { font-size: 13px; color: var(--jp-text-sub); margin-bottom: 8px; }
.stat-card .value { font-size: 26px; font-weight: 700; color: var(--jp-text); }
.stat-card.warn { border-left-color: #e6a23c; }
.stat-card.danger { border-left-color: #f56c6c; }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.amount { font-variant-numeric: tabular-nums; }
.amount.pos { color: var(--jp-blue); font-weight: 600; }
.muted { color: var(--jp-text-sub); }
.section-title { font-weight: 600; margin: 18px 0 8px; font-size: 14px; color: var(--jp-text); }
.section-title:first-child { margin-top: 0; }
.combined-hint { font-size: 12px; color: var(--jp-text-sub); }

.footer-total { text-align: right; font-size: 15px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--jp-border); }
.footer-total b { color: var(--jp-blue); font-size: 18px; }

/* Print sheet */
.print-sheet { background: #fff; padding: 24px; max-width: 900px; margin: 0 auto; }
.print-sheet .doc-title { text-align: center; font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.print-sheet .doc-sub { text-align: center; color: var(--jp-text-sub); font-size: 13px; margin-bottom: 16px; }
.print-meta { display: flex; flex-wrap: wrap; gap: 6px 24px; font-size: 13px; margin-bottom: 12px; }
.print-sheet table { width: 100%; border-collapse: collapse; font-size: 13px; }
.print-sheet th, .print-sheet td { border: 1px solid #999; padding: 6px 8px; text-align: left; }
.print-sheet th { background: #f0f2f5; }
.print-footer-text { margin-top: 20px; font-size: 12px; color: var(--jp-text-sub); }
@media print {
  .no-print { display: none !important; }
  .layout, .main { all: unset; }
  body { background: #fff; }
  .print-sheet { box-shadow: none; padding: 0; }
}

/* Feedback button (auto-injected, keep) */
.jp-feedback-btn {
  position: fixed; right: 20px; bottom: 20px; z-index: 999;
  background: var(--jp-blue); color: #fff; border-radius: 24px; padding: 10px 18px;
  box-shadow: 0 4px 12px rgba(26,86,219,0.4); cursor: pointer; font-size: 13px;
}

/* Responsive */
@media (max-width: 860px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 56px; bottom: 0; z-index: 30;
    transform: translateX(-100%); transition: transform .2s ease; box-shadow: 4px 0 12px rgba(0,0,0,0.15);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: inline-flex; }
  .brand .sub { display: none; }
  .main { padding: 10px; }
  .page-card { padding: 12px; }
  .topbar-right .username { display: none; }
}
