:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #172026;
  --muted: #68737d;
  --line: #dce2e8;
  --accent: #0f766e;
  --accent-2: #d97706;
  --danger: #b91c1c;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

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

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(440px, 100%);
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
}

.auth-brand {
  color: var(--ink);
  margin-bottom: 18px;
}

.alert {
  border: 1px solid #fecaca;
  background: #fff1f2;
  color: var(--danger);
  border-radius: var(--radius);
  padding: 10px 12px;
}

a {
  color: var(--accent);
  text-decoration: none;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 230px;
  background: #162126;
  color: white;
  padding: 22px 16px;
}

.brand {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 28px;
}

nav {
  display: grid;
  gap: 6px;
}

nav a {
  color: #d8e1e6;
  padding: 10px 12px;
  border-radius: var(--radius);
}

nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: white;
}

.sidebar-footer {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 18px;
  display: grid;
  gap: 8px;
}

.user-chip {
  color: #d8e1e6;
  font-size: 12px;
}

.main {
  margin-left: 230px;
  padding: 28px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 18px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metrics.compact {
  grid-template-columns: repeat(3, minmax(140px, 220px));
}

.metrics div,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.metrics div {
  padding: 16px;
}

.metrics span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.metrics strong {
  font-size: 22px;
}

.panel {
  padding: 18px;
  margin-bottom: 18px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.grid {
  display: grid;
  gap: 18px;
}

.grid.two {
  grid-template-columns: 360px minmax(0, 1fr);
}

.form {
  display: grid;
  gap: 12px;
  align-content: start;
}

.form.wide {
  max-width: 760px;
}

.compact-form {
  display: grid;
  grid-template-columns: minmax(220px, 360px) auto auto;
  align-items: end;
  gap: 12px;
}

.inline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--ink);
  font: inherit;
  background: white;
}

.small-input {
  min-width: 150px;
  padding: 8px 10px;
}

textarea {
  min-height: 420px;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
}

.button,
button {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  border-radius: var(--radius);
  padding: 9px 12px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.button.primary,
button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

button[value="rejected"],
button[value="cancelled"],
.danger-button {
  border-color: #fecaca;
  color: var(--danger);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 10px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

code {
  background: #edf3f3;
  color: #115e59;
  border-radius: 6px;
  padding: 3px 6px;
}

.status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  background: #eef2f7;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.status.active,
.status.approved,
.status.paid {
  background: #dff5ef;
  color: #0f766e;
}

.status.pending {
  background: #fff4d8;
  color: var(--accent-2);
}

.status.payment_intent,
.status.invoice_issued,
.status.checkout_started,
.status.open,
.status.needs_review {
  background: #e0f2fe;
  color: #0369a1;
}

.status.clear {
  background: #eef2f7;
  color: var(--muted);
}

.status.inactive {
  background: #fff4d8;
  color: var(--accent-2);
}

.status.deleted {
  background: #f1f5f9;
  color: #64748b;
}

.status.rejected,
.status.cancelled,
.status.invalid,
.status.refunded {
  background: #fee2e2;
  color: var(--danger);
}

.truncate {
  max-width: 480px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.muted-text {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 980px) {
  .sidebar {
    position: static;
    width: auto;
  }

  .sidebar-footer {
    position: static;
    margin-top: 18px;
  }

  .main {
    margin-left: 0;
    padding: 18px;
  }

  .metrics,
  .grid.two,
  .compact-form {
    grid-template-columns: 1fr;
  }

  table {
    display: block;
    overflow-x: auto;
  }
}
