/* ─── Google Fonts ───────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@600;700&family=Inter:wght@400;500;600&display=swap');

/* ---- Box sizing global ---- */
*, *::before, *::after {
  box-sizing: border-box;
}

:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --background-color: #f8f9fa;
    --card-background: #fff;
    --text-color: #212529;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);

    /* ─── Tipografía ─────────────────────────────── */
    --font-titulo:    'Poppins', sans-serif;
    --font-contenido: 'Inter', sans-serif;
}

body {
    font-family: var(--font-contenido);
    margin: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* ─── Títulos globales con Poppins ───────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-titulo);
}

/* ─── Inputs y selects heredan Inter ────────────────────────────────────── */
input, textarea, select {
    font-family: var(--font-contenido);
}

#app-container {
    padding: 20px;
}

.screen {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}


/*Estilos generales componentes*/
button {
    padding: 12px;
    margin-top: 10px;
    margin-bottom: 15px;
    border-radius: var(--border-radius);
    border: 1px solid #ccc;
    font-size: 16px;
    font-family: var(--font-contenido);
}

button:hover {
    background-color: var(--primary-color);
    color: white;
    font-weight: bold;
    cursor: pointer;
    border: none;
    transition: background-color 0.3s;
}

#menu-toggle{
    display: none;
}


/* Estilo para el formulario de login */
#login-screen {
    text-align: center;
    padding-top: 50px;
}

#login-form {
    display: flex;
    flex-direction: column;
    max-width: 300px;
    margin: 20px auto;
    padding: 20px;
    background-color: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

#login-form input,
#login-form button {
    padding: 12px;
    margin-bottom: 15px;
    border-radius: var(--border-radius);
    border: 1px solid #ccc;
    font-size: 16px;
}

#login-form button {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background-color 0.3s;
}

#login-form button:hover {
    background-color: #0056b3;
}


/*Estilos para pantalla de navegacion*/
#pantalla-registro{
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
}


/* Estilos para el dashboard y navegación */
#dashboard-screen header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}

#main-nav {
    display: flex;
    justify-content: space-around;
    background-color: var(--card-background);
    padding: 10px 0;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 20px;
}

#main-nav button {
    background: none;
    border: none;
    color: var(--secondary-color);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

#main-nav button:hover {
    background-color: #1306cd;
    color: #ddd;
}

#content {
    background-color: var(--card-background);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

#nav-tareas{
    display: none;
}


/*Estilos de la pantalla de proyectos*/
form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.form-group input {
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 6px;
}

.form-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 1rem;
}

.form-actions button {
  padding: 0.7rem 1rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.form-actions button[type="submit"] {
  background: #0ea5a4;
  color: white;
}

.form-actions button[type="button"] {
  background: #ddd;
}


/* Estilos para las tarjetas de proyectos */
.proyecto-item {
    background-color: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 15px;
    margin-bottom: 15px;
}


/* ═══════════════════════════════════════════════════════════════════
   DESIGN SYSTEM UNIFICADO — basado en el estilo de Libro de Obra
   Reemplaza los estilos dispersos de cada pantalla
═══════════════════════════════════════════════════════════════════ */

/* Todas las pantallas activas heredan el fondo neutro del LO */
.screen.active {
  background: var(--lo-bg);
  min-height: 100vh;
  gap: 16px;
  padding: 16px;
}

/* Cabecera unificada para todas las pantallas */
.screen-header {
  border-bottom: 2px solid var(--lo-border);
  padding-bottom: 12px;
  margin-bottom: 4px;
}
.screen-header-top {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.screen-header-top h2 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--lo-text);
  letter-spacing: -0.4px;
}
.screen-badge {
  font-size: 0.85rem;
  background: var(--lo-accent-light);
  color: var(--lo-accent);
  padding: 3px 10px;
  border-radius: 20px;
}

/* Botón volver unificado */
.btnVolver {
  background: transparent;
  color: var(--lo-muted);
  border: 1px solid var(--lo-border);
  font-size: 0.85rem;
  padding: 6px 14px;
  border-radius: var(--lo-radius);
  cursor: pointer;
  margin: 0;
}
.btnVolver:hover {
  background: var(--lo-border);
  color: var(--lo-text);
  font-weight: normal;
}

/* ─── DASHBOARD ────────────────────────────────────────────────────── */

