:root {
    --bg: #0f172a;
    --bg2: #111827;
    --surface: #1e293b;
    --surface2: #111827;
    --text: #f8fafc;
    --muted: #94a3b8;
    --ok: #22c55e;
    --warn: #f59e0b;
    --bad: #ef4444;
    --neutral: #64748b;
    --border: #334155;
    --blue: #2563eb;
    --blue2: #3b82f6;
  }
  
  * {
    box-sizing: border-box;
  }
  
  body {
    margin: 0;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    background:
      radial-gradient(circle at top left, rgba(37, 99, 235, 0.24), transparent 32rem),
      linear-gradient(145deg, var(--bg), var(--bg2));
    color: var(--text);
    min-height: 100dvh;
    line-height: 1.45;
  }
  
  main {
    max-width: 28rem;
    margin: 0 auto;
    padding: 2.5rem 1rem 3rem;
  }
  
  .auth-shell {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 1.25rem;
  }
  
  .auth-card {
    width: 100%;
    max-width: 28rem;
    padding: 1.25rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 1rem;
    background: rgba(15, 23, 42, 0.82);
    box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(16px);
  }
  
  .auth-top,
  .header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
  }
  
  .brand {
    color: var(--text);
    text-decoration: none;
    font-weight: 800;
    letter-spacing: -0.02em;
  }
  
  .brand span {
    color: var(--blue2);
  }
  
  .staff-pill,
  .header-staff-tag {
    padding: 0.25rem 0.6rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.75rem;
    background: rgba(30, 41, 59, 0.7);
  }
  
  .auth-heading {
    margin-bottom: 1rem;
  }
  
  .eyebrow {
    margin: 0 0 0.35rem;
    color: var(--blue2);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.72rem;
    font-weight: 700;
  }
  
  h1 {
    font-size: 1.55rem;
    line-height: 1.15;
    font-weight: 750;
    margin: 0 0 0.45rem;
  }
  
  p.sub {
    color: var(--muted);
    font-size: 0.9rem;
    margin: 0 0 1rem;
  }
  
  label {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-bottom: 0.4rem;
    font-weight: 700;
  }
  
  input,
  select,
  button,
  textarea {
    width: 100%;
    padding: 0.8rem 0.9rem;
    border-radius: 0.65rem;
    border: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.78);
    color: var(--text);
    font-size: 1rem;
  }
  
  textarea {
    min-height: 6rem;
    resize: vertical;
  }
  
  input::placeholder,
  textarea::placeholder {
    color: rgba(148, 163, 184, 0.68);
  }
  
  input:focus,
  select:focus,
  button:focus,
  textarea:focus {
    outline: 2px solid var(--blue2);
    outline-offset: 2px;
  }
  
  button {
    cursor: pointer;
    font-weight: 700;
    border: none;
    margin-top: 0.75rem;
  }
  
  button.primary {
    background: linear-gradient(135deg, var(--blue), var(--blue2));
    color: #fff;
    box-shadow: 0 0.75rem 1.75rem rgba(37, 99, 235, 0.25);
  }
  
  button.primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
  }
  
  button.ghost {
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid var(--border);
    color: var(--text);
    box-shadow: none;
  }
  
  button.danger {
    background: transparent;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.875rem;
    margin-top: 0.75rem;
    box-shadow: none;
  }
  
  .auth-button {
    margin-top: 1rem;
  }
  
  .stack > * + * {
    margin-top: 0.85rem;
  }
  
  .hidden {
    display: none !important;
  }
  
  .card {
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid var(--border);
    border-radius: 0.85rem;
    padding: 1rem;
  }
  
  .result {
    margin-top: 0.85rem;
    padding: 0.8rem 0.9rem;
    border-radius: 0.65rem;
    font-size: 0.92rem;
  }
  
  .result.error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fecaca;
  }
  
  .auth-footnote,
  .hint {
    color: var(--muted);
    font-size: 0.78rem;
    margin: 0.85rem 0 0;
  }
  
  .row-btns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }
  
  #reader {
    border-radius: 0.85rem;
    overflow: hidden;
    background: #000;
    min-height: 12rem;
    border: 1px solid var(--border);
  }
  
  #reader video {
    border-radius: 0.85rem;
  }
  
  #scan-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1rem;
    padding: 2rem;
    text-align: center;
    animation: overlayIn 0.15s ease-out;
  }
  
  #scan-overlay.show {
    display: flex;
  }
  
  #scan-overlay.valid {
    background: rgba(22, 101, 52, 0.96);
  }
  
  #scan-overlay.used,
  #scan-overlay.warn {
    background: rgba(146, 64, 14, 0.96);
  }
  
  #scan-overlay.bad {
    background: rgba(127, 29, 29, 0.96);
  }
  
  @keyframes overlayIn {
    from {
      opacity: 0;
      transform: scale(0.96);
    }
  
    to {
      opacity: 1;
      transform: scale(1);
    }
  }
  
  .scan-icon {
    font-size: 5rem;
    line-height: 1;
  }
  
  .scan-label {
    font-size: 2rem;
    font-weight: 850;
    letter-spacing: 0.03em;
    line-height: 1.15;
  }
  
  .scan-detail {
    color: rgba(255, 255, 255, 0.88);
    max-width: 28rem;
  }
  
  .scan-dismiss {
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.85rem;
  }
  
  @media (max-width: 420px) {
    main {
      padding: 1.25rem 1rem 2rem;
    }
  
    .auth-card {
      padding: 1rem;
    }
  
    .row-btns {
      grid-template-columns: 1fr;
    }
  }