:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --line: #dfe5ec;
  --text: #1b2733;
  --muted: #6b7785;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --danger: #b42318;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}
a { color: var(--brand-dark); text-decoration: none; }
button, .button {
  border: 0;
  background: var(--brand);
  color: white;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font: inherit;
}
.ghost { background: #eef3f5; color: var(--text); }
.disabled {
  pointer-events: none;
  opacity: .45;
}
.full { width: 100%; }
.link { background: transparent; color: var(--danger); padding: 0; min-height: 0; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 220px;
  background: #102027;
  color: white;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.brand { font-size: 22px; font-weight: 700; }
.project-switcher {
  display: grid;
  gap: 6px;
}
.project-switcher label {
  color: #b7c7cc;
  font-size: 12px;
}
.project-switcher select {
  min-height: 34px;
  color: white;
  border-color: rgba(255,255,255,.18);
  background: #162d35;
}
.sidebar nav { display: grid; gap: 6px; }
.sidebar a { color: #dce7ea; padding: 10px 12px; border-radius: 6px; }
.sidebar a:hover { background: rgba(255,255,255,.08); }
.main { margin-left: 220px; padding: 24px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.topbar h1 { margin: 0; font-size: 24px; }
.eyebrow { color: var(--muted); font-size: 12px; }
.userbox { background: white; border: 1px solid var(--line); padding: 8px 12px; border-radius: 6px; }
.notice { padding: 10px 12px; border-radius: 6px; margin-bottom: 14px; }
.success { background: #e8f7ef; color: #166534; }
.error { background: #fff0f0; color: var(--danger); }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.metric, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}
.metric span { color: var(--muted); display: block; }
.metric strong { font-size: 24px; margin-top: 6px; display: block; }
.metric.account-cny { border-left: 5px solid #0f766e; background: #f0fdfa; }
.metric.account-usd { border-left: 5px solid #2563eb; background: #eff6ff; }
.balance-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.balance-card {
  color: white;
  border-radius: 8px;
  padding: 16px;
}
.balance-cny { background: #0f766e; }
.balance-usd { background: #1d4ed8; }
.balance-card span { color: #b7c7cc; display: block; }
.balance-card strong { display: block; font-size: 28px; margin-top: 4px; }
.pending-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.pending-card {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-left: 5px solid #f97316;
  border-radius: 8px;
  padding: 14px 16px;
}
.pending-card span { color: #9a3412; display: block; }
.pending-card strong { display: block; font-size: 24px; margin-top: 4px; color: #9a3412; }
.pending-card small { color: var(--muted); display: block; margin-top: 2px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.panel { margin-bottom: 14px; }
.panel h2 { margin: 0 0 12px; font-size: 16px; }
.panel-title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-title-row h2 { margin: 0; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid var(--line); padding: 9px 8px; vertical-align: top; text-align: left; }
th { color: var(--muted); font-weight: 600; background: #fafbfc; }
tfoot th { background: #eef3f5; color: var(--text); }
.monthly-table { min-width: 980px; }
.monthly-table th { text-align: center; }
.account-head-cny { background: #ccfbf1; color: #115e59; }
.account-head-usd { background: #dbeafe; color: #1e40af; }
.account-col-cny { background: #f0fdfa; }
.account-col-usd { background: #eff6ff; }
tfoot .account-col-cny { background: #ccfbf1; }
tfoot .account-col-usd { background: #dbeafe; }
.strong { font-weight: 700; }
.income { color: #166534; }
.expense { color: #9f1239; }
.negative { color: var(--danger); }
.pending-amount { color: #c2410c; background: #fff7ed; }
.num { text-align: right; white-space: nowrap; }
.toolbar { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 14px; align-items: flex-start; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.entry-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.entry-summary-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
}
.entry-summary-card span {
  color: var(--muted);
  display: block;
  font-size: 12px;
}
.entry-summary-card strong {
  display: block;
  font-size: 18px;
  margin-top: 4px;
}
.entry-summary-card.account-cny { border-left: 4px solid #0f766e; background: #f0fdfa; }
.entry-summary-card.account-usd { border-left: 4px solid #2563eb; background: #eff6ff; }
.investment-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
input, select, textarea {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 9px;
  font: inherit;
  background: white;
}
.filters input, .filters select { width: 150px; }
.admin-create-form input { width: 220px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
label { display: grid; gap: 6px; color: var(--muted); }
.wide { grid-column: 1 / -1; }
textarea { min-height: 90px; resize: vertical; }
.narrow { max-width: 960px; }
.actions { display: flex; gap: 10px; align-items: center; }
.actions form { margin: 0; }
.bulk-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  flex-wrap: wrap;
}
.bulk-status {
  display: grid;
  gap: 2px;
  min-width: 210px;
}
.bulk-status strong { font-size: 15px; }
.bulk-control-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.bulk-actions select { width: 150px; }
.bulk-actions button:disabled {
  cursor: not-allowed;
  opacity: .45;
}
.danger-soft {
  background: #fff0f0;
  color: var(--danger);
}
.check-col {
  width: 42px;
  text-align: center;
}
.check-col input {
  width: auto;
  min-height: 0;
}
.entries-table {
  min-width: 1180px;
}
.entries-table tbody tr:hover {
  background: #f8fafc;
}
.entries-table tfoot th {
  position: sticky;
  bottom: 0;
  z-index: 1;
}
.muted, .muted-row { color: var(--muted); }
.muted-row { background: #fafafa; }
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-left: 8px;
  padding: 0 8px;
  border-radius: 999px;
  background: #e8f7ef;
  color: #166534;
  font-size: 12px;
}
.details { max-width: 520px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attachment-list { display: flex; gap: 10px; flex-wrap: wrap; }
.form-actions { display: flex; gap: 10px; }
.pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card {
  width: min(420px, 100%);
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
}
.login-card h1 { margin: 0; }
.login-card p { color: var(--muted); margin: 4px 0 24px; }
.stack { display: grid; gap: 14px; }

@media (max-width: 920px) {
  .sidebar { position: static; width: auto; }
  .main { margin-left: 0; padding: 16px; }
  .metric-grid, .balance-grid, .pending-grid, .entry-summary, .split, .form-grid { grid-template-columns: 1fr; }
  .toolbar { display: grid; }
  table { font-size: 13px; }
}