.dash-hero {
  background: var(--lo-firma);
  border-radius: 12px;
  padding: 28px 24px 22px;
  color: #fff;
}
.dash-titulo {
  font-size: 1.55rem;
  margin: 0 0 10px;
  color: #fff;
  line-height: 1.25;
}
.dash-subtitulo {
  font-size: 0.92rem;
  opacity: 0.88;
  margin: 0 0 18px;
  line-height: 1.55;
}
.dash-trust-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.dash-badge {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 20px;
  font-size: 0.78rem;
  padding: 4px 12px;
  color: #fff;
}

.dash-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.dash-stat-card {
  flex: 1;
  min-width: 100px;
  background: var(--lo-surface);
  border: 1px solid var(--lo-border);
  border-radius: var(--lo-radius);
  padding: 16px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--lo-shadow);
}
.dash-stat-icon { font-size: 1.6rem; }
.dash-stat-num {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--lo-firma);
  margin: 0;
  font-family: var(--font-titulo);
}
.dash-stat-label {
  font-size: 0.75rem;
  color: var(--lo-muted);
  margin: 0;
}

.dash-cta-wrapper {
  text-align: center;
}
.dash-cta-btn {
  width: 100%;
  background: var(--lo-accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 16px 24px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.3px;
  box-shadow: 0 4px 14px rgba(44,95,46,0.3);
  transition: background 0.2s, transform 0.1s;
  margin: 0;
}
.dash-cta-btn:hover {
  background: #235225;
  color: #fff;
  transform: translateY(-1px);
}
.dash-cta-hint {
  font-size: 0.78rem;
  color: var(--lo-muted);
  margin: 8px 0 0;
  font-style: italic;
}

.dash-pilares {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.dash-pilar {
  background: var(--lo-surface);
  border: 1px solid var(--lo-border);
  border-left: 4px solid var(--lo-accent);
  border-radius: var(--lo-radius);
  padding: 16px;
  box-shadow: var(--lo-shadow);
}
.dash-pilar-icono { font-size: 1.4rem; }
.dash-pilar h4 {
  margin: 4px 0 6px;
  font-size: 0.95rem;
  color: var(--lo-text);
}
.dash-pilar p {
  font-size: 0.85rem;
  color: var(--lo-muted);
  margin: 0;
  line-height: 1.5;
}

/* ─── PROYECTOS ACTIVOS ────────────────────────────────────────────── */

.proyecto-item {
  background: var(--lo-surface);
  border: 1px solid var(--lo-border);
  border-radius: var(--lo-radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--lo-shadow);
  cursor: pointer;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.proyecto-item:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  border-color: var(--lo-accent);
}
.proyecto-item h3 {
  margin: 0 0 6px;
  font-size: 1rem;
  color: var(--lo-firma);
}
.proyecto-item p {
  margin: 2px 0;
  font-size: 0.85rem;
  color: var(--lo-muted);
}

/* ─── DETALLE DEL PROYECTO ─────────────────────────────────────────── */

.etapa {
  display: flex;
  flex-direction: row;
  align-items: center;
  margin-bottom: 12px;
}
.recuadro1 {
  background: var(--lo-surface);
  border: 1.5px solid var(--lo-border);
  border-left: 4px solid var(--lo-firma);
  border-radius: var(--lo-radius);
  padding: 12px 14px;
  margin-bottom: 0;
  width: 50vw;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: var(--lo-shadow);
}
.recuadro1:hover {
  background: var(--lo-firma-bg);
  border-left-color: var(--lo-accent);
  box-shadow: 0 4px 14px rgba(0,0,0,0.1);
}
.recuadro1 h4 {
  margin: 0;
  font-size: 0.9rem;
  color: var(--lo-firma);
}
.recuadro1 p { margin: 0; color: var(--lo-muted); font-size: 0.85rem; }

.recuadro2 {
  background: var(--lo-accent-light);
  border: 1px solid var(--lo-accent);
  border-radius: 6px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
}
.recuadro2 p {
  margin: 0;
  font-weight: 700;
  color: var(--lo-accent);
  font-size: 0.9rem;
}

.btn-etapas {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-left: 8px;
}
.btn-afectaciones,
.btnMateriales {
  background: var(--lo-surface);
  border: 1px solid var(--lo-border);
  color: var(--lo-firma);
  font-size: 0.8rem;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  height: auto;
  margin: 0;
  transition: background 0.2s;
}
.btn-afectaciones:hover,
.btnMateriales:hover {
  background: var(--lo-firma-bg);
  border-color: var(--lo-firma);
  color: var(--lo-firma);
  font-weight: 600;
}

/* ─── DETALLE ETAPA — SLIDERS ──────────────────────────────────────── */

.fila-actividad {
  background: var(--lo-surface);
  border: 1px solid var(--lo-border);
  border-radius: var(--lo-radius);
  padding: 10px 12px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  box-shadow: var(--lo-shadow);
}
.label-actividad {
  font-size: 0.85rem;
  color: var(--lo-text);
  font-weight: 500;
  min-width: 200px;
  flex: 1;
  margin: 0;
}
.fila-dentro {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.slider-actividad {
  width: 160px;
  accent-color: var(--lo-accent);
}
.input-porcentaje {
  width: 56px;
  text-align: center;
  border: 1px solid var(--lo-border);
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 0.85rem;
  color: var(--lo-firma);
  font-weight: 600;
}
.btn-envio-foto {
  background: transparent;
  border: 1px solid var(--lo-border);
  color: var(--lo-muted);
  font-size: 0.78rem;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  margin: 0;
  transition: all 0.2s;
}
.btn-envio-foto:not(:disabled):hover {
  background: var(--lo-accent-light);
  border-color: var(--lo-accent);
  color: var(--lo-accent);
}
.btn-envio-foto:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ─── AFECTACIONES ─────────────────────────────────────────────────── */

#tiposDeAfectaciones {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.afectacion-btn {
  background: var(--lo-surface);
  border: 1.5px solid var(--lo-border);
  color: var(--lo-text);
  border-radius: var(--lo-radius);
  padding: 10px;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  margin: 0;
}
.afectacion-btn:hover {
  background: var(--lo-firma-bg);
  border-color: var(--lo-firma);
  color: var(--lo-firma);
  font-weight: 600;
}
.afectacion-btn-seleccionado {
  background: var(--lo-firma) !important;
  border-color: var(--lo-firma) !important;
  color: #fff !important;
}
#afectacion {
  background: var(--lo-surface);
  border: 1px solid var(--lo-border);
  border-radius: var(--lo-radius);
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  box-shadow: var(--lo-shadow);
}

/* ─── SOLICITUD DE MATERIALES ──────────────────────────────────────── */

#contenedor-interno-materiales {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#lista-materiales {
  background: var(--lo-surface);
  border: 1px solid var(--lo-border);
  border-radius: var(--lo-radius);
  padding: 12px;
}
#nombre-material-solicitado {
  background: var(--lo-surface);
  border: 1px solid var(--lo-border);
  border-radius: var(--lo-radius);
  padding: 12px;
}
#detalles-solicitud-material {
  background: var(--lo-surface);
  border: 1px solid var(--lo-border);
  border-radius: var(--lo-radius);
  padding: 16px;
}
#btnNuevomaterial {
  background: transparent;
  border: 1.5px dashed var(--lo-accent);
  color: var(--lo-accent);
  border-radius: var(--lo-radius);
  font-size: 0.88rem;
  padding: 8px;
  cursor: pointer;
  width: 100%;
  margin: 0;
}
#btnNuevomaterial:hover {
  background: var(--lo-accent-light);
  color: var(--lo-accent);
  font-weight: 600;
}
#contenedor-nivel-prioridad {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

