:root {
  --teal: #69A596;
  --dark-teal: #4B8787;
  --navy: #003C4B;
  --bg: #f4f7f6;
  --white: #ffffff;
  --gray: #6b7280;
  --light-gray: #e5e7eb;
  --red: #dc2626;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--navy);
  min-height: 100vh;
}

/* ── Layout ─────────────────────────────────────── */

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
}

.card {
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 60, 75, 0.10);
  padding: 2rem 2rem;
  width: 100%;
  max-width: 480px;
}

.card-wide {
  max-width: 700px;
}

/* ── Header ─────────────────────────────────────── */

.header {
  background: var(--navy);
  color: var(--white);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header img {
  height: 36px;
}

.header h1 {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
}

.header .subtitle {
  font-size: 0.75rem;
  opacity: 0.75;
}

/* ── Logo centrado en cards ─────────────────────── */

.logo-wrap {
  text-align: center;
  margin-bottom: 1.5rem;
}

.logo-wrap img {
  height: 52px;
  object-fit: contain;
}

.logo-placeholder {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--navy);
  color: var(--white);
  padding: 0.5rem 1.2rem;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

/* ── Typography ─────────────────────────────────── */

h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 0.25rem;
}

h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--dark-teal);
  margin: 1.5rem 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--teal);
}

p.subtitle {
  color: var(--gray);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

/* ── Info bloque ─────────────────────────────────── */

.bloque-info {
  font-size: 0.8rem;
  color: var(--gray);
  background: rgba(105,165,150,0.08);
  border-left: 3px solid var(--teal);
  border-radius: 0 6px 6px 0;
  padding: 0.5rem 0.75rem;
  margin: -0.25rem 0 0.75rem;
  line-height: 1.5;
}

/* ── Forms ──────────────────────────────────────── */

.form-group {
  margin-bottom: 1.1rem;
}

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
  color: var(--navy);
}

input[type="text"],
input[type="time"],
input[type="date"],
input[type="week"],
select,
textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid var(--light-gray);
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: var(--font);
  color: var(--navy);
  background: var(--white);
  transition: border-color 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(105, 165, 150, 0.15);
}

input[readonly], input[disabled] {
  background: var(--bg);
  color: var(--gray);
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23003C4B' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  padding-right: 2.2rem;
}

textarea {
  resize: vertical;
  min-height: 80px;
}

.char-counter {
  font-size: 0.75rem;
  color: var(--gray);
  text-align: right;
  margin-top: 0.25rem;
}

.field-readonly {
  padding: 0.65rem 0.85rem;
  background: var(--bg);
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--gray);
  border: 1.5px solid var(--light-gray);
}

/* ── Botones ─────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--teal);
  color: var(--white);
  width: 100%;
}

.btn-primary:hover { background: var(--dark-teal); }

.btn-navy {
  background: var(--navy);
  color: var(--white);
}

.btn-navy:hover { background: #002535; }

.btn-outline {
  background: transparent;
  color: var(--navy);
  border: 2px solid var(--light-gray);
}

.btn-outline:hover { border-color: var(--teal); color: var(--teal); }

.btn-ghost {
  background: transparent;
  color: var(--gray);
  font-size: 0.8rem;
  padding: 0.4rem 0.75rem;
}

/* ── Error ───────────────────────────────────────── */

.error-msg {
  background: #fee2e2;
  color: var(--red);
  padding: 0.7rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  margin-bottom: 1rem;
  border: 1px solid #fca5a5;
}

/* ── Dias tabla ──────────────────────────────────── */

.dias-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin-bottom: 0.5rem;
}

.dias-table th {
  background: var(--navy);
  color: var(--white);
  padding: 0.5rem 0.4rem;
  text-align: left;
  font-weight: 600;
}

.dias-table td {
  padding: 0.4rem 0.4rem;
  border-bottom: 1px solid var(--light-gray);
  vertical-align: middle;
}

.dias-table tr:last-child td { border-bottom: none; }

.dias-table tr.worked-row { background: rgba(105,165,150,0.07); }

.time-inputs {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.time-inputs input[type="time"] {
  width: 90px;
  padding: 0.3rem 0.4rem;
  font-size: 0.8rem;
}

.horas-dia {
  font-weight: 600;
  color: var(--dark-teal);
  min-width: 40px;
  font-size: 0.8rem;
}

.total-row td {
  background: var(--bg);
  font-weight: 700;
  color: var(--navy);
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
  font-size: 0.9rem;
}

/* ── Checkbox ────────────────────────────────────── */

.check-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--teal);
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Bloques condicionales ───────────────────────── */

.conditional {
  display: none;
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: var(--bg);
  border-radius: 8px;
  border-left: 3px solid var(--teal);
}

.conditional.active { display: block; }

/* ── Firma ───────────────────────────────────────── */

