:root {
  --bg: #f3f5f7;
  --surface: #ffffff;
  --ink: #12161c;
  --muted: #5c6b7a;
  --line: #e3e8ee;
  --accent: #0f7a5a;
  --warn: #9a6700;
  --warn-soft: #fff4d6;
  --danger: #b42318;
  --danger-soft: #fde8e6;
  --ok: #0f7a5a;
  --ok-soft: #e7f6f0;
  --sidebar: #101820;
  --sidebar-text: #d7dee6;
  --sidebar-muted: #8b9aab;
  --font: "DM Sans", sans-serif;
  --display: "Sora", sans-serif;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 32, 0.04), 0 10px 28px rgba(16, 24, 32, 0.05);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(180deg, #eef2f5, #f7f8fa 45%, #f3f5f7);
}
.login-box {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 32px 28px;
}
.login-brand {
  font-family: var(--display);
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -0.03em;
  margin: 0 0 6px;
}
.login-brand span { color: var(--accent); }
.login-sub { margin: 0 0 24px; color: var(--muted); }

.field { margin-bottom: 14px; }
.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}
.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  background: #fff;
  outline: none;
  font: inherit;
  color: inherit;
}
.field input,
.field select { height: 44px; }
.field textarea {
  min-height: 110px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.4;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: #9ccfbe;
  box-shadow: 0 0 0 3px rgba(15, 122, 90, 0.12);
}
.btn:disabled,
.link-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.hint {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.btn {
  height: 44px;
  border: 0;
  border-radius: 10px;
  padding: 0 16px;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
}
.btn.block { width: 100%; margin-top: 8px; }
.btn.ghost {
  background: transparent;
  color: var(--sidebar-text);
  border: 1px solid rgba(255,255,255,0.12);
  height: 38px;
}
.link-btn {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 600;
  padding: 0 6px;
  height: auto;
}
.link-btn.danger { color: var(--danger); }
.error, .form-msg {
  min-height: 18px;
  margin: 8px 0 0;
  font-size: 13px;
}
.error { color: var(--danger); }
.form-msg { color: var(--accent); }

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 220px 1fr;
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
}

.sidebar {
  background: var(--sidebar);
  color: var(--sidebar-text);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.side-brand {
  font-family: var(--display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.02em;
  padding: 8px 10px 4px;
}
.side-brand span { color: #3dcea0; }
.nav { display: grid; gap: 4px; }
.nav button {
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--sidebar-muted);
  border-radius: 8px;
  padding: 10px 12px;
  font-weight: 500;
}
.nav button:hover { background: rgba(255,255,255,0.05); color: #fff; }
.nav button.active {
  background: rgba(61, 206, 160, 0.14);
  color: #fff;
}
.side-foot {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: grid;
  gap: 10px;
}
.who {
  padding: 0 10px;
  font-size: 13px;
  color: var(--sidebar-muted);
  line-height: 1.4;
}
.who strong {
  display: block;
  color: #fff;
  font-weight: 600;
  margin-bottom: 2px;
}

.content {
  padding: 28px 32px 48px;
  max-width: 1180px;
}
.page-head { margin-bottom: 18px; }
.page-head h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.page-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
@media (max-width: 980px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.stat .k { color: var(--muted); font-size: 12px; font-weight: 500; }
.stat .v {
  margin-top: 8px;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.stat .sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}
.stats-2 { margin-top: 12px; }

.charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 900px) {
  .charts { grid-template-columns: 1fr; }
}
.chart-card { padding: 18px; }
.chart-card h3 {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 600;
}
.chart-foot {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.bars { display: grid; gap: 10px; }
.bar-row {
  display: grid;
  grid-template-columns: 72px 1fr 36px;
  gap: 10px;
  align-items: center;
}
.bar-label { font-size: 12px; color: var(--muted); }
.bar-val { font-size: 12px; font-weight: 700; text-align: right; }
.bar-track {
  height: 10px;
  border-radius: 999px;
  background: #eef2f5;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  animation: grow 0.7s ease forwards;
}
.bar-fill.c0 { background: #f0b429; }
.bar-fill.c1 { background: #0f7a5a; }
.bar-fill.c2 { background: #d64545; }
.bar-fill.c3 { background: #2f6fed; }
.amount-bars .bar-row { grid-template-columns: 72px 1fr 96px; }
@keyframes grow {
  to { width: var(--w); }
}

.spark {
  width: 100%;
  height: 72px;
  display: block;
}
.spark-line {
  stroke: #0f7a5a;
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.spark-area { fill: rgba(15, 122, 90, 0.12); }
.spark-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.filter-tab {
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
}
.filter-tab:hover { border-color: #b7c4d0; color: var(--ink); }
.filter-tab.active {
  background: #101820;
  border-color: #101820;
  color: #fff;
}

.search-panel {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}
.search-panel .field { margin: 0; }
.search-actions { gap: 8px; }
.btn.ghost-light {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}
.result-meta {
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.muted-line {
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
}
.doc-list {
  margin: 0 0 16px;
  padding-left: 18px;
  color: var(--ink);
  display: grid;
  gap: 8px;
}
.doc-list li { line-height: 1.45; }
.doc-box {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 10px;
  background: #f7f9fb;
  border: 1px solid var(--line);
}
.doc-box > div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px;
  align-items: start;
}
.doc-box span {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.doc-box code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  word-break: break-all;
}
@media (max-width: 980px) {
  .search-panel { grid-template-columns: 1fr 1fr; }
  .doc-box > div { grid-template-columns: 1fr; gap: 4px; }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.form-panel { padding: 18px; margin-bottom: 14px; }
.form-panel h3 {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 600;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}
.form-grid .field { margin: 0; }
.form-grid .grow { grid-column: span 2; }
.form-actions { display: flex; align-items: end; }
.form-stack { max-width: 520px; }
@media (max-width: 980px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-grid .grow { grid-column: span 2; }
}

.table-wrap { overflow: auto; }
table.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 720px;
}
.data-table th, .data-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
}
.data-table th {
  position: sticky;
  top: 0;
  background: #f7f9fb;
  color: var(--muted);
  font-weight: 600;
  z-index: 1;
}
.data-table tbody tr {
  transition: background 0.15s ease;
}
.data-table tbody tr:hover { background: #f7fbf9; }
.data-table tr:last-child td { border-bottom: 0; }
.amount { font-weight: 600; }
.mono {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}
.actions { white-space: nowrap; text-align: right; }
.empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.pill.pending { background: var(--warn-soft); color: var(--warn); }
.pill.approved, .pill.available { background: var(--ok-soft); color: var(--ok); }
.pill.rejected, .pill.disabled { background: var(--danger-soft); color: var(--danger); }

.anim {
  animation: rise 0.4s ease both;
}
.anim.d1 { animation-delay: 0.04s; }
.anim.d2 { animation-delay: 0.08s; }
.anim.d3 { animation-delay: 0.12s; }
.anim.d4 { animation-delay: 0.16s; }
tr.anim {
  animation: rise 0.35s ease both;
  animation-delay: calc(var(--i, 0) * 0.03s);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
