@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
  --bg: #f0f8fc;
  --bg-2: #ffffff;
  --sidebar-bg: #ffffff;
  --card: #ffffff;
  --card-hover: #f9feff;
  --border: #d7e8f0;
  --border-hover: #9dd0e8;
  --text: #0f2040;
  --text-2: #4a6380;
  --text-3: #8aa4bc;
  --accent: #f97316;
  --accent-2: #fb923c;
  --accent-dark: #ea580c;
  --accent-gradient: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  --teal: #18c8bd;
  --teal-light: rgba(24,200,189,0.12);
  --azul: #16386f;
  --azul-profundo: #102a55;
  --success: #0fa868;
  --success-bg: rgba(15,168,104,0.1);
  --danger: #c0392b;
  --danger-bg: rgba(192,57,43,0.08);
  --warning: #c99000;
  --warning-bg: rgba(240,200,66,0.12);
  --shadow: 0 20px 48px rgba(16,42,85,0.10);
  --shadow-sm: 0 4px 18px rgba(16,42,85,0.07);
  --shadow-xs: 0 2px 8px rgba(16,42,85,0.05);
  --radius: 14px;
  --radius-sm: 9px;
  --radius-xs: 6px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, -apple-system, sans-serif;
  color: var(--text);
  background: linear-gradient(160deg, #e8f6fc 0%, #f0f8fd 40%, #fafcff 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

/* ── APP SHELL ──────────────────────────────────────────── */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 220px 1fr;
}

/* ── SIDEBAR ────────────────────────────────────────────── */
.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  box-shadow: 2px 0 16px rgba(16,42,85,0.04);
  display: flex;
  flex-direction: column;
}

.brand-logo {
  display: block;
  width: 110px;
  height: auto;
  margin: 0 0 24px 2px;
}

.nav {
  display: grid;
  gap: 4px;
}

.nav-item {
  border: 0;
  border-left: 3px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text-2);
  background: transparent;
  text-align: left;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s ease;
}

.nav-item:hover {
  color: var(--azul);
  background: rgba(24,200,189,0.08);
  border-left-color: var(--border-hover);
}

.nav-item.active {
  color: var(--azul-profundo);
  background: rgba(249,115,22,0.08);
  border-left-color: var(--accent);
  font-weight: 700;
}

/* ── MAIN ───────────────────────────────────────────────── */
.main { padding: 30px 36px 48px; }

/* ── TOPBAR ─────────────────────────────────────────────── */
.topbar,
.list-header,
.module-head,
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar { margin-bottom: 28px; }

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

h1, h2 { margin: 0; color: var(--azul-profundo); }
h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.5px; }
h2 { font-size: 18px; font-weight: 700; }

/* ── SCREENS ────────────────────────────────────────────── */
.screen { display: none; }
.screen.active { display: block; }

/* ── PANEL ──────────────────────────────────────────────── */
.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.panel:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow);
}

.form-panel { margin-bottom: 18px; }
.section-title { margin-bottom: 16px; }

/* ── FORMS ──────────────────────────────────────────────── */
.form-grid,
.modal-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 16px;
}

.full-field,
.full { grid-column: 1 / -1; }

label,
.multi-field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

input, select, textarea, .multi-trigger {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  color: var(--text);
  background: var(--bg-2);
  transition: border-color 0.2s, box-shadow 0.2s;
  font-size: 14px;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(249,115,22,0.1);
}

textarea { resize: vertical; }

/* ── BUTTONS ────────────────────────────────────────────── */
.primary-button {
  border: 0;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  color: #fff;
  font-weight: 700;
  font-size: 13.5px;
  background: var(--accent-gradient);
  box-shadow: 0 4px 14px rgba(249,115,22,0.3);
  transition: opacity 0.15s, transform 0.1s, box-shadow 0.2s;
}
.primary-button:hover {
  opacity: 0.92;
  box-shadow: 0 6px 20px rgba(249,115,22,0.4);
  transform: translateY(-1px);
}
.primary-button:active { transform: scale(0.98); opacity: 1; box-shadow: none; }

