:root {
  color-scheme: light;
  --bg: #f3f4f8;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --text: #1d2433;
  --muted: #667085;
  --line: #e5e7eb;
  --primary: #3457d5;
  --primary-dark: #1f3fae;
  --success: #039855;
  --warning: #dc6803;
  --danger: #d92d20;
  --shadow: 0 18px 45px rgba(31, 41, 55, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft Yahei", sans-serif;
  background: radial-gradient(circle at top left, #e8edff 0, #f3f4f8 36%, #eef2f6 100%);
  color: var(--text);
}
button, input, select { font: inherit; }
button {
  border: 0;
  border-radius: 12px;
  background: var(--primary);
  color: white;
  padding: 10px 16px;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(52, 87, 213, 0.22);
}
button:hover { background: var(--primary-dark); }
button.secondary {
  background: #eef2ff;
  color: var(--primary-dark);
  box-shadow: none;
}
input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: white;
  color: var(--text);
}
label {
  font-size: 12px;
  color: var(--muted);
  display: block;
  margin-bottom: 6px;
}
.app-shell { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; }
.sidebar {
  background: #111827;
  color: white;
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, #6d7cff, #39d6ae);
  font-weight: 800;
}
.brand h1 { font-size: 20px; margin: 0; }
.brand p { margin: 4px 0 0; color: #b8c1d1; font-size: 12px; }
.nav-list { display: grid; gap: 10px; }
.nav-item {
  display: block;
  padding: 12px 14px;
  color: #d9e0ee;
  text-decoration: none;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
}
.nav-item.active { background: rgba(109, 124, 255, 0.25); color: white; }
.sidebar-note {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  color: #d9e0ee;
  display: grid;
  gap: 8px;
  font-size: 13px;
}
.main-panel { padding: 28px; min-width: 0; }
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 22px;
}
.eyebrow { color: var(--primary); text-transform: uppercase; letter-spacing: .08em; margin: 0 0 4px; font-size: 12px; font-weight: 700; }
.topbar h2 { margin: 0; font-size: 30px; }
.topbar p { color: var(--muted); margin: 8px 0 0; }
.api-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  min-width: 360px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  box-shadow: var(--shadow);
}
.api-box label { grid-column: 1 / -1; }
.filters-card, .panel-card, .stat-card {
  background: rgba(255,255,255,0.88);
  border: 1px solid rgba(229,231,235,0.9);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.filters-card {
  padding: 18px;
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.filter-field.wide { grid-column: span 2; }
.filter-actions { display: flex; gap: 10px; align-items: end; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
.stat-card { padding: 18px; }
.stat-card span { color: var(--muted); font-size: 13px; }
.stat-card strong { display: block; margin-top: 8px; font-size: 25px; }
.content-grid { display: grid; grid-template-columns: 1fr; gap: 18px; }
.panel-card { padding: 18px; overflow: hidden; }
.panel-heading { display: flex; justify-content: space-between; gap: 12px; align-items: end; margin-bottom: 12px; }
.panel-heading h3 { margin: 0; }
.panel-heading p { color: var(--muted); margin: 0; font-size: 13px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 860px; }
th, td { text-align: left; border-bottom: 1px solid var(--line); padding: 12px 10px; vertical-align: top; }
th { color: var(--muted); font-size: 12px; font-weight: 700; background: var(--panel-soft); }
td { font-size: 14px; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 9px; font-size: 12px; font-weight: 700; background: #eef2ff; color: var(--primary-dark); }
.badge.PENDING { background: #fff7ed; color: var(--warning); }
.badge.CANCELED { background: #fef3f2; color: var(--danger); }
.badge.APPROVED, .badge.PENDING_PAYMENT, .badge.COMMITTED { background: #ecfdf3; color: var(--success); }
.muted { color: var(--muted); font-size: 12px; }
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 420px;
  background: #111827;
  color: white;
  border-radius: 16px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: .2s ease;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
@media (max-width: 1080px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .topbar { flex-direction: column; }
  .api-box { min-width: 0; width: 100%; }
  .filters-card { grid-template-columns: repeat(2, 1fr); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 680px) {
  .main-panel { padding: 16px; }
  .filters-card, .stats-grid { grid-template-columns: 1fr; }
  .filter-field.wide { grid-column: auto; }
}
