/* Public staff attendance flows. Scoped to .staff-flow so owner and marketing pages stay untouched. */
.staff-flow {
  --sf-ink: #102a3a;
  --sf-muted: #60717d;
  --sf-blue: #176f9d;
  --sf-blue-dark: #105779;
  --sf-blue-soft: #eaf6fc;
  --sf-sky: #70bff0;
  --sf-line: #d7e3ea;
  --sf-line-strong: #bdd3df;
  --sf-surface: #ffffff;
  --sf-surface-soft: #f6f9fb;
  --sf-success: #18794e;
  --sf-success-soft: #ecf8f1;
  --sf-warning: #9a6700;
  --sf-warning-soft: #fff8e7;
  --sf-danger: #b42318;
  --sf-danger-soft: #fff2f0;
  position: relative;
  isolation: isolate;
  width: 100%;
  min-height: 100svh;
  padding: 48px 18px calc(44px + env(safe-area-inset-bottom)) !important;
  background: linear-gradient(180deg, #eff8fd 0%, #f7fafc 38%, #f4f7f9 100%);
  color: var(--sf-ink);
  font-family: "Manrope", "DM Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.staff-flow::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--sf-blue) 0 72%, var(--sf-sky) 72% 100%);
}

.staff-flow > [data-normal-scan],
.staff-flow > [data-ios-qr-gate] {
  width: 100%;
}

.staff-flow > .card,
.staff-flow > [data-normal-scan] > .card,
.staff-flow > [data-ios-qr-gate] > .card {
  width: min(100%, 680px);
  margin-inline: auto !important;
  padding: 30px !important;
  overflow: hidden;
  border: 1px solid var(--sf-line) !important;
  border-top: 3px solid var(--sf-blue) !important;
  border-radius: 8px !important;
  background: var(--sf-surface) !important;
  box-shadow: 0 18px 50px rgba(16, 42, 58, 0.11) !important;
  transform: none !important;
}

.staff-flow--face > .card {
  width: min(100%, 740px);
}

.staff-flow--result > .card {
  width: min(100%, 560px);
}

.staff-flow .topbar {
  display: block;
  margin: 0 0 20px !important;
  padding: 0 0 18px;
  border-bottom: 1px solid var(--sf-line);
}

.staff-flow .h-eyebrow {
  display: none;
}

.staff-flow h2 {
  margin: 0 !important;
  color: var(--sf-ink);
  font-family: inherit;
  font-size: 28px !important;
  font-weight: 750;
  line-height: 1.2;
  letter-spacing: 0 !important;
}

.staff-flow .topbar > div:first-child::before {
  border-color: #c7dfea !important;
  border-radius: 7px !important;
  background-color: var(--sf-blue-soft) !important;
}

.staff-flow .topbar .small {
  margin-top: 9px !important;
}

.staff-flow .small,
.staff-flow p {
  color: var(--sf-muted);
  font-size: 13px;
  line-height: 1.6;
}

.staff-flow .tt-store-ident {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--sf-muted);
}

.staff-flow .tt-store-ident-prefix {
  font-size: 12px;
  font-weight: 600;
}

.staff-flow .tt-store-ident-main {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--sf-ink);
}

.staff-flow .tt-store-ident-logo,
.staff-flow .tt-store-ident-fallback {
  border: 1px solid var(--sf-line);
  border-radius: 5px !important;
  background: var(--sf-surface-soft);
  box-shadow: none;
}

.staff-flow .tt-store-ident-fallback {
  display: inline-grid;
  place-items: center;
  color: var(--sf-blue);
  font-size: 11px;
  font-weight: 800;
}

.staff-flow .notice {
  padding: 14px 15px;
  border: 1px solid var(--sf-line) !important;
  border-left: 3px solid var(--sf-sky) !important;
  border-radius: 6px !important;
  background: var(--sf-surface-soft);
  box-shadow: none !important;
}

.staff-flow .notice > div:first-child {
  color: var(--sf-ink);
  font-size: 13px;
  font-weight: 750 !important;
}

