:root {
  color-scheme: light;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --border: #e6e9f2;
  --text: #12172b;
  --text-muted: #6b7280;
  --sidebar-bg: #12172b;
  --sidebar-text: #b6bdd6;
  --sidebar-active-bg: #1f2946;
  --accent: #4f6bff;
  --accent-soft: #e9edff;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px;
}
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
}
.brand-name {
  color: #fff;
  font-weight: 600;
  font-size: 15px;
}
.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 14px;
}
.nav-item.active {
  background: var(--sidebar-active-bg);
  color: #fff;
}
.nav-icon {
  font-size: 12px;
  width: 16px;
  text-align: center;
}

/* Main */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.breadcrumb {
  font-size: 13px;
  color: var(--text-muted);
}
.env-badge {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #fff7e6;
  color: #92600a;
  border: 1px solid #f3d99f;
}
.content {
  padding: 24px 28px 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Stat cards */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}
.stat-card .label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.stat-card .value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.stat-card .sub {
  font-size: 12px;
  margin-top: 6px;
  color: var(--text-muted);
}
.stat-card svg {
  margin-top: 8px;
  display: block;
}

/* Cards / grid */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.card-header h2 {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
}
.card-header select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
}

/* Donut */
.donut-wrap {
  display: flex;
  align-items: center;
  gap: 20px;
}
.legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}
.legend li {
  display: flex;
  align-items: center;
  gap: 8px;
}
.legend .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Create form */
.create-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.create-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
}
.create-form input {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  color: var(--text);
}
.create-form button {
  align-self: flex-start;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.create-form button:hover { opacity: 0.92; }
.create-result {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-muted);
  min-height: 16px;
}

/* Table */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
tbody tr:hover { background: #fafbff; }
.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}
.order-id {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 12px;
  color: var(--text-muted);
}
.status {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}
.status-created { background: #eef0f6; color: #4b5266; }
.status-pending { background: #fff4d6; color: #92600a; }
.status-succeeded { background: #e3f9ed; color: #0a7a44; }
.status-failed { background: #fde8e8; color: #b91c1c; }
.status-expired { background: #eef0f6; color: #4b5266; }

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; align-items: center; }
  .nav { flex-direction: row; }
  .grid-2 { grid-template-columns: 1fr; }
}
