:root {
  --bg-app: #faf9f8;
  --bg-sidebar: #f3f2f1;
  --bg-surface: #ffffff;
  --bg-hover: #edebe9;
  --bg-selected: #e1e6fa;
  --border: #e1dfdd;
  --text: #201f1e;
  --text-muted: #605e5c;
  --text-faint: #a19f9d;
  --accent: #2564cf;
  --accent-hover: #1a4faa;
  --accent-soft: #e8f1fb;
  --danger: #d13438;
  --danger-bg: #fdf3f4;
  --star: #d9a300;
  --shadow: rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] {
  --bg-app: #1f1f1f;
  --bg-sidebar: #252423;
  --bg-surface: #2b2a29;
  --bg-hover: #3b3a39;
  --bg-selected: #33396b;
  --border: #3b3a39;
  --text: #f3f2f1;
  --text-muted: #c8c6c4;
  --text-faint: #8a8886;
  --accent: #62a0ea;
  --accent-hover: #8ab8f0;
  --accent-soft: #2a3a52;
  --danger: #f1707b;
  --danger-bg: #3a2325;
  --star: #ffcf4d;
  --shadow: rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  max-width: 100%;
  overflow-x: hidden;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-app);
  color: var(--text);
}
* { min-width: 0; }
img, svg { max-width: 100%; }

.layout {
  display: flex;
  height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 280px;
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 8px;
  overflow-y: auto;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 20px;
}
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.app-name {
  font-weight: 600;
  font-size: 14px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 6px;
  border-radius: 50%;
  color: var(--text-muted);
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--bg-hover); }

.notif-wrap { position: relative; }
.notif-btn { position: relative; }

/* position: fixed (no absolute) a propósito: el sidebar tiene su propio
   scroll (overflow-y: auto), y un panel "absolute" queda atrapado/recortado
   dentro de ese contenedor en vez de flotar libre sobre toda la pantalla.
   Con "fixed" se escapa de ese scroll; la posición exacta (top/left) se
   calcula en JS contra la pantalla completa al abrirlo. */
