:root {
  --vc-primary: #4f46e5;
  --vc-primary-600: #4338ca;
  --vc-purple: #7c3aed;
  --vc-grad: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  --vc-bg: #f5f7fb;
  --vc-card: #ffffff;
  --vc-text: #1f2937;
  --vc-muted: #6b7280;
  --vc-border: #e5e7eb;
  --vc-soft: #f3f4f6;
  --vc-shadow: 0 10px 30px rgba(15, 23, 42, .06);
  --vc-radius: 16px;
}

[data-bs-theme="dark"] {
  --vc-bg: #0b1020;
  --vc-card: #131a30;
  --vc-text: #e5e7eb;
  --vc-muted: #9ca3af;
  --vc-border: #25304d;
  --vc-soft: #1a2238;
  --vc-shadow: 0 12px 40px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--vc-bg);
  color: var(--vc-text);
}

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.app-main { flex: 1; }
.app-footer { color: var(--vc-muted); border-top: 1px solid var(--vc-border); margin-top: 4rem; }

/* Header */
.app-header {
  background: var(--vc-card);
  border-bottom: 1px solid var(--vc-border);
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(180%) blur(14px);
}
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--vc-text); font-weight: 600; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--vc-grad); color: #fff;
  font-weight: 700; letter-spacing: .5px; font-size: 13px;
  box-shadow: 0 4px 14px rgba(79, 70, 229, .35);
}
.brand-title { font-size: 16px; }
.brand-logo {
  height: 40px;
  width: auto;
  display: block;
  object-fit: contain;
}
.nav-link-soft {
  text-decoration: none; color: var(--vc-muted);
  padding: 8px 12px; border-radius: 10px; font-weight: 500; font-size: 14px;
  transition: all .15s ease;
}
.nav-link-soft:hover { color: var(--vc-text); background: var(--vc-soft); }
.btn-light-soft {
  background: var(--vc-soft); color: var(--vc-text); border: 1px solid var(--vc-border);
}
.btn-light-soft:hover { background: var(--vc-border); color: var(--vc-text); }

/* Hero */
.hero { padding-top: 1.5rem; }
.eyebrow {
  display: inline-block; text-transform: uppercase; letter-spacing: 2px;
  font-size: 12px; color: var(--vc-primary); font-weight: 600; margin-bottom: 12px;
}
.hero-title { font-size: clamp(2rem, 4vw, 3.25rem); font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.text-grad { background: var(--vc-grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.hero-sub { color: var(--vc-muted); font-size: 18px; max-width: 560px; }
.hero-card { max-width: 560px; margin-inline: auto; }
.hero-card-head { padding-bottom: 10px; border-bottom: 1px solid var(--vc-border); }
.hero-flow-list { display: grid; gap: 12px; margin-top: 6px; }
.hero-flow-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--vc-soft) 70%, transparent);
  border: 1px solid var(--vc-border);
}
.hero-flow-step {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: var(--vc-grad);
  flex-shrink: 0;
  margin-top: 2px;
}

.warehouse-sites-section {
  margin-top: 3rem;
  padding-top: 1rem;
  background:
    radial-gradient(circle at 12% 10%, rgba(79, 70, 229, .12), transparent 36%),
    radial-gradient(circle at 90% 80%, rgba(16, 185, 129, .08), transparent 32%);
}
.section-title { font-size: clamp(1.6rem, 3vw, 2.4rem); }
.section-header { max-width: 760px; }
.section-sub { max-width: 680px; }

.checkin-card-grid { max-width: 1120px; margin-inline: auto; }
.checkin-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.checkin-card:hover {
  transform: translateY(-4px);
  border-color: rgba(79, 70, 229, .45);
  box-shadow: 0 16px 34px rgba(79, 70, 229, .18);
}
.checkin-card-image {
  width: 100%;
  height: 170px;
  object-fit: cover;
  display: block;
  background: var(--vc-soft);
}
.checkin-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--vc-border);
  color: var(--vc-primary);
  font-size: 13px;
  letter-spacing: .3px;
  font-weight: 600;
}
.checkin-card-head i { font-size: 16px; }
.checkin-card-body { padding: 14px 16px 10px; }
.checkin-card-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 8px;
  letter-spacing: -.01em;
}
.checkin-card-text {
  color: var(--vc-muted);
  font-size: 13px;
  margin: 0;
  line-height: 1.45;
  min-height: 56px;
}
.checkin-card-footer {
  margin-top: auto;
  padding: 12px 16px 16px;
}

@media (max-width: 992px) {
  .warehouse-sites-section { margin-top: 1.75rem; }
  .checkin-card-grid { max-width: 100%; }
}

