:root {
  --navy: #0B1F3A;
  --red: #DA1F3D;
  --white: #FFFFFF;
  --bg: #F5F7FA;
  --line: #D9E1EA;
  --text: #142236;
  --muted: #66758A;
  --success: #198754;
  --warning: #F0AD4E;
  --danger: #DC3545;
  --focus: #2F6FED;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  font-family: Arial, "Helvetica Neue", sans-serif;
  color: var(--text);
  background: var(--bg);
  letter-spacing: 0;
}
a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; }
input, select, textarea, button {
  font: inherit;
  letter-spacing: 0;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--white);
  color: var(--text);
}
textarea { min-height: 104px; resize: vertical; }
label { display: grid; gap: 6px; font-weight: 700; color: var(--navy); }
table { width: 100%; border-collapse: collapse; min-width: 860px; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--navy); background: #EEF3F8; font-size: .88rem; }
code { background: #EEF3F8; border-radius: 4px; padding: 2px 5px; }

.public-shell { min-height: 100vh; display: flex; flex-direction: column; }
.public-header, .public-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 18px clamp(18px, 5vw, 72px);
  background: var(--white);
  border-bottom: 1px solid var(--line);
}
.public-footer { margin-top: auto; border-top: 1px solid var(--line); border-bottom: 0; color: var(--muted); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; color: var(--navy); }
.brand-mark { background: var(--red); color: var(--white); padding: 7px 9px; border-radius: 6px; }
.public-header nav { display: flex; gap: 18px; }
.public-main { width: min(1080px, calc(100% - 32px)); margin: 42px auto; }
.verify-panel, .auth-panel, .panel, .result {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(20px, 4vw, 36px);
}
.verify-panel { display: grid; gap: 28px; }
.verify-copy h1, .auth-panel h1, .page-heading h1 { margin: 0; color: var(--navy); line-height: 1.1; }
.verify-copy h1 { font-size: clamp(2rem, 5vw, 3.6rem); max-width: 780px; }
.verify-copy p { max-width: 720px; line-height: 1.6; }
.eyebrow { color: var(--red); text-transform: uppercase; font-size: .78rem; font-weight: 800; margin: 0 0 8px; }
.input-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 14px;
  background: var(--white);
  color: var(--navy);
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
}
.button.primary { background: var(--navy); border-color: var(--navy); color: var(--white); }
.button.success { background: var(--success); border-color: var(--success); color: var(--white); }
.button.warning { background: var(--warning); border-color: var(--warning); color: #231600; }
.button.danger { background: var(--danger); border-color: var(--danger); color: var(--white); }
.button.small { min-height: 32px; padding: 6px 10px; font-size: .86rem; }
.icon-button { border: 1px solid var(--line); background: var(--white); border-radius: 6px; width: 36px; height: 36px; cursor: pointer; }
.result { margin-top: 20px; display: grid; gap: 18px; position: relative; }
.result.valid { border-left: 6px solid var(--success); }
.result.invalid { border-left: 6px solid var(--danger); }
.result-grid, .detail-grid, .metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.result-grid div, .detail-grid div, .metric {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
  background: #FBFCFE;
}
dt, .detail-grid span, .metric span { color: var(--muted); font-size: .86rem; }
dd { margin: 4px 0 0; font-weight: 800; color: var(--navy); }
.qr { width: 132px; height: 132px; object-fit: contain; }
.qr.large { width: 190px; height: 190px; }
.auth-panel { width: min(520px, 100%); margin: 0 auto; display: grid; gap: 18px; }
.auth-panel.wide { width: min(820px, 100%); }
.auth-panel form, .panel form { display: grid; gap: 14px; }
.activation-grid { display: grid; grid-template-columns: 240px 1fr; gap: 24px; align-items: start; }
.code-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; padding: 0; list-style: none; }
.code-list li { border: 1px solid var(--line); border-radius: 6px; padding: 12px; }
.flash { margin-bottom: 12px; padding: 12px 14px; border-radius: 6px; border: 1px solid var(--line); background: var(--white); }
.flash-success { border-color: #A7D8B8; background: #EDF8F1; }
.flash-error { border-color: #F3B1B8; background: #FFF0F2; }

.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 250px 1fr; }
.sidebar { background: var(--navy); color: var(--white); padding: 20px; }
.admin-brand { color: var(--white); margin-bottom: 24px; }
.side-nav { display: grid; gap: 6px; }
.side-nav a { color: var(--white); padding: 10px 12px; border-radius: 6px; }
.side-nav a:hover { background: rgba(255,255,255,.12); text-decoration: none; }
.admin-main { min-width: 0; }
.topbar {
  height: 68px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 24px;
}
.global-search { flex: 1; max-width: 520px; }
.profile-menu { display: flex; align-items: center; gap: 10px; }
.profile-menu form { margin: 0; }
.workspace { padding: 24px; display: grid; gap: 18px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.split { display: grid; grid-template-columns: minmax(280px, 430px) 1fr; gap: 18px; align-items: start; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.filters, .toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 16px; }
.filters input, .filters select { max-width: 240px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--white); }
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 3px 9px;
  background: #EEF3F8;
  color: var(--navy);
  font-size: .8rem;
  font-weight: 800;
}
.status-pill.success, .status-pill.verified { background: #E8F6EE; color: var(--success); }
.status-pill.returned, .status-pill.assigned { background: #FFF6E3; color: #795000; }
.status-pill.rejected, .status-pill.revoked { background: #FFECEF; color: var(--danger); }
.status-pill.in_review { background: #EAF0FF; color: #214EA6; }
.muted { color: var(--muted); font-size: .9rem; }
.actions { display: grid; gap: 8px; min-width: 220px; }
.actions form { display: flex; gap: 6px; align-items: center; }
.decision-form { max-width: 720px; }
.detail-list div { display: grid; grid-template-columns: 120px 1fr; padding: 8px 0; border-bottom: 1px solid var(--line); }

@media (max-width: 860px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .side-nav { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
  .topbar, .public-header, .public-footer { flex-direction: column; align-items: stretch; height: auto; }
  .split, .activation-grid, .input-row { grid-template-columns: 1fr; }
  .filters input, .filters select { max-width: none; }
}
