:root {
  --bg: #0b0f14;
  --panel: #121821;
  --text: #e6edf3;
  --muted: #98a6b3;
  --border: #283341;
  --accent: #7cc7ff;
  --danger: #ff6b6b;
  --success: #5ed38c;
}

:root[data-theme="light"] {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --text: #1b2430;
  --muted: #5d6b7b;
  --border: #d7dee8;
  --accent: #0073e6;
  --danger: #cc2e2e;
  --success: #118847;
}

* {
  box-sizing: border-box;
}

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

.container {
  width: min(1100px, 92vw);
  margin: 0 auto;
  padding: 24px 0 40px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

h1 {
  margin: 0;
  font-size: 1.5rem;
}

.muted {
  color: var(--muted);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 14px;
}

.panel h2 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.row {
  display: grid;
  gap: 10px;
}

.row.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.row.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.row.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
}

.stat .label {
  color: var(--muted);
  font-size: 0.8rem;
}

.stat .value {
  margin-top: 4px;
  font-size: 1.2rem;
  font-weight: 600;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  background: var(--accent);
  color: #041220;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
}

button.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

input {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  width: 100%;
}

textarea {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}

label {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
  display: inline-block;
}

pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: color-mix(in srgb, var(--panel) 70%, #000);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  max-height: 280px;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th,
td {
  border-bottom: 1px solid var(--border);
  text-align: left;
  padding: 8px 6px;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
}

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  border: 1px solid var(--border);
}

.status-pending {
  color: #f7c66d;
}

.status-processing {
  color: #8cc9ff;
}

.status-delivered {
  color: var(--success);
}

.status-failed {
  color: var(--danger);
}

.status-cancelled {
  color: var(--muted);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.82rem;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.cell-input {
  min-width: 130px;
}

tr.row-dirty {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.helper {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.75rem;
}

.danger {
  color: var(--danger);
}

.success {
  color: var(--success);
}

.toast {
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  background: var(--panel);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 8px;
  min-width: 240px;
  max-width: 360px;
  font-size: 0.85rem;
}

.toast.error {
  border-left-color: var(--danger);
}

.toast.success {
  border-left-color: var(--success);
}