.icon-button,
.row-button,
.chip {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 11px;
  color: var(--text-2);
  background: var(--card);
  font-size: 12.5px;
  font-weight: 500;
  transition: all 0.15s;
  box-shadow: var(--shadow-xs);
}

.icon-button:hover,
.row-button:hover {
  border-color: var(--border-hover);
  color: var(--azul);
  background: var(--teal-light);
}

.row-button.delete { color: var(--danger); border-color: rgba(192,57,43,0.2); }
.row-button.delete:hover { background: var(--danger-bg); border-color: var(--danger); }

.chip.active { color: #fff; background: var(--azul); border-color: var(--azul); }
.chip:hover:not(.active) { border-color: var(--teal); color: var(--azul); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── METRICS ────────────────────────────────────────────── */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.metric {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
  border-top: 3px solid var(--teal);
  position: relative;
  overflow: hidden;
}

.metric:hover { transform: translateY(-3px); box-shadow: var(--shadow); }

.metric span {
  display: block;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 10px;
}

.metric strong { color: var(--azul-profundo); font-size: 26px; font-weight: 800; }
.metric.accent { border-top-color: var(--accent); }
.metric.accent strong { color: var(--accent-dark); }

/* ── MULTI-SELECT ───────────────────────────────────────── */
.multi-field { position: relative; }
.multi-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  cursor: pointer;
}
.multi-trigger span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.multi-menu {
  display: none;
  position: absolute;
  z-index: 8;
  top: 72px;
  left: 0; right: 0;
  max-height: 240px;
  overflow: auto;
  border: 1.5px solid var(--border-hover);
  border-radius: var(--radius-sm);
  padding: 10px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.multi-menu.open { display: grid; gap: 6px; }
.multi-menu label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--text);
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
}
.multi-menu input { width: 16px; height: 16px; accent-color: var(--accent); }

/* ── TABLE ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}
th, td {
  border-bottom: 1px solid var(--border);
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
}
th {
  color: var(--text-3);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  background: rgba(24,200,189,0.07);
}
td { color: var(--text); font-size: 13.5px; }
tr:hover td { background: rgba(249,115,22,0.03); }

td[contenteditable="true"] {
  border-radius: 4px;
  outline: 1px solid transparent;
}
td[contenteditable="true"]:focus {
  background: rgba(24,200,189,0.08);
  outline-color: var(--teal);
}

.time-pair {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.time-pair label { flex: 1; margin-bottom: 0; }

.actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── BADGES ─────────────────────────────────────────────── */
.badge-ok {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--success-bg);
  color: var(--success);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid rgba(15,168,104,0.2);
}

.badge-en-curso {
  display: inline-block;
  padding: 3px 8px;
  background: var(--warning-bg);
  color: var(--warning);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(240,200,66,0.3);
}

.row-aprobada td { background: rgba(15,168,104,0.04); }
.row-en-curso td { background: rgba(240,200,66,0.04); }

