:root {
  --primary: #10b981;
  --primary-dark: #059669;
  --primary-light: #d1fae5;
  --primary-ultra-light: #f0fdf4;
  --secondary: #3b82f6;
  --accent: #f59e0b;
  --danger: #ef4444;
  --purple: #8b5cf6;
  --teal: #14b8a6;
  --dark: #1f2937;
  --gray: #6b7280;
  --light-gray: #f3f4f6;
  --white: #ffffff;
  --border: #e5e7eb;
  --shadow: 0 20px 25px -5px rgba(15, 23, 42, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--dark);
  background: var(--light-gray);
  font-family: "Noto Sans SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.page {
  display: none;
}

.page.active,
.view.active {
  display: block;
}

.view {
  display: none;
  animation: fadeIn 0.35s ease both;
}

.auth-shell {
  position: relative;
  min-height: 100vh;
  display: none;
  place-items: center;
  overflow: hidden;
  padding: 32px;
  background: linear-gradient(135deg, #f0fdf4 0%, #eff6ff 100%);
}

.auth-shell.active {
  display: grid;
}

.auth-card {
  position: relative;
  width: min(440px, 100%);
  padding: 40px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  z-index: 2;
}

.auth-card h1,
.role-header h1,
.topbar h1 {
  margin: 16px 0 8px;
  font-size: 32px;
  line-height: 1.2;
}

.auth-card p,
.role-header p,
.topbar p {
  margin: 0 0 28px;
  color: var(--gray);
}

.brand-mark,
.side-logo {
  width: 64px;
  height: 64px;
  display: inline-grid;
  place-items: center;
  color: var(--white);
  border-radius: 18px;
  background: linear-gradient(135deg, var(--primary), var(--teal));
  box-shadow: 0 16px 35px rgba(16, 185, 129, 0.32);
}

.brand-mark {
  position: relative;
  font-size: 28px;
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 26px;
  background: rgba(16, 185, 129, 0.16);
  animation: pulse 2s infinite;
  z-index: -1;
}

.float-mark {
  animation: float 3s ease-in-out infinite;
}

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

.form-message {
  display: none;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
}

.form-message.active {
  display: flex;
}

.field,
.form-row label {
  position: relative;
  display: block;
}

.field i {
  position: absolute;
  left: 18px;
  top: 50%;
  color: #9ca3af;
  transform: translateY(-50%);
  transition: color 0.3s ease;
}

.field input,
.form-row input,
.form-row select,
.inline-form input,
.inline-form select {
  width: 100%;
  height: 48px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--white);
  color: var(--dark);
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.field input {
  padding: 0 16px 0 48px;
}

.form-row input,
.form-row select,
.inline-form input,
.inline-form select {
  padding: 0 14px;
}

.field:focus-within i {
  color: var(--primary);
}

.field input:focus,
.form-row input:focus,
.form-row select:focus,
.inline-form input:focus,
.inline-form select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.14);
}

.btn {
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  padding: 0 20px;
  font-weight: 700;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn.primary {
  color: var(--white);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 12px 24px rgba(16, 185, 129, 0.28);
}

.btn.secondary {
  color: var(--primary-dark);
  border: 1px solid var(--primary);
  background: var(--white);
}

.btn.danger {
  color: var(--white);
  background: linear-gradient(135deg, var(--danger), #b91c1c);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.small-btn {
  min-height: 40px;
  padding: 0 14px;
}

.leaf,
.ring {
  position: absolute;
  opacity: 0.42;
  animation: drift 9s ease-in-out infinite;
}

.leaf {
  color: var(--primary);
  font-size: 34px;
}

.leaf-a {
  left: 9%;
  top: 15%;
}

.leaf-b {
  right: 16%;
  top: 18%;
  animation-delay: -2s;
}

.leaf-c {
  left: 18%;
  bottom: 17%;
  animation-delay: -4s;
}

.leaf-d {
  right: 10%;
  bottom: 14%;
  animation-delay: -6s;
}

.ring {
  width: 130px;
  height: 130px;
  border: 2px dashed rgba(16, 185, 129, 0.4);
  border-radius: 50%;
}

.ring-a {
  left: 6%;
  bottom: 10%;
}

.ring-b {
  right: 8%;
  top: 9%;
  border-color: rgba(59, 130, 246, 0.34);
  animation-delay: -3s;
}

.role-page {
  width: min(1120px, 100%);
  z-index: 2;
}

.stepper {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  color: var(--gray);
  font-size: 14px;
}

.stepper .current {
  color: var(--primary-dark);
  font-weight: 700;
}

.role-header {
  text-align: center;
}

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

.role-card {
  position: relative;
  overflow: hidden;
  min-height: 250px;
  padding: 32px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  transition: transform 0.4s ease, box-shadow 0.4s ease, opacity 0.4s ease;
}

.role-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 4px;
  background: var(--role-color);
  transition: width 0.4s ease;
}

.role-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 22px 45px rgba(15, 23, 42, 0.14);
}