/* ─── TAREAS ───────────────────────────────────────────────────────── */

.tareaAsignada {
  background: var(--lo-surface);
  border: 1px solid var(--lo-border);
  border-radius: var(--lo-radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: var(--lo-shadow);
}
.tarea-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.tarea-header h4 { margin: 0; font-size: 0.95rem; color: var(--lo-text); }
.tarea-estado {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
}
.tarea-estado--pendiente { background: #fff3cd; color: #856404; }
.tarea-estado--completada { background: var(--lo-accent-light); color: var(--lo-accent); }
.tarea-acciones {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

/* ─── NUEVO PROYECTO (formulario) ──────────────────────────────────── */

#nuevo-proyecto-screen {
  padding: 16px;
  background: var(--lo-bg);
}
#nuevo-proyecto-screen h2 {
  font-size: 1.4rem;
  color: var(--lo-firma);
  border-bottom: 2px solid var(--lo-border);
  padding-bottom: 10px;
  margin-bottom: 16px;
}
.form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 14px;
}
.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--lo-muted);
  margin-bottom: 4px;
}
.form-group input,
.form-group textarea,
.form-group select {
  padding: 10px 12px;
  border: 1px solid var(--lo-border);
  border-radius: var(--lo-radius);
  font-size: 0.92rem;
  background: var(--lo-surface);
  color: var(--lo-text);
  transition: border-color 0.2s;
}
.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--lo-firma);
}
.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.form-actions button[type="submit"] {
  background: var(--lo-accent);
  color: #fff;
  border: none;
  padding: 12px 20px;
  border-radius: var(--lo-radius);
  font-weight: 600;
  cursor: pointer;
  flex: 1;
  margin: 0;
}
.form-actions button[type="button"] {
  background: transparent;
  color: var(--lo-danger);
  border: 1px solid var(--lo-danger);
  padding: 11px 20px;
  border-radius: var(--lo-radius);
  cursor: pointer;
  margin: 0;
}

