/* Extensiones móviles del diseño MB para la app de Mantenimiento. */

.role-tag { text-transform: capitalize; color: var(--accent); font-weight: 600; }
.logo-link { display: block; line-height: 0; }

/* ---------- Navegación ---------- */
.main-nav {
  display: flex; gap: 4px; padding: 8px 20px;
  background: var(--panel); border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.main-nav a {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: 5px;
  color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 600;
  white-space: nowrap;
}
.main-nav a:hover { color: var(--accent); background: var(--accent-soft); }
.main-nav a.active { background: var(--accent); color: #fff; }
.nav-ico { font-size: 15px; line-height: 1; }
.nav-spacer { display: none; }

@media (max-width: 720px) {
  .app-header { padding: 12px 16px; gap: 12px; }
  .app-logo { height: 26px; }
  .app-header h1 { font-size: 17px; }
  .subtitle { font-size: 10px; }
  .updated { font-size: 11px; }
  main { padding: 16px; }
  .cards { gap: 10px; }
  .card { min-width: calc(50% - 5px); flex: 1; padding: 12px 14px; }
  .card .value { font-size: 24px; }
  /* Barra inferior fija estilo app */
  .main-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    border-top: 1px solid var(--border); border-bottom: none;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    justify-content: space-around; gap: 0;
  }
  .main-nav a { flex-direction: column; gap: 2px; padding: 6px 10px; font-size: 10px; }
  .nav-ico { font-size: 19px; }
  .nav-spacer { display: block; height: 76px; }
}

/* ---------- Lista de tareas (tarjetas) ---------- */
.task-list { display: flex; flex-direction: column; gap: 10px; }
.task-item {
  display: block; background: var(--panel); border: 1px solid var(--border);
  border-radius: 6px; padding: 14px 16px; text-decoration: none; color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.task-item:hover { border-color: var(--accent); box-shadow: 0 1px 6px rgba(154,123,74,.15); }
.task-item.done { opacity: .72; }
.task-item .t-top { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 6px; }
.task-item .t-id { color: var(--muted); font-size: 12px; font-weight: 700; }
.task-item .t-title { font-family: var(--serif); font-size: 16px; margin: 2px 0 6px; }
.task-item .t-meta { color: var(--muted); font-size: 12px; display: flex; gap: 14px; flex-wrap: wrap; }
.t-thumb { float: right; width: 58px; height: 58px; object-fit: cover; border-radius: 5px; margin-left: 10px; border: 1px solid var(--border); }

/* ---------- Formularios ---------- */
form.mb-form { background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 20px; max-width: 640px; }
.mb-form label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin: 16px 0 5px; }
.mb-form label:first-child { margin-top: 0; }
.mb-form input[type=text], .mb-form input[type=email], .mb-form input[type=password],
.mb-form input[type=number], .mb-form input[type=date], .mb-form textarea, .mb-form select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 5px;
  font-size: 15px; font-family: inherit; background: #fff; color: var(--text);
}
.mb-form textarea { min-height: 90px; resize: vertical; }
.mb-form input:focus, .mb-form textarea:focus, .mb-form select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(154,123,74,.18);
}
.mb-form .row2 { display: flex; gap: 12px; }
.mb-form .row2 > div { flex: 1; }
.mb-form .chkline { display: flex; align-items: center; gap: 9px; margin: 14px 0 0; font-size: 14px; cursor: pointer; }
.mb-form .chkline input { width: 18px; height: 18px; accent-color: var(--accent); }
.mb-form button.action { margin-top: 20px; width: 100%; padding: 12px; font-size: 15px; }
.mb-form .hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
.subbox { border: 1px dashed var(--border); border-radius: 6px; padding: 4px 14px 14px; margin-top: 14px; background: var(--bg); }