.card-soft {
  background: var(--vc-card);
  border: 1px solid var(--vc-border);
  border-radius: var(--vc-radius);
  box-shadow: var(--vc-shadow);
}
.shadow-soft { box-shadow: 0 8px 22px rgba(79, 70, 229, .25); }
.avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--vc-soft); display: inline-flex; align-items: center; justify-content: center;
  color: var(--vc-primary); font-size: 22px;
}
.loc-card {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border: 1px solid var(--vc-border); border-radius: 12px;
  background: var(--vc-card); text-decoration: none; color: var(--vc-text);
  transition: all .15s ease;
}
.loc-card:hover { border-color: var(--vc-primary); transform: translateY(-1px); }
.loc-name { font-weight: 600; }
.loc-addr { color: var(--vc-muted); font-size: 13px; }
.loc-card i { color: var(--vc-primary); font-size: 22px; }

/* Form */
.form-shell { max-width: 760px; }
.form-header .form-title { font-weight: 700; letter-spacing: -.01em; margin: 6px 0 8px; }
.form-address { color: var(--vc-muted); }
.req { color: #ef4444; }

.form-control, .form-select {
  border-radius: 12px;
  border: 1px solid var(--vc-border);
  background: var(--vc-card);
  color: var(--vc-text);
  padding: 12px 14px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form-control-lg, .form-select-lg { padding: 14px 16px; font-size: 15px; }
.form-control:focus, .form-select:focus {
  border-color: var(--vc-primary);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, .15);
}
.form-label { font-weight: 500; font-size: 14px; color: var(--vc-text); margin-bottom: 6px; }
.invalid-text { color: #ef4444; font-size: 12.5px; display: block; margin-top: 4px; }
.form-check-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--vc-border); background: var(--vc-card);
}
.form-check-pill .form-check-input { margin: 0; }