.role-card:hover::before {
  width: 100%;
}

.role-card.full {
  opacity: 0.55;
}

.role-lock {
  position: absolute;
  right: 18px;
  top: 18px;
  color: var(--danger);
}

.role-avatar {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  margin-bottom: 20px;
  border: 3px solid var(--role-color);
  border-radius: 50%;
  transition: transform 0.4s ease;
}

.role-card:hover .role-avatar {
  transform: scale(1.1);
}

.role-avatar span {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  color: var(--white);
  border-radius: 50%;
  background: var(--role-color);
  font-size: 32px;
}

.role-card h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.role-card p {
  min-height: 46px;
  margin: 10px 0 20px;
  color: var(--gray);
  line-height: 1.6;
}

.role-tag {
  display: inline-flex;
  padding: 5px 10px;
  color: var(--role-color);
  border-radius: 999px;
  background: color-mix(in srgb, var(--role-color) 12%, white);
  font-size: 12px;
  font-weight: 700;
}

.people-line {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--gray);
  font-size: 13px;
}

.meter {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}

.meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--role-color), var(--primary));
}

.role-back {
  display: block;
  margin: 24px auto 0;
}

.app-shell {
  min-height: 100vh;
}

.app-shell.active {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px;
  background: var(--white);
  border-right: 1px solid var(--border);
}

.side-brand,
.user-card {
  display: flex;
  align-items: center;
  gap: 14px;
}

.side-logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  font-size: 22px;
}

.side-brand strong {
  display: block;
  font-size: 18px;
}

.side-brand span,
.side-footer,
.section-title span {
  color: var(--gray);
  font-size: 12px;
}

.user-card {
  padding: 16px;
  border-radius: 18px;
  background: var(--primary-ultra-light);
}

.avatar {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--white);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--teal));
  font-weight: 800;
}

.user-meta {
  min-width: 0;
}

.user-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.online-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
  animation: scanPulse 2s infinite;
}

.role-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  color: var(--primary-dark);
  border-radius: 999px;
  background: var(--primary-light);
  font-size: 12px;
  font-weight: 700;
}

.nav-menu,
.side-system {
  display: grid;
  gap: 8px;
}

.side-system {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.side-system > span {
  color: var(--gray);
  font-size: 13px;
  font-weight: 700;
}

.nav-item {
  position: relative;
  width: 100%;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--gray);
  text-align: left;
  font-weight: 700;
  transition: background 0.25s ease, color 0.25s ease;
}

.nav-item i {
  width: 24px;
  font-size: 18px;
}

.nav-item::before {
  content: "";
  width: 3px;
  height: 0;
  border-radius: 999px;
  background: var(--primary);
  transition: height 0.25s ease;
}

.nav-item:hover,
.nav-item.active {
  color: var(--primary-dark);
  background: var(--primary-ultra-light);
}

.nav-item:hover::before,
.nav-item.active::before {
  height: 24px;
}

.danger-nav:hover {
  color: var(--danger);
  background: #fef2f2;
}

.danger-nav:hover::before {
  background: var(--danger);
}

.content {
  min-width: 0;
  padding: 32px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 28px;
}

.topbar h1 {
  margin-top: 0;
}

