:root {
  --bg: #f6f1e7;
  --ink: #111111;
  --white: #ffffff;
  --yellow: #ffe600;
  --mint: #4ade80;
  --coral: #ff5e5b;
  --sky: #93c5fd;
  --border: 3px solid var(--ink);
  --shadow: 5px 5px 0px var(--ink);
  --shadow-sm: 3px 3px 0px var(--ink);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background-color: var(--bg);
  background-image: radial-gradient(rgba(17, 17, 17, 0.16) 1.2px, transparent 1.2px);
  background-size: 24px 24px;
  min-height: 100vh;
  line-height: 1.45;
}

code, pre, .mono {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.hidden {
  display: none !important;
}

.bg-yellow { background: var(--yellow); }
.bg-white  { background: var(--white); }
.bg-mint   { background: var(--mint); }
.bg-coral  { background: var(--coral); color: var(--white); }
.bg-sky    { background: var(--sky); }

/* TOPBAR */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--white);
  border-bottom: var(--border);
}

.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-box {
  width: 44px;
  height: 44px;
  background: var(--yellow);
  border: var(--border);
  box-shadow: var(--shadow-sm);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 20px;
}

.brand-title {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.brand-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  opacity: 0.72;
}

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

.tab-btn {
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  padding: 9px 14px;
  background: var(--white);
  color: var(--ink);
  border: var(--border);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.08s ease;
}

.tab-btn:hover {
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0px var(--ink);
}

.tab-btn.active {
  background: var(--yellow);
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0px var(--ink);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: var(--mint);
  border: var(--border);
  box-shadow: var(--shadow-sm);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
}

.status-pill.offline {
  background: var(--coral);
  color: var(--white);
}

.status-pill .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ink);
}

/* CONTAINER */
.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* METRICS */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.metric-card {
  border: var(--border);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}

.metric-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.metric-value {
  font-size: 22px;
  font-weight: 700;
}

/* SECTION HEAD */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.section-head h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.base-url-box {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--white);
  border: var(--border);
  box-shadow: var(--shadow-sm);
  padding: 6px 10px;
  font-size: 13px;
}

.tag-black {
  background: var(--ink);
  color: var(--yellow);
  font-weight: 700;
  font-size: 11px;
  padding: 3px 7px;
}

/* TABS */
.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* ENDPOINT CARD */
.endpoint-card {
  background: var(--white);
  border: var(--border);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 24px;
}

.endpoint-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--ink);
  margin-bottom: 14px;
}

.endpoint-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.method-badge {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 12px;
  padding: 4px 10px;
  border: 2px solid var(--ink);
}

.method-badge.get  { background: var(--mint); }
.method-badge.post { background: var(--coral); color: var(--white); }

.endpoint-path {
  font-size: 16px;
  font-weight: 700;
}

.cat-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 10px;
  border: 2px solid var(--ink);
}

.endpoint-desc {
  font-size: 14px;
  margin-bottom: 16px;
}

/* TABLE */
.param-table-wrap {
  overflow-x: auto;
  margin-bottom: 20px;
}

.brutal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.brutal-table th,
.brutal-table td {
  border: 2px solid var(--ink);
  padding: 9px 11px;
  text-align: left;
  vertical-align: middle;
}

.brutal-table th {
  background: var(--bg);
  font-size: 11px;
  letter-spacing: 0.05em;
}

.req-yes {
  background: var(--coral);
  color: var(--white);
  font-weight: 700;
  font-size: 11px;
  padding: 2px 6px;
  border: 1.5px solid var(--ink);
}

.req-no {
  background: var(--bg);
  font-weight: 700;
  font-size: 11px;
  padding: 2px 6px;
  border: 1.5px solid var(--ink);
}

/* PLAYGROUND */
.playground-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 20px;
  padding-top: 16px;
  border-top: 2px dashed var(--ink);
}

.pg-title {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
  margin-bottom: 12px;
}

.field-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin: 10px 0 5px;
}

.brutal-input {
  width: 100%;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 13px;
  background: var(--bg);
  color: var(--ink);
  border: 2.5px solid var(--ink);
  outline: none;
}

.brutal-input:focus {
  background: var(--white);
  box-shadow: 3px 3px 0px var(--ink);
}

.file-input {
  padding: 7px 10px;
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.brutal-btn {
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  padding: 11px 18px;
  border: var(--border);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.brutal-btn:hover:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0px var(--ink);
}

.brutal-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.mini-btn {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 11px;
  padding: 4px 9px;
  background: var(--yellow);
  color: var(--ink);
  border: 2px solid var(--ink);
  cursor: pointer;
}

.mini-btn.danger { background: var(--coral); color: var(--white); }
.mini-btn.mint   { background: var(--mint); }
.mini-btn.white  { background: var(--white); }

.pg-output {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pg-out-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 4px;
}

.pg-preview-box {
  min-height: 290px;
  border: var(--border);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px;
  gap: 10px;
}

.pg-preview-box img {
  max-width: 100%;
  max-height: 440px;
  border: 2.5px solid var(--ink);
  box-shadow: var(--shadow-sm);
}

.empty-state {
  font-size: 12px;
  text-align: center;
  opacity: 0.72;
  padding: 20px;
}

.code-box {
  background: #16161a;
  color: #f4f4f6;
  border: var(--border);
  padding: 12px;
  font-size: 11.5px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.inline-tester {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.inline-tester .brutal-input {
  flex: 1;
  min-width: 200px;
}

/* CHECK KEY */
.check-wrap,
.admin-login-box {
  max-width: 680px;
  margin: 0 auto;
}

.key-result-box {
  margin-top: 16px;
  border: var(--border);
  background: var(--bg);
  padding: 16px;
}

.key-stat-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1.5px dashed rgba(17, 17, 17, 0.25);
  font-size: 13px;
}

.progress-track {
  margin-top: 12px;
  height: 18px;
  border: 2px solid var(--ink);
  background: var(--white);
}

.progress-fill {
  height: 100%;
  background: var(--mint);
}

/* ADMIN */
.create-key-grid {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr 0.8fr 0.8fr;
  gap: 12px;
}

.align-end {
  display: flex;
  align-items: flex-end;
}

.full-w {
  width: 100%;
}

.badge-on  { background: var(--mint); padding: 3px 8px; border: 2px solid var(--ink); font-weight: 700; font-size: 11px; }
.badge-off { background: var(--coral); color: var(--white); padding: 3px 8px; border: 2px solid var(--ink); font-weight: 700; font-size: 11px; }

.action-cell {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.err-msg {
  margin-top: 10px;
  background: var(--coral);
  color: var(--white);
  border: 2px solid var(--ink);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
}

/* TOAST */
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 99;
  background: var(--ink);
  color: var(--yellow);
  border: 3px solid var(--yellow);
  box-shadow: var(--shadow-sm);
  padding: 11px 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 920px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .playground-grid { grid-template-columns: 1fr; }
  .create-key-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  .metrics-grid { grid-template-columns: 1fr; }
  .row-2, .create-key-grid { grid-template-columns: 1fr; }
}
