:root {
  --ink: #1e251d;
  --muted: #6e7867;
  --paper: rgba(255, 250, 240, .78);
  --paper-strong: #fffaf0;
  --cream: #f7f1e7;
  --olive: #39442e;
  --olive-dark: #222b1e;
  --sage: #dfe8d6;
  --gold: #caa874;
  --line: rgba(57, 68, 46, .12);
  --red: #9c3f35;
  --green: #3d6a42;
  --yellow: #8a6824;
  --shadow: 0 26px 80px rgba(57, 68, 46, .16);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, rgba(223, 232, 214, .88), transparent 32%),
    radial-gradient(circle at 86% 8%, rgba(202, 168, 116, .2), transparent 28%),
    linear-gradient(180deg, #fffdf8, var(--cream));
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.admin-shell {
  width: min(1240px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 52px;
}

.login-card,
.topbar,
.panel,
.stat-card,
.drawer__panel {
  border: 1px solid rgba(255, 255, 255, .7);
  background: var(--paper);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.login-card {
  width: min(520px, 100%);
  display: grid;
  gap: 18px;
  margin: 12vh auto 0;
  padding: clamp(24px, 5vw, 42px);
  border-radius: 32px;
}

.brand-pill,
.eyebrow {
  width: fit-content;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--olive);
  background: rgba(255, 255, 255, .54);
  font-size: 12px;
  font-weight: 900;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(34px, 6vw, 56px);
  line-height: 1;
}

h2 {
  margin-bottom: 6px;
  font-size: 22px;
}

p {
  color: var(--muted);
  line-height: 1.55;
  font-weight: 700;
}

.login-form,
.login-form label {
  display: grid;
  gap: 9px;
}

.login-form {
  gap: 14px;
}

.login-form span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

input,
select {
  min-height: 48px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  outline: 0;
  color: var(--ink);
  background: rgba(255, 255, 255, .72);
  padding: 0 14px;
}

input:focus,
select:focus {
  border-color: rgba(86, 98, 69, .38);
  box-shadow: 0 0 0 4px rgba(143, 155, 120, .16);
}

.button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  font-weight: 900;
}

.button--primary {
  color: #fffaf0;
  background: linear-gradient(135deg, var(--olive-dark), #536143);
}

.button--ghost {
  color: var(--olive-dark);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .58);
}

.form-error {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid rgba(156, 63, 53, .2);
  border-radius: 16px;
  color: var(--red);
  background: rgba(255, 236, 231, .78);
  font-size: 13px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
  padding: clamp(20px, 4vw, 34px);
  border-radius: 30px;
}

.topbar__actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat-card {
  padding: 18px;
  border-radius: 22px;
}

.stat-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
  line-height: 1;
}

.panel {
  padding: 18px;
  border-radius: 30px;
}

.panel__head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}

.filters {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, .45);
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
}

th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

tbody tr {
  transition: background .18s ease;
}

tbody tr:hover {
  background: rgba(223, 232, 214, .36);
}

.status,
.email-state {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 900;
}

.status--paid,
.email-state--sent {
  color: var(--green);
  background: rgba(223, 232, 214, .78);
}

.status--pending {
  color: var(--yellow);
  background: rgba(250, 234, 191, .72);
}

.status--failed,
.status--canceled,
.email-state--error {
  color: var(--red);
  background: rgba(255, 236, 231, .8);
}

.order-link {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--olive-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 900;
}

.empty {
  margin: 16px 0 0;
  text-align: center;
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
}

.drawer.is-open {
  display: block;
}

.drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 25, 18, .42);
}

.drawer__panel {
  position: absolute;
  top: 14px;
  right: 14px;
  bottom: 14px;
  width: min(560px, calc(100% - 28px));
  overflow: auto;
  border-radius: 28px;
  padding: 22px;
}

.drawer__close {
  min-height: 40px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .66);
  padding: 0 14px;
  font-weight: 900;
}

.details-grid {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.detail {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, .5);
}

.detail span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.detail strong {
  display: block;
  margin-top: 5px;
  overflow-wrap: anywhere;
}

pre {
  max-height: 280px;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, .55);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 12px;
}

@media (min-width: 760px) {
  .stats-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .filters {
    grid-template-columns: 160px 170px 1fr;
  }

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

@media (max-width: 620px) {
  .topbar,
  .panel__head {
    display: grid;
  }

  .panel {
    padding: 12px;
  }
}