.firma-wrap {
  border: 2px solid var(--light-gray);
  border-radius: 10px;
  overflow: hidden;
  background: var(--white);
  touch-action: none;
}

#firma-canvas {
  display: block;
  width: 100%;
  height: 160px;
  cursor: crosshair;
}

.firma-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/* ── Opciones choice ─────────────────────────────── */

.choice-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.choice-group label {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.4rem 0.8rem;
  border: 1.5px solid var(--light-gray);
  border-radius: 20px;
  transition: all 0.15s;
}

.choice-group input[type="radio"] {
  width: 14px;
  height: 14px;
  accent-color: var(--teal);
}

.choice-group label:has(input:checked) {
  border-color: var(--teal);
  background: rgba(105,165,150,0.12);
  color: var(--dark-teal);
}

/* ── Jornada cards (dashboard) ───────────────────── */

.jornada-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1.5px solid var(--light-gray);
  margin-bottom: 0.5rem;
  background: var(--white);
}

.jornada-activa {
  border-color: var(--teal);
  background: rgba(105,165,150,0.06);
}

.jornada-completada {
  border-color: var(--light-gray);
  background: var(--bg);
  opacity: 0.85;
}

.jornada-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.jornada-cliente {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jornada-hora {
  font-size: 0.8rem;
  color: var(--gray);
}

.badge-completada {
  font-size: 0.78rem;
  font-weight: 700;
  color: #16a34a;
  background: #dcfce7;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Elección cards ──────────────────────────────── */

.choice-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1.5rem 0;
}

.choice-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.5rem 1rem;
  border-radius: 12px;
  border: 2px solid var(--light-gray);
  text-decoration: none;
  color: var(--navy);
  font-weight: 600;
  font-size: 0.9rem;
  text-align: center;
  transition: all 0.15s;
  cursor: pointer;
}

.choice-card:hover {
  border-color: var(--teal);
  background: rgba(105,165,150,0.08);
}

.choice-card .icon {
  font-size: 2rem;
}

/* ── Confirmación ────────────────────────────────── */

.confirm-icon {
  font-size: 3rem;
  text-align: center;
  margin-bottom: 0.5rem;
}

.action-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1.5rem;
}

.status-msg {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  text-align: center;
  display: none;
}

.status-msg.success {
  background: #dcfce7;
  color: #16a34a;
  border: 1px solid #86efac;
  display: block;
}

.status-msg.error {
  background: #fee2e2;
  color: var(--red);
  border: 1px solid #fca5a5;
  display: block;
}

/* ── Formulario contenedor ───────────────────────── */

.form-page {
  padding-bottom: 2rem;
}

.form-container {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 1rem 2rem;
}

.submit-bar {
  position: sticky;
  bottom: 0;
  background: var(--white);
  border-top: 1px solid var(--light-gray);
  padding: 1rem;
  display: flex;
  justify-content: center;
}

.submit-bar .btn {
  max-width: 400px;
  width: 100%;
}

/* ── Semana badge ────────────────────────────────── */

.semana-badge {
  display: inline-block;
  background: rgba(105,165,150,0.15);
  color: var(--dark-teal);
  border-radius: 20px;
  padding: 0.25rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

/* ── Spinner ─────────────────────────────────────── */

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ──────────────────────────────────── */

@media (max-width: 480px) {
  .card { padding: 1.5rem 1.25rem; }
  .choice-cards { grid-template-columns: 1fr; }
  .action-buttons { grid-template-columns: 1fr; }

  /* Tabla días → tarjetas apiladas */
  .dias-table thead { display: none; }
  .dias-table, .dias-table tbody, .dias-table tr, .dias-table td {
    display: block;
    width: 100%;
  }
  .dias-table tr {
    border: 1.5px solid var(--light-gray);
    border-radius: 10px;
    margin-bottom: 0.5rem;
    padding: 0.6rem 0.75rem;
    background: var(--white);
  }
  .dias-table tr.total-row {
    background: var(--bg);
    border-color: var(--teal);
  }
  .dias-table td {
    border: none;
    padding: 0.2rem 0;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }
  .dias-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--gray);
    font-size: 0.75rem;
    min-width: 80px;
  }
  .time-inputs {
    flex-wrap: nowrap;
  }
  .time-inputs input[type="time"] {
    width: calc(50% - 12px);
    min-width: 0;
  }
  .horas-dia { font-size: 0.875rem; }

  /* Header más compacto */
  .header { padding: 0.75rem 1rem; }
  .header h1 { font-size: 0.9rem; }

  /* Canvas firma más alto en móvil */
  #firma-canvas { height: 200px; }

  /* Formulario con menos padding lateral */
  .form-container { padding: 0 0.75rem 2rem; }

  /* choice-group full width en móvil */
  .choice-group { gap: 0.4rem; }
  .choice-group label { font-size: 0.8rem; padding: 0.35rem 0.65rem; }
}