/* ─── EQUIPO ───────────────────────────────────────────────────────── */

.equipo-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.equipo-card {
  background: var(--lo-surface);
  border: 1px solid var(--lo-border);
  border-radius: var(--lo-radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--lo-shadow);
}
.equipo-card-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.equipo-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  font-size: 0.85rem;
}
.equipo-email, .equipo-tel { color: var(--lo-muted); font-size: 0.78rem; }
.equipo-card-acciones {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}
.select-rol-worker {
  font-size: 0.78rem;
  padding: 4px 8px;
  border: 1px solid var(--lo-border);
  border-radius: 6px;
  background: var(--lo-surface);
}
.btn-eliminar-worker {
  background: transparent;
  border: 1px solid var(--lo-danger);
  color: var(--lo-danger);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  margin: 0;
}

/* ─── CAMPO BÚSQUEDA GLOBAL ────────────────────────────────────────── */

.campo-busqueda {
  width: 100%;
  height: auto;
  padding: 8px 12px;
  border: 1px solid var(--lo-border);
  border-radius: var(--lo-radius);
  font-size: 0.9rem;
  background: var(--lo-surface);
}
.campo-busqueda:focus {
  outline: none;
  border-color: var(--lo-firma);
}

/* ─── CÁMARA getUserMedia — Modal overlay ──────────────────────────── */

.camara-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.camara-video {
  width: 100%;
  max-height: 65vh;
  object-fit: cover;
  border-radius: 0;
}
.camara-controles {
  display: flex;
  gap: 16px;
}
.camara-btn-capturar {
  background: #fff;
  color: #111;
  border: none;
  padding: 14px 28px;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin: 0;
}
.camara-btn-cancelar {
  background: transparent;
  color: rgba(255,255,255,0.7);
  border: 1px solid rgba(255,255,255,0.4);
  padding: 13px 20px;
  border-radius: 50px;
  font-size: 0.9rem;
  cursor: pointer;
  margin: 0;
}

/* ─── RESPONSIVE MÓVIL ─────────────────────────────────────────────── */


/*LIBRO DE OBRA*/

/* ---- Variables de color ---- */
:root {
  --lo-bg: #f8f7f4;
  --lo-surface: #ffffff;
  --lo-border: #d9d4c8;
  --lo-accent: #2c5f2e;
  --lo-accent-light: #e8f5e9;
  --lo-firma: #1a3a5c;
  --lo-firma-bg: #e8f0f8;
  --lo-activada: #2c5f2e;
  --lo-firmada: #1a3a5c;
  --lo-text: #1c1c1c;
  --lo-muted: #6b6b6b;
  --lo-danger: #c0392b;
  --lo-radius: 8px;
  --lo-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* ---- Pantalla ---- */
/* Georgia reemplazado por Inter; h2 usa Poppins vía regla global */
#libro-obra-screen {
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  background: var(--lo-bg);
  min-height: 100vh;
}