.staff-flow [data-pwa-install-card] {
  border-color: #b9dceb !important;
  border-left-color: var(--sf-blue) !important;
  background: var(--sf-blue-soft) !important;
}

.staff-flow .error {
  padding: 12px 14px;
  border: 1px solid #f1b8b3 !important;
  border-left: 3px solid var(--sf-danger) !important;
  border-radius: 6px !important;
  background: var(--sf-danger-soft) !important;
  color: #7a271a;
  box-shadow: none !important;
  font-size: 13px;
  line-height: 1.55;
}

.staff-flow .form {
  gap: 15px;
}

.staff-flow .field {
  gap: 7px;
}

.staff-flow label {
  color: #274555;
  font-size: 12px;
  font-weight: 750;
}

.staff-flow input,
.staff-flow select,
.staff-flow textarea {
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid var(--sf-line-strong);
  border-radius: 6px !important;
  background: #fff;
  color: var(--sf-ink);
  box-shadow: 0 1px 2px rgba(16, 42, 58, 0.03);
  font-family: inherit;
  font-size: 15px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.staff-flow input::placeholder,
.staff-flow textarea::placeholder {
  color: #8a9aa4;
}

.staff-flow input:focus,
.staff-flow select:focus,
.staff-flow textarea:focus {
  border-color: var(--sf-blue);
  outline: none;
  box-shadow: 0 0 0 3px rgba(112, 191, 240, 0.23);
}

.staff-flow .actions {
  align-items: stretch;
  gap: 9px !important;
}

.staff-flow .btn,
.staff-flow button {
  min-height: 46px;
  padding: 11px 17px;
  border: 1px solid var(--sf-line-strong) !important;
  border-radius: 6px !important;
  background: #fff;
  color: var(--sf-ink) !important;
  -webkit-text-fill-color: var(--sf-ink) !important;
  box-shadow: none !important;
  font-family: inherit;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.25;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.staff-flow .btn:hover,
.staff-flow button:hover {
  border-color: #91b6c9 !important;
  background: #f2f8fb;
  box-shadow: 0 5px 12px rgba(16, 42, 58, 0.08) !important;
  transform: translateY(-1px);
  text-decoration: none;
}

.staff-flow .btn:active,
.staff-flow button:active {
  box-shadow: none !important;
  transform: translateY(0);
}

.staff-flow .btn.primary,
.staff-flow button.primary,
.staff-flow .employee-btn--primary {
  border-color: var(--sf-blue) !important;
  background: var(--sf-blue) !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
}

.staff-flow .btn.primary:hover,
.staff-flow button.primary:hover,
.staff-flow .employee-btn--primary:hover {
  border-color: var(--sf-blue-dark) !important;
  background: var(--sf-blue-dark) !important;
  box-shadow: 0 7px 16px rgba(23, 111, 157, 0.2) !important;
}

.staff-flow .btn[disabled],
.staff-flow button[disabled] {
  border-color: #cad5db !important;
  background: #e8eef1 !important;
  color: #71818a !important;
  -webkit-text-fill-color: #71818a !important;
  box-shadow: none !important;
  opacity: 1;
}

.staff-flow a:focus-visible,
.staff-flow button:focus-visible,
.staff-flow input:focus-visible,
.staff-flow select:focus-visible,
.staff-flow textarea:focus-visible {
  outline: 3px solid rgba(112, 191, 240, 0.45);
  outline-offset: 2px;
}

/* Scan */
.staff-flow--scan .notice[style*="#f8faf9"] {
  background: #f4f9fc !important;
}

.staff-flow--scan [data-pwa-install-card] {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 12px;
}

.staff-flow--scan [data-pwa-install-card] > div:first-child {
  grid-column: 1;
}

.staff-flow--scan [data-pwa-install-card] > .small:not([data-pwa-install-status]) {
  display: none;
}

.staff-flow--scan [data-pwa-install-card] > .actions {
  display: block !important;
  grid-column: 2;
  grid-row: 1 / span 2;
  width: auto;
  margin: 0 !important;
}

.staff-flow--scan [data-pwa-install-card] > .actions .btn {
  width: auto !important;
  min-height: 40px;
  padding: 9px 14px;
}

.staff-flow--scan [data-pwa-install-status] {
  grid-column: 1;
  margin-top: 1px !important;
  font-size: 11px;
  line-height: 1.45;
}

.staff-flow--scan form > .card {
  margin-top: 15px !important;
  padding: 13px 14px !important;
  border: 1px solid var(--sf-line) !important;
  border-radius: 6px !important;
  background: #f7fafc !important;
  box-shadow: none !important;
}

.staff-flow--scan form > .card .badge {
  padding: 0;
  border: 0;
  background: transparent !important;
  box-shadow: none;
  color: #274555;
  font-weight: 750;
  white-space: nowrap;
}

.staff-flow--scan form > .card .dot {
  width: 8px;
  height: 8px;
  border: 0;
  border-radius: 50%;
  background: var(--sf-success);
}

.staff-flow--scan #gpsStatus {
  color: #405a68;
  font-weight: 600;
}

.staff-flow--scan #gpsDebug:empty {
  display: none;
}

