:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #eef2f6;
  color: #101726;
  --ink: #101726;
  --muted: #607086;
  --line: #d8e0ea;
  --panel: #ffffff;
  --soft: #f6f8fb;
  --blue: #1261d8;
  --blue-dark: #0b4db2;
  --green: #16864a;
  --red: #c7352c;
  --shadow: 0 18px 46px rgba(18, 32, 54, 0.11);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #eef2f6;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(238, 242, 246, 0.92)),
    linear-gradient(135deg, #dce8f6 0%, #f3f6f9 46%, #e8f0ec 100%);
}

a {
  color: inherit;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  color: var(--ink);
  font-size: 2.15rem;
  line-height: 1.05;
  letter-spacing: 0;
}

.lede {
  max-width: 560px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.shell {
  width: min(100% - 28px, 980px);
  margin: 0 auto;
  padding: 22px 0 34px;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  color: #1b2a40;
  font-size: 0.98rem;
  font-weight: 900;
}

.brand-mark {
  display: inline-flex;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #12213a;
  color: #fff;
  font-size: 0.8rem;
  letter-spacing: 0;
  box-shadow: 0 10px 22px rgba(18, 33, 58, 0.18);
}

.eyebrow {
  width: fit-content;
  margin: 0 0 10px;
  padding: 6px 10px;
  border: 1px solid #c9d7e7;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: #3f5877;
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  font: inherit;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, background 140ms ease;
}

.button:active {
  transform: translateY(1px);
}

.button.primary {
  background: var(--blue);
  color: white;
  box-shadow: 0 14px 28px rgba(18, 97, 216, 0.25);
}

.button.primary:hover,
.button.primary:focus {
  background: var(--blue-dark);
  outline: none;
}

.button.secondary {
  border: 1px solid #cbd7e6;
  background: rgba(255, 255, 255, 0.86);
  color: #26384f;
}

.button.secondary:hover,
.button.secondary:focus {
  border-color: #91a8c2;
  outline: none;
}

.button:disabled {
  opacity: 0.52;
  cursor: not-allowed;
  box-shadow: none;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  align-items: center;
  padding: 18px;
}

.auth-panel {
  display: grid;
  gap: 24px;
  width: min(100%, 430px);
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.auth-panel h1 {
  margin-bottom: 10px;
}

.auth-form {
  display: grid;
  gap: 10px;
}

.auth-form label,
.scan-result label {
  color: #2b3e56;
  font-size: 0.88rem;
  font-weight: 900;
}

.auth-form input {
  min-height: 52px;
  width: 100%;
  border: 1px solid #cbd7e6;
  border-radius: 8px;
  padding: 0 14px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  outline: none;
}

.auth-form input:focus,
.scan-result textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(18, 97, 216, 0.13);
}

.auth-form .button {
  width: 100%;
  margin-top: 8px;
}

.form-error {
  border: 1px solid #f1b2ad;
  border-radius: 8px;
  padding: 12px;
  background: #fff3f2;
  color: #9a251e;
  font-weight: 800;
  line-height: 1.4;
}

.portal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 0 22px;
}

.portal-header h1 {
  margin-bottom: 10px;
}

.portal-header .actions {
  justify-content: flex-end;
}

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

