:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-muted: #f9fafb;
  --ink: #18202a;
  --muted: #667085;
  --line: #d8dee8;
  --line-strong: #b7c1d0;
  --accent: #0f766e;
  --accent-strong: #0b5e57;
  --danger: #b42318;
  --warning: #9a5d00;
  --success: #137a4b;
  --shadow: 0 18px 45px rgba(24, 32, 42, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  margin: 0;
}

[hidden] {
  display: none !important;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
}

.admin-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #101820;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px 18px;
}

.brand {
  align-items: center;
  display: flex;
  gap: 12px;
  font-weight: 800;
  text-decoration: none;
}

.brand-logo {
  background: #fff;
  border-radius: 6px;
  display: block;
  height: auto;
  padding: 6px;
  width: 128px;
}

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

.nav a {
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 11px 12px;
  text-decoration: none;
}

.nav a:hover,
.nav a.is-active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.main {
  min-width: 0;
  padding: 28px;
}

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

.eyebrow {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 7px;
  text-transform: uppercase;
}

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

h1 {
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  letter-spacing: 0;
  line-height: 1.05;
  margin-bottom: 0;
}

h2 {
  font-size: 1.25rem;
  letter-spacing: 0;
}

h3 {
  font-size: 1rem;
  letter-spacing: 0;
}

.auth-panel,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-panel {
  display: grid;
  gap: 22px;
  max-width: 620px;
  padding: 28px;
}

.auth-copy p,
.help-text,
.muted {
  color: var(--muted);
  line-height: 1.55;
}

.auth-form,
.upload-form,
.filter-row {
  display: grid;
  gap: 12px;
}

label {
  color: #344054;
  font-size: 0.86rem;
  font-weight: 800;
}

input[type="password"],
input[type="search"],
input[type="file"] {
  background: var(--surface-muted);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  min-height: 44px;
  padding: 9px 12px;
  width: 100%;
}

.primary-button,
.secondary-button,
.link-button {
  border-radius: 6px;
  cursor: pointer;
  font-weight: 800;
  min-height: 42px;
  padding: 0 14px;
}

.primary-button {
  background: var(--accent);
  border: 0;
  color: #fff;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.secondary-button,
.link-button {
  background: #fff;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  text-decoration: none;
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.content {
  display: grid;
  gap: 20px;
}

.metrics {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.metric span {
  color: var(--muted);
  display: block;
  font-size: 0.78rem;
  font-weight: 800;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  font-size: 2rem;
  line-height: 1;
}

.panel {
  overflow: hidden;
}

.panel-header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
}

.panel-body {
  padding: 18px;
}

.table-wrap {
  overflow-x: auto;
}

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

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

th {
  background: var(--surface-muted);
  color: #475467;
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

td {
  font-size: 0.92rem;
}

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

.status {
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.76rem;
  font-weight: 900;
  padding: 5px 9px;
  text-transform: uppercase;
}

.status.active,
.status.valid,
.status.published {
  background: rgba(19, 122, 75, 0.12);
  color: var(--success);
}

.status.not_found,
.status.needs_review {
  background: rgba(154, 93, 0, 0.12);
  color: var(--warning);
}

.status.revoked,
.status.error,
.status.bad_request {
  background: rgba(180, 35, 24, 0.12);
  color: var(--danger);
}

.notice {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  color: #9a3412;
  padding: 14px;
}

.success-box {
  background: #ecfdf3;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  color: #166534;
  padding: 14px;
}

.error-box {
  background: #fef3f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #991b1b;
  padding: 14px;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  overflow-wrap: anywhere;
}

@media (max-width: 920px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

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

  .main {
    padding: 18px;
  }

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

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

  .topbar,
  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }
}