.staff-flow--scan form > .small {
  font-size: 11px;
  line-height: 1.55;
}

.staff-flow--scan form + div[style*="border-top"] {
  border-top: 1px solid var(--sf-line) !important;
}

/* Break, resume and checkout */
.staff-flow--choice .employee-actions {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px !important;
}

.staff-flow--choice .employee-btn {
  width: 100%;
  min-height: 54px;
  border-radius: 6px !important;
}

.staff-flow--choice .employee-btn--secondary {
  border-color: #b9cbd4 !important;
  background: #fff !important;
}

.staff-flow--choice form + div[style*="border-top"] {
  border-top: 1px solid var(--sf-line) !important;
}

/* Attendance result */
.staff-flow--result > .card {
  text-align: center;
}

.staff-flow--result .topbar {
  padding-bottom: 16px;
}

.staff-flow--result .topbar > div:first-child {
  display: block !important;
}

.staff-flow--result .topbar > div:first-child::before {
  display: none;
}

.staff-flow--result .emp-act-hero {
  gap: 9px;
  margin: 0 0 17px;
}

.staff-flow--result .emp-act-ring {
  width: 88px;
  height: 88px;
  border-width: 1px;
  box-shadow: 0 10px 28px rgba(16, 42, 58, 0.09);
}

.staff-flow--result .emp-act-ring::before {
  background: rgba(255, 255, 255, 0.86);
}

.staff-flow--result .emp-act-label {
  font-family: inherit;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

.staff-flow--result .notice {
  text-align: left;
}

.staff-flow--result .notice[style*="#eaf6f0"] {
  border-color: #b9dfc9 !important;
  border-left-color: var(--sf-success) !important;
  background: var(--sf-success-soft) !important;
}

.staff-flow--result .notice[style*="#fff1f1"] {
  border-color: #f1b8b3 !important;
  border-left-color: var(--sf-danger) !important;
  background: var(--sf-danger-soft) !important;
}

.staff-flow--result .actions:empty {
  display: none;
}

.staff-flow--result #attReturnNow {
  color: var(--sf-blue);
  font-weight: 750;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Face verification */
.staff-flow--face [data-face-gate] {
  padding: 4px 0 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.staff-flow--face .tt-face-video-shell {
  aspect-ratio: 4 / 3;
  min-height: 0 !important;
  max-height: 390px !important;
  border: 1px solid #a9c3d0 !important;
  border-radius: 8px !important;
  background: #0d1e27;
  box-shadow: 0 12px 28px rgba(16, 42, 58, 0.13);
}

.staff-flow--face .tt-face-video-overlay {
  right: 12px;
  bottom: 12px;
  left: 12px;
  padding: 9px 11px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px !important;
  background: rgba(10, 37, 52, 0.78);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  backdrop-filter: blur(8px);
}

.staff-flow--face #faceGateProgress {
  color: #274555;
  font-weight: 700;
}

.staff-flow--face #faceGateStatus {
  min-height: 21px;
  padding: 9px 11px;
  border-radius: 5px;
  background: #f4f8fa;
}

