:root {
  --bg: #f4f1ea;
  --bg-elev: #fffdf8;
  --ink: #161410;
  --muted: #6d675c;
  --line: #e4ddd1;
  --accent: #1f4d3a;
  --accent-2: #c9a227;
  --danger: #9b2c2c;
  --ok: #1f4d3a;
  --warn: #8a5a12;
  --shadow: 0 1px 0 rgba(22, 20, 16, 0.04);
  --radius: 22px;
  --font: "Iowan Old Style", "Palatino Linotype", Palatino, "Times New Roman", serif;
  --sans: "Segoe UI", system-ui, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

[data-theme="dark"] {
  --bg: #12110f;
  --bg-elev: #1c1a16;
  --ink: #f4efe4;
  --muted: #b7b09f;
  --line: #2d2a24;
  --accent: #9fd0b8;
  --accent-2: #e0c36a;
  --danger: #e07a7a;
  --ok: #9fd0b8;
  --warn: #e0b06a;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 20px 20px calc(92px + var(--safe-bottom));
  position: relative;
}

.staff-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

h1, .display {
  font-family: var(--font);
  font-weight: 600;
  letter-spacing: -0.03em;
  margin: 6px 0 0;
  font-size: 32px;
}

h2 { font-family: var(--font); font-size: 22px; margin: 0 0 12px; }

.card-visual {
  background: var(--ink);
  color: #f7f1e4;
  border-radius: 28px;
  padding: 22px;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  margin: 18px 0;
}
.card-visual small { opacity: 0.7; letter-spacing: 0.12em; text-transform: uppercase; font-size: 11px; }
.card-visual .pan { font-family: var(--font); font-size: 28px; letter-spacing: 0.08em; margin-top: 18px; }
.card-visual .row { display: flex; justify-content: space-between; align-items: end; gap: 12px; }
.balance { font-size: 28px; font-family: var(--font); }

.panel {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 12px 0;
}
.panel + .panel { margin-top: 12px; }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.action {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  min-height: 72px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  font-weight: 600;
}
.action span { color: var(--muted); font-size: 12px; font-weight: 500; display: block; margin-top: 4px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  border: 0;
  background: var(--accent);
  color: #fff;
  font-weight: 650;
  width: 100%;
  cursor: pointer;
}
.btn.secondary { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost { background: transparent; color: var(--ink); width: auto; }

.field { margin: 12px 0; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  padding: 12px 14px;
}
.field textarea { min-height: 96px; resize: vertical; }

.nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(480px, 100%);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--bg-elev);
  border-top: 1px solid var(--line);
  padding: 8px 6px calc(8px + var(--safe-bottom));
  z-index: 20;
}
.nav a {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  padding: 8px 0;
  font-weight: 600;
}
.nav a.active { color: var(--ink); }

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 650;
  background: #ece6d8;
  color: var(--ink);
}
.badge.ok { background: #d9ebe3; color: var(--ok); }
.badge.warn { background: #f3e4c8; color: var(--warn); }
.badge.danger { background: #f3d6d6; color: var(--danger); }

.list-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.list-row:last-child { border-bottom: 0; }
.muted { color: var(--muted); }
.alert { padding: 12px 14px; border-radius: 14px; background: #f3e4c8; margin: 12px 0; }
.alert.error { background: #f3d6d6; }
.timeline { border-left: 2px solid var(--line); margin: 16px 0 8px 8px; padding-left: 16px; }
.timeline li { list-style: none; margin: 0 0 14px; }
.timeline li::before {
  content: "";
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  margin-right: 8px;
}

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.metric-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 768px) {
  .metric-grid { grid-template-columns: repeat(4, 1fr); }
  .staff-shell { padding-top: 32px; }
}
.metric { background: var(--bg-elev); border: 1px solid var(--line); border-radius: 18px; padding: 14px; }
.metric b { display: block; font-size: 24px; font-family: var(--font); }

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }

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

.calc {
  background: #ece6d8;
  border-radius: 16px;
  padding: 14px;
  margin-top: 12px;
  font-family: var(--font);
  font-size: 22px;
}

.hidden { display: none; }
.staff-shell .btn { width: auto; min-width: 140px; }
.staff-shell table { display: block; overflow-x: auto; }
[data-theme="dark"] .badge { background: #2d2a24; color: var(--ink); }
[data-theme="dark"] .badge.ok { background: #1f3d32; }
[data-theme="dark"] .badge.warn { background: #3d3220; }
[data-theme="dark"] .badge.danger { background: #3d2020; }
[data-theme="dark"] .calc { background: #2d2a24; }
@media (min-width: 900px) {
  .app-shell { max-width: 560px; }
}
