:root {
  color-scheme: light;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f7fb;
  color: #10233c;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: linear-gradient(135deg, #ecfeff 0%, #f8fafc 100%);
  min-height: 100vh;
}

button, input, select { font: inherit; }

button { min-height: 44px; }

label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #475569;
}

input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid #14b8a6;
  outline-offset: 1px;
  border-color: #14b8a6;
}

.app-shell {
  max-width: 980px;
  margin: 0 auto;
  padding: 16px;
  padding-top: max(16px, env(safe-area-inset-top));
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
}

.header h1 {
  font-size: clamp(1.15rem, 4.5vw, 1.55rem);
  line-height: 1.25;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: #0f766e;
  font-weight: 700;
  margin: 0 0 4px;
}

h1, h2, h3, p { margin: 0; }

.card {
  background: white;
  border-radius: 20px;
  padding: 18px;
  box-shadow: 0 12px 45px rgba(15, 23, 42, 0.08);
  margin-bottom: 16px;
}

.role-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 16px;
}

.role-card, .primary-button, .secondary-button, .ghost-button {
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.role-card {
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #f8fafc;
  text-align: left;
  min-height: 96px;
}

.role-card span {
  font-size: 1.9rem;
  line-height: 1;
}

.role-card:hover, .primary-button:hover, .secondary-button:hover, .ghost-button:hover {
  transform: translateY(-1px);
}

.primary-button {
  background: #0f766e;
  color: white;
  padding: 12px 16px;
  font-weight: 600;
}

.secondary-button {
  background: #e2e8f0;
  color: #0f172a;
  padding: 10px 14px;
}

.ghost-button {
  background: transparent;
  color: #0f766e;
  padding: 10px 14px;
  border: 1px solid #99f6e4;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form-stack.compact { gap: 8px; }

input, select {
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #fff;
  min-height: 44px;
}

.upload-box {
  border: 1px dashed #14b8a6;
  border-radius: 12px;
  padding: 12px;
  color: #0f766e;
  background: #f0fdfa;
}

.upload-box input {
  display: block;
  margin-top: 8px;
  border: none;
  padding: 0;
}

.photo-preview {
  width: 100%;
  max-width: 360px;
  aspect-ratio: 3 / 4;
  border-radius: 20px;
  object-fit: cover;
}

.camera-box {
  border: 1px dashed #14b8a6;
  border-radius: 16px;
  padding: 14px;
  background: #f0fdfa;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.camera-box video {
  width: 100%;
  max-width: 360px;
  aspect-ratio: 3 / 4;
  border-radius: 20px;
  object-fit: cover;
  background: #0f172a;
  transform: scaleX(-1);
}

.camera-hint {
  color: #0f766e;
  font-size: 0.85rem;
  text-align: center;
}

.capture-shutter-button {
  width: 68px;
  height: 68px;
  min-height: 68px;
  border-radius: 999px;
  background: #0f766e;
  border: 4px solid #ccfbf1;
  box-shadow: 0 4px 14px rgba(15, 118, 110, 0.35);
  padding: 0;
  flex-shrink: 0;
}

.capture-shutter-button:hover {
  transform: translateY(-1px);
}

.camera-actions {
  justify-content: center;
  width: 100%;
  flex-wrap: nowrap;
}

.camera-actions > button {
  flex: 0 0 auto;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}

.tab-button {
  border: 1px solid #99f6e4;
  background: transparent;
  color: #0f766e;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  flex: 1;
  max-width: 220px;
}

.tab-button.active {
  background: #0f766e;
  color: white;
  border-color: #0f766e;
}

.table-scroll {
  overflow-x: auto;
  margin-top: 12px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  max-height: 60vh;
  overflow-y: auto;
}

.dashboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  min-width: 720px;
}

.dashboard-table th, .dashboard-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}

.dashboard-table thead th {
  color: #0f766e;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #f8fafc;
  position: sticky;
  top: 0;
  z-index: 1;
}

.dashboard-table tbody tr:hover {
  background: #f8fafc;
}

.badge-falta_injustificada { background: #fee2e2; color: #b91c1c; }
.badge-falta_justificada { background: #ffedd5; color: #9a3412; }
.badge-abono { background: #f3e8ff; color: #6b21a8; }
.badge-folga { background: #dbeafe; color: #1e40af; }
.badge-atraso { background: #fef3c7; color: #92400e; }
.badge-feriado { background: #e0e7ff; color: #3730a3; }

.occurrence-dialog {
  padding: 48px 20px 20px;
}

.occurrence-dialog h3 {
  margin-bottom: 12px;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.item {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 12px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.item img,
.photo-thumb img {
  width: 70px;
  height: 70px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}

.photo-thumb {
  border: 0;
  padding: 0;
  background: transparent;
  border-radius: 10px;
  cursor: zoom-in;
  line-height: 0;
  flex-shrink: 0;
}

.photo-thumb:focus-visible {
  outline: 3px solid #14b8a6;
  outline-offset: 3px;
}

.badge {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  background: #ccfbf1;
  color: #115e59;
  margin-top: 4px;
}

.location-link {
  display: inline-flex;
  margin-top: 6px;
  font-size: 0.8rem;
  color: #0f766e;
  text-decoration: none;
}

.location-link:hover { text-decoration: underline; }

.filters {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 12px 0;
}

.toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.toolbar-inline {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.toolbar-inline > input,
.toolbar-inline > select {
  flex: 1 1 160px;
}

.toolbar-inline > button {
  flex: 1 1 auto;
}

.item-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.item-actions button {
  font-size: 0.8rem;
  padding: 6px 10px;
}

.status-inactive {
  color: #b91c1c;
  background: #fee2e2;
}

.photo-dialog {
  width: min(92vw, 720px);
  border: 0;
  border-radius: 18px;
  padding: 48px 14px 14px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.22);
}

.photo-dialog::backdrop {
  background: rgba(15, 23, 42, 0.58);
}

.photo-dialog img {
  display: block;
  width: 100%;
  max-height: 78vh;
  border-radius: 12px;
  object-fit: contain;
  background: #0f172a;
}

.photo-dialog-close {
  position: absolute;
  top: 10px;
  right: 10px;
}

.hidden { display: none !important; }
.section-title { display:flex; justify-content:space-between; align-items:center; gap:10px; margin-bottom: 10px; }
.top-space { margin-top: 16px; }

@media (max-width: 700px) {
  .role-grid, .filters { grid-template-columns: 1fr; }
  .header, .section-title { flex-direction: column; align-items: flex-start; }
  .app-shell {
    padding: 10px;
    padding-top: max(10px, env(safe-area-inset-top));
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
  }
  .card { padding: 14px; border-radius: 16px; }
  .dashboard-table { font-size: 0.78rem; }
  .dashboard-table th, .dashboard-table td { padding: 8px; }
}

@media (max-width: 480px) {
  .toolbar-inline:not(.camera-actions) {
    flex-direction: column;
    align-items: stretch;
  }
  .toolbar-inline:not(.camera-actions) > input,
  .toolbar-inline:not(.camera-actions) > select,
  .toolbar-inline:not(.camera-actions) > button {
    flex: 1 1 auto;
    width: 100%;
  }
}