/* ── APPROVE / FINALIZE ─────────────────────────────────── */
.btn-aprobar {
  background: linear-gradient(135deg, var(--teal), #0d9e94);
  color: #fff;
  border-color: transparent;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(24,200,189,0.25);
}
.btn-finalizar {
  background: linear-gradient(135deg, #f0c842, #d4a800);
  color: #1a1000;
  border-color: transparent;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(240,200,66,0.25);
}
.planner-card-actions .btn-finalizar {
  font-size: 13px !important;
  padding: 7px 16px !important;
  border-radius: var(--radius-sm);
}

/* ── AJUSTES ────────────────────────────────────────────── */
.ajuste-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 3px 6px;
  border-radius: var(--radius-xs);
  margin-bottom: 3px;
}
.ajuste-abono { background: rgba(15,168,104,0.1); color: #0a7a4c; }
.ajuste-descuento { background: rgba(249,115,22,0.1); color: var(--accent-dark); }
.text-verde { color: #0a7a4c; font-weight: 700; }
.text-rojo { color: var(--danger); font-weight: 700; }

/* ── TARIFA ─────────────────────────────────────────────── */
.tarifa-acordada-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}

/* ── CONFIG ─────────────────────────────────────────────── */
.config-seccion-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.config-icono { font-size: 28px; line-height: 1; display: none; }
.config-titulo { margin: 0 0 4px; font-size: 18px; color: var(--azul-profundo); }
.config-desc { margin: 0; color: var(--text-3); font-size: 13px; }
.config-mini-tabla { margin-bottom: 18px; }
.config-mini-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

/* ── PLANNER ────────────────────────────────────────────── */
.planner-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.planner-semana-label {
  flex: 1;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--azul-profundo);
}
.planner-dias {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 8px;
}
.planner-dia {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 8px;
  background: var(--card);
  min-height: 140px;
  box-shadow: var(--shadow-xs);
  transition: border-color 0.2s;
}
.planner-dia:hover { border-color: var(--border-hover); }

.planner-dia-header {
  font-weight: 700;
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  margin-bottom: 8px;
  padding-bottom: 5px;
  border-bottom: 2px solid var(--border);
  letter-spacing: 0.5px;
}
.planner-dia-header.hoy {
  color: var(--teal);
  border-bottom-color: var(--teal);
}
.planner-card {
  border: 1px solid rgba(192,57,43,0.25);
  border-radius: var(--radius-xs);
  padding: 7px 8px;
  margin-bottom: 6px;
  background: rgba(192,57,43,0.05);
  font-size: 12px;
  transition: all 0.15s;
}
.planner-card.estado-en-diario {
  background: rgba(15,168,104,0.07);
  border-color: rgba(15,168,104,0.3);
}
.planner-card.estado-en-curso {
  background: rgba(240,200,66,0.08);
  border-color: rgba(240,200,66,0.35);
}
.planner-card-prop { font-weight: 700; color: var(--azul-profundo); margin-bottom: 2px; }
.planner-card-tipo { color: var(--texto); font-size: 12px; font-weight: 600; }
.planner-card-colab { color: var(--teal); font-weight: 600; font-size: 11px; margin-top: 2px; }
.planner-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.planner-card-actions .btn-aprobar {
  font-size: 13px !important;
  padding: 7px 16px !important;
  border-radius: var(--radius-sm);
}
.planner-add {
  display: block;
  width: 100%;
  text-align: center;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-xs);
  padding: 5px;
  color: var(--text-3);
  background: transparent;
  font-size: 11px;
  margin-top: 4px;
  cursor: pointer;
  transition: all 0.15s;
}
.planner-add:hover { border-color: var(--teal); color: var(--teal); background: var(--teal-light); }

.money-col { display: table-cell; }