.notif-panel {
  position: fixed;
  z-index: 1000;
  width: 340px;
  max-width: calc(100vw - 32px);
  box-sizing: border-box;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  box-shadow: 0 4px 16px var(--shadow);
}
.notif-panel-header {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.notif-panel-list { max-height: 320px; overflow-y: auto; overflow-x: hidden; }
.notif-group-label {
  padding: 8px 14px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-faint);
}
.notif-group-label.vencida { color: var(--danger); }
.notif-item {
  display: block;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  overflow-wrap: break-word;
  word-break: break-word;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.notif-item:hover { background: var(--bg-hover); }
.notif-item:last-child { border-bottom: none; }
.notif-item-area {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}
.notif-item-detalle { font-size: 13px; color: var(--text); margin-top: 2px; line-height: 1.4; }
.notif-item-hora { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.notif-item.vencida .notif-item-hora { color: var(--danger); font-weight: 600; }
.notif-item.vencida { background: var(--danger-bg); }
.notif-panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.notif-panel-footer a { font-size: 12px; color: var(--accent); text-decoration: none; }
.notif-panel-footer a:hover { text-decoration: underline; }
.notif-permiso-btn {
  border: none;
  background: none;
  color: var(--accent);
  font-size: 11px;
  cursor: pointer;
  padding: 0;
}
.notif-permiso-btn:hover { text-decoration: underline; }

/* Modal de "marcar actividad" (solo se muestra en celular vía JS) */
.marcar-modal-backdrop {
  display: none;
}
@media (max-width: 640px) {
  .marcar-modal-backdrop {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 1100;
    align-items: flex-end;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
  }
  .marcar-modal-backdrop[hidden] { display: none; }
}
.marcar-modal {
  width: 100%;
  max-width: 480px;
  background: var(--bg-surface);
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -4px 24px var(--shadow);
}
.marcar-modal-titulo {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 14px;
}
.marcar-modal-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}
.marcar-modal-textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  background: var(--bg-app);
  color: var(--text);
  resize: vertical;
}
.marcar-modal-textarea:focus { outline: none; border-color: var(--accent); }
.marcar-modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.marcar-modal-cancelar {
  flex: 1;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-muted);
  border-radius: 3px;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.marcar-modal-confirmar {
  flex: 2;
  border: none;
  background: #498205;
  color: #fff;
  border-radius: 3px;
  padding: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.marcar-modal-confirmar:hover { background: #3d6e04; }

/* Modal de confirmar (reemplaza el confirm() feo del navegador), en
   cualquier tamaño de pantalla -- a diferencia del modal de marcar arriba,
   que solo aplica en celular. */
.confirm-modal-backdrop {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 1200;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  padding: 20px;
}
.confirm-modal-backdrop[hidden] { display: none; }
.confirm-modal {
  width: 100%;
  max-width: 360px;
  background: var(--bg-surface);
  border-top: 3px solid var(--danger);
  border-radius: 3px;
  box-shadow: 0 8px 28px var(--shadow);
  padding: 24px;
  text-align: center;
}
.confirm-modal-icono { font-size: 28px; margin-bottom: 10px; }
.confirm-modal-mensaje { font-size: 14px; color: var(--text); line-height: 1.5; margin-bottom: 20px; }
.confirm-modal-actions { display: flex; gap: 10px; }
.confirm-modal-confirmar {
  flex: 1;
  border: none;
  background: var(--danger);
  color: #fff;
  border-radius: 3px;
  padding: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.confirm-modal-confirmar:hover { background: #a92a2d; }
.confirm-modal .marcar-modal-cancelar { flex: 1; }

.notif-badge {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
}
.notif-badge.urgente { background: var(--danger); }

.switch-sucursal-form { padding: 0 12px 12px; }
.switch-sucursal-form select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 8px 10px;
  font-size: 13px;
  background: var(--bg-surface);
  color: var(--text);
  cursor: pointer;
}

.sucursal-badge {
  margin: 0 12px 12px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.sucursal-badge, .role-tag {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-hover);
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
}
.role-tag { color: var(--accent); background: var(--accent-soft); }

.search-box { padding: 0 12px 12px; }
.search-box input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  border-radius: 3px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text);
  outline: none;
}
.search-box input:focus { border-color: var(--accent); }

.smart-lists, .own-lists {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 3px;
  text-decoration: none;
  color: var(--text);
  font-size: 14px;
  position: relative;
  transition: background 0.1s ease;
}
.nav-item:hover { background: var(--bg-hover); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-hover); font-weight: 600; }
.nav-icon { font-size: 16px; width: 20px; text-align: center; }
.count {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-muted);
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 8px;
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 6px;
}
.new-list-form {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 3px;
}
.new-list-form:focus-within, .new-list-form:hover { background: var(--bg-hover); }
.new-list-form .row-icon { color: var(--accent); font-weight: bold; font-size: 15px; }
.new-list-form input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}
.new-list-form input:focus {
  outline: none;
  cursor: text;
}

/* Main */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: var(--bg-surface);
  min-width: 0;
}

.main-header {
  padding: 32px 40px 16px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  border-radius: 0;
  transition: background 0.2s ease;
}
.main-header.banner {
  background: color-mix(in srgb, var(--list-color, var(--accent)) 10%, transparent);
  border-bottom: 2px solid var(--list-color, var(--accent));
}
.main-header h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 600;
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: break-word;
}
.main-header .menu-toggle { flex-shrink: 0; }

.add-task-form {
  margin: 8px 40px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  border-radius: 3px;
  padding: 14px 16px;
  box-shadow: none;
  transition: border-color 0.15s ease;
}
.add-task-form:focus-within { border-color: var(--accent); }
.add-task-form .plus {
  color: var(--accent);
  font-size: 18px;
  font-weight: bold;
}
.add-task-form input {
  flex: 1;
  border: none;
  font-size: 15px;
  outline: none;
  background: transparent;
  color: var(--text);
}

.task-list {
  list-style: none;
  margin: 0;
  padding: 0 40px;
}

@keyframes task-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.task-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  border-radius: 3px;
  cursor: default;
  animation: task-in 0.15s ease;
}
.task-item:hover { background: var(--bg-hover); }
.task-item.selected { background: var(--accent-soft); }
.task-item.dragging { opacity: 0.4; }

.drag-handle {
  cursor: grab;
  color: var(--text-faint);
  font-size: 14px;
  padding: 0 2px;
  opacity: 0;
  flex-shrink: 0;
  user-select: none;
}
.task-item:hover .drag-handle { opacity: 1; }
.drop-indicator {
  height: 2px;
  background: var(--accent);
  margin: 0 40px;
  border-radius: 3px;
}

