:root {
  color-scheme: light;
  --ink: #12100d;
  --paper: #f2efe7;
  --panel: #fffdf8;
  --muted: #696359;
  --line: #b9b1a5;
  --red: #d93a1f;
  --yellow: #f2c500;
  --blue: #214da0;
  font-family: Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; color: var(--ink); background: var(--paper); }
button, input { color: inherit; font: inherit; }
button { cursor: pointer; }

.masthead {
  min-height: 72px;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr);
  align-items: stretch;
  color: #fff;
  background: var(--ink);
  border-bottom: 6px solid var(--yellow);
}

.brand {
  align-self: center;
  padding: 0 24px;
  color: #fff;
  font-size: 27px;
  font-weight: 900;
  letter-spacing: .17em;
  text-decoration: none;
}
.brand span { color: #ff563c; }
.environment { display: flex; align-items: center; gap: 10px; font-size: 12px; letter-spacing: .09em; text-transform: uppercase; }
.environment span { color: #aaa399; }
.environment em { padding: 5px 7px; color: var(--ink); background: var(--yellow); font-style: normal; font-weight: 900; }
.identity { display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding: 0 24px; font-size: 13px; }
.identity button, #refresh-button { padding: 8px 11px; border: 1px solid #777066; background: transparent; color: inherit; font-weight: 700; }
.identity button:hover, #refresh-button:hover { border-color: var(--yellow); }

.gate { width: min(760px, calc(100% - 36px)); margin: 11vh auto 0; padding: 48px; background: var(--panel); border: 3px solid var(--ink); box-shadow: 12px 12px 0 var(--red); }
.gate h1 { max-width: 640px; margin: 3px 0 16px; font: 900 clamp(44px, 7vw, 78px)/.91 Georgia, serif; letter-spacing: -.055em; }
.gate > p:not(.eyebrow, .error) { max-width: 620px; color: var(--muted); font-size: 19px; line-height: 1.45; }
.eyebrow { margin: 0 0 6px; color: var(--red); font-size: 12px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.primary { margin-top: 16px; padding: 13px 17px; border: 3px solid var(--ink); background: var(--yellow); font-weight: 900; box-shadow: 5px 5px 0 var(--ink); }
.primary:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--ink); }
.error { min-height: 1.2em; color: #a62513; font-weight: 700; }

.dashboard { min-height: calc(100vh - 78px); display: grid; grid-template-columns: 228px minmax(0, 1fr); }
.rail { padding: 24px 13px; background: #dad5cb; border-right: 2px solid var(--ink); }
.nav-item { width: 100%; padding: 12px 11px; border: 0; border-bottom: 1px solid #aaa398; background: transparent; text-align: left; font-weight: 800; }
.nav-item:hover { background: #ebe7df; }
.nav-item.active { color: #fff; background: var(--blue); box-shadow: inset 5px 0 0 var(--yellow); }

.workspace { min-width: 0; padding: 28px clamp(18px, 4vw, 52px) 34px; }
.workspace-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; padding-bottom: 18px; border-bottom: 4px solid var(--ink); }
.workspace h1 { margin: 0; font: 900 clamp(34px, 5vw, 58px)/.95 Georgia, serif; letter-spacing: -.04em; }
.workspace-tools { display: flex; align-items: center; gap: 9px; }
#refresh-button { border-color: var(--ink); color: var(--ink); background: var(--panel); }
#search { width: min(280px, 34vw); padding: 9px 11px; border: 2px solid var(--ink); background: var(--panel); }
.loading { margin: 28px 0; color: var(--muted); font-weight: 700; }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 12px; margin: 22px 0; }
.metric { min-height: 112px; padding: 14px; background: var(--panel); border: 2px solid var(--ink); }
.metric b { display: block; font: 900 37px/1 Georgia, serif; }
.metric span { display: block; margin-top: 8px; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.metric.alert { border-top: 8px solid var(--red); }
.metric.good { border-top: 8px solid #238159; }

.panel { margin: 20px 0; background: var(--panel); border: 2px solid var(--ink); }
.panel > h2 { margin: 0; padding: 12px 15px; border-bottom: 2px solid var(--ink); font-size: 15px; letter-spacing: .08em; text-transform: uppercase; }
.panel-body { padding: 15px; }
.status-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1px; background: var(--line); }
.status-grid div { padding: 13px; background: var(--panel); }
.status-grid small { display: block; margin-bottom: 5px; color: var(--muted); font-weight: 800; text-transform: uppercase; }
.status-grid b { overflow-wrap: anywhere; }

.table-wrap { max-width: 100%; overflow: auto; border: 2px solid var(--ink); background: var(--panel); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { position: sticky; top: 0; z-index: 1; padding: 10px; color: #fff; background: var(--ink); text-align: left; white-space: nowrap; }
td { max-width: 360px; padding: 10px; border: 1px solid #d1cbc0; vertical-align: top; overflow-wrap: anywhere; }
tbody tr:nth-child(even) { background: #f2eee6; }
.pill { display: inline-block; padding: 3px 6px; border: 1px solid currentColor; font-size: 11px; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
.pill.approved, .pill.active, .pill.sent, .pill.open, .pill.collected, .pill.submitted { color: #126242; background: #e3f4eb; }
.pill.pending, .pill.pending_approval, .pill.pending_confirmation, .pill.checkout_open, .pill.processing { color: #7b5700; background: #fff3bd; }
.pill.declined, .pill.failed, .pill.suppressed_bounce, .pill.suppressed_complaint { color: #a62513; background: #fce5e0; }

details { border-top: 1px solid var(--line); }
details:first-child { border-top: 0; }
summary { padding: 13px 15px; cursor: pointer; font-weight: 800; }
.detail-body { padding: 0 15px 15px; }
pre { max-height: 460px; margin: 10px 0 0; padding: 14px; overflow: auto; color: #eee; background: #201d19; font: 12px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.empty { padding: 30px; border: 2px dashed var(--line); color: var(--muted); text-align: center; }
footer { display: flex; justify-content: space-between; gap: 20px; margin-top: 24px; color: var(--muted); font-size: 11px; text-transform: uppercase; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 760px) {
  .masthead { grid-template-columns: 1fr auto; }
  .environment { display: none; }
  .identity { padding: 0 14px; }
  .identity span { display: none; }
  .dashboard { display: block; }
  .rail { display: flex; gap: 4px; overflow-x: auto; padding: 8px; border: 0; border-bottom: 2px solid var(--ink); }
  .nav-item { width: auto; flex: 0 0 auto; border: 1px solid var(--line); }
  .workspace-head { align-items: flex-start; flex-direction: column; }
  .workspace-tools, #search-wrap, #search { width: 100%; }
  .gate { padding: 30px 24px; }
  footer { flex-direction: column; }
}