/* ── MODAL ──────────────────────────────────────────────── */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 30;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(16,42,85,0.35);
  backdrop-filter: blur(4px);
}
.modal.open { display: flex; }
.modal-card {
  width: min(720px, 100%);
  max-height: 92vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.modal-head { margin-bottom: 16px; flex-shrink: 0; }
.modal-head h2 { font-size: 18px; }
.modal-form { overflow-y: auto; overflow-x: hidden; flex: 1; padding-bottom: 8px; }

/* ── ICON BUTTONS ───────────────────────────────────────── */
.btn-icon {
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px; border: none; cursor: pointer; flex-shrink: 0;
  transition: opacity 0.15s, transform 0.1s;
}
.btn-icon:active { opacity: 0.7; transform: scale(0.9); }
.btn-icon-edit { background: rgba(24,200,189,0.12); color: #0d9e94; }
.btn-icon-delete { background: rgba(192,57,43,0.1); color: var(--danger); }

/* ── ALCANCES ───────────────────────────────────────────── */
.alcance-check-grid {
  display: flex; flex-direction: column;
  gap: 2px; max-height: 200px; overflow-y: auto;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  -webkit-overflow-scrolling: touch;
  padding: 8px 10px; margin-top: 4px; background: var(--bg);
}
.alcance-check-item {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; cursor: pointer; padding: 6px 4px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
  color: var(--text);
}
.alcance-check-item:last-child { border-bottom: none; }
.alcance-check-item input[type="checkbox"] {
  width: 16px; height: 16px; flex-shrink: 0; accent-color: var(--accent);
}

/* ── MENU MODAL (móvil) ─────────────────────────────────── */
.menu-modal { position: fixed; inset: 0; z-index: 500; display: flex; align-items: flex-end; }
.menu-modal.hidden { display: none; }
.menu-modal-backdrop { position: absolute; inset: 0; background: rgba(16,42,85,0.4); backdrop-filter: blur(3px); }
.menu-modal-sheet {
  position: relative;
  background: var(--card);
  border-radius: 20px 20px 0 0;
  border-top: 1px solid var(--border);
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 20px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 -8px 40px rgba(16,42,85,0.15);
}
.menu-modal-head { display: flex; align-items: center; justify-content: space-between; }
.menu-modal-title { font-size: 17px; font-weight: 700; color: var(--text); }
.menu-modal-close {
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 15px;
  color: var(--text-2);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}
.menu-modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.menu-section-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 14px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}
.menu-section-card:hover { border-color: var(--border-hover); background: var(--teal-light); }
.menu-section-card.active {
  background: rgba(249,115,22,0.07);
  border-color: rgba(249,115,22,0.35);
}
.menu-section-card:active { transform: scale(0.97); }
.menu-card-name { font-size: 13.5px; font-weight: 700; color: var(--text); }
.menu-card-kicker { font-size: 11px; color: var(--text-3); }
.menu-modal-logout {
  background: none;
  border: 1.5px solid rgba(192,57,43,0.25);
  border-radius: var(--radius-sm);
  padding: 12px;
  color: var(--danger);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: background 0.15s;
}
.menu-modal-logout:hover { background: var(--danger-bg); }

.nav-current-label { font-size: 14px; font-weight: 600; color: var(--text); padding: 8px 4px; }
.nav-menu-btn {
  background: var(--accent-gradient);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(249,115,22,0.25);
}

/* ── INSTALL BANNER ─────────────────────────────────────── */
.install-banner {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 8000;
  background: var(--azul);
  color: white;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-shadow: 0 -4px 20px rgba(16,42,85,0.25);
  animation: slideUp 0.3s ease;
}
.install-banner.hidden { display: none; }

@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.install-banner-content { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.install-banner-logo { width: 36px; height: 36px; object-fit: contain; border-radius: 8px; background: white; padding: 3px; flex-shrink: 0; }
.install-banner-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.install-banner-text strong { font-size: 14px; font-weight: 700; }
.install-banner-text span, #install-banner-msg { font-size: 12px; opacity: 0.85; }
.install-banner-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.install-banner-btn {
  background: var(--teal);
  color: var(--azul);
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.install-banner-close {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  border-radius: 50%;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  cursor: pointer;
}

/* ── SIDEBAR TOP / SALIR ────────────────────────────────── */
.sidebar-top { display: contents; }
.sidebar-salir-btn {
  display: none;
  background: none;
  border: 1.5px solid rgba(192,57,43,0.25);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--danger);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.sidebar-salir-btn:hover { background: var(--danger-bg); }

@media (max-width: 820px) {
  .sidebar-top { display: flex; align-items: center; gap: 10px; }
  .sidebar-salir-btn { display: flex; }
}

/* ── AUTH OVERLAY ───────────────────────────────────────── */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: linear-gradient(160deg, #ddf1f8 0%, #eef7fc 50%, #f5faff 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}
.auth-overlay.hidden { display: none; }

.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 40px 32px 32px;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: auto;
}

@media (max-width: 480px) {
  .auth-overlay { padding: 16px; align-items: flex-start; padding-top: 40px; }
  .auth-card { padding: 28px 20px 24px; border-radius: 16px; }
  .auth-logo { width: 56px; margin-bottom: 20px; }
  .auth-title { font-size: 20px; }
  .auth-row { grid-template-columns: 1fr; }
}

.auth-logo {
  width: 130px;
  height: auto;
  margin-bottom: 28px;
}

#auth-content { width: 100%; }

.auth-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--azul-profundo);
  margin: 0 0 6px;
  text-align: center;
  letter-spacing: -0.3px;
}

.auth-sub {
  font-size: 14px;
  color: var(--text-3);
  margin: 0 0 24px;
  text-align: center;
}

#auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 16px;
}

#auth-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#auth-form input[type="text"],
#auth-form input[type="email"],
#auth-form input[type="password"] {
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
  color: var(--text);
  background: var(--bg-2);
}

