/* ============================================================
   exostareas — diseño moderno
   ============================================================ */

:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #f0eee9;
  --border: #e7e4dd;
  --border-strong: #d8d3c8;

  --texto: #201d18;
  --texto-2: #5f5a50;
  --texto-3: #9a948a;

  /* colores corporativos (del logo: naranja #F49817) */
  --primario: #F49817;
  --primario-600: #d97e06;
  --primario-soft: #fdf1dd;
  --dorado: #f6ad3a;
  --grad: linear-gradient(135deg, #f6a72f 0%, #e8830a 100%);

  --bien: #2f9e6e;
  --bien-soft: #e6f5ee;
  --alerta: #d97706;
  --alerta-soft: #fdf3e3;
  --exceso: #d64545;
  --exceso-soft: #fdecec;

  --slate: #7a7468;
  --slate-soft: #efece6;

  --radio: 14px;
  --radio-sm: 10px;
  --radio-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(32, 29, 24, 0.05), 0 1px 3px rgba(32, 29, 24, 0.06);
  --shadow: 0 2px 6px rgba(32, 29, 24, 0.06), 0 10px 26px rgba(32, 29, 24, 0.09);
  --shadow-lg: 0 14px 40px rgba(32, 29, 24, 0.16);

  --sidebar-bg: #1d1812;
  --sidebar-texto: #b3a992;
  --sidebar-activo: #2b241a;

  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Consolas, "Courier New", monospace;
}

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

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--texto);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: var(--mono); font-size: 12px; }

/* ===== scrollbars sutiles ===== */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--texto-3); background-clip: content-box; }

