/* Camera + GPS attendance wizard ---------------------------------------- */
.attendance-layout.has-attendance-capture {
  display: block !important;
  width: 100%;
  max-width: 100%;
}

.attendance-layout.has-attendance-capture > :not(.attendance-capture) {
  display: none !important;
}

.attendance-capture [hidden],
.capture-location-gate[hidden] { display: none !important; }

.app-shell.capture-location-locked .content { display: none !important; }

.attendance-capture,
.capture-location-gate {
  --capture-ink: #102e4a;
  --capture-muted: #60788c;
  --capture-blue: #0b83bf;
  --capture-blue-dark: #075b88;
  --capture-sky: #39b8e2;
  --capture-line: #d8e7ef;
  --capture-green: #098b68;
  --capture-red: #b33d4c;
  display: grid;
  gap: 16px;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 22px;
  border: 1px solid #cfe2ec;
  border-radius: 22px;
  background: linear-gradient(145deg, #ffffff 0%, #f5fbfe 100%);
  box-shadow: 0 18px 42px rgba(10, 64, 95, .1);
  box-sizing: border-box;
}

.capture-location-gate {
  width: calc(100% - 32px);
  margin: 24px auto;
  color: var(--capture-ink);
}
.capture-location-gate h2 { margin: 0; color: var(--capture-ink); font-size: clamp(20px, 3vw, 26px); line-height: 1.3; }
.capture-location-gate > p:not(.capture-message) { margin: 0; color: #49677c; font-size: 14px; line-height: 1.6; }

.attendance-capture *,
.attendance-capture *::before,
.attendance-capture *::after,
.capture-location-gate * { box-sizing: border-box; }

.capture-header { min-width: 0; }
.capture-kicker {
  color: var(--capture-blue);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .12em;
  line-height: 1.3;
}
.capture-header h2 {
  margin: 5px 0 0;
  color: var(--capture-ink);
  font-size: clamp(21px, 2.2vw, 28px);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -.5px;
}
.capture-header p {
  max-width: 650px;
  margin: 7px 0 0;
  color: var(--capture-muted);
  font-size: 13px;
  line-height: 1.55;
}

.capture-status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.capture-status-card {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--capture-line);
  border-radius: 14px;
  background: #fff;
  transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
.capture-status-card.is-loading { background: #f7fbfd; }
.capture-status-card.is-ready { border-color: #bfe6d8; background: #f2fcf8; }
.capture-status-card.is-warning { border-color: #efd49f; background: #fffaf1; }
.capture-status-card.is-error { border-color: #efc5cc; background: #fff6f7; }
.capture-status-icon {
  display: grid;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 11px;
  background: linear-gradient(145deg, #e0f5fb, #c6e9f4);
  color: var(--capture-blue-dark);
  font-size: 21px;
  font-weight: 800;
}
.capture-status-card.is-ready .capture-status-icon { background: #d6f3e8; color: var(--capture-green); }
.capture-status-card.is-warning .capture-status-icon { background: #fff0ce; color: #a46a0c; }
.capture-status-card.is-error .capture-status-icon { background: #ffe1e5; color: var(--capture-red); }
.capture-status-copy { display: grid; min-width: 0; gap: 2px; }
.capture-status-copy b {
  overflow: hidden;
  color: var(--capture-ink);
  font-size: 12px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.capture-status-copy small {
  overflow-wrap: anywhere;
  color: var(--capture-muted);
  font-size: 10px;
  line-height: 1.35;
}

.capture-view {
  position: relative;
  min-height: 300px;
  overflow: hidden;
  border: 1px solid #b9d4e2;
  border-radius: 18px;
  background: linear-gradient(145deg, #0b2e49, #124c6d);
  box-shadow: inset 0 0 0 1px #ffffff12;
}
.attendance-capture .capture-view video,
.attendance-capture .capture-view > img {
  display: block;
  width: 100%;
  height: clamp(300px, 43vw, 450px);
  object-fit: cover;
  object-position: center;
}
.attendance-capture .capture-view video { transform: scaleX(-1); }
.attendance-capture .capture-view > img { transform: none; } /* JPEG is already mirrored. */
.capture-placeholder {
  display: grid;
  min-height: 300px;
  place-items: center;
  align-content: center;
  gap: 7px;
  padding: 28px;
  color: #d4eef8;
  text-align: center;
}
.capture-placeholder-icon {
  display: grid;
  width: 58px;
  height: 58px;
  margin-bottom: 4px;
  place-items: center;
  border: 1px solid #ffffff45;
  border-radius: 50%;
  background: #ffffff14;
  color: #8ddcf2;
  font-size: 29px;
}
.capture-placeholder b { color: #fff; font-size: 16px; }
.capture-placeholder small { color: #b3d7e4; font-size: 11px; line-height: 1.45; }

.capture-message {
  margin: 0;
  padding: 11px 13px;
  border: 1px solid #cde5ef;
  border-radius: 11px;
  color: var(--capture-blue-dark);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}
.capture-message.info { background: #eef9fd; }
.capture-message.warning { border-color: #ecd39c; background: #fff9ed; color: #8a5a11; }
.capture-message.error { border-color: #edc7cc; background: #fff5f6; color: var(--capture-red); }
.capture-message.success { border-color: #bde4d5; background: #effbf6; color: var(--capture-green); }

.capture-times {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.capture-times span {
  display: grid;
  gap: 3px;
  padding: 11px 13px;
  border: 1px solid var(--capture-line);
  border-radius: 12px;
  background: #fff;
}
.capture-times small {
  color: var(--capture-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.capture-times b { color: var(--capture-ink); font-size: 18px; line-height: 1.1; }

.capture-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.capture-button {
  min-width: 0;
  min-height: 46px;
  padding: 10px 15px;
  border: 0;
  border-radius: 11px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}
.capture-button:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.03); }
.capture-button:focus-visible { outline: 3px solid #47bfe7; outline-offset: 2px; }
.capture-button:disabled { cursor: not-allowed; opacity: .52; }
.attendance-capture .capture-button.primary,
.capture-location-gate .capture-button.primary,
.attendance-capture .capture-button.submit {
  grid-column: 1 / -1;
  background: linear-gradient(115deg, var(--capture-blue-dark), var(--capture-blue), var(--capture-sky));
  color: #fff;
  box-shadow: 0 8px 18px rgba(8, 126, 174, .22);
}
.attendance-capture .capture-button.submit {
  background: linear-gradient(115deg, #0674ac, #079bc8);
  box-shadow: 0 8px 18px rgba(8, 126, 174, .27);
}
.attendance-capture .capture-button.secondary {
  background: #edf7fa;
  color: var(--capture-blue-dark);
  border: 1px solid #c7e3ed;
}
.capture-privacy { color: #49677c; font-size: 11px; line-height: 1.6; overflow-wrap: anywhere; }

@media (max-width: 760px) {
  .attendance-capture {
    gap: 13px;
    padding: 16px;
    border-radius: 17px;
  }
  .capture-header h2 { font-size: 22px; }
  .capture-header p { font-size: 12px; }
  .capture-status-grid { grid-template-columns: 1fr; gap: 8px; }
  .capture-status-card { padding: 10px; }
  .capture-status-copy b { font-size: 12px; }
  .capture-status-copy small { font-size: 10px; }
  .capture-view,
  .capture-placeholder { min-height: 270px; }
  .attendance-capture .capture-view video,
  .attendance-capture .capture-view > img { height: min(76vw, 370px); min-height: 270px; }
  .capture-message { font-size: 11px; }
  .capture-times b { font-size: 17px; }
  .capture-button { min-height: 45px; font-size: 12px; }
}

@media (max-width: 380px) {
  .attendance-capture { padding: 13px; }
  .capture-times { grid-template-columns: 1fr; }
  .capture-view,
  .capture-placeholder { min-height: 245px; }
  .attendance-capture .capture-view video,
  .attendance-capture .capture-view > img { height: 70vw; min-height: 245px; }
}

@media (prefers-reduced-motion: reduce) {
  .attendance-capture * { transition: none !important; }
}
