:root {
  --ink: #17202a;
  --muted: #607082;
  --line: #d9e1ea;
  --panel: #ffffff;
  --bg: #f4f7f9;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --accent: #d97706;
  --danger: #b91c1c;
  --ok: #15803d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 24px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  font-weight: 800;
  font-size: 20px;
  color: var(--brand);
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

nav a {
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--muted);
}

nav a.active,
nav a:hover {
  background: #e6f4f1;
  color: var(--brand-dark);
}

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 18px 60px;
}

.hero,
.customer-hero {
  min-height: 430px;
  display: grid;
  align-items: center;
  padding: 56px;
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(110deg, rgba(13, 56, 58, 0.92), rgba(15, 118, 110, 0.66)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='700' viewBox='0 0 1200 700'%3E%3Crect width='1200' height='700' fill='%23364854'/%3E%3Cpath d='M160 430h880l-80-150c-22-42-58-70-106-70H340c-46 0-82 25-105 65z' fill='%239fb8bf'/%3E%3Ccircle cx='330' cy='455' r='58' fill='%2317202a'/%3E%3Ccircle cx='870' cy='455' r='58' fill='%2317202a'/%3E%3Cpath d='M380 245h340l55 110H310z' fill='%23d8e8ea'/%3E%3C/svg%3E");
  background-size: cover;
  background-position: center;
  border-radius: 8px;
}

.customer-hero {
  position: relative;
  min-height: 360px;
}

.pulse {
  position: absolute;
  right: 7%;
  bottom: 18%;
  width: 160px;
  height: 160px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  animation: pulse 2.2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.72); opacity: 1; }
  100% { transform: scale(1.28); opacity: 0; }
}

.hero h1,
.customer-hero h1 {
  max-width: 760px;
  margin: 0;
  font-size: 48px;
  line-height: 1.05;
  letter-spacing: 0;
}

.hero p,
.customer-hero p {
  max-width: 650px;
  font-size: 18px;
  line-height: 1.6;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.page-head {
  margin-bottom: 20px;
}

.page-head h1,
.panel h2 {
  margin: 0 0 8px;
}

.page-head p,
.hint {
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 18px;
}

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

.panel {
  margin: 18px 0;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel.narrow {
  max-width: 620px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

input,
textarea,
select {
  width: 100%;
  margin: 8px 0 14px;
  padding: 12px;
  font: inherit;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

label {
  display: block;
  font-weight: 700;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 700;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

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

.button.danger {
  color: #fff;
  border-color: var(--danger);
  background: var(--danger);
}

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.actions.wrap {
  flex-wrap: wrap;
}

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

.table {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

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

th {
  color: var(--muted);
  background: #f8fafc;
}

.qr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.qr-card {
  padding: 14px;
  background: #fff;
  border: 1px dashed #9aa9b8;
  border-radius: 8px;
  break-inside: avoid;
}

.qr-box {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  margin-bottom: 10px;
  color: var(--brand);
  font-weight: 800;
  text-align: center;
  border: 8px solid #17202a;
  background: repeating-linear-gradient(45deg, #fff 0 10px, #eef6f4 10px 20px);
}

.qr-image {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  margin-bottom: 10px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
}

.scanner {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 340px;
  overflow: hidden;
  background: #17202a;
  border-radius: 8px;
}

.qr-scan-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.72);
}

.qr-scan-box {
  position: relative;
  width: min(720px, 100%);
  overflow: hidden;
  border-radius: 8px;
  background: #17202a;
}

.qr-scan-box video {
  display: block;
  width: 100%;
}

.qr-scan-box .button {
  position: absolute;
  left: 16px;
  bottom: 16px;
}

video {
  width: 100%;
  max-height: 520px;
}

.scan-frame {
  position: absolute;
  width: min(76%, 520px);
  aspect-ratio: 1.58;
  border: 3px solid #f59e0b;
  border-radius: 8px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.28);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.upload-fallback {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.chip {
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--brand-dark);
  background: #dff5ef;
  font-size: 13px;
  font-weight: 700;
}

.card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.status {
  font-weight: 800;
  color: var(--accent);
}

.ok {
  color: var(--ok);
}

.error {
  color: var(--danger);
  font-weight: 700;
}

pre {
  white-space: pre-wrap;
  padding: 12px;
  border-radius: 6px;
  background: #f8fafc;
  border: 1px solid var(--line);
}

@media (max-width: 780px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  main {
    padding: 18px 12px 40px;
  }

  .hero,
  .customer-hero {
    min-height: 360px;
    padding: 32px 22px;
  }

  .hero h1,
  .customer-hero h1 {
    font-size: 34px;
  }

  .grid.two,
  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  .topbar,
  .page-head,
  .panel,
  .button {
    display: none !important;
  }

  .qr-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }
}