.staff-flow--face .tt-face-thumbs {
  gap: 7px;
}

.staff-flow--face .tt-face-thumb {
  border: 1px solid var(--sf-line-strong);
  border-radius: 5px;
  background: var(--sf-surface-soft);
  box-shadow: none;
}

/* Leave request */
.staff-flow--leave .emp-leave-hero {
  margin: 0 0 18px;
}

.staff-flow--leave .emp-leave-ring {
  width: 88px;
  height: 88px;
  border: 1px solid #9bccec;
  background: var(--sf-blue-soft);
  box-shadow: 0 10px 28px rgba(16, 42, 58, 0.09);
}

.staff-flow--leave .emp-leave-label {
  color: var(--sf-blue);
  font-family: inherit;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

.staff-flow--leave .badge {
  padding: 5px 8px;
  border: 1px solid var(--sf-line);
  border-radius: 5px;
  box-shadow: none;
  font-size: 11px;
  font-weight: 750;
}

.staff-flow--leave .badge .dot {
  width: 7px;
  height: 7px;
  border: 0;
  border-radius: 50%;
}

.staff-flow--leave > .card > div[style*="border-top"] {
  border-top: 1px solid var(--sf-line) !important;
}

/* Device verification */
.staff-flow--device .notice {
  border-color: #ecd49c !important;
  border-left-color: #d9a526 !important;
  background: var(--sf-warning-soft) !important;
}

.staff-flow--device > .card > .card {
  margin-top: 16px;
  padding: 16px !important;
  border: 1px solid #c8dce6 !important;
  border-left: 3px solid var(--sf-blue) !important;
  border-radius: 6px !important;
  background: #f4f9fc !important;
  box-shadow: none !important;
}

.staff-flow--device > .card > .card > div:first-child {
  color: var(--sf-ink);
  font-size: 13px;
  font-weight: 750 !important;
}

@media (min-width: 700px) {
  .staff-flow--leave form.form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .staff-flow--leave form.form > .field,
  .staff-flow--leave form.form > .actions {
    grid-column: 1 / -1;
  }

  .staff-flow--leave form.form > .field:has(input[type="date"]) {
    grid-column: auto;
  }
}

@media (max-width: 600px) {
  .staff-flow {
    min-height: 100dvh;
    padding: 18px 10px calc(28px + env(safe-area-inset-bottom)) !important;
  }

  .staff-flow > .card,
  .staff-flow > [data-normal-scan] > .card,
  .staff-flow > [data-ios-qr-gate] > .card {
    padding: 21px 17px !important;
    border-top-width: 3px !important;
    box-shadow: 0 10px 28px rgba(16, 42, 58, 0.09) !important;
  }

  .staff-flow .topbar {
    margin-bottom: 16px !important;
    padding-bottom: 15px;
  }

  .staff-flow h2 {
    font-size: 23px !important;
    line-height: 1.25;
  }

  .staff-flow .notice {
    padding: 12px 13px;
  }

  .staff-flow input,
  .staff-flow select,
  .staff-flow textarea {
    min-height: 50px;
    font-size: 16px;
  }

  .staff-flow .actions {
    display: grid !important;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .staff-flow .actions .btn,
  .staff-flow .actions button {
    width: 100% !important;
  }

  .staff-flow .actions .primary,
  .staff-flow .actions button.primary {
    order: -1;
  }

  .staff-flow--choice .employee-actions {
    grid-template-columns: 1fr !important;
  }

  .staff-flow--choice .employee-btn {
    min-height: 52px;
  }

  .staff-flow--result .emp-act-ring,
  .staff-flow--leave .emp-leave-ring {
    width: 80px;
    height: 80px;
  }

  .staff-flow--face .tt-face-video-shell {
    max-height: none !important;
  }

  .staff-flow--face form > .actions {
    margin-top: 15px !important;
  }

  .staff-flow--leave .badge {
    max-width: 112px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .staff-flow *,
  .staff-flow *::before,
  .staff-flow *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
