:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #1c2430;
  --muted: #6b7280;
  --border: #e3e7ec;
  --accent: #0070ba;
  --accent-dark: #003087;
  --ok: #1a9b4e;
  --warn: #b45309;
  --danger: #c0392b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

.center-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.card h1 {
  font-size: 20px;
  margin: 0 0 20px;
  color: var(--accent-dark);
}

label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
}

.btn-primary {
  width: 100%;
  padding: 10px 12px;
  background: var(--accent);
  color: white;
}

.btn-primary:hover { background: var(--accent-dark); }

.error-text {
  color: var(--danger);
  font-size: 13px;
  min-height: 18px;
  margin-top: -8px;
  margin-bottom: 8px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--accent-dark);
  color: white;
}

.topbar h1 { font-size: 18px; margin: 0; }

.btn-logout {
  background: transparent;
  color: white;
  border: 1px solid rgba(255,255,255,0.4);
  padding: 6px 14px;
  border-radius: 6px;
}

.btn-logout:hover { background: rgba(255,255,255,0.1); }

main {
  padding: 24px;
  max-width: 1600px;
  margin: 0 auto;
}

.toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

#search-input {
  flex: 1;
  min-width: 200px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}

.btn-secondary {
  background: var(--card);
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 14px;
  white-space: nowrap;
}

.btn-secondary:hover { background: #eaf3ff; }

.table-scroll {
  overflow-x: auto;
}

.summary-row {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.summary-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 20px;
  flex: 1;
  min-width: 160px;
}

.summary-card .label { font-size: 12px; color: var(--muted); }
.summary-card .value { font-size: 22px; font-weight: 700; margin-top: 4px; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

thead th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  padding: 9px 8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

thead th.sortable {
  cursor: pointer;
  user-select: none;
}

thead th.sortable:hover { color: var(--accent); }

thead th.sortable .sort-arrow {
  display: inline-block;
  margin-left: 4px;
  opacity: 0.35;
}

thead th.sortable.sort-active .sort-arrow { opacity: 1; }

tbody td {
  padding: 8px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  white-space: nowrap;
}

td.id-cell {
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
}

tbody tr:last-child td { border-bottom: none; }

.status {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.status-completed { background: #e4f7ec; color: var(--ok); }
.status-approved { background: #eaf3ff; color: var(--accent); }
.status-pending { background: #fef3e2; color: var(--warn); }
.status-denied, .status-refunded { background: #fdebe9; color: var(--danger); }

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 48px 16px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider-track {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #cbd2d9;
  border-radius: 999px;
  transition: 0.15s;
}

.slider-track::before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: 0.15s;
}

input:checked + .slider-track { background-color: var(--accent); }
input:checked + .slider-track::before { transform: translateX(18px); }

.promo-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}