/* Campo de foto */
.photo-input { position: relative; }
.photo-input input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.photo-input .photo-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  border: 2px dashed var(--accent); background: var(--accent-soft); color: var(--accent);
  border-radius: 6px; padding: 18px; font-weight: 600; font-size: 14px;
}
.photo-previews { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.photo-previews img, .photo-previews video { width: 74px; height: 74px; object-fit: cover; border-radius: 5px; border: 1px solid var(--border); display: block; background: #000; }
.pv-cell { position: relative; }

/* X para borrar una foto (previsualización y fotos ya subidas) */
.photo-del {
  position: absolute; top: -7px; right: -7px; z-index: 5;
  width: 24px; height: 24px; border: 2px solid #fff; border-radius: 50%;
  background: var(--danger); color: #fff; font-size: 15px; font-weight: 700;
  line-height: 1; cursor: pointer; padding: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.photo-del:hover { background: #6e232c; }
.photo-cell { position: relative; }
.photo-cell .photo-del { top: 5px; right: 5px; }

/* ---------- Detalle de tarea ---------- */
.detail-card { background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 20px; margin-bottom: 16px; }
.detail-card h2 { font-family: var(--serif); font-weight: 500; margin: 6px 0 12px; font-size: 22px; }
.detail-grid { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; }
.detail-grid dt { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; padding-top: 2px; }
.detail-grid dd { margin: 0; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-top: 10px; }
.photo-grid a img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); display: block; }
.photo-grid video { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); display: block; background: #000; }
.section-title { font-family: var(--serif); font-size: 17px; font-weight: 500; margin: 22px 0 10px; }

/* ---------- Login ---------- */
.login-wrap { max-width: 380px; margin: 8vh auto 0; padding: 0 16px; }
.login-wrap .logo-big { display: block; margin: 0 auto 22px; height: 44px; }
.login-card { background: var(--panel); border: 1px solid var(--border); border-top: 3px solid var(--accent); border-radius: 6px; padding: 26px; }
.login-card h1 { font-family: var(--serif); font-weight: 500; font-size: 22px; margin: 0 0 2px; text-align: center; }
.login-card .subtitle { text-align: center; margin-bottom: 18px; }

.notice.error { background: var(--danger-soft); border-color: #ddbfc2; color: var(--danger); }
a.plain { color: var(--accent); }

/* ---------- Idioma ---------- */
.lang-switch { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; }
.lang-switch a { color: var(--muted); text-decoration: none; font-weight: 700; }
.lang-switch a.on { color: var(--accent); border-bottom: 2px solid var(--accent); }
.lang-switch span { color: var(--border); }

/* ---------- Tareas urgentes ---------- */
.task-item.urgent { background: #fdf6d8; border-color: #e3c95d; }
.task-item.urgent:hover { border-color: #c9a832; }
.badge.urg { background: #f5e6a8; color: #7a5d00; }
.badge.proc { background: #fdebd3; color: var(--warn); }
.badge.cat-inst { background: #e7e2f0; color: #5b4a7a; }
.badge.cat-maq { background: #dde9ef; color: #33606f; }

/* ---------- Overlay "Enviando aviso" ---------- */
.sending-overlay {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(246, 243, 238, .88); align-items: center; justify-content: center;
}
.sending-overlay.show { display: flex; }
.sending-box {
  background: var(--panel); border: 1px solid var(--border); border-top: 3px solid var(--accent);
  border-radius: 8px; padding: 28px 36px; text-align: center;
  font-family: var(--serif); font-size: 17px; box-shadow: 0 8px 30px rgba(0,0,0,.12);
}
.spinner {
  width: 42px; height: 42px; margin: 0 auto 14px;
  border: 4px solid var(--accent-soft); border-top-color: var(--accent);
  border-radius: 50%; animation: mb-spin .9s linear infinite;
}
@keyframes mb-spin { to { transform: rotate(360deg); } }

/* ---------- Selector segmentado (Instalaciones / Maquinaria) ---------- */
.seg { display: flex; gap: 0; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.seg label { flex: 1; margin: 0 !important; cursor: pointer; }
.seg input { position: absolute; opacity: 0; }
.seg span {
  display: block; text-align: center; padding: 11px 8px; font-size: 14px; font-weight: 600;
  color: var(--muted); background: var(--panel); text-transform: none; letter-spacing: 0;
}
.seg label + label span { border-left: 1px solid var(--border); }
.seg input:checked + span { background: var(--accent); color: #fff; }

/* ---------- Página pública de avisos ---------- */
.public-ok { text-align: center; padding: 40px 20px; }
.public-ok .big { font-size: 52px; }
.public-ok h2 { font-family: var(--serif); font-weight: 500; }
.public-ok .num { font-family: var(--serif); font-size: 28px; color: var(--accent); }

/* ---------- Admin ---------- */
/* En móvil las tablas anchas se desplazan horizontalmente (mb-styles usa overflow:hidden) */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tabbar { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.assign-grid td, .assign-grid th { padding: 8px 10px; font-size: 13px; }
.assign-grid .chk-cell { text-align: center; }
.assign-grid input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--accent); }
/* ---------- Visor de fotos (lightbox) ---------- */
.lightbox {
  display: none; position: fixed; inset: 0; z-index: 300;
  background: rgba(15, 13, 11, .94);
  align-items: center; justify-content: center;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.lightbox.show { display: flex; }
.lightbox { touch-action: none; overflow: hidden; }
.lightbox img {
  max-width: 100vw; max-height: 92vh; object-fit: contain;
  transform-origin: center center;
}
.lightbox-close {
  position: fixed; top: calc(14px + env(safe-area-inset-top)); right: 14px; z-index: 301;
  width: 46px; height: 46px; border: none; border-radius: 50%;
  background: rgba(255, 255, 255, .18); color: #fff;
  font-size: 24px; line-height: 1; cursor: pointer;
}
.lightbox-hint {
  position: fixed; bottom: calc(16px + env(safe-area-inset-bottom)); left: 0; right: 0;
  text-align: center; color: rgba(255,255,255,.55); font-size: 12px; pointer-events: none;
}

/* ---------- Comentarios ---------- */
.comment { border-top: 1px solid var(--border); padding: 10px 0; }
.comment:first-of-type { border-top: none; padding-top: 0; }
.comment .c-head { display: flex; gap: 10px; align-items: baseline; font-size: 13px; margin-bottom: 3px; }
.comment .c-head span { color: var(--muted); font-size: 12px; }
.comment .c-body { font-size: 14px; }

.optbox {
  background: var(--accent-soft); border: 1px solid #e0d3b6; border-radius: 6px;
  padding: 4px 14px 14px; margin-top: 18px;
}
