/* TimeSheet — gris claro + azul rey */
:root {
  --bg: #f1f4f8;
  --card: #ffffff;
  --line: #dde3ea;
  --line-strong: #d5dce4;
  --text: #111827;
  --text-2: #374151;
  --muted: #5b6675;
  --blue: #1d4ed8;
  --blue-dark: #1e40af;
  --blue-soft: rgba(29, 78, 216, 0.12);
  --blue-light: #bfdbfe;
  --green: #15803d;
  --green-soft: rgba(21, 128, 61, 0.12);
  --orange: #f59e0b;
  --orange-text: #b45309;
  --red: #b91c1c;
  --red-soft: #fef2f2;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; min-height: 100dvh; }
a { color: var(--blue); }
a:hover { color: var(--blue-dark); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.logo { font-weight: 800; letter-spacing: -0.5px; }
.logo b { color: var(--blue); font-weight: 800; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--line-strong); background: var(--card); font-weight: 600; text-decoration: none; color: var(--text); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--blue-dark); color: #fff; }
.btn-danger { color: var(--red); }
.btn-sm { min-height: 40px; padding: 0 14px; border-radius: 10px; font-size: 14px; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; padding: 8px; color: var(--muted); text-decoration: underline; font-size: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 15px; color: var(--text-2); }
.input { height: 52px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--card); padding: 0 14px; font-size: 18px; width: 100%; }
.input:focus, .btn:focus-visible { outline: 3px solid var(--blue-soft); outline-offset: 1px; border-color: var(--blue); }
.input-sm { height: 42px; font-size: 15px; border-radius: 10px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.avatar { border-radius: 50%; background: var(--line-strong); display: flex; align-items: center; justify-content: center; font-weight: 800; color: var(--text); overflow: hidden; flex-shrink: 0; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

.error { background: var(--red-soft); color: var(--red); border-radius: 12px; padding: 12px 14px; font-size: 15px; }
.notice { background: #fffbeb; color: #92400e; border-radius: 12px; padding: 10px 14px; font-size: 14px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 15px; z-index: 200; max-width: calc(100% - 32px); text-align: center; }

/* ---------- App del conductor ---------- */
.app { max-width: 480px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 18px; }
.topbar { display: flex; justify-content: space-between; align-items: center; }
.profile { display: flex; gap: 14px; align-items: center; padding: 14px; }
.big-start { width: min(250px, 70vw); aspect-ratio: 1; border-radius: 50%; border: 0; background: var(--blue); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; box-shadow: 0 0 0 12px var(--blue-soft); font-weight: 800; font-size: 27px; line-height: 1.1; }
.big-start:active { transform: scale(.97); }
.timer-card { padding: 18px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.timer { font-family: var(--mono); font-size: 46px; color: var(--blue); letter-spacing: -1px; }
.tl { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 12px; }
.tl-rail { display: flex; flex-direction: column; align-items: center; width: 14px; }
.tl-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--blue); margin-top: 5px; }
.tl-dot.pending { background: var(--orange); }
.tl-line { flex-grow: 1; width: 2px; background: var(--line-strong); }
.tl-body { display: flex; gap: 10px; flex-grow: 1; padding-bottom: 14px; min-width: 0; }
.tl-thumb { width: 46px; height: 46px; border-radius: 8px; background: var(--line-strong); object-fit: cover; flex-shrink: 0; }
.action-btn { min-height: 74px; border-radius: 16px; font-size: 20px; font-weight: 800; }
.choice { min-height: 98px; border-radius: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 12px; width: 100%; border: 2px solid var(--line-strong); background: var(--card); }
.choice.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.choice strong { font-size: 22px; }
.choice span { font-size: 14px; }
.check-circle { width: 72px; height: 72px; border-radius: 50%; background: var(--green-soft); color: var(--green); display: flex; align-items: center; justify-content: center; }
.row { display: flex; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid #eef1f5; font-size: 15px; gap: 12px; }
.row:last-child { border-bottom: 0; }

/* Cámara */
.cam { position: fixed; inset: 0; background: #000; z-index: 100; display: flex; flex-direction: column; }
.cam-head { background: var(--bg); padding: calc(12px + env(safe-area-inset-top)) 12px 10px; display: flex; align-items: center; justify-content: space-between; }
.cam-view { position: relative; flex-grow: 1; overflow: hidden; background: #111; }
.cam-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-view video.mirror { transform: scaleX(-1); }
.cam-stamp { position: absolute; left: 10px; right: 10px; bottom: 10px; background: rgba(0,0,0,.74); color: #fff; border-radius: 10px; padding: 10px 12px; font-family: var(--mono); font-size: 13px; line-height: 1.45; }
.cam-stamp .t { color: #93c5fd; font-size: 17px; }
.cam-thumb { position: absolute; top: 12px; right: 12px; width: 92px; height: 124px; border-radius: 10px; border: 3px solid #fff; object-fit: cover; background: #333; }
.cam-msg { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; color: #fff; background: rgba(17,24,39,.86); font-size: 17px; }
.cam-foot { background: var(--bg); padding: 16px 20px calc(18px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.shutter { width: 82px; height: 82px; border-radius: 50%; border: 5px solid var(--blue); background: transparent; display: flex; align-items: center; justify-content: center; padding: 0; }
.shutter span { width: 60px; height: 60px; border-radius: 50%; background: var(--blue); }
.shutter:disabled { opacity: .35; }
.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; transition: opacity .25s; }
.flash.on { opacity: .9; transition: none; }

/* ---------- Panel admin ---------- */
.wrap { max-width: 1240px; margin: 0 auto; padding: 24px 20px 64px; display: flex; flex-direction: column; gap: 28px; }
.admin-top { display: flex; flex-wrap: wrap; gap: 14px; justify-content: space-between; align-items: center; }
.tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
h2 { margin: 0; font-size: 20px; font-weight: 800; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.dcard { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.dcard-head { display: flex; gap: 12px; align-items: center; }
.thumb { width: 72px; height: 72px; border-radius: 8px; background: var(--line-strong); object-fit: cover; flex-shrink: 0; }
.bars { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.bar-row { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.bar-name { width: 140px; font-size: 14px; font-weight: 600; }
.bar { flex: 999 1 380px; min-width: 0; display: flex; height: 26px; border-radius: 6px; overflow: hidden; gap: 2px; background: #eef1f5; }
.bar span { min-width: 3px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; color: var(--text-2); }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; margin-right: 6px; vertical-align: -1px; }
.c-go { background: var(--blue-light); }
.c-drive { background: var(--blue); }
.c-job { background: var(--orange); }
.c-close { background: #9aa3ad; }
.table-box { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
table { width: 100%; min-width: 820px; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-weight: 500; padding: 11px 14px; background: #f8fafc; }
td { padding: 11px 14px; border-top: 1px solid var(--line); font-family: var(--mono); }
td:first-child { font-family: var(--sans); font-weight: 600; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat { padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.stat b { font-family: var(--mono); font-size: 26px; color: var(--blue); font-weight: 500; }
.point { padding: 16px; display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.point-photos { display: flex; gap: 8px; }
.ph { border-radius: 10px; background: var(--line-strong); object-fit: cover; border: 0; padding: 0; cursor: zoom-in; display: block; }
.ph-back { width: 200px; height: 150px; }
.ph-front { width: 112px; height: 150px; }
.ph-missing { display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--muted); text-align: center; padding: 8px; cursor: default; }
.point-info { flex: 999 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.gap-line { display: flex; align-items: center; gap: 10px; padding: 6px 0 6px 24px; font-size: 14px; color: var(--muted); }
.gap-line i { width: 2px; height: 24px; background: var(--line-strong); }
.pill { font-size: 13px; border-radius: 999px; padding: 3px 10px; background: var(--bg); border: 1px solid var(--line-strong); }
.viewer { position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 150; display: flex; align-items: center; justify-content: center; padding: 16px; }
.viewer img { max-width: 100%; max-height: 100%; border-radius: 8px; }
.viewer button { position: absolute; top: 14px; right: 14px; }
.users-list { display: flex; flex-direction: column; gap: 10px; }
.urow { padding: 14px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.urow-info { flex: 999 1 220px; min-width: 0; }
.tag { font-size: 12px; font-weight: 600; border-radius: 999px; padding: 3px 10px; background: var(--blue-soft); color: var(--blue); }
.tag.off { background: #eef1f5; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; align-items: end; }
.modal-bg { position: fixed; inset: 0; background: rgba(17,24,39,.45); z-index: 120; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { width: min(460px, 100%); max-height: 100%; overflow: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 560px) {
  .ph-back { width: 150px; height: 112px; }
  .ph-front { width: 84px; height: 112px; }
  .bar-name { width: 100%; }
}
.bars > .bar { flex: none; }