#auth-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(249,115,22,0.1);
}

.auth-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.auth-check-label {
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
  font-weight: 500 !important;
  font-size: 13px !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  cursor: pointer;
  padding: 8px 0;
  color: var(--text-2) !important;
}

.auth-check-label input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

.auth-error {
  background: var(--danger-bg);
  border: 1px solid rgba(192,57,43,0.25);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 12px;
}
.auth-error.hidden { display: none; }

.auth-switch {
  margin: 0;
  font-size: 13px;
  color: var(--text-3);
  text-align: center;
  width: 100%;
}

.auth-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13px;
  padding: 0;
  cursor: pointer;
  font-weight: 700;
}
.auth-link:hover { text-decoration: underline; }

/* ── NAV USER / LOGOUT ──────────────────────────────────── */
.nav-user {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-user-name {
  font-size: 12px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 4px;
}

.nav-logout {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 7px 12px;
  font-size: 12px;
  color: var(--text-2);
  text-align: left;
  transition: all 0.15s;
  width: 100%;
}
.nav-logout:hover { border-color: rgba(192,57,43,0.3); color: var(--danger); }

/* ── COLABORADORA ───────────────────────────────────────── */
body.colaboradora .admin-only { display: none !important; }
body.colaboradora th.admin-only,
body.colaboradora td.admin-only { display: none !important; }

/* ── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 820px) {
  .alcance-check-grid { max-height: 120px; }
  .modal-card { padding: 16px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 15;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: center;
  }
  .brand-logo { width: 38px; margin: 0; }
  .nav { display: flex; overflow-x: auto; padding-bottom: 4px; }
  .nav-item { white-space: nowrap; padding: 9px 10px; font-size: 13px; }
  .main { padding: 16px 14px 80px; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 10px; }
  .topbar h1 { font-size: 24px; }
  .list-header, .module-head { align-items: flex-start; flex-direction: column; gap: 10px; }
  .form-grid, .modal-form, .summary-grid { grid-template-columns: 1fr; }
  .money-col, .owner-only { display: none; }
  th.money-col, td.money-col { display: none; }
  h1 { font-size: 26px; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 0; width: 100%; }
  table th { font-size: 11px; padding: 6px; white-space: nowrap; }
  table td { font-size: 12px; padding: 7px 6px; white-space: nowrap; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }

  #screen-equipo th:nth-child(3), #screen-equipo td:nth-child(3),
  #screen-equipo th:nth-child(4), #screen-equipo td:nth-child(4),
  #screen-equipo th:nth-child(8), #screen-equipo td:nth-child(8) { display: none; }

  #screen-diario th:nth-child(2), #screen-diario td:nth-child(2),
  #screen-diario th:nth-child(5), #screen-diario td:nth-child(5),
  #screen-diario th:nth-child(7), #screen-diario td:nth-child(7),
  #screen-diario th:nth-child(8), #screen-diario td:nth-child(8) { display: none; }

  #screen-gastos th:nth-child(2), #screen-gastos td:nth-child(2),
  #screen-gastos th:nth-child(3), #screen-gastos td:nth-child(3),
  #screen-gastos th:nth-child(4), #screen-gastos td:nth-child(4),
  #screen-gastos th:nth-child(6), #screen-gastos td:nth-child(6),
  #screen-gastos th:nth-child(7), #screen-gastos td:nth-child(7) { display: none; }

  #screen-cobros th:nth-child(1), #screen-cobros td:nth-child(1),
  #screen-cobros th:nth-child(4), #screen-cobros td:nth-child(4),
  #screen-cobros th:nth-child(6), #screen-cobros td:nth-child(6) { display: none; }

  #screen-propiedades th:nth-child(2), #screen-propiedades td:nth-child(2),
  #screen-propiedades th:nth-child(3), #screen-propiedades td:nth-child(3),
  #screen-propiedades th:nth-child(5), #screen-propiedades td:nth-child(5),
  #screen-propiedades th:nth-child(6), #screen-propiedades td:nth-child(6),
  #screen-propiedades th:nth-child(7), #screen-propiedades td:nth-child(7) { display: none; }

  #screen-configuracion .config-mini-tabla th:nth-child(2),
  #screen-configuracion .config-mini-tabla td:nth-child(2),
  #screen-configuracion .config-mini-tabla th:nth-child(3),
  #screen-configuracion .config-mini-tabla td:nth-child(3) { display: none; }

  .nav-user { flex-direction: row; align-items: center; justify-content: space-between; padding: 6px 4px 0; border-top: 1px solid var(--border); margin-top: 6px; }
  .nav-logout { width: auto; padding: 5px 10px; }
}

/* ── COLABORADORA MÓVIL ─────────────────────────────────── */
@media (max-width: 820px) {
  body.colaboradora .app-shell { display: block; }
  body.colaboradora .sidebar {
    position: fixed;
    bottom: 0; left: 0; right: 0; top: auto;
    z-index: 200;
    display: block;
    padding: 0;
    background: var(--card);
    border-top: 1px solid var(--border);
    border-right: none;
    box-shadow: 0 -4px 20px rgba(16,42,85,0.1);
  }
  body.colaboradora .brand-logo { display: none; }
  body.colaboradora .nav {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    overflow: visible;
    padding: 0;
    gap: 0;
  }
  body.colaboradora .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 6px 14px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 0;
    white-space: normal;
    text-align: center;
    gap: 0;
    min-height: 68px;
    color: var(--text-3);
    border: none;
    border-top: 3px solid transparent;
    background: none;
    line-height: 1.2;
  }
  body.colaboradora .nav-item.active {
    color: var(--azul);
    border-top-color: var(--teal);
    background: var(--teal-light);
  }
  body.colaboradora .nav-item-salir { color: var(--danger); font-size: 12px; }
  body.colaboradora .nav-user { display: none; }
  body.colaboradora .main { padding: 14px 14px 80px; }
  body.colaboradora .topbar { display: none; }

  body.colaboradora #screen-diario .table-wrap { overflow: visible; }
  body.colaboradora #screen-diario table { min-width: 0; width: 100%; border-collapse: separate; }
  body.colaboradora #screen-diario table thead { display: none; }
  body.colaboradora #screen-diario table tbody tr {
    display: block;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-xs);
  }
  body.colaboradora #screen-diario table tbody td { display: flex; padding: 2px 0; font-size: 13px; border: none; min-width: 0; }
  body.colaboradora #screen-diario table tbody td:empty { display: none; }

  body.colaboradora #screen-diario .form-panel { border-radius: var(--radius); padding: 18px 16px; margin-bottom: 16px; }
  body.colaboradora #screen-diario .form-grid label { font-size: 13px; }
  body.colaboradora #screen-diario input,
  body.colaboradora #screen-diario select,
  body.colaboradora #screen-diario textarea { font-size: 16px; padding: 12px; border-radius: var(--radius-sm); }
  body.colaboradora .primary-button.full { font-size: 16px; padding: 14px; border-radius: 10px; }

  body.colaboradora .table-wrap { overflow: visible; }
  body.colaboradora table { min-width: 0; width: 100%; border-collapse: separate; border-spacing: 0; }
  body.colaboradora table thead { display: none; }
  body.colaboradora table tbody tr {
    display: block;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-xs);
  }
  body.colaboradora table tbody td { display: flex; align-items: flex-start; padding: 3px 0; font-size: 14px; border: none; min-width: 0; }
  body.colaboradora table tbody td:empty { display: none; }
  body.colaboradora table tbody td .badge-ok { font-size: 12px; }
  body.colaboradora table tbody td .actions { flex-wrap: wrap; gap: 6px; margin-top: 6px; }
  body.colaboradora table tbody td .row-button { font-size: 13px; padding: 7px 14px; }

  body.colaboradora .summary-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  body.colaboradora .metric { padding: 14px; border-radius: var(--radius); }
  body.colaboradora .metric span { font-size: 11px; }
  body.colaboradora .metric strong { font-size: 20px; }

  body.colaboradora .planner-dias { grid-template-columns: 1fr; gap: 10px; }
  body.colaboradora .planner-dia { border-radius: var(--radius); }
  body.colaboradora .planner-dia-header { font-size: 15px; }
  body.colaboradora .planner-card { font-size: 14px; padding: 12px; }
}