.menu-button {
  display: grid;
  min-height: 178px;
  align-content: space-between;
  gap: 20px;
  border: 1px solid #d5dfeb;
  border-radius: 8px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.menu-button:hover,
.menu-button:focus {
  border-color: var(--blue);
  box-shadow: 0 20px 50px rgba(18, 97, 216, 0.16);
  outline: none;
  transform: translateY(-2px);
}

.menu-button-primary {
  border-color: #b9d0f5;
  background: linear-gradient(180deg, #ffffff 0%, #f3f8ff 100%);
}

.menu-kicker {
  display: inline-flex;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #eef5ff;
  color: var(--blue);
  font-weight: 900;
}

.menu-button strong {
  display: block;
  font-size: 1.55rem;
  line-height: 1.08;
  letter-spacing: 0;
}

.menu-button small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.scan-panel,
.connection-card,
.details-grid div,
.feature-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.scan-panel {
  padding: 14px;
}

.scanner {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 14px;
  align-items: start;
}

.workflow-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  grid-column: 1 / -1;
}

.workflow-pill {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid #d7e1ed;
  border-radius: 8px;
  padding: 0 10px;
  background: #f8fafc;
  color: #617288;
  font-size: 0.82rem;
  font-weight: 900;
}

.workflow-pill.is-active {
  border-color: #9ab8ed;
  background: #eef5ff;
  color: var(--blue);
}

.workflow-pill.is-done {
  border-color: #a9ddbc;
  background: #f1fbf5;
  color: #17633a;
}

.scanner-camera {
  position: relative;
  overflow: hidden;
  border: 1px solid #24364e;
  border-radius: 8px;
  background: #0d1726;
  aspect-ratio: 1 / 1;
  min-height: 280px;
}

.scanner-camera video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner-camera img {
  max-width: 100%;
}

.scanner-camera > div {
  border: 0 !important;
}

.scanner-camera button,
.scanner-camera select {
  border-radius: 8px;
  font: inherit;
}

.scanner-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  grid-column: 1 / -1;
  order: 3;
}

.scan-result {
  display: grid;
  gap: 10px;
}

.scan-result textarea {
  width: 100%;
  min-height: 168px;
  resize: vertical;
  border: 1px solid #cbd7e6;
  border-radius: 8px;
  padding: 14px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  line-height: 1.5;
  outline: none;
}

.scan-status {
  border: 1px solid #d8e0ea;
  border-radius: 8px;
  padding: 12px;
  background: var(--soft);
  color: var(--muted);
  font-weight: 800;
  line-height: 1.45;
}

.scan-status[data-tone="success"] {
  border-color: #a9ddbc;
  background: #f1fbf5;
  color: #17633a;
}

.scan-status[data-tone="error"] {
  border-color: #f1b2ad;
  background: #fff3f2;
  color: #9a251e;
}

.scan-status[data-tone="info"] {
  border-color: #b8cdf2;
  background: #f2f7ff;
  color: #255aa2;
}