.topbar p {
  margin-bottom: 0;
}

.icon-btn {
  width: 44px;
  height: 44px;
  display: none;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--dark);
  background: var(--white);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.stat-card,
.panel,
.batch-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--white);
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.05);
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px;
}

.stat-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--white);
  border-radius: 16px;
  font-size: 22px;
}

.stat-card strong {
  display: block;
  font-size: 28px;
}

.stat-card span {
  color: var(--gray);
  font-size: 13px;
}

.trend {
  margin-top: 3px;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
}

.panel {
  padding: 24px;
  margin-bottom: 24px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-title h2 {
  margin: 0;
  font-size: 22px;
}

.text-btn {
  border: 0;
  color: var(--primary-dark);
  background: transparent;
  font-weight: 700;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: end;
}

.scan-transfer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

input[readonly] {
  color: var(--dark);
  background: #f9fafb;
  cursor: default;
}

.flow-tip {
  grid-column: 1 / -1;
  padding: 12px 14px;
  border: 1px solid rgba(16, 185, 129, 0.24);
  border-radius: 12px;
  background: var(--primary-ultra-light);
  color: var(--primary-dark);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.6;
}

.warn-tip {
  border-color: rgba(245, 158, 11, 0.36);
  background: #fffbeb;
  color: #92400e;
}

.form-row label span {
  display: block;
  margin-bottom: 8px;
  color: var(--gray);
  font-size: 13px;
  font-weight: 700;
}

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

.batch-card {
  padding: 18px;
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.batch-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 18px 35px rgba(15, 23, 42, 0.11);
}

.batch-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.batch-no {
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 800;
}

.batch-card h3 {
  margin: 0 0 12px;
  font-size: 18px;
}

.batch-meta {
  display: grid;
  gap: 6px;
  color: var(--gray);
  font-size: 14px;
}

.stage-track {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
  margin-top: 16px;
}

.stage-dot {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}

.stage-dot.done {
  background: linear-gradient(90deg, var(--primary), var(--teal));
}

.batch-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.delete-confirm {
  padding: 16px 4px 4px;
  text-align: center;
}

.delete-confirm > i {
  color: #dc2626;
  font-size: 36px;
}

.delete-confirm h3 {
  margin: 14px 0 8px;
}

.delete-confirm p {
  margin: 0;
  color: var(--gray);
  line-height: 1.6;
}

.delete-confirm .modal-actions {
  justify-content: center;
  margin-top: 20px;
}

.qr-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 12px;
  border: 1px dashed rgba(16, 185, 129, 0.45);
  border-radius: 14px;
  background: var(--primary-ultra-light);
}

.qr-card canvas {
  flex: 0 0 auto;
  width: 88px;
  height: 88px;
  max-width: 168px;
  max-height: 168px;
  border: 6px solid var(--white);
  border-radius: 12px;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
}

.qr-card strong,
.qr-card span {
  display: block;
}

.qr-card span {
  margin-top: 6px;
  color: var(--gray);
  font-size: 13px;
  line-height: 1.5;
}

.handoff-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 20px;
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, #ecfdf5, #eff6ff);
  border: 1px solid rgba(16, 185, 129, 0.24);
}

.handoff-copy h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.handoff-copy p {
  margin: 0;
  color: var(--gray);
  line-height: 1.6;
}

.handoff-panel .qr-card {
  min-width: 310px;
  margin-top: 0;
  background: rgba(255, 255, 255, 0.78);
}

.handoff-panel .qr-card canvas {
  width: 104px;
  height: 104px;
}

.modal-mask {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.55);
  z-index: 100;
}

.modal-mask.active {
  display: flex;
}

.scanner-mask {
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(8px);
}

.modal-card {
  width: min(540px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 18px 18px 20px;
  border-radius: 18px;
  background: var(--white);
  box-shadow: 0 22px 50px rgba(15, 23, 42, 0.25);
}

.modal-head {
  position: sticky;
  top: -18px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0 10px;
  margin-bottom: 14px;
  background: var(--white);
}

.modal-head h3 {
  margin: 0;
  font-size: 18px;
}

.modal-close-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--white);
}