/* ── ADMIN MÓVIL ────────────────────────────────────────── */
@media (max-width: 820px) {
  #screen-planner { overflow-x: hidden; }
  #screen-planner .panel { overflow-x: hidden; }
  .planner-dias { grid-template-columns: 1fr !important; min-width: 0 !important; gap: 10px; }
  .planner-dia { min-height: 0; border-radius: var(--radius); }
  .planner-dia-header { font-size: 14px; font-weight: 700; }
  .planner-card { font-size: 14px; padding: 12px; }

  .sidebar-salir-btn { display: none !important; }
  body.admin .sidebar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 50;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    border-right: none;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    gap: 10px;
  }
  body.admin .sidebar-top { display: flex; align-items: center; }
  body.admin .brand-logo { width: 36px; margin: 0; }
  body.admin .nav { display: flex; align-items: center; gap: 6px; overflow-x: auto; overflow-y: hidden; flex-wrap: nowrap; }
  body.admin .nav-item { font-size: 12px; padding: 6px 10px; white-space: nowrap; }
  body.admin .nav-user { display: none; }
  body.admin .main { padding-top: 68px; }

  /* Topbar admin móvil — botones en fila */
  body.admin .topbar { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: nowrap; gap: 8px; padding: 10px 14px; }
  body.admin .topbar > div { min-width: 0; }
  body.admin .topbar h1 { font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  body.admin .topbar > div:last-child { display: flex; gap: 6px; flex-shrink: 0; }
  body.admin .topbar .primary-button { padding: 8px 14px; font-size: 13px; white-space: nowrap; }
  body.admin .topbar #secondary-action { padding: 8px 14px; font-size: 13px; }

  /* Summary grid — 2 columnas en admin móvil */
  body.admin .summary-grid { grid-template-columns: 1fr 1fr !important; gap: 8px; }
  body.admin .metric { padding: 12px; }
  body.admin .metric strong { font-size: 18px; }

  /* Tablas en admin → card layout */
  body.admin table { min-width: 0; width: 100%; }
  body.admin .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 8px; }

  /* Fuentes más legibles en móvil */
  body.admin .eyebrow { font-size: 12px; }
  body.admin label { font-size: 13px; }
  body.admin .modal-form { gap: 0 10px; }
  body.admin .modal-form label input,
  body.admin .modal-form label select,
  body.admin .modal-form label textarea { font-size: 16px; } /* evita zoom en iOS */

  /* Modal full width en móvil */
  body.admin .modal-card { width: 100%; max-height: 95vh; border-radius: 16px 16px 0 0; margin-top: auto; }
  body.admin .modal { align-items: flex-end; }

  /* Hub y setup cards */
  .hub-card { max-width: 100% !important; border-radius: 16px !important; padding: 20px 16px !important; }
  .hub-grid { grid-template-columns: 1fr 1fr !important; gap: 10px !important; }
  .hub-item { padding: 14px 10px !important; }
  .setup-card { max-width: 100% !important; padding: 20px 16px !important; }
  .setup-check-grid { grid-template-columns: 1fr !important; }
  .setup-field input,
  .setup-field select { font-size: 16px !important; } /* evita zoom iOS */

  /* Chat en móvil */
  .chat-wrap { height: calc(100vh - 120px); }
  .chat-input { font-size: 16px; } /* evita zoom iOS */

  /* Tesorería cards en móvil */
  #screen-caja .panel > div[style*="grid"] { grid-template-columns: 1fr 1fr !important; }

  /* Botón + Añadir planner */
  .planner-add { padding: 10px; font-size: 13px; margin-top: 6px; }

  /* Configuración en móvil */
  .config-mini-tabla { margin-bottom: 16px; }
  .config-seccion { padding: 16px; }
}

/* ── INSTALL MOBILE ─────────────────────────────────────── */
.install-btn {
  margin-top: 16px;
  width: 100%;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  background: var(--accent-gradient);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}
.install-ios {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--teal-light);
}
.install-ios p {
  margin: 0;
  font-size: 12px;
  color: var(--azul-profundo);
  line-height: 1.5;
}