/* ---- Cabecera ---- */
.lo-header {
  border-bottom: 2px solid var(--lo-border);
  padding-bottom: 12px;
}
.lo-header-top {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.lo-header-top h2 {
  margin: 0;
  font-size: 1.6rem;
  color: var(--lo-text);
  letter-spacing: -0.5px;
  /* Poppins heredado del h2 global */
}
.lo-proyecto-badge {
  font-size: 0.85rem;
  background: var(--lo-accent-light);
  color: var(--lo-accent);
  padding: 3px 10px;
  border-radius: 20px;
  font-style: normal;
}

/* ---- Toolbar ---- */
.lo-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: space-between;
}
.lo-filtros {
  display: flex;
  gap: 8px;
  flex: 1;
  min-width: 240px;
}
.lo-filtro-tipo select {
  padding: 7px 10px;
  border: 1px solid var(--lo-border);
  border-radius: var(--lo-radius);
  font-size: 0.85rem;
  background: var(--lo-surface);
}
.lo-filtros .campo-busqueda {
  flex: 1;
  padding: 7px 12px;
  border: 1px solid var(--lo-border);
  border-radius: var(--lo-radius);
  font-size: 0.9rem;
}
.lo-acciones {
  display: flex;
  gap: 8px;
}
.btn-primario {
  background: var(--lo-accent);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: var(--lo-radius);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
}
.btn-secundario {
  background: transparent;
  color: var(--lo-accent);
  border: 1.5px solid var(--lo-accent);
  padding: 7px 14px;
  border-radius: var(--lo-radius);
  cursor: pointer;
  font-size: 0.85rem;
}
.btn-cancelar {
  background: transparent;
  color: var(--lo-danger);
  border: 1px solid var(--lo-danger);
  padding: 7px 14px;
  border-radius: var(--lo-radius);
  cursor: pointer;
  font-size: 0.85rem;
}
.btn-firmar {
  background: var(--lo-firma);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: var(--lo-radius);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
}
.btn-firmar:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ---- Formulario nueva nota ---- */
.lo-form-nota {
  background: var(--lo-surface);
  border: 1.5px solid var(--lo-border);
  border-radius: var(--lo-radius);
  padding: 16px;
  box-shadow: var(--lo-shadow);
  animation: loSlideDown 0.2s ease;
}
@keyframes loSlideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.lo-form-row {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.lo-form-meta {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding: 8px 12px;
  background: #f4f2ee;
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--lo-muted);
}
.lo-meta-item strong { color: var(--lo-text); }
.lo-form-row label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--lo-muted);
}
.lo-form-row textarea {
  padding: 10px;
  border: 1px solid var(--lo-border);
  border-radius: 6px;
  font-size: 0.95rem;
  resize: vertical;
  color: var(--lo-text);
  line-height: 1.5;
  /* font-family heredado de la regla global textarea */
}
.lo-char-counter {
  font-size: 0.78rem;
  color: var(--lo-muted);
  text-align: right;
}
.lo-form-acciones {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.lo-aviso-firma {
  font-size: 0.78rem;
  color: var(--lo-danger);
  margin: 8px 0 0;
  font-style: italic;
}

/* ---- Badges de estado ---- */
.lo-badge-estado {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.lo-badge-estado.activada {
  background: var(--lo-accent-light);
  color: var(--lo-activada);
}
.lo-badge-estado.firmada {
  background: var(--lo-firma-bg);
  color: var(--lo-firma);
}

/* ---- Timeline ---- */
.lo-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  padding-left: 36px;
}
.lo-timeline::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--lo-border);
}

/* ---- Nota individual ---- */
.lo-nota {
  position: relative;
  background: var(--lo-surface);
  border: 1px solid var(--lo-border);
  border-radius: var(--lo-radius);
  padding: 14px 16px;
  margin-bottom: 16px;
  box-shadow: var(--lo-shadow);
  transition: box-shadow 0.2s;
}
.lo-nota:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.lo-nota::before {
  content: '';
  position: absolute;
  left: -28px;
  top: 20px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--lo-border);
  border: 2px solid var(--lo-surface);
  box-shadow: 0 0 0 2px var(--lo-border);
}
.lo-nota.firmada::before {
  background: var(--lo-firma);
  box-shadow: 0 0 0 2px var(--lo-firma-bg);
}
.lo-nota.activada::before {
  background: var(--lo-accent);
  box-shadow: 0 0 0 2px var(--lo-accent-light);
}

/* Cabecera de nota */
.lo-nota-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.lo-nota-numero {
  font-size: 0.8rem;
  font-weight: 700;
  font-family: monospace; /* intencional: referencia a código/ID */
  background: #f0ede6;
  padding: 2px 8px;
  border-radius: 4px;
  color: var(--lo-muted);
  letter-spacing: 1px;
}
.lo-nota-fecha {
  font-size: 0.82rem;
  color: var(--lo-muted);
  margin-left: auto;
}
.lo-nota-autor {
  font-size: 0.82rem;
  color: var(--lo-muted);
  font-style: italic;
}

/* Contenido */
.lo-nota-contenido {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--lo-text);
  white-space: pre-wrap;
  margin: 8px 0;
}