.group-label {
  margin: 20px 40px 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.inline { display: contents; }

.checkbox {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: var(--bg-surface);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: transform 0.1s ease;
}
.checkbox:hover { background: var(--bg-selected); transform: scale(1.08); }
.checkbox.checked {
  background: var(--accent);
  position: relative;
}
.checkbox.checked::after {
  content: "✓";
  color: #fff;
  font-size: 12px;
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.task-body { flex: 1; min-width: 0; cursor: pointer; }
.task-title { font-size: 14px; }
.task-title.strike { text-decoration: line-through; color: var(--text-faint); }
.task-meta-row { display: flex; gap: 10px; margin-top: 2px; }
.task-meta { font-size: 12px; color: var(--text-muted); }
.task-meta.overdue { color: var(--danger); font-weight: 600; }

.editar-actividad-panel {
  margin: 4px 0 8px 34px;
  padding: 12px;
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: 3px;
}
.edit-actividad-toggle { cursor: pointer; }

.rango-hora-fields { display: flex; gap: 12px; margin: 8px 0; flex-wrap: wrap; }
.rango-hora-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.rango-hora-label input[type="time"] {
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 6px 8px;
  font-size: 13px;
  background: var(--bg-app);
  color: var(--text);
}

.star {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-faint);
}
.star.active { color: var(--star); }

.delete {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-faint);
}
.delete:hover { color: var(--danger); }

.completed-section {
  margin: 16px 40px;
}
.completed-section summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  padding: 8px 0;
}
.completed-section .task-list { padding: 0; }

/* Áreas / actividades */
.areas-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 20px 60px;
  background: var(--bg-app);
  min-height: 100vh;
  color: var(--text);
}
.areas-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}
.areas-header h1 { flex: 1; margin: 0; font-size: 22px; }
.back-link { color: var(--accent); text-decoration: none; font-size: 13px; }
.back-link:hover { text-decoration: underline; }

.stats-strip {
  display: flex;
  align-items: center;
  gap: 32px;
  margin: 8px 40px 20px;
  padding: 18px 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 3px;
}
.stat-block { text-align: left; }
.stat-number { font-size: 22px; font-weight: 700; color: var(--text); line-height: 1.1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.stat-progress { flex: 1; min-width: 140px; }
.stat-progress-bar {
  height: 8px;
  border-radius: 3px;
  background: var(--bg-hover);
  overflow: hidden;
  margin-bottom: 4px;
}
.stat-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #62c48f);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.filtro-estado-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 40px 16px;
}
.filtro-chip {
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-muted);
  border-radius: 3px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.filtro-chip:hover { border-color: var(--accent); color: var(--text); }
.filtro-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.empleados-area {
  margin: 8px 40px 20px;
  padding: 14px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 3px;
}
.empleados-area-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.empleados-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.empleado-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-soft);
  color: var(--accent-hover);
  border-radius: 3px;
  padding: 6px 10px 6px 12px;
  font-size: 12px;
  font-weight: 600;
}
.empleado-chip button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--accent-hover);
  font-size: 11px;
  opacity: 0.7;
}
.empleado-chip button:hover { opacity: 1; }
.asignar-empleado-form { display: flex; gap: 8px; }
.asignar-empleado-form select {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 8px;
  font-size: 13px;
  background: var(--bg-app);
  color: var(--text);
}
.asignar-empleado-form button {
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 3px;
  padding: 0 16px;
  cursor: pointer;
  font-size: 13px;
}

.clase-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 20px 40px 4px;
  flex-wrap: wrap;
}
.clase-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 140px;
}
.clase-progress-count { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.clase-progress-bar { flex: 1; margin-bottom: 0; width: 100px; }

.area-rows { padding: 0 40px; }
.area-row { padding: 4px 8px; }
.area-row-link {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--text);
}
.area-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--dot-color);
  flex-shrink: 0;
}
.area-row .task-title { font-size: 15px; font-weight: 500; }
.area-row-count {
  background: var(--bg-hover);
  border-radius: 3px;
  padding: 2px 10px;
  font-size: 12px;
  white-space: nowrap;
}
.area-row-count.historial-ok { background: #dff3e6; color: #1e7a3d; }
:root:not([data-theme="light"]) .area-row-count.historial-ok { background: #1f3a28; color: #6fd68f; }

.panel-general-rows .area-row {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 10px 8px;
}
.panel-general-form { border: none; background: none; padding: 0; cursor: pointer; }
.panel-general-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 24px;
}
.panel-general-progress .clase-progress-bar { flex: 1; max-width: 260px; }
.panel-general-hint {
  margin: 8px 40px;
  font-size: 12px;
  color: var(--text-faint);
}

.fecha-form input[type="date"] {
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 6px 10px;
  font-size: 13px;
  background: var(--bg-surface);
  color: var(--text);
}

.clase-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 16px;
  margin-bottom: 16px;
}
.clase-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.clase-header h2 { margin: 0; font-size: 16px; }
.clase-card .task-list { padding: 0; }

