:root {
  --bg: #f8f9fa;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --primary: #3b82f6;
  --green: #10b981;
  --amber: #f59e0b;
  --red: #ef4444;
  --radius: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── NAV ── */
nav {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

nav .logo {
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.nav-links { display: flex; gap: 0.25rem; }
.nav-links a {
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  transition: all 0.15s;
}
.nav-links a:hover { color: #fff; background: rgba(255,255,255,0.08); }

/* ── LAYOUT ── */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 3rem;
}

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 1.25rem;
  color: var(--text);
}

h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 2rem 0 0.75rem;
  letter-spacing: -0.01em;
}

/* ── STAT CARDS ── */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.stat::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
}

.stat.pending::before { background: var(--amber); }
.stat.received::before { background: var(--green); }

.stat-num {
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.stat.pending .stat-num { color: var(--amber); }
.stat.received .stat-num { color: var(--green); }

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.25rem;
}

.stat-sub {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 0.35rem;
}

/* ── TABLES ── */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}

thead {
  background: #f1f5f9;
}

th {
  text-align: left;
  padding: 0.65rem 1rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.1s; }
tbody tr:hover { background: #f8fafc; }

.id {
  font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.amount {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.days {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 3rem 1rem;
  font-size: 0.9rem;
}

/* ── TAGS ── */
.tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  vertical-align: middle;
  margin-left: 0.35rem;
}

.tag.lokal { background: #dbeafe; color: #1d4ed8; }
.tag.sub { background: #ecfdf5; color: #047857; }
.tag.alert { background: #fef3c7; color: #92400e; }

.status-pending {
  color: var(--amber);
  font-weight: 700;
  font-size: 0.8rem;
}

.status-received {
  color: var(--green);
  font-weight: 700;
  font-size: 0.8rem;
}

/* ── BUTTONS ── */
.btn-received {
  background: var(--green);
  color: #fff;
  border: none;
  padding: 0.35rem 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-received:hover {
  background: #059669;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(16,185,129,0.3);
}

.btn-received:active { transform: translateY(0); }

/* ── TABS ── */
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--border);
}

.tab {
  padding: 0.7rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
}

.tab:hover {
  color: var(--text);
  background: #f8fafc;
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ── FILTERS ── */
.filters {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.filters select, .filters button {
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.85rem;
  background: var(--card);
  color: var(--text);
  font-weight: 500;
  transition: all 0.15s;
}

.filters select:focus { outline: 2px solid var(--primary); border-color: transparent; }

.filters button {
  background: var(--text);
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: 600;
}

.filters button:hover { background: #334155; }

/* ── CONFIG GRID ── */
.config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.config-grid h2 { margin-top: 0; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  nav { padding: 0 1rem; }
  main { padding: 1rem; }
  .stats { grid-template-columns: 1fr 1fr; }
  .config-grid { grid-template-columns: 1fr; }

  table { font-size: 0.8rem; }
  td, th { padding: 0.5rem 0.6rem; }
  .id { font-size: 0.65rem; }

  .nav-links a { font-size: 0.75rem; padding: 0.3rem 0.5rem; }
}

@media (max-width: 480px) {
  .stats { grid-template-columns: 1fr; }
  .stat-num { font-size: 1.75rem; }
}
