:root {
  --fg: #000;
  --bg: #fff;
  --muted: #777;
  --line: #eaeaea;
  --success: #008000;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  color: var(--fg);
  background: var(--bg);
  font-family: "Geist", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px; /* iOS: prevent zoom on inputs */
  line-height: 1.55;
  letter-spacing: -0.01em;
}

body,
h1,
h2,
h3,
h4,
h5,
h6,
p,
ol,
ul {
  margin: 0;
  padding: 0;
  font-weight: normal;
}

.role-employee #mobile-only-notice {
  display: flex;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  color: #000;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  z-index: 9999999;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 32px;
  text-wrap: balance;
  font-weight: 600;
  line-height: 1.7;
}

@media (min-width: 960px) {
  .important {
    color: #c92a2a;
    font-weight: 600;
    line-height: 1.7;
    font-size: 24px;
    font-weight: 600;
    margin: 24px 0;
  }
}

@media (max-width: 960px) {
  .role-employee #mobile-only-notice {
    display: none;
  }
}

.role-manager #mobile-only-notice {
  display: none;
}

.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 16px;
}

.role-manager .wrap {
  max-width: 1280px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.brand {
  font-weight: 700;
}
.site-nav a {
  color: var(--fg);
  text-decoration: none;
  margin-right: 14px;
}
.site-nav a:last-child {
  margin-right: 0;
}

h1 {
  font-size: 22px;
  margin: 10px 0 16px;
}
h2 {
  font-size: 18px;
  margin: 20px 0 8px;
}

form {
  display: grid;
  gap: 12px;
  max-width: 560px;
}
label {
  display: block;
  margin: 6px 0 4px;
  color: var(--fg);
}
input,
button,
select,
textarea {
  padding: 12px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: #000;
  font-size: 16px; /* iOS: prevent zoom on focus */
}
input[type="radio"],
input[type="checkbox"] {
  width: auto;
  padding: 0;
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
  line-height: 1.4;
}

button {
  cursor: pointer;
  background: #000;
  color: #fff;
  border-color: #000;
  transition: transform 0.02s ease-in-out, opacity 0.2s;
}
button:hover {
  opacity: 0.9;
}
button:active {
  transform: translateY(1px);
}
button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.error {
  background: #000;
  color: #fff;
  padding: 10px;
  border-radius: 8px;
  margin: 10px 0;
}

.table-grid {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed; /* equal column widths */
}
.table-grid th,
.table-grid td {
  padding: 10px 8px;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.table-grid thead th {
  background: #f5f5f5;
  border-bottom: 1px solid var(--line); /* clean separation to body */
}
.table-grid tbody td {
  border-top: 1px solid var(--line);
}
/* Striped rows for readability */
.table-grid tbody tr:nth-child(odd) {
  background: #fff;
}
.table-grid tbody tr:nth-child(even) {
  background: #fafafa;
}

.hide {
  display: none;
}
.muted {
  color: var(--muted);
}

#snap {
  max-width: 100%;
  box-shadow: 0 0 10px 0 rgba(107, 255, 9, 0.5);
  border-radius: 12px;
}

.selfie-checkmark {
  position: absolute;
  bottom: 20%;
  left: 50%;
  transform: translate(-50%, 0);
  z-index: 10;
  pointer-events: none;
  vertical-align: middle;
  color: white;
}
.selfie-checkmark svg {
  width: 64px;
  height: 64px;
}

/* Cámara: apilar video y botón debajo */
#camera {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.video-container {
  position: relative;
  width: fit-content;
}

#cam {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--muted);
}

#btnSnap {
  width: 230px;
  flex-shrink: 0;
}

.link {
  display: block;
}
.selfie {
  object-fit: cover;
  width: 150px;
  height: 150px;
  border-radius: 8px;
}

.brand-logo {
  height: 40px;
}

@media (max-width: 560px) {
  .brand-logo {
    height: 24px;
  }
}

/* Segmented control for Entrar/Salir */
.segmented {
  display: inline-flex;
  align-items: center;
  gap: 18px;
}
.segmented .seg {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: #000;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.segmented .seg input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}
.segmented .seg.selected {
  background: #000;
  color: #fff;
  border-color: #000;
}
.segmented .seg:not(.selected):hover {
  background: #f7f7f7;
}
.segmented .seg.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.manager-view-selfie {
  width: 100%;
  height: auto;
  margin-top: 6px;
  border-radius: 3px;
  max-height: 150px;
  object-fit: cover;
}

/* Toast */
.toast {
  background: var(--success);
  color: #fff;
  font-weight: 600;
  padding: 12px 14px;
  border-radius: 10px;
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.15);
  opacity: 1;
  transition: opacity 0.3s ease;
  z-index: 9999;
}
.toast.hide {
  opacity: 0;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.4;
  border: 1px solid transparent;
}
.badge-cat-inasistencia {
  background: #fff5f5;
  color: #c92a2a;
  border-color: #ffc9c9;
}
.badge-cat-tarde {
  background: #fff9db;
  color: #e67700;
  border-color: #ffe8a1;
}
.badge-cat-retiro {
  background: #e7f5ff;
  color: #0b7285;
  border-color: #a5d8ff;
}

/* Onboarding overlay */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 1;
  transition: opacity 0.25s ease;
}
.overlay.hide {
  display: none;
}
.overlay.closing {
  opacity: 0;
}
.overlay .modal {
  background: #fff;
  color: #000;
  border-radius: 14px;
  padding: 20px;
  max-width: 520px;
  margin: 0 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}
.overlay h2 {
  margin: 0 0 10px;
  font-size: 18px;
}
.overlay p {
  margin: 6px 0;
}
.overlay .actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  align-items: center;
}

.btn-absence {
  flex-shrink: 1;
  margin-left: auto;
}

/* Buttons hierarchy */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 600;
  border-radius: 12px;
  padding: 12px 14px;
  line-height: 1;
}
.btn-primary {
  background: #000;
  color: #fff;
  border: 1px solid #000;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
}
.btn-primary:hover {
  opacity: 0.9;
}
.btn-secondary {
  background: #fff;
  color: #000;
  border: 1px solid var(--muted);
}
.btn-secondary:hover {
  background: #f7f7f7;
}
.btn-ghost {
  background: transparent;
  color: #000;
  border: 1px solid transparent;
}
.btn-ghost:hover {
  text-decoration: underline;
}
.btn-link {
  background: transparent;
  color: #000;
  text-decoration: none;
  border-bottom: 1px solid var(--muted);
  padding: 6px 0;
  font-size: 16px;
  line-height: 1;
}
.btn-block {
  width: 100%;
}
.btn-lg {
  padding: 14px 18px;
  font-size: 18px;
}

/* Divider */
.divider {
  border-top: 1px solid var(--line);
  margin: 40px 0;
}

@media (max-width: 560px) {
  #cam,
  #snap {
    width: 230px;
    height: 230px;
    max-height: 230px;
    object-fit: cover;
  }

  .video-container {
    width: 230px;
  }
}