.estado-pill {
  display: inline-block;
  border: none;
  border-radius: 3px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
  white-space: nowrap;
}
span.estado-pill { cursor: default; opacity: 0.85; }
.task-item-col { flex-direction: column; align-items: stretch; gap: 4px; }
.task-item-row { display: flex; align-items: center; gap: 10px; }
.task-item-row .task-body { flex: 1; min-width: 0; }

.nota-details { margin-left: 34px; }
.nota-details summary {
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  list-style: none;
}
.nota-details summary::-webkit-details-marker { display: none; }
.nota-details summary:hover { color: var(--accent); }
.nota-form {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.nota-form input {
  flex: 1;
  min-width: 160px;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 8px;
  font-size: 13px;
  background: var(--bg-app);
  color: var(--text);
}
.pasos-details { margin-top: 4px; }
.pasos-lista { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pasos-lista li {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  padding: 4px 0;
  border-bottom: 1px dashed var(--border);
}
.pasos-lista li:last-child { border-bottom: none; }
.pasos-lista .estado-pill { padding: 3px 10px; font-size: 11px; }
.paso-empleado { font-weight: 600; color: var(--text); }
.paso-hora { color: var(--text-faint); }

.nota-form button {
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 3px;
  padding: 0 14px;
  cursor: pointer;
  font-size: 13px;
}

.nota-inline-input {
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 6px 10px;
  font-size: 12px;
  background: var(--bg-app);
  color: var(--text);
  width: 140px;
  flex-shrink: 1;
}

.estado-pendiente { background: #f7a325; }
.estado-no-cumplida { background: var(--danger); }
.estado-hecho { background: #498205; }

.new-actividad-form { display: flex; flex-direction: column; gap: 10px; }
.new-actividad-form input[type=text] {
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 8px;
  background: var(--bg-app);
  color: var(--text);
  font-size: 13px;
}
.dias-checks { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--text-muted); }
.dias-checks label { display: flex; align-items: center; gap: 4px; }

.new-clase-form {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.new-clase-form input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 10px 12px;
  background: var(--bg-surface);
  color: var(--text);
  font-size: 13px;
}
.new-clase-form button {
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 3px;
  padding: 0 16px;
  cursor: pointer;
  font-size: 13px;
}

/* Login / elegir sucursal */
.auth-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--bg-app);
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 360px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 3px;
  box-shadow: 0 1px 3px var(--shadow);
  padding: 36px 32px 32px;
}
.auth-mark {
  width: 40px;
  height: 40px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--text);
  color: var(--bg-surface);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: 3px;
}
.auth-title {
  margin: 0 0 20px;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-sub { margin: -8px 0 4px; font-size: 13px; color: var(--text-muted); text-align: center; }
.auth-error {
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 3px;
  border: 1px solid var(--danger);
}
.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.auth-card input, .auth-card select {
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 11px 12px;
  font-size: 14px;
  background: var(--bg-app);
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.auth-card input:focus, .auth-card select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.auth-card button {
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 3px;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 6px;
  transition: background 0.15s ease;
}
.auth-card button:hover { background: var(--accent-hover); }
.auth-logout-link { color: var(--accent); font-size: 13px; }
.auth-footer { font-size: 12px; color: var(--text-faint); }

.list-badge {
  background: var(--bg-hover);
  padding: 1px 8px;
  border-radius: 3px;
}

.suggestions { margin: 8px 0 16px; }
.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 40px;
}
.suggestion-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.suggestion-chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.suggestion-chip .plus { color: var(--accent); font-weight: bold; }
.suggestion-chip .task-meta { color: var(--text-faint); }

.empty-state {
  text-align: center;
  color: var(--text-faint);
  padding: 60px 20px;
  font-size: 14px;
}

/* Mobile menu button, hidden on desktop */
.menu-toggle {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  border-radius: 3px;
}
.menu-toggle:hover { background: var(--bg-hover); }
.menu-toggle:active { background: var(--bg-selected); }
.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
}