.modal-section-title {
  margin: 0 0 14px;
  font-size: 18px;
}

.scanner-card {
  width: min(460px, 100%);
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 22px 50px rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(20px);
}

.scanner-card .modal-head {
  position: static;
  padding: 0;
  background: transparent;
}

.scanner-card .modal-head h3,
.scanner-stage,
.scanner-status {
  color: #f8fafc;
}

.scanner-stage {
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 700;
}

.scanner-preview {
  position: relative;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  border-radius: 22px;
  background: rgba(15, 23, 42, 0.8);
}

.scanner-mask.photo-mode .scanner-preview {
  display: none;
}

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

.scanner-frame-mark {
  position: absolute;
  inset: 16% 12%;
  border: 2px solid rgba(16, 185, 129, 0.9);
  border-radius: 24px;
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.25);
}

.scanner-frame-mark::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  top: 50%;
  height: 2px;
  background: rgba(16, 185, 129, 0.95);
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.85);
  animation: scannerBeam 2s linear infinite alternate;
}

.scanner-status {
  margin: 14px 0 0;
  font-size: 14px;
  line-height: 1.6;
}

.scanner-photo-btn {
  display: flex;
  width: 100%;
  margin-top: 12px;
  color: #047857;
  background: #ffffff;
}

.scanner-photo-input {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.modal-meta {
  display: grid;
  gap: 6px;
}

.modal-progress {
  margin-top: 16px;
}

.modal-progress h4 {
  margin: 0 0 10px;
  font-size: 15px;
}

.progress-list,
.modal-scan-list {
  display: grid;
  gap: 10px;
}

.progress-item,
.modal-scan-item {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #f9fafb;
}

.progress-item {
  display: grid;
  gap: 4px;
}

.progress-item.done {
  border-color: rgba(16, 185, 129, 0.3);
  background: var(--primary-ultra-light);
}

.progress-item span {
  color: var(--gray);
  font-size: 13px;
  line-height: 1.5;
}

.progress-detail {
  margin-top: 4px;
  color: #374151;
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.modal-scan-item .qr-card {
  margin-top: 0;
  margin-bottom: 12px;
}

.muted {
  color: var(--gray);
  font-size: 13px;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
}

.search-panel {
  padding: 32px;
  margin-bottom: 24px;
  text-align: center;
  border: 2px dashed var(--primary);
  border-radius: 22px;
  background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
}

.search-panel > i {
  color: var(--primary);
  font-size: 48px;
  animation: pulse 2s infinite;
}

.search-panel h2 {
  margin: 16px 0;
  font-size: 24px;
}

.inline-form {
  display: flex;
  max-width: 640px;
  gap: 12px;
  margin: 0 auto;
}

.result-panel.empty-state,
.empty-state {
  color: var(--gray);
  text-align: center;
}

.timeline {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0;
  margin: 24px 0;
}

.timeline-step {
  position: relative;
  text-align: center;
}

.timeline-step::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 17px;
  height: 2px;
  background: linear-gradient(90deg, var(--primary-light), var(--primary));
}

.timeline-step:first-child::before {
  left: 50%;
}

.timeline-step:last-child::before {
  right: 50%;
}

.timeline-dot {
  position: relative;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  margin: 0 auto 10px;
  border: 2px solid var(--primary);
  border-radius: 50%;
  color: var(--primary);
  background: var(--white);
  z-index: 1;
}

.timeline-step.done .timeline-dot {
  color: var(--white);
  background: var(--primary);
  box-shadow: 0 0 0 8px rgba(16, 185, 129, 0.12);
}

.event-list,
.record-list {
  display: grid;
  gap: 12px;
}

.event-item,
.record-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #f9fafb;
}

.scan-frame {
  position: relative;
  width: 130px;
  height: 130px;
  display: grid;
  place-items: center;
  margin: 0 auto;
  color: var(--primary);
  font-size: 48px;
}

.scan-frame::before,
.scan-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 4px solid var(--primary);
  animation: pulse 2s infinite;
}

