:root {
  --navy: #1E4FD6;
  --navy-2: #163db0;
  --gold: #E30613;
  --gold-2: #ff2a36;
  --red: #E30613;
  --green: #1B7A4E;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #121826;
  --muted: #5c6b7a;
  --line: #e2e8f0;
  --sidebar: 272px;
  --ink: #0a0a0a;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--navy-2); text-decoration: none; }
a:hover { color: var(--red); }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar);
  background: linear-gradient(180deg, #0a0a0a 0%, #121212 55%, #1a1a1a 100%);
  color: #fff;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
  padding: 1.1rem 0.85rem 2rem;
}
.sidebar .brand {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.2rem 0.35rem 1.05rem;
  border-bottom: 1px solid rgba(227,6,19,.35);
  margin-bottom: 0.85rem;
}
.sidebar .brand-logo-plate {
  background: #fff;
  border-radius: 12px;
  padding: 8px 10px;
  box-shadow: inset 0 0 0 1px rgba(12,42,107,.08);
}
.sidebar .brand-logo-plate-dark {
  background: #000;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.sidebar .brand img {
  width: 100%;
  height: auto;
  max-height: 118px;
  object-fit: contain;
  display: block;
}
.sidebar .brand-text {
  padding: 0 .2rem;
}
.sidebar .brand-text small { display: block; color: #8eb0ff; letter-spacing: .12em; font-size: .68rem; }
.sidebar .brand-text strong { font-size: .95rem; line-height: 1.2; }

.letterhead {
  background: #000;
  border-bottom: 3px solid var(--red);
  padding: .45rem 1rem;
  text-align: center;
}
.letterhead img {
  width: min(920px, 100%);
  height: auto;
  max-height: 78px;
  object-fit: contain;
  object-position: center;
}
.nav-label {
  font-size: .68rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #8aa0b8;
  padding: 0.85rem 0.75rem 0.3rem;
}
.sidebar a.nav-link {
  display: flex;
  align-items: center;
  gap: .55rem;
  color: #d7e2ee;
  padding: .48rem .75rem;
  border-radius: 8px;
  font-size: .92rem;
}
.sidebar a.nav-link:hover,
.sidebar a.nav-link.active {
  background: rgba(30,79,214,.28);
  color: #fff;
}
.sidebar a.nav-link i { width: 1.15rem; text-align: center; color: #7ea2ff; }

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: .85rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.page { padding: 1.25rem; }
.page-title { margin: 0 0 1rem; font-size: 1.45rem; color: var(--navy); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem 1.1rem;
  box-shadow: 0 6px 18px rgba(10,37,64,.04);
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: "";
  position: absolute;
  right: -12px; top: -12px;
  width: 76px; height: 76px;
  border-radius: 50%;
  background: rgba(201,162,39,.12);
}
.stat-card .label { color: var(--muted); font-size: .78rem; letter-spacing: .04em; text-transform: uppercase; }
.stat-card .value { font-size: 1.8rem; font-weight: 700; color: var(--navy); margin-top: .2rem; }
.stat-card.used .value { color: var(--green); }
.stat-card.unused .value { color: #2b6cb0; }
.stat-card.fraud .value { color: var(--red); }

.card-masac {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(10,37,64,.04);
}
.card-masac .card-header {
  background: transparent;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  color: var(--navy);
}

.badge-unused { background: #dbeafe; color: #1e3a8a; }
.badge-used { background: #dcfce7; color: #166534; }
.badge-revoked { background: #fef3c7; color: #92400e; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }
.badge-draft { background: #e2e8f0; color: #334155; }
.badge-active { background: #dcfce7; color: #166534; }
.badge-closed { background: #e2e8f0; color: #475569; }

.table thead th {
  font-size: .75rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  background: #f8fafc;
}
.btn-navy { background: var(--navy); color: #fff; border: 0; }
.btn-navy:hover { background: var(--navy-2); color: #fff; }
.btn-gold { background: var(--red); color: #fff; border: 0; font-weight: 600; }
.btn-gold:hover { background: var(--gold-2); color: #fff; }

.guest-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 18% 12%, rgba(30,79,214,.35), transparent 34%),
    radial-gradient(circle at 86% 18%, rgba(227,6,19,.28), transparent 30%),
    linear-gradient(165deg, #000 0%, #0d0d0d 48%, #141820 100%);
  padding: 1.5rem;
}
.guest-card {
  width: min(480px, 100%);
  background: #fff;
  border-radius: 18px;
  padding: 2rem 1.6rem;
  box-shadow: 0 24px 60px rgba(0,0,0,.45);
}
.guest-wide { width: min(760px, 100%); }
.guest-brand { text-align: center; margin-bottom: 1.25rem; }
.guest-logo-plate {
  background: #000;
  border-radius: 14px;
  padding: 14px 16px;
  margin: 0 auto 0.75rem;
  width: fit-content;
  max-width: 100%;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.guest-brand img {
  width: min(280px, 100%);
  height: auto;
  max-height: 140px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}
.guest-brand p { color: var(--muted); margin: .65rem 0 0; line-height: 1.45; }
.guest-tagline { color: #64748b; font-size: .92rem; }

.auth-banner {
  height: 6px;
  background: linear-gradient(90deg, var(--navy), #fff, var(--red));
  border-radius: 18px 18px 0 0;
  margin: -2rem -1.6rem 1.4rem;
}

.upload-preview {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .75rem;
  background: #f8fafc;
  display: inline-block;
}
.upload-preview img {
  max-height: 72px;
  width: auto;
  display: block;
}

.scan-frame {
  background: #04121f;
  border-radius: 18px;
  overflow: hidden;
  min-height: 420px;
  position: relative;
}
.scan-frame video {
  width: 100% !important;
  max-height: 70vh;
  object-fit: cover;
  display: block;
}
.scan-frame img {
  image-rendering: pixelated;
}
.scan-result {
  border-radius: 16px;
  padding: 1.1rem;
  margin-top: 1rem;
  display: none;
}
.scan-result.valid { display: block; background: #ecfdf5; border: 1px solid #86efac; }
.scan-result.used, .scan-result.fraud { display: block; background: #fef2f2; border: 1px solid #fca5a5; }
.scan-result.revoked { display: block; background: #fffbeb; border: 1px solid #fcd34d; }

.menu-toggle { display: none; }

@media (max-width: 992px) {
  .letterhead img { max-height: 52px; }
  .sidebar {
    position: fixed;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform .2s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: inline-flex; }
}

.verify-hero {
  min-height: 100vh;
  padding: 1.5rem;
  display: grid;
  place-items: center;
}
.verify-hero.valid { background: linear-gradient(180deg, #ecfdf5, #fff); }
.verify-hero.used, .verify-hero.fraud { background: linear-gradient(180deg, #fef2f2, #fff); }
.verify-hero.revoked { background: linear-gradient(180deg, #fffbeb, #fff); }
.verify-panel {
  width: min(520px, 100%);
  background: #fff;
  border-radius: 18px;
  padding: 1.5rem;
  box-shadow: 0 12px 40px rgba(10,37,64,.08);
  text-align: center;
}
.verify-panel h1 { font-size: 1.4rem; margin-bottom: .4rem; }
.verify-logo {
  width: min(240px, 80%);
  height: auto;
  max-height: 110px;
  object-fit: contain;
  margin: 0 auto .85rem;
  display: block;
}
.meta-row { text-align: left; font-size: .92rem; padding: .35rem 0; border-bottom: 1px dashed var(--line); }
.meta-row span { color: var(--muted); display: inline-block; min-width: 110px; }

.ticket-preview-logo {
  width: min(220px, 100%);
  height: auto;
  max-height: 120px;
  object-fit: contain;
  display: block;
  margin: 0 auto .75rem;
}
