:root {
  --bg-top: #eef5ff;
  --bg-bottom: #edf7ee;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: #ffffff;
  --surface-tint: rgba(244, 249, 255, 0.82);
  --line: rgba(24, 91, 156, 0.12);
  --line-strong: rgba(24, 91, 156, 0.22);
  --ink: #16344f;
  --muted: #5d7286;
  --brand-blue: #237cc4;
  --brand-blue-deep: #165f9d;
  --brand-green: #3bb54a;
  --brand-green-deep: #23913a;
  --shadow: 0 30px 70px rgba(17, 48, 84, 0.12);
  --shadow-soft: 0 16px 34px rgba(17, 48, 84, 0.08);
  --radius-xl: 34px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --success: #0f7d3d;
  --success-bg: #eaf8ef;
  --warning: #9a6112;
  --warning-bg: #fff4de;
  --danger: #b62e21;
  --danger-bg: #ffedea;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(35, 124, 196, 0.16), transparent 26%),
    radial-gradient(circle at bottom right, rgba(59, 181, 74, 0.14), transparent 24%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Trebuchet MS", "Gill Sans", "Segoe UI", sans-serif;
  background: transparent;
}

.shell,
.mobile-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 64px;
}

.mobile-shell {
  width: min(760px, calc(100vw - 24px));
}

.mobile-body {
  min-height: 100vh;
}

.brand-banner {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 24px;
  grid-template-columns: 112px minmax(0, 1fr);
  align-items: center;
  padding: 28px 30px;
  margin-bottom: 22px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(241, 249, 255, 0.92)),
    linear-gradient(135deg, rgba(35, 124, 196, 0.08), rgba(59, 181, 74, 0.08));
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.brand-banner::after {
  content: "";
  position: absolute;
  inset: auto -60px -70px auto;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59, 181, 74, 0.18), transparent 68%);
}

.brand-mark {
  position: relative;
  width: 96px;
  height: 168px;
  justify-self: center;
}

.brand-mark::before {
  content: "";
  position: absolute;
  inset: 0;
  clip-path: polygon(20% 0, 82% 0, 82% 42%, 71% 48%, 64% 100%, 37% 100%, 30% 48%, 20% 42%);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.08) 22%, transparent 23%),
    linear-gradient(180deg, #91b6ea 0%, var(--brand-blue) 36%, var(--brand-blue) 64%, var(--brand-green) 64%, var(--brand-green) 100%);
  border-radius: 24px;
  box-shadow: inset 0 0 0 1px rgba(22, 95, 157, 0.12);
}

.brand-mark::after {
  content: "";
  position: absolute;
  left: 24px;
  right: 24px;
  top: 78px;
  height: 4px;
  background: rgba(255, 255, 255, 0.8);
  box-shadow:
    0 10px 0 rgba(255, 255, 255, 0.8),
    0 20px 0 rgba(255, 255, 255, 0.8);
}

.brand-copy {
  position: relative;
  z-index: 1;
}

.brand-kicker,
.eyebrow {
  margin: 0 0 8px;
  color: var(--brand-green-deep);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

.brand-title,
h1 {
  font-size: clamp(2.2rem, 5vw, 4.7rem);
  line-height: 0.92;
  letter-spacing: -0.04em;
  font-weight: 900;
}

.brand-title {
  color: var(--brand-blue);
}

.brand-title .accent {
  color: var(--brand-green);
}

.brand-subtitle {
  margin-top: 14px;
  max-width: 760px;
  font-size: 1.02rem;
  line-height: 1.6;
  color: var(--muted);
}

.hero {
  margin-bottom: 24px;
}

.hero h1 {
  color: var(--ink);
}

.lede,
.summary-line,
.role-copy,
.meta {
  color: var(--muted);
  line-height: 1.55;
}

.lede {
  margin-top: 14px;
  max-width: 760px;
}

.panel,
.mobile-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, var(--surface) 0%, rgba(255, 255, 255, 0.94) 100%);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
}

.panel::before,
.mobile-card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 6px;
  background: linear-gradient(90deg, var(--brand-blue), var(--brand-green));
}

.panel + .panel {
  margin-top: 18px;
}

.stack-form {
  display: grid;
  gap: 14px;
}

.action-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.button-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(35, 124, 196, 0.1);
  color: var(--brand-blue);
  font-size: 1rem;
  line-height: 1;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
}

.field span {
  color: var(--muted);
}

.search-field {
  margin-bottom: 8px;
}

.scan-field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

input,
button,
.link-button {
  width: 100%;
  border-radius: 18px;
  padding: 14px 16px;
  font: inherit;
}

input {
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--ink);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

input:focus {
  outline: none;
  border-color: rgba(35, 124, 196, 0.48);
  box-shadow: 0 0 0 4px rgba(35, 124, 196, 0.12);
}

button,
.link-button,
.role-button {
  position: relative;
  overflow: hidden;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-blue-deep));
  color: #fff;
  font-weight: 800;
  text-decoration: none;
  text-align: center;
  box-shadow: 0 14px 30px rgba(22, 95, 157, 0.22);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

button:hover,
.link-button:hover,
.role-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 34px rgba(22, 95, 157, 0.26);
  filter: saturate(1.04);
}

button:disabled {
  opacity: 0.72;
  cursor: progress;
  transform: none;
}

.ghost-button,
.danger-button {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(244, 249, 255, 0.9));
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
}

.ghost-button:hover,
.danger-button:hover {
  box-shadow: none;
  border-color: var(--line-strong);
}

.danger-button {
  color: var(--danger);
}

