:root {
  --bg: #f5f7f6;
  --card: #ffffff;
  --ink: #1c2b24;
  --ink-soft: #5c6f66;
  --line: #e3e9e6;
  --brand: #0f5c3e;
  --brand-soft: #e6f2ec;
  --accent: #b7791f;
  --danger: #b23b3b;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 44, 32, 0.08), 0 4px 14px rgba(16, 44, 32, 0.06);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(135deg, #0f5c3e, #147a52);
  color: #fff;
  padding: calc(env(safe-area-inset-top) + 10px) 14px 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 8px; max-width: 720px; margin: 0 auto; }
.brand h1 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: 0.5px; }
.meta { font-size: 12px; opacity: 0.85; margin-top: 2px; }
.actions { display: flex; gap: 8px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  border: none; background: rgba(255, 255, 255, 0.16); color: #fff;
  font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.icon-btn:active { background: rgba(255, 255, 255, 0.3); }
.icon-btn.spinning { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.content { max-width: 720px; margin: 0 auto; padding: 12px 12px calc(env(safe-area-inset-bottom) + 24px); }

.status {
  background: #fff8ec; border: 1px solid #f0dcb4; color: #8a6420;
  border-radius: var(--radius); padding: 10px 12px; margin-bottom: 12px; font-size: 13px;
}
.status.error { background: #fdeeee; border-color: #eec9c9; color: #a03c3c; }
.hidden { display: none !important; }

.block {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 12px; overflow: hidden;
}
.block-title {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; font-size: 14px; font-weight: 600; color: var(--brand);
  border-bottom: 1px solid var(--line); background: var(--brand-soft);
}
.block-note { font-size: 11px; color: var(--ink-soft); font-weight: 400; }
.block-body { padding: 4px 14px 10px; }
.block-empty { color: var(--ink-soft); font-size: 13px; padding: 10px 0; text-align: center; }

table.limit { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.limit th {
  text-align: left; font-weight: 600; color: var(--ink-soft);
  padding: 8px 6px 4px; font-size: 12px; border-bottom: 1px solid var(--line);
}
table.limit td { padding: 7px 6px; border-bottom: 1px solid #f0f4f2; vertical-align: top; }
table.limit tr:last-child td { border-bottom: none; }
td.amount { font-weight: 700; color: var(--accent); white-space: nowrap; font-variant-numeric: tabular-nums; }
td.name { min-width: 0; word-break: break-all; }
td.codes { color: var(--ink-soft); font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }

.changes { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; margin-bottom: 12px; }
.changes h3 { margin: 0 0 6px; font-size: 14px; color: var(--brand); }
.changes ul { margin: 0; padding-left: 18px; font-size: 13px; color: var(--ink); }
.changes li { margin: 3px 0; }

.warnings { background: #fff8ec; border: 1px solid #f0dcb4; color: #8a6420; border-radius: var(--radius); padding: 10px 12px; margin-bottom: 12px; font-size: 13px; }
.warnings ul { margin: 0; padding-left: 18px; }

.footer { text-align: center; color: var(--ink-soft); font-size: 11.5px; padding: 16px 8px 8px; }

.modal {
  position: fixed; inset: 0; z-index: 50; background: rgba(10, 30, 22, 0.5);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-card {
  background: #fff; border-radius: 16px 16px 0 0; width: 100%; max-width: 480px;
  padding: 18px 18px calc(env(safe-area-inset-bottom) + 18px);
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.2);
  animation: slideUp 0.18s ease-out;
}
@keyframes slideUp { from { transform: translateY(30px); opacity: 0.4; } to { transform: none; opacity: 1; } }
.modal-card h2 { margin: 0 0 14px; font-size: 17px; color: var(--brand); }
.field { display: block; margin-bottom: 12px; }
.field span { display: block; font-size: 12.5px; color: var(--ink-soft); margin-bottom: 4px; }
.field select, .field input {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; background: #fbfdfc; color: var(--ink);
}
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.field-hint { display: block; margin-top: 4px; font-size: 11.5px; color: #8a6420; }
.btn {
  flex: 1; padding: 11px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; font-size: 14px; cursor: pointer; color: var(--ink);
}
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn:active { opacity: 0.85; }