/* ===== botones ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  appearance: none;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radio-sm);
  color: var(--texto);
  cursor: pointer;
  font: inherit;
  font-weight: 500;
  padding: 8px 14px;
  white-space: nowrap;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}
.btn:hover { background: var(--surface-2); border-color: var(--texto-3); }
.btn:active { transform: translateY(1px); }

.btn-block { display: flex; width: 100%; padding: 10px 14px; }

.btn-primario {
  background: var(--grad);
  border: none;
  color: #fff;
  box-shadow: 0 4px 14px rgba(244, 152, 23, 0.35);
}
.btn-primario:hover { background: var(--grad); filter: brightness(1.07); box-shadow: 0 6px 18px rgba(244, 152, 23, 0.42); }

.btn-exito {
  background: var(--bien);
  border: none;
  color: #fff;
  box-shadow: 0 4px 14px rgba(47, 158, 110, 0.3);
}
.btn-exito:hover { filter: brightness(1.06); }

/* acciones de tarea según data-action */
[data-action="tomar"].btn,
[data-action="reanudar"].btn { background: var(--grad); border: none; color: #fff; box-shadow: 0 4px 14px rgba(244, 152, 23, 0.32); }
[data-action="tomar"].btn:hover,
[data-action="reanudar"].btn:hover { filter: brightness(1.07); }
[data-action="finalizar"].btn { background: var(--bien); border: none; color: #fff; box-shadow: 0 4px 14px rgba(47, 158, 110, 0.3); }
[data-action="finalizar"].btn:hover { filter: brightness(1.06); }
[data-action="ir-nueva"].btn,
[data-action="guardar-desc"].btn,
[data-action="crear-proyecto"].btn { background: var(--grad); border: none; color: #fff; box-shadow: 0 4px 14px rgba(244, 152, 23, 0.32); }
[data-action="ir-nueva"].btn:hover,
[data-action="guardar-desc"].btn:hover,
[data-action="crear-proyecto"].btn:hover { filter: brightness(1.07); }
[data-action="eliminar-usuario"].btn { color: var(--exceso); border-color: var(--exceso); }
[data-action="eliminar-usuario"].btn:hover { background: var(--exceso-soft); }

input, select, textarea {
  appearance: none;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radio-sm);
  color: var(--texto);
  font: inherit;
  padding: 9px 12px;
  width: 100%;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
input:hover, select:hover, textarea:hover { border-color: var(--texto-3); }
input:focus, select:focus, textarea:focus { border-color: var(--primario); outline: none; box-shadow: 0 0 0 3px rgba(244, 152, 23, 0.18); }
textarea { resize: vertical; }

:focus-visible { outline: 2px solid var(--primario); outline-offset: 2px; }

.campo { display: block; color: var(--texto-2); font-size: 12px; font-weight: 500; }
.campo input, .campo select, .campo textarea { margin-top: 5px; font-size: 14px; font-weight: 400; }

.check { display: flex; align-items: center; gap: 8px; color: var(--texto-2); font-size: 14px; font-weight: 500; }
.check input { width: auto; }

/* ===== títulos en mayúsculas (menú y secciones) ===== */
.tab span,
.cabecera h1,
.col-titulo,
.form-titulo,
.mini-titulo,
.d-seccion {
  letter-spacing: 0.02em;
}

/* ===== badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radio-pill);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  padding: 3px 10px;
  white-space: nowrap;
}
.badge-baja { background: var(--slate-soft); color: var(--slate); }
.badge-media { background: var(--alerta-soft); color: var(--alerta); }
.badge-alta { background: var(--exceso-soft); color: var(--exceso); }
.badge-pendiente { background: var(--slate-soft); color: var(--slate); }
.badge-en_proceso { background: var(--primario-soft); color: var(--primario-600); }
.badge-pausada { background: var(--alerta-soft); color: var(--alerta); }
.badge-finalizada { background: var(--bien-soft); color: var(--bien); }
.badge-cancelada { background: var(--exceso-soft); color: var(--exceso); }

/* ===== login ===== */
.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 16px;
  background: radial-gradient(1200px 600px at 20% -10%, #ece9ff 0%, transparent 60%),
              radial-gradient(1000px 500px at 100% 110%, #e4e6ff 0%, transparent 55%),
              var(--bg);
}
.login-tarjeta {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 36px 30px;
  width: 100%;
  max-width: 360px;
  display: grid;
  gap: 16px;
}
.login-logo {
  width: auto;
  height: auto;
  border-radius: 14px;
  background: #fff;
  padding: 10px 14px;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 20px rgba(244, 152, 23, 0.35);
  justify-self: center;
}
.login-logo img { height: 46px; width: auto; max-width: 100%; display: block; }
.login-sub { color: var(--texto-3); font-size: 13px; text-align: center; }
.login-error { color: var(--exceso); font-size: 13px; font-weight: 500; min-height: 18px; text-align: center; }

/* ===== shell ===== */
.shell { display: flex; min-height: 100dvh; }

.sidebar {
  width: 236px;
  flex: none;
  background: var(--sidebar-bg);
  color: var(--sidebar-texto);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  gap: 22px;
}

.brand { display: block; padding: 2px 4px 6px; overflow: hidden; }
.brand-logo { display: block; width: 100%; height: auto; max-width: 100%; }
.brand-nombre { font-weight: 700; font-size: 15px; color: #fff; letter-spacing: -0.2px; }

.tabs { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.tab {
  display: flex;
  align-items: center;
  gap: 11px;
  background: transparent;
  border: none;
  border-radius: 10px;
  color: var(--sidebar-texto);
  cursor: pointer;
  font: inherit;
  font-weight: 500;
  font-size: 14px;
  padding: 9px 12px;
  text-align: left;
  position: relative;
  transition: background 140ms ease, color 140ms ease;
}
.tab svg { width: 20px; height: 20px; flex: none; color: #d8d3c8; }
.tab:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.tab:hover svg { color: #e6e2d8; }
.tab.activo { background: var(--sidebar-activo); color: #fff; }
.tab.activo svg { color: var(--dorado); }

.sidebar-pie { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid rgba(255, 255, 255, 0.08); padding-top: 14px; }
.perfil { display: flex; align-items: center; gap: 10px; padding: 6px 10px; }
.avatar {
  width: 32px; height: 32px; flex: none;
  border-radius: 50%;
  background: var(--grad);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  display: grid;
  place-items: center;
}
.usuario-nombre { font-size: 13px; font-weight: 500; color: #e6e8f2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-salir {
  display: flex;
  align-items: center;
  gap: 11px;
  background: transparent;
  border: none;
  border-radius: 10px;
  color: var(--sidebar-texto);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  padding: 9px 12px;
  text-align: left;
  transition: background 140ms ease, color 140ms ease;
}
.btn-salir svg { width: 19px; height: 19px; }
.btn-salir:hover { background: rgba(225, 29, 72, 0.16); color: #fda4af; }

.contenido { flex: 1; min-width: 0; height: 100dvh; overflow-y: auto; }

.cabecera { display: flex; align-items: center; gap: 12px; padding: 20px 28px 8px; }
.cabecera h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.4px; }

.btn-menu {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--texto-2);
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}
.btn-menu svg { width: 21px; height: 21px; }
.btn-menu:hover { background: var(--surface-2); color: var(--texto); }

/* colapso de la sidebar (solo escritorio): barra angosta con logo + solo íconos */
@media (min-width: 769px) {
  body.sidebar-cerrada .sidebar { width: 84px; padding: 20px 10px; gap: 0; }
  body.sidebar-cerrada .sidebar .sidebar-pie { display: none; }
  body.sidebar-cerrada .sidebar .brand { padding: 2px 0 6px; }
  body.sidebar-cerrada .sidebar .brand-logo { width: 100%; height: auto; }
  body.sidebar-cerrada .sidebar .tabs { align-items: center; gap: 6px; }
  body.sidebar-cerrada .sidebar .tab {
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    flex: none;
  }
  body.sidebar-cerrada .sidebar .tab span { display: none; }
  body.sidebar-cerrada .sidebar .tab svg { width: 22px; height: 22px; }
  body.sidebar-cerrada .sidebar .tab::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: #201d18;
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    padding: 5px 11px;
    border-radius: 7px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 120ms ease;
    z-index: 1000;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  }
  body.sidebar-cerrada .sidebar .tab:hover::after { opacity: 1; }
}

main { padding: 14px 28px 40px; max-width: 1180px; margin: 0 auto; }

/* ===== barra de jornada ===== */
.jornada {
  background: linear-gradient(135deg, #fdf1dd 0%, #fbf4e8 100%);
  border: 1px solid #f3e2c4;
  border-radius: var(--radio);
  padding: 16px 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.j-linea1 { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.j-tarea { font-weight: 600; color: var(--texto); }
.j-inactiva { color: var(--texto-3); font-weight: 500; }
.j-contador { font-family: var(--mono); font-size: 15px; font-weight: 600; color: var(--primario-600); }
.j-nota { color: var(--alerta); font-size: 12px; font-weight: 500; background: var(--alerta-soft); border-radius: var(--radio-pill); padding: 2px 10px; }
.j-prog { height: 7px; background: rgba(244, 152, 23, 0.16); border-radius: 4px; margin-top: 12px; overflow: hidden; }
.j-prog-fill { height: 100%; background: var(--grad); border-radius: 4px; transition: width 500ms linear; }
.j-marcas { display: flex; justify-content: space-between; color: var(--texto-3); margin-top: 5px; }
.j-linea2 { color: var(--texto-2); font-size: 12px; font-weight: 500; margin-top: 8px; }

/* ===== tablero ===== */
.tablero-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; }
#buscar { max-width: 300px; }
.filtro-proyecto { max-width: 220px; }
.segmentado { display: none; }

.columnas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: start; }
.col-titulo { font-size: 13px; font-weight: 600; color: var(--texto-2); padding: 2px 2px 12px; display: flex; align-items: center; gap: 8px; }
.col-cuenta {
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  background: var(--surface-2); color: var(--texto-3);
  border-radius: var(--radio-pill); padding: 1px 8px;
}
.col-lista { display: grid; gap: 12px; }

.columna { border-radius: var(--radio); min-height: 80px; transition: background 150ms ease, outline-color 150ms ease; }
.columna.sobre { background: var(--primario-soft); outline: 2px dashed var(--primario); outline-offset: -4px; }

/* ===== tarjetas ===== */
.tarjeta {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radio);
  padding: 14px;
  display: grid;
  gap: 7px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}
.tarjeta:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.tarjeta[draggable="true"] { cursor: grab; user-select: none; -webkit-user-select: none; }
.tarjeta:active { cursor: grabbing; }

.tarjeta.arrastrando { opacity: 0.45; border-style: dashed; }
.tarjeta.insertar-antes { box-shadow: inset 0 2px 0 var(--primario), var(--shadow-sm); }
.tarjeta.insertar-despues { box-shadow: inset 0 -2px 0 var(--primario), var(--shadow-sm); }

.tarjeta.finalizada {
  background: var(--surface-2);
  border-color: transparent;
  box-shadow: none;
  color: var(--texto-2);
  opacity: 0.85;
}
.tarjeta.finalizada:hover { transform: none; box-shadow: none; background: #e7e9f0; }
.tarjeta.finalizada .t-titulo { color: var(--texto-2); font-weight: 500; }

.t-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.t-head-der { display: flex; align-items: center; gap: 6px; }
.d-head-der { display: flex; align-items: center; gap: 8px; }

.btn-eliminar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex: none;
  background: transparent;
  border: none;
  border-radius: 7px;
  color: var(--texto-3);
  cursor: pointer;
  opacity: 0;
  transition: background 140ms ease, color 140ms ease, opacity 140ms ease;
}
.btn-eliminar svg { width: 15px; height: 15px; }
.tarjeta:hover .btn-eliminar,
.d-head .btn-eliminar,
.btn-eliminar:focus-visible { opacity: 1; }
.btn-eliminar:hover { background: var(--exceso-soft); color: var(--exceso); }
.t-titulo { font-size: 14px; font-weight: 600; letter-spacing: -0.1px; line-height: 1.35; }
.t-meta { color: var(--texto-3); font-size: 12px; }
.t-meta.vencida { color: var(--exceso); font-weight: 600; }

.t-linea { display: flex; align-items: center; gap: 8px; }
.punto { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.punto-vivo { background: var(--bien); box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.18); }
.punto-pausa { background: var(--texto-3); }

.prog4 { height: 5px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.prog4-fill { height: 100%; border-radius: 3px; transition: width 500ms linear; }

.t-tiempo { color: var(--texto-2); }
.t-acciones { display: flex; gap: 8px; margin-top: 5px; flex-wrap: wrap; }

.vacio {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radio);
  color: var(--texto-3);
  padding: 26px 18px;
  text-align: center;
  display: grid;
  gap: 12px;
  justify-items: center;
  background: rgba(255, 255, 255, 0.5);
}

/* ===== mis tareas ===== */
.activo-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #fdf1dd, #fbf4e8);
  border: 1px solid #f3e2c4;
  border-radius: var(--radio);
  padding: 14px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}
.activo-strip .j-contador { font-size: 15px; }
.mias-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

/* ===== formularios ===== */
.form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radio);
  box-shadow: var(--shadow-sm);
  padding: 22px;
  display: grid;
  gap: 16px;
  max-width: 560px;
}
.form-titulo { font-size: 16px; font-weight: 700; letter-spacing: -0.2px; }
.fila-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.mini-proyecto { border-top: 1px solid var(--border); padding-top: 16px; display: grid; gap: 10px; }
.mini-titulo { font-size: 12px; font-weight: 600; color: var(--texto-2); letter-spacing: 0.2px; }

/* ===== reportes ===== */
.reportes-filtro { display: flex; gap: 12px; align-items: end; margin-bottom: 18px; flex-wrap: wrap; }
.reportes-filtro .campo { width: 160px; }

.rep-fila {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr 90px;
  gap: 10px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radio);
  box-shadow: var(--shadow-sm);
  padding: 14px 18px;
  margin-bottom: 10px;
  transition: box-shadow 140ms ease, transform 140ms ease;
}
.rep-fila:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.rep-nombre { font-weight: 600; }
.rep-dato { color: var(--texto-2); font-size: 13px; }
.rep-dato b { color: var(--texto); font-weight: 600; }
.rep-desv { text-align: right; font-weight: 600; padding: 4px 10px; border-radius: var(--radio-pill); font-family: var(--mono); }
.rep-desv.bien { background: var(--bien-soft); color: var(--bien); }
.rep-desv.alerta { background: var(--alerta-soft); color: var(--alerta); }
.rep-desv.exceso { background: var(--exceso-soft); color: var(--exceso); }

/* ===== usuarios ===== */
.usr-fila {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radio);
  box-shadow: var(--shadow-sm);
  padding: 14px 18px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.usr-info { display: grid; gap: 2px; }
.usr-nombre { font-weight: 600; }
.usr-acciones { display: flex; gap: 8px; flex-wrap: wrap; }
#vista-usuarios .form { margin-top: 18px; }

/* ===== detalle ===== */
.overlay { position: fixed; inset: 0; background: rgba(23, 27, 46, 0.4); backdrop-filter: blur(2px); z-index: 50; }
.detalle {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(440px, 100%);
  background: var(--bg);
  border-left: 1px solid var(--border);
  box-shadow: -12px 0 40px rgba(26, 31, 54, 0.12);
  overflow-y: auto;
  padding: 20px;
  display: grid;
  gap: 14px;
  align-content: start;
  animation: entrar-lateral 200ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes entrar-lateral { from { transform: translateX(50px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.d-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.d-titulo { font-size: 17px; font-weight: 700; letter-spacing: -0.3px; line-height: 1.3; }
.d-stats { display: flex; gap: 10px; flex-wrap: wrap; }
.d-stats span { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radio-sm); padding: 6px 12px; font-size: 13px; color: var(--texto-2); }
.d-seccion { font-size: 12px; font-weight: 700; color: var(--texto-2); letter-spacing: 0.2px; border-top: 1px solid var(--border); padding-top: 16px; margin-top: 6px; }
.d-form { display: flex; gap: 8px; flex-wrap: wrap; }
.d-form input { flex: 1; min-width: 140px; }

#desc-edit { min-height: 140px; resize: vertical; line-height: 1.55; }

.com { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radio); box-shadow: var(--shadow-sm); padding: 12px 14px; margin-bottom: 8px; display: grid; gap: 5px; }
.com-texto { white-space: pre-wrap; }
.d-registros { display: grid; gap: 6px; color: var(--texto-2); }
.reg-fila { display: flex; justify-content: space-between; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radio-sm); padding: 8px 12px; }
.act-fila { padding: 8px 0; border-bottom: 1px solid var(--border); display: grid; gap: 3px; }
.act-fila:last-child { border-bottom: none; }
.act-fila p { color: var(--texto-2); }

/* ===== toast ===== */
.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--texto);
  color: #fff;
  border-radius: var(--radio-sm);
  padding: 11px 18px;
  font-size: 13px;
  font-weight: 500;
  z-index: 100;
  box-shadow: var(--shadow-lg);
  animation: subir 180ms cubic-bezier(0.16, 1, 0.3, 1);
  max-width: calc(100vw - 32px);
}
.toast.error { background: var(--exceso); }
@keyframes subir { from { transform: translate(-50%, 10px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* ===== modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(23, 27, 46, 0.45);
  backdrop-filter: blur(2px);
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 16px;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 22px;
  width: 100%;
  max-width: 380px;
  display: grid;
  gap: 12px;
  animation: aparecer-modal 180ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes aparecer-modal { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal-titulo { font-size: 15px; font-weight: 700; letter-spacing: 0.02em; }
.modal-mensaje { color: var(--texto-2); font-size: 14px; }
.modal-input { width: 100%; }
.modal-acciones { display: flex; gap: 10px; justify-content: flex-end; }
.btn-peligro { background: var(--exceso); border: none; color: #fff; box-shadow: 0 4px 14px rgba(214, 69, 69, 0.35); }
.btn-peligro:hover { filter: brightness(1.06); }

/* animación de entrada de vistas */
.vista:not([hidden]) { animation: aparecer 200ms ease; }
@keyframes aparecer { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ============================================================
   móvil
   ============================================================ */
@media (max-width: 768px) {
  .shell { flex-direction: column; }

  .sidebar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    top: auto;
    width: 100%;
    height: 64px;
    flex-direction: row;
    padding: 0;
    gap: 0;
    z-index: 40;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }
  .brand, .sidebar-pie { display: none; }
  .btn-menu { display: none; }
  .tabs { flex-direction: row; flex: 1; gap: 0; }
  .tab { flex: 1; flex-direction: column; gap: 4px; font-size: 10px; justify-content: center; padding: 8px 2px; border-radius: 0; }
  .tab svg { width: 21px; height: 21px; }
  .tab.activo { background: transparent; color: #fff; }
  .tab.activo svg { color: var(--dorado); }

  .contenido { height: 100dvh; padding-bottom: 64px; }
  .cabecera { padding: 18px 18px 2px; }
  .cabecera h1 { font-size: 20px; }
  main { padding: 12px 18px 28px; }

  .segmentado { display: flex; gap: 0; border: 1px solid var(--border-strong); border-radius: var(--radio-sm); overflow: hidden; flex: 1; background: var(--surface); }
  .seg { flex: 1; background: transparent; border: none; color: var(--texto-2); cursor: pointer; font: inherit; font-size: 12px; font-weight: 500; padding: 9px 4px; }
  .seg.activo { background: var(--primario); color: #fff; }
  .tablero-toolbar { flex-wrap: wrap; }
  #buscar { max-width: none; flex: 1 1 100%; }
  .filtro-proyecto { max-width: none; flex: 1 1 100%; }

  .columnas { display: block; }
  .columna { display: none; min-height: 0; }
  .columna.col-activa { display: block; }

  .jornada { position: sticky; top: 0; z-index: 20; padding: 12px 14px; margin: -6px -6px 14px; border-radius: var(--radio); }
  .j-linea1 { flex-wrap: nowrap; gap: 8px; }
  .j-tarea { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .j-prog { height: 5px; margin-top: 8px; }
  .j-marcas, .j-linea2 { display: none; }

  .t-acciones .btn { width: 100%; min-height: 44px; }
  .j-linea1 .btn, .activo-strip .btn { min-height: 44px; }

  .btn-eliminar { opacity: 1; width: 34px; height: 34px; }
  .btn-eliminar svg { width: 18px; height: 18px; }

  .overlay { position: static; background: transparent; }
  .detalle { position: static; width: 100%; min-height: 100dvh; border-left: none; box-shadow: none; animation: entrar-abajo 200ms cubic-bezier(0.16, 1, 0.3, 1); }
  @keyframes entrar-abajo { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
  body.detalle-abierto .shell { display: none; }

  .form { max-width: none; border: none; background: transparent; box-shadow: none; padding: 4px 0; }
  .fila-2 { grid-template-columns: 1fr; }

  .rep-fila { grid-template-columns: 1fr 1fr; padding: 14px; }
  .rep-nombre { grid-column: 1 / -1; }
  .rep-desv { text-align: left; justify-self: start; }

  .toast { bottom: 80px; }
}


/* Imagen Adjunta */
.img-adjunta {
  max-width: 100%;
  max-height: 400px;
  border-radius: 6px;
  margin-top: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  cursor: zoom-in;
  object-fit: contain;
  display: block;
}



/* Editor Visual */
.ce-editor {
  border: 1px solid var(--borde);
  border-radius: 6px;
  padding: 12px;
  min-height: 48px;
  background: var(--fondo);
  outline: none;
  font-family: inherit;
  color: inherit;
  overflow-y: auto;
}
.ce-editor:focus {
  border-color: var(--primario);
  box-shadow: 0 0 0 3px rgba(245, 124, 0, 0.1);
}
.ce-editor[data-placeholder]:empty:before {
  content: attr(data-placeholder);
  color: #999;
}


/* Mejoras visuales Comentarios y Visor */
#form-comentario { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; background: #fff; padding: 16px; border-radius: 8px; border: 1px solid var(--border-strong); box-shadow: 0 2px 6px rgba(0,0,0,0.04); margin-top: 16px; }
#form-comentario .ce-editor { width: 100%; min-height: 80px; border: 1px solid var(--border); box-shadow: inset 0 1px 3px rgba(0,0,0,0.03); font-size: 14px; background: #fafafa; transition: border-color 0.2s, background 0.2s; }
#form-comentario .ce-editor:focus { background: #fff; border-color: var(--primario); }
#form-comentario button { align-self: flex-end; padding: 10px 24px; font-weight: 600; }

.img-adjunta { max-width: 100%; height: 120px; object-fit: cover; border-radius: 6px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); border: 1px solid var(--border-strong); margin-top: 8px; transition: transform 0.2s; }
.img-adjunta:hover { transform: scale(1.02); }

#visor-img-close { position: absolute; top: 20px; right: 20px; font-size: 40px; color: white; background: transparent; border: none; cursor: pointer; opacity: 0.8; z-index: 10000; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }
#visor-img-close:hover { opacity: 1; }


/* Estilos para Hilos de Comentarios */
.hilo-padre {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.hilo-hijo {
  border-left: 3px solid #e0e7ff;
  padding-left: 20px;
  margin-top: 20px;
  margin-left: 24px;
  background: #f8f9ff;
  border-radius: 0 8px 8px 0;
  padding-top: 14px;
  padding-right: 16px;
  padding-bottom: 14px;
}
.hilo-form {
  margin-top: 16px;
  background: #f8faff;
  border: 1px dashed #c7d2fe;
  border-radius: 8px;
  padding: 16px;
}
.hilo-form .ce-editor {
  min-height: 72px;
  width: 100%;
  font-size: 14px;
  background: #fff;
  border: 1px solid #c7d2fe;
  border-radius: 6px;
  margin-bottom: 12px;
}
.hilo-form .hilo-form-btns {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.hilo-acciones {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.hilo-meta { font-size: 12px; color: var(--texto-3); }
.hilo-botones { display: flex; align-items: center; gap: 8px; }
.badge-comentarios {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e0e7ff;
  color: #3730a3;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: bold;
  margin-left: 8px;
  cursor: pointer;
  transition: background 0.2s;
}
.badge-comentarios:hover { background: #c7d2fe; }


.badge-icon { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; font-size: 13px; color: var(--texto-3); opacity: 0.8; }