.scan-details {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.scan-alert {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(16, 23, 38, 0.46);
  backdrop-filter: blur(4px);
}

.scan-alert[hidden] {
  display: none;
}

.scan-alert-card {
  display: grid;
  justify-items: center;
  gap: 12px;
  width: min(100%, 380px);
  border-radius: 8px;
  padding: 24px;
  background: #fff;
  box-shadow: 0 30px 80px rgba(16, 23, 38, 0.28);
  text-align: center;
}

.scan-alert-icon {
  display: inline-flex;
  width: 58px;
  height: 58px;
  align-items: center;
  justify-content: center;
  border: 3px solid #f1b2ad;
  border-radius: 50%;
  color: var(--red);
  font-size: 2rem;
  font-weight: 900;
}

.scan-alert[data-tone="success"] .scan-alert-icon {
  border-color: #a9ddbc;
  color: var(--green);
}

.scan-alert h2 {
  color: var(--ink);
  font-size: 1.45rem;
  line-height: 1.2;
}

.scan-alert p {
  color: var(--muted);
  line-height: 1.5;
}

.scan-alert-details {
  display: grid;
  gap: 8px;
  width: 100%;
  margin: 4px 0;
}

.scan-alert-details div {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 10px;
  border: 1px solid #e0e7f0;
  border-radius: 8px;
  padding: 9px 10px;
  background: #f8fafc;
  text-align: left;
}

.scan-alert-details dt {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.scan-alert-details dd {
  margin: 0;
  color: var(--ink);
  font-weight: 900;
  overflow-wrap: anywhere;
}

.scan-alert .actions {
  width: 100%;
}

.scan-alert .button {
  flex: 1 1 0;
}

.scan-details[hidden] {
  display: none;
}

.scan-details-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.scan-details h2 {
  color: var(--ink);
  font-size: 1.15rem;
  line-height: 1.2;
}

.result-badge {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  border: 1px solid #cbd7e6;
  border-radius: 8px;
  padding: 0 10px;
  background: #f7f9fc;
  color: #33445b;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.result-badge[data-tone="passed"],
.result-badge[data-tone="active"] {
  border-color: #a9ddbc;
  background: #f1fbf5;
  color: #17633a;
}

.result-badge[data-tone="hold"] {
  border-color: #ead28d;
  background: #fff9e8;
  color: #785c12;
}

.result-badge[data-tone="rejected"],
.result-badge[data-tone="inactive"],
.result-badge[data-tone="not-found"] {
  border-color: #f1b2ad;
  background: #fff3f2;
  color: #9a251e;
}

.label-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin: 0;
}

.label-grid div {
  min-width: 0;
  border: 1px solid #e0e7f0;
  border-radius: 8px;
  padding: 10px;
  background: #f8fafc;
}

.label-grid .label-grid-wide {
  grid-column: 1 / -1;
}

.label-grid dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.label-grid dd {
  margin: 5px 0 0;
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 850;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.status-panel {
  display: grid;
  gap: 16px;
  max-width: 760px;
  padding: 34px 0;
}

.connection-card {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 88px;
  padding: 18px;
}

.connection-card.is-success {
  border-color: #a9ddbc;
  background: #f6fdf8;
}

.connection-card.is-error {
  border-color: #f1b2ad;
  background: #fff7f6;
}

.status-dot {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 6px rgba(199, 53, 44, 0.12);
}

.connection-card.is-success .status-dot {
  background: var(--green);
  box-shadow: 0 0 0 6px rgba(22, 134, 74, 0.14);
}

.status-label {
  color: var(--ink);
  font-weight: 900;
}

.status-copy {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.5;
  word-break: break-word;
}

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

.details-grid div {
  padding: 14px;
  box-shadow: none;
}

.details-grid dt {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.details-grid dd {
  margin: 7px 0 0;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 900;
}

.hero,
.features,
.portal-grid {
  display: grid;
  gap: 14px;
}

.feature-card {
  padding: 20px;
}

@media (max-width: 780px) {
  body {
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(238, 242, 246, 0.95)),
      linear-gradient(145deg, #dce8f6 0%, #f8fafc 54%, #e8f0ec 100%);
  }

  h1 {
    font-size: 1.9rem;
  }

  .shell {
    width: min(100% - 22px, 980px);
    padding: 14px 0 24px;
  }

  .auth-shell {
    align-items: start;
    padding-top: 18px;
  }

  .auth-panel {
    padding: 20px;
  }

  .portal-header {
    display: grid;
    padding-top: 8px;
  }

  .portal-header .actions,
  .portal-header .button {
    width: 100%;
  }

  .menu-grid,
  .scanner,
  .label-grid,
  .details-grid {
    grid-template-columns: 1fr;
  }

  .menu-button {
    min-height: 144px;
    padding: 18px;
  }

  .menu-button strong {
    font-size: 1.35rem;
  }

  .scan-panel {
    padding: 10px;
  }

  .scanner {
    gap: 12px;
  }

  .scanner-camera {
    min-height: 0;
    width: 100%;
  }

  .scanner-controls {
    position: sticky;
    bottom: 10px;
    z-index: 5;
    margin-top: 2px;
    padding: 8px;
    border: 1px solid rgba(203, 215, 230, 0.9);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 12px 34px rgba(18, 32, 54, 0.16);
  }

  .scanner-controls .button {
    min-height: 52px;
    padding: 0 12px;
  }

  .scan-result textarea {
    min-height: 128px;
  }
}

@media (max-width: 380px) {
  .shell {
    width: min(100% - 16px, 980px);
  }

  .auth-shell {
    padding: 12px;
  }

  .button {
    min-height: 50px;
    padding: 0 12px;
  }

  .scanner-controls {
    grid-template-columns: 1fr;
  }
}