.sidebar-backdrop {
  display: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

/* Tablet y mobile: sidebar como cajón desplegable a partir de 900px */
@media (max-width: 900px) {
  .layout { position: relative; overflow: hidden; }

  .menu-toggle { display: flex; }

  .sidebar {
    width: 280px;
    position: fixed;
    top: 0;
    left: -280px;
    bottom: 0;
    z-index: 20;
    transition: left 0.22s ease;
    box-shadow: 2px 0 12px var(--shadow);
  }
  /* Antes se usaba transform: translateX() para deslizar el menú, pero eso
     convierte al sidebar en "containing block" de cualquier hijo con
     position: fixed (como el panel de notificaciones), rompiendo su
     posicionamiento respecto a la pantalla completa. Con "left" se evita
     ese problema y el panel se posiciona bien relativo al viewport. */
  .sidebar.open { left: 0; }

  .notif-panel {
    position: fixed;
    top: 66px;
    left: 8px;
    right: 8px;
    width: auto;
    max-width: none;
    z-index: 45;
  }

  .main-header { padding: 24px 24px 12px; }
  .add-task-form, .task-list, .completed-section { margin-left: 24px; margin-right: 24px; }
  .task-list { padding: 0; }
  .area-rows { padding: 0 24px; }
  .suggestion-chips { padding: 0 24px; }
  .stats-strip { margin: 8px 24px 16px; }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 15;
    opacity: 0;
    pointer-events: none;
  }
  .sidebar-backdrop.open { opacity: 1; pointer-events: auto; }
  body.no-scroll { overflow: hidden; }

  .main { width: 100%; }
  .main-header { padding: 16px 16px 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
  .main-header h1 { font-size: 20px; flex-basis: 100%; }
  .main-header .fecha-form,
  .main-header .sort-select,
  .main-header .switch-sucursal-form { flex: 1 1 auto; }
  .fecha-form input[type="date"] { width: 100%; }
  .add-task-form, .task-list, .completed-section { margin-left: 16px; margin-right: 16px; }
  .task-item { padding: 14px 4px; }
  .group-label { margin: 16px 16px 4px; }
  .clase-progress-header { margin: 16px 16px 4px; }
  .empleados-area { margin: 8px 16px 16px; }
  .filtro-estado-bar { margin: 0 16px 16px; }
  .drop-indicator { margin: 0 16px; }
  .area-rows { padding: 0 16px; }
  .suggestion-chips { padding: 0 16px; }
  .stats-strip { flex-wrap: wrap; gap: 16px; margin: 8px 16px 16px; padding: 14px 16px; }
  .stat-progress { flex-basis: 100%; }
  .task-item-row { flex-wrap: wrap; }
  .nota-inline-input { width: auto; flex: 1 1 120px; }
  .nota-details { margin-left: 0; }
  .panel-general-hint { margin: 8px 16px; }
  .panel-general-progress { padding-left: 0; }
  .asignar-empleado-form, .new-clase-form, .new-actividad-form { flex-wrap: wrap; }
  .asignar-empleado-form select, .new-clase-form input { flex-basis: 100%; }
  .empleados-area { padding: 12px; }
  .stat-number { font-size: 18px; }

  .detail-panel.open {
    position: fixed;
    inset: 0;
    z-index: 25;
    width: 100%;
  }
}

/* ===== Detail panel ===== */
.detail-panel {
  width: 0;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border);
  transition: width 0.18s ease;
}
.detail-panel.open {
  width: 340px;
  overflow-y: auto;
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 12px;
  border-bottom: 1px solid var(--border);
}
.checkbox.big { width: 24px; height: 24px; border-width: 2px; }
.star.big { font-size: 22px; }
.detail-title-form { flex: 1; }
.detail-title-input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 16px;
  font-weight: 600;
  padding: 4px 0;
  color: var(--text);
}
.detail-title-input.strike { text-decoration: line-through; color: var(--text-faint); }
.detail-title-input:focus {
  outline: none;
  border-bottom: 1px solid var(--accent);
}
.close-panel {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 16px;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 50%;
}
.close-panel:hover { color: var(--text); background: var(--bg-hover); }

.detail-body { padding: 4px 16px 24px; display: flex; flex-direction: column; }

.detail-row-static {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.step-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  font-size: 13px;
}
.step-row span { flex: 1; color: var(--text); }
.step-row .strike { text-decoration: line-through; color: var(--text-faint); }
.step-delete { opacity: 0; transition: opacity 0.15s; }
.step-row:hover .step-delete { opacity: 1; }