/* Firma digital */
.lo-nota-firma {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--lo-border);
  font-size: 0.78rem;
  color: var(--lo-firma);
}
.lo-nota-firma-icon {
  font-size: 1.1rem;
}
.lo-nota-firma-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.lo-nota-firma-hash {
  font-family: monospace; /* intencional: hash criptográfico */
  font-size: 0.72rem;
  color: #999;
  word-break: break-all;
}

/* Acciones de nota */
.lo-nota-acciones {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.lo-nota-acciones .btn-firmar {
  font-size: 0.82rem;
  padding: 5px 12px;
}

/* ---- Empty state ---- */
.lo-empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--lo-muted);
  font-style: italic;
}

/*FIN DE LIBRO DE OBRA*/


/* ─── Toast de avisos ───────────────────────────────────────────────────────── */
.bilo-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  padding: 12px 20px;
  border-radius: var(--border-radius);
  font-size: 14px;
  box-shadow: var(--box-shadow);
  z-index: 99999;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  max-width: 90vw;
  text-align: center;
  pointer-events: none;
}

.bilo-toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.bilo-toast--info    { background: #323232; color: #fff; }
.bilo-toast--warning { background: #f0a500; color: #fff; }
.bilo-toast--error   { background: var(--lo-danger, #c0392b); color: #fff; }
.bilo-toast--success { background: var(--lo-accent, #2c5f2e); color: #fff; }


/* ─── RESPONSIVE MÓVIL ─────────────────────────────────────────────── */
/* ---- Responsive 600px ---- */
@media (max-width: 600px) {
  .lo-toolbar { flex-direction: column; align-items: stretch; }
  .lo-acciones { justify-content: flex-end; }
  .lo-form-meta { flex-direction: column; }
  .dash-stats { flex-direction: column; }
  .dash-pilar { border-left-width: 3px; }
}

/* ---- Responsive móvil ---- */
@media (max-width: 480px) {

  body {
    margin-bottom: 50px;
  }

  #app-container {
    padding: 10px;
  }

  .screen.active {
    padding: 12px;
    gap: 12px;
  }

  .screen {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .btnVolverInferior {
    position: fixed;
    right: 35px;
    bottom: 2px;
  }

  #menu-toggle {
    display: block;
    width: 50px;
    position: fixed;
    right: 10px;
    bottom: 15px;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    z-index: 10000;
  }

  #menu-toggle img {
    width: 100%;
    padding: 0;
  }

  #main-nav {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 30px;
    right: 5px;
    z-index: 9999;
    transform: translateX(110%);
    transition: transform 0.3s ease;
  }

  #main-nav.active {
    transform: translateX(0);
  }

  #logout-btn {
    position: fixed;
    bottom: 3px;
    left: 10px;
    padding: 0;
    width: 50px;
    height: 50px;
    align-items: center;
    align-content: center;
  }

  /* ── Dashboard ── */
  .dash-hero { padding: 20px 16px; }
  .dash-titulo { font-size: 1.3rem; }
  .dash-stat-card { padding: 12px; }
  .dash-pilares { gap: 10px; }

  /* ── Etapas ── */
  .etapa {
    flex-direction: column;
    margin-bottom: 10px;
  }
  .btn-etapas {
    flex-direction: row;
    margin-top: 6px;
    gap: 6px;
    width: 100%;
  }
  .btn-afectaciones,
  .btnMateriales {
    flex: 1;
    margin: 0;
    text-align: center;
    font-size: 0.75rem;
    padding: 8px 4px;
  }
  .recuadro1 {
    width: 100%;
    max-width: 100%;
    margin-bottom: 0;
  }

  /* ── Actividades ── */
  .fila-actividad { flex-wrap: wrap; }
  .label-actividad { width: 100%; }
  .fila-dentro { width: 100%; }
  .slider-actividad { flex: 1; }

  /* ── Afectaciones ── */
  #tiposDeAfectaciones { grid-template-columns: 1fr 1fr; }
  .afectacion-btn { font-size: 0.8rem; padding: 8px 4px; }
  #afectacion { grid-template-columns: 1fr; }

  /* ── Materiales ── */
  .campo-busqueda { width: 100%; max-width: 100%; }
  #btnNuevomaterial { width: 100%; }

  /* ── Detalle etapa ── */
  #detalleEtapaNombre { font-size: 0.95rem; }
  .botones-actividad { margin-bottom: 5px; }

  /* ── Proyectos ── */
  #btn-eliminar-proyecto {
    position: relative;
    right: 2px;
    bottom: 1px;
  }
}