.scan-frame::before {
  clip-path: polygon(0 0, 35% 0, 35% 8%, 8% 8%, 8% 35%, 0 35%, 0 0, 65% 0, 100% 0, 100% 35%, 92% 35%, 92% 8%, 65% 8%);
}

.scan-frame::after {
  clip-path: polygon(0 65%, 8% 65%, 8% 92%, 35% 92%, 35% 100%, 0 100%, 0 65%, 92% 65%, 100% 65%, 100% 100%, 65% 100%, 65% 92%, 92% 92%);
}

.scan-line {
  position: absolute;
  left: 12px;
  right: 12px;
  height: 3px;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 18px var(--primary);
  animation: scanLine 2s infinite;
}

.scan-count {
  display: grid;
  justify-items: center;
  gap: 6px;
  margin-bottom: 20px;
}

.scan-count span {
  color: var(--gray);
}

.scan-count strong {
  font-size: 64px;
  line-height: 1;
  color: transparent;
  background: linear-gradient(135deg, var(--primary), var(--teal));
  -webkit-background-clip: text;
  background-clip: text;
}

.record-badge {
  flex: 0 0 auto;
  padding: 4px 10px;
  border-radius: 999px;
  color: var(--primary-dark);
  background: var(--primary-light);
  font-size: 12px;
  font-weight: 800;
}

.user-table {
  display: grid;
  gap: 12px;
}

.user-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1.2fr 1.2fr auto;
  gap: 12px;
  align-items: end;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #f9fafb;
}

.user-row label span {
  display: block;
  margin-bottom: 6px;
  color: var(--gray);
  font-size: 12px;
  font-weight: 700;
}

.user-row input,
.user-row select {
  width: 100%;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--white);
  outline: none;
}

.user-actions {
  display: flex;
  gap: 8px;
}

.toast-host {
  position: fixed;
  right: 18px;
  top: 18px;
  display: grid;
  gap: 12px;
  z-index: 50;
}

.toast {
  min-width: 260px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 14px;
  color: var(--white);
  box-shadow: 0 16px 35px rgba(15, 23, 42, 0.18);
  animation: slideIn 0.25s ease both;
}

.toast.success {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.toast.error {
  background: linear-gradient(135deg, var(--danger), #b91c1c);
}

.toast.warn {
  background: linear-gradient(135deg, var(--accent), #d97706);
}

.shake {
  animation: shake 0.4s ease both;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.75;
  }
  50% {
    transform: scale(1.08);
    opacity: 1;
  }
}

@keyframes drift {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(0);
  }
  50% {
    transform: translate3d(16px, -18px, 0) rotate(10deg);
  }
}

@keyframes scanPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.45);
  }
  100% {
    box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
  }
}

@keyframes scanLine {
  0% {
    top: 16px;
  }
  100% {
    top: 112px;
  }
}

@keyframes scannerBeam {
  0% {
    transform: translateY(-120px);
  }
  100% {
    transform: translateY(120px);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    transform: translateX(16px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20%,
  60% {
    transform: translateX(-8px);
  }
  40%,
  80% {
    transform: translateX(8px);
  }
}

@media (max-width: 1024px) {
  .app-shell.active {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 20;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .icon-btn {
    display: grid;
  }

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

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

@media (max-width: 768px) {
  .auth-shell {
    padding: 18px;
  }

  .auth-card {
    padding: 28px 20px;
  }

  .auth-card h1,
  .role-header h1,
  .topbar h1 {
    font-size: 26px;
  }

  .content {
    padding: 20px;
  }

  .role-grid,
  .batch-grid,
  .form-row,
  .timeline {
    grid-template-columns: 1fr;
  }

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

  .stat-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .inline-form {
    flex-direction: column;
  }

  .timeline-step {
    display: flex;
    gap: 12px;
    align-items: center;
    text-align: left;
  }

  .timeline-step::before {
    display: none;
  }

  .timeline-dot {
    margin: 0;
  }

  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .handoff-panel,
  .qr-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .handoff-panel .qr-card {
    min-width: 0;
    width: 100%;
  }

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

  .user-actions {
    flex-direction: column;
  }
}