.checkbox.small { width: 16px; height: 16px; }

/* Icon rows (estilo Fluent: icono + texto, expandibles) */
.icon-row-form, .icon-row-btn-form { display: block; }
.icon-row-form {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 4px;
}
.icon-row-form input {
  flex: 1;
  border: none;
  font-size: 13px;
  outline: none;
  background: transparent;
  color: var(--text);
}
.row-icon { color: var(--accent); font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }

.icon-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 3px;
  list-style: none;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
}
.icon-row::-webkit-details-marker { display: none; }
.icon-row:hover { background: var(--bg-hover); }
.icon-row.active { color: var(--accent); font-weight: 600; }
.icon-row.active .row-icon { color: var(--accent); }

.icon-row-details {
  border-bottom: 1px solid var(--border);
}
.icon-row-details[open] summary { color: var(--text); font-weight: 600; }
.detail-row-content { padding: 4px 4px 14px 32px; }

.quick-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.chip {
  border: 1px solid var(--border);
  background: var(--bg-surface);
  border-radius: 3px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text);
}
.chip:hover { background: var(--bg-hover); }
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.date-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 8px;
  font-size: 13px;
  background: var(--bg-surface);
  color: var(--text);
}

.detail-row-content textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 8px;
  resize: vertical;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  background: var(--bg-surface);
  color: var(--text);
}

.detail-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 12px;
}

.detail-meta {
  font-size: 11px;
  color: var(--text-faint);
}

.detail-delete {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 13px;
  padding: 8px 10px;
  cursor: pointer;
  border-radius: 3px;
}
.detail-delete:hover { background: var(--danger-bg); }

.detail-hint { font-size: 11px; color: var(--text-faint); padding: 4px 0; }
.repeat-form { display: flex; gap: 8px; }
.repeat-form select { flex: 1; border: 1px solid var(--border); border-radius: 3px; padding: 8px; font-size: 13px; background: var(--bg-surface); color: var(--text); }
.repeat-interval { width: 50px; border: 1px solid var(--border); border-radius: 3px; padding: 8px; font-size: 13px; background: var(--bg-surface); color: var(--text); }

/* Sort select */
.sort-select {
  margin-left: auto;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 6px 10px;
  font-size: 12px;
  background: var(--bg-surface);
  color: var(--text-muted);
  cursor: pointer;
}

/* List groups (sidebar) */
.list-group { margin-bottom: 2px; }
.list-group-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  list-style: none;
  position: relative;
}
.list-group-summary::-webkit-details-marker { display: none; }
.list-group-summary:hover { background: var(--bg-hover); }
.list-group-summary .group-menu-btn { margin-left: auto; opacity: 0; position: static; }
.list-group-summary:hover .group-menu-btn { opacity: 1; }
.list-group .own-lists, .list-group .list-row { padding-left: 14px; }
.color-swatches {
  display: flex;
  gap: 6px;
  padding: 4px 0 8px;
}
.swatch {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--swatch-color);
  cursor: pointer;
  padding: 0;
}
.swatch.active { border-color: var(--text); }

.list-group-form select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 6px;
  background: var(--bg-surface);
  color: var(--text);
  margin-bottom: 8px;
}

/* List menu (sidebar) */
.list-row { position: relative; display: flex; align-items: center; }
.list-row .nav-item { flex: 1; }
.list-menu-btn {
  position: absolute;
  right: 4px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 16px;
  padding: 4px 8px;
  opacity: 0;
}
.list-row:hover .list-menu-btn { opacity: 1; }
.list-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 34px;
  z-index: 30;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  box-shadow: 0 2px 6px var(--shadow);
  padding: 10px;
  width: 220px;
}
.list-menu.open { display: block; }
.list-rename-form {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.list-rename-form select { width: 46px; border: 1px solid var(--border); border-radius: 3px; background: var(--bg-surface); color: var(--text); }
.list-rename-form input { flex: 1; min-width: 0; border: 1px solid var(--border); border-radius: 3px; padding: 4px 6px; background: var(--bg-surface); color: var(--text); }
.list-rename-form button { border: none; background: var(--accent); color: #fff; border-radius: 3px; padding: 0 10px; cursor: pointer; }
.list-menu-delete {
  width: 100%;
  background: none;
  border: none;
  color: var(--danger);
  font-size: 13px;
  padding: 6px 4px;
  cursor: pointer;
  text-align: left;
}
.list-menu-delete:hover { background: var(--danger-bg); border-radius: 3px; }