.compact-button {
  width: auto;
  min-width: 92px;
  padding: 14px 18px;
}

.status-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

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

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.summary-grid article,
.item-card,
.next-item {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, rgba(245, 250, 255, 0.94));
  padding: 16px;
}

.summary-grid article {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.summary-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.summary-grid strong {
  font-size: 30px;
  color: var(--brand-blue-deep);
}

.message {
  margin: 16px 0 0;
  border-radius: 18px;
  padding: 14px 16px;
  font-weight: 700;
  border: 1px solid transparent;
}

.message.success {
  background: var(--success-bg);
  color: var(--success);
  border-color: rgba(15, 125, 61, 0.16);
}

.message.error {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(182, 46, 33, 0.16);
}

.message.warning {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: rgba(154, 97, 18, 0.16);
}

.item-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.item-list.empty,
.next-item.empty {
  color: var(--muted);
}

.item-card.attention,
.next-item.attention {
  background: var(--warning-bg);
  border-color: rgba(154, 97, 18, 0.18);
}

.item-card.completed,
.next-item.completed {
  background: var(--success-bg);
  border-color: rgba(15, 125, 61, 0.18);
}

.item-card strong,
.next-item strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1.05rem;
}

.mobile-card {
  padding: 26px;
}

.page-nav {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 18px;
}

.nav-link {
  width: auto;
  min-width: 118px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 800;
  color: var(--brand-blue-deep);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(238, 247, 255, 0.96));
  border: 1px solid rgba(35, 124, 196, 0.14);
  box-shadow: 0 10px 22px rgba(22, 95, 157, 0.08);
}

.nav-link::before {
  content: "←";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(35, 124, 196, 0.1);
  color: var(--brand-blue);
  font-size: 0.95rem;
  line-height: 1;
}

.nav-link:hover {
  border-color: rgba(35, 124, 196, 0.24);
  box-shadow: 0 14px 26px rgba(22, 95, 157, 0.12);
}

.nav-link.ghost-button {
  color: var(--brand-blue-deep);
}

.queue-section {
  margin-top: 24px;
}

.queue-section h2 {
  margin-bottom: 12px;
  color: var(--brand-blue-deep);
}

.role-card {
  text-align: left;
}

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

.role-button {
  display: grid;
  gap: 8px;
  justify-items: start;
  min-height: 138px;
  padding: 22px;
  border-radius: 24px;
}

.role-button.ghost-button {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(241, 248, 255, 0.9));
  color: var(--ink);
  border: 1px solid var(--line);
}

.role-label {
  font-size: 1.12rem;
}

.role-detail {
  font-size: 0.94rem;
  line-height: 1.45;
  color: inherit;
  opacity: 0.82;
}

.queue-item {
  position: relative;
  display: grid;
  gap: 6px;
}

.queue-item.active {
  border-color: rgba(35, 124, 196, 0.28);
  box-shadow: inset 0 0 0 1px rgba(35, 124, 196, 0.1);
}

.queue-indicator {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.94);
}

.queue-indicator.ready {
  background: linear-gradient(180deg, #52d96b, var(--success));
}

.queue-indicator.not-ready {
  background: linear-gradient(180deg, #ff7a6c, var(--danger));
}

.queue-readiness {
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.queue-readiness.ready {
  color: var(--success);
}

.queue-readiness.not-ready {
  color: var(--danger);
}

.queue-action {
  width: 100%;
  margin-top: 8px;
}

.complete-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(17, 42, 65, 0.7);
  backdrop-filter: blur(8px);
  z-index: 1000;
  padding: 24px;
}

.success-overlay {
  background: rgba(16, 74, 36, 0.78);
}

.wrong-overlay {
  background: rgba(122, 22, 17, 0.82);
}

.warning-overlay {
  background: rgba(138, 94, 12, 0.8);
}

.complete-card {
  width: min(460px, 100%);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 250, 255, 0.95));
  border-radius: 30px;
  padding: 34px 26px;
  text-align: center;
  color: var(--ink);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.2);
}

.success-card {
  color: var(--success);
}

.wrong-card {
  color: var(--danger);
}

.warning-card {
  color: var(--warning);
}

.camera-card {
  width: min(560px, 100%);
}

.camera-video {
  width: 100%;
  margin: 18px 0;
  border-radius: 22px;
  background: #0f1720;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}

.checkmark {
  font-size: 88px;
  line-height: 1;
  font-weight: 900;
  margin-bottom: 12px;
}

.signature-card {
  text-align: left;
}

.signature-canvas {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  touch-action: none;
}

.summary-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(35, 124, 196, 0.1);
  color: var(--brand-blue-deep);
  font-size: 0.86rem;
  font-weight: 800;
}

.brand-divider {
  height: 1px;
  margin: 18px 0 0;
  background: linear-gradient(90deg, rgba(35, 124, 196, 0.26), rgba(59, 181, 74, 0.26));
}

@media (max-width: 900px) {
  .brand-banner {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .brand-mark {
    margin: 0 auto;
  }

  .role-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  .shell,
  .mobile-shell {
    width: min(100vw - 20px, 100%);
    padding: 18px 0 42px;
  }

  .panel,
  .mobile-card,
  .brand-banner {
    padding: 20px;
    border-radius: 26px;
  }

  .status-header,
  .status-actions {
    flex-direction: column;
    align-items: stretch;
  }

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

  .brand-title,
  h1 {
    font-size: clamp(2rem, 10vw, 3.6rem);
  }

  .action-row {
    grid-template-columns: 1fr;
  }
}