.btn-gradient {
  background: var(--vc-grad);
  color: #fff; border: 0; font-weight: 600;
  padding: 14px 24px; border-radius: 12px;
  box-shadow: 0 8px 22px rgba(79, 70, 229, .35);
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn-gradient:hover { color: #fff; transform: translateY(-1px); box-shadow: 0 12px 28px rgba(79, 70, 229, .42); }
.btn-primary { background: var(--vc-primary); border-color: var(--vc-primary); }
.btn-primary:hover { background: var(--vc-primary-600); border-color: var(--vc-primary-600); }
.btn-outline-primary { color: var(--vc-primary); border-color: var(--vc-primary); }
.btn-outline-primary:hover { background: var(--vc-primary); color: #fff; }

.d-none-when-empty:empty { display: none !important; }
.validation-summary-valid { display: none !important; }

/* Success / Badge */
.success-circle {
  width: 80px; height: 80px; margin: 0 auto;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff; font-size: 38px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 14px 30px rgba(16, 185, 129, .4);
}
.success-circle.bg-soft-purple {
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  box-shadow: 0 14px 30px rgba(124, 58, 237, .4);
}

.badge-card {
  max-width: 360px;
  border-radius: 16px;
  border: 1px solid var(--vc-border);
  background: var(--vc-card);
  overflow: hidden;
  text-align: left;
}
.badge-header {
  background: var(--vc-grad);
  color: #fff; padding: 14px 18px;
  display: flex; align-items: center; gap: 12px;
  font-weight: 600; letter-spacing: 1.5px; font-size: 12px; text-transform: uppercase;
}
.badge-body { padding: 20px; }
.badge-name { font-size: 22px; font-weight: 700; }
.badge-company { color: var(--vc-muted); margin-bottom: 14px; }
.badge-meta { display: grid; grid-template-columns: 110px 1fr; gap: 6px 14px; font-size: 14px; }
.badge-meta dt { color: var(--vc-muted); font-weight: 500; }
.badge-meta dd { margin: 0; font-weight: 500; }
.badge-qr { margin-top: 16px; text-align: center; }
.badge-qr img { width: 150px; height: 150px; }

/* Print */
@media print {
  body { background: #fff; }
  .app-header, .app-footer, .d-print-none { display: none !important; }
  .card-soft { border: none; box-shadow: none; }
  .badge-card { box-shadow: none; }
}

/* Admin layout */
.admin-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
@media (max-width: 900px) { .admin-shell { grid-template-columns: 1fr; } }
.admin-sidebar {
  background: var(--vc-card); border-right: 1px solid var(--vc-border);
  padding: 22px 18px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.admin-brand { display: flex; align-items: center; padding: 6px 8px 18px; border-bottom: 1px solid var(--vc-border); }
.admin-nav { display: flex; flex-direction: column; gap: 4px; padding-top: 14px; }
.admin-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 10px;
  color: var(--vc-muted); text-decoration: none; font-weight: 500; font-size: 14.5px;
  transition: all .15s ease;
}
.admin-nav-item:hover { background: var(--vc-soft); color: var(--vc-text); }
.admin-nav-item.active { background: rgba(79, 70, 229, .12); color: var(--vc-primary); font-weight: 600; }
.admin-main { padding: 0 0 32px; }
.admin-content { padding: 24px; }
.admin-page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: 14px; margin-bottom: 20px;
}
.page-title { font-size: 24px; font-weight: 700; margin: 0; }

.stat-card {
  background: var(--vc-card); border: 1px solid var(--vc-border);
  border-radius: var(--vc-radius); padding: 20px 22px;
  position: relative; overflow: hidden;
  box-shadow: var(--vc-shadow);
}
.stat-label { color: var(--vc-muted); font-size: 13px; font-weight: 500; }
.stat-value { font-size: 32px; font-weight: 700; margin-top: 6px; }
.stat-icon {
  position: absolute; right: 18px; top: 50%; transform: translateY(-50%);
  font-size: 36px; opacity: .25;
}

.table { color: var(--vc-text); }
.table thead th {
  background: var(--vc-soft); color: var(--vc-muted);
  font-size: 12px; text-transform: uppercase; letter-spacing: .5px;
  border-bottom: 1px solid var(--vc-border);
  font-weight: 600;
}
.table tbody td { border-color: var(--vc-border); }
.badge-pill {
  display: inline-block; padding: 4px 10px;
  background: var(--vc-soft); border-radius: 999px;
  font-family: 'Inter', monospace; font-weight: 600; font-size: 12px;
}
.status-pill {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
}
.status-active { background: rgba(16, 185, 129, .12); color: #059669; }
.status-out { background: rgba(107, 114, 128, .15); color: #4b5563; }

.warehouse-tile {
  border: 1px dashed var(--vc-border); border-radius: 12px; padding: 16px;
}

.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline li { display: flex; gap: 12px; padding: 8px 0; }
.timeline .dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }

.login-shell { max-width: 460px; }

.pagination .page-link { color: var(--vc-primary); border-radius: 8px; margin: 0 2px; border: 1px solid var(--vc-border); }
.pagination .active .page-link { background: var(--vc-primary); border-color: var(--vc-primary); color: #fff; }

/* Environment banner */
.env-banner {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 6px 16px;
  background: var(--env-color, #6b7280);
  color: #fff; font-weight: 700; letter-spacing: 2px;
  font-size: 12px; text-transform: uppercase;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
}
.env-banner-dot {
  width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.85);
  animation: env-pulse 1.6s ease-in-out infinite;
}
.env-banner-host {
  margin-left: 8px; font-weight: 500; letter-spacing: .5px; opacity: .85;
  text-transform: none; font-size: 11px;
}
@keyframes env-pulse {
  0%, 100% { opacity: .35; transform: scale(.9); }
  50%      { opacity: 1;   transform: scale(1.1); }
}

/* Mode selector — Check In / Check Out segmented control */
.mode-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 1.25rem;
}
.mode-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
  padding: 22px 14px;
  border: 2px solid var(--vc-border);
  background: var(--vc-card);
  color: var(--vc-text);
  border-radius: var(--vc-radius);
  font-weight: 600;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease, background .15s ease;
  text-align: center;
}
.mode-btn i {
  font-size: 28px;
  line-height: 1;
  margin-bottom: 4px;
}
.mode-btn .mode-label {
  font-size: 18px;
  letter-spacing: .3px;
}
.mode-btn .mode-sub {
  font-size: 12px;
  font-weight: 500;
  opacity: .7;
  text-transform: none;
  letter-spacing: 0;
}
.mode-btn:hover {
  border-color: var(--vc-primary);
  transform: translateY(-1px);
}
.btn-check:checked + .mode-btn-in {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-color: #059669;
  color: #fff;
  box-shadow: 0 8px 24px rgba(16, 185, 129, .35);
}
.btn-check:checked + .mode-btn-out {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  border-color: #ea580c;
  color: #fff;
  box-shadow: 0 8px 24px rgba(249, 115, 22, .35);
}
.btn-check:checked + .mode-btn .mode-sub {
  opacity: .92;
}
.btn-check:focus-visible + .mode-btn {
  outline: 3px solid rgba(79, 70, 229, .35);
  outline-offset: 2px;
}

/* Submit button — loading spinner state */
#submitBtn {
  position: relative;
}
#submitBtn:disabled {
  opacity: .85;
  cursor: progress;
}
.btn-spinner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* URL display box on success page */
.success-url-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--vc-soft);
  border: 1px solid var(--vc-border);
  border-radius: 12px;
  padding: 10px 12px;
  margin-top: 16px;
}
.success-url-box .success-url-text {
  flex: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  color: var(--vc-text);
  word-break: break-all;
  text-align: left;
}
.success-url-box .btn-copy {
  flex-shrink: 0;
}
