/* MARQA Dashboard — estilos */
:root {
  --bg: #F7F7F7;           /* base casi blanca, neutra (gris claro oficial) */
  --card: #FFFFFF;
  --ink: #1A1A1A;          /* texto principal (negro de marca, suavizado) */
  --ink-soft: #717171;     /* gris oscuro: textos secundarios y apoyo */
  --line: #E6E6E6;         /* gris claro oficial: líneas y separadores */
  --accent: #1A1A1A;
  --negro: #111111;        /* negro de marca (topbar, KPI principal) */
  --marqa: #D7C724;        /* amarillo Pantone 611 C: acento de marca */
  --marqa-soft: #FBF6D3;
  --marqa-tint: rgba(215, 199, 36, .16);   /* amarillo translúcido suave */
  --marqa-tint-2: rgba(215, 199, 36, .30); /* amarillo translúcido medio */
  --blue: #3B7DD8;
  --red: #C8401F;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 16px rgba(0,0,0,.05);
  --font-display: 'Montserrat', 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Montserrat', 'Segoe UI', system-ui, sans-serif;
  font-size: 13.5px;
  color: var(--ink);
  background: var(--bg);
}
/* Botones e inputs no heredan la fuente por defecto: forzamos Montserrat (MARQA) */
button, input, select, textarea, optgroup {
  font-family: 'Montserrat', 'Segoe UI', system-ui, sans-serif;
}
h1, h2, h3, h4 { margin: 0 0 10px; font-weight: 600; font-family: var(--font-display); }
h3 { font-size: 15px; font-family: var(--font-display); }
h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); }
.hint { color: var(--ink-soft); font-size: 12px; margin: 2px 0 10px; }
.empty-note { color: var(--ink-soft); font-style: italic; padding: 8px 0; }

/* ── Topbar (negro de marca, logo blanco) ── */
.topbar {
  display: flex; align-items: center; gap: 18px;
  background: var(--negro);
  padding: 0 18px; height: 58px; position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.brand img { height: 34px; display: block; }
.brand:hover img { opacity: .75; }
.tabs { display: flex; gap: 2px; flex: 1; }
.tab-btn {
  background: none; border: none; padding: 20px 14px; cursor: pointer;
  font-family: var(--font-display); font-size: 13px; font-weight: 500;
  color: #8F8F88; border-bottom: 3px solid transparent;
}
.tab-btn.active { color: #fff; border-bottom-color: var(--marqa); font-weight: 600; }
.tab-btn:hover { color: #fff; }
.tab-btn.tab-right { margin-left: auto; }
.topbar .btn { background: transparent; border-color: #3A3A34; color: #D8D8D2; }
.topbar .btn:hover { background: #26261F; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.mode-badge { font-size: 12px; padding: 3px 10px; border-radius: 20px; font-weight: 600; }
.mode-badge.admin { background: #FBEAE5; color: var(--red); }
.mode-badge.equipo { background: #E8F0E2; color: #4A7A35; }

main { padding: 18px; max-width: 1400px; margin: 0 auto; }

/* ── Cards / layout ── */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 16px;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
.chart-box { height: 240px; position: relative; }
.chart-box.tall { height: 320px; }

/* ── Botones / inputs ── */
.btn {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 15px; cursor: pointer; font-size: 13px; color: var(--ink);
}
.btn:hover { background: #F2F2F2; }
.btn.primary { background: var(--negro); color: #fff; border-color: var(--negro); }
.btn.primary:hover { background: var(--marqa); color: var(--negro); border-color: var(--marqa); }
.btn.danger { background: #FBEAE5; color: var(--red); border-color: #EBC4B8; }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn.icon { padding: 4px 8px; font-size: 13px; line-height: 1; }
.btn.wide { width: 100%; }
input, select {
  border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px;
  font-size: 13px; font-family: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus { outline: 2px solid rgba(212,196,30,.55); }

/* ── Toolbar / pills ── */
.view-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.view-toolbar input[type=search] { flex: 1; min-width: 220px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  border: 1px solid var(--line); background: var(--card); border-radius: 20px;
  padding: 5px 13px; font-size: 12px; cursor: pointer; color: var(--ink-soft);
}
.pill.active {
  background: var(--pill-color, var(--marqa-tint-2)); border-color: var(--pill-color, var(--marqa));
  color: var(--negro); font-weight: 600;
}
.pill.active[style*="--pill-color"] { color: #fff; }

/* ── Avatares / tags ── */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; color: #fff; font-weight: 700; flex: none;
  vertical-align: middle;
}
.tag {
  display: inline-block; background: #ECECEC; border-radius: 5px;
  padding: 2px 8px; font-size: 11.5px; font-weight: 600;
}
.tag.soft { background: #F0F0F0; color: var(--ink-soft); font-weight: 500; }
.tag.purple { background: #333333; color: #fff; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.dot.big { width: 13px; height: 13px; }

/* ── Métricas / alertas ── */
.avance-legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 11.5px; color: var(--ink-soft); margin-bottom: 12px; }
.avance-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }
.metric-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.card.metric { text-align: left; padding: 15px 16px; margin: 0; display: flex; flex-direction: column; gap: 7px; transition: box-shadow .15s, transform .15s; }
.card.metric:hover { transform: translateY(-1px); box-shadow: 0 2px 4px rgba(22,22,20,.06), 0 8px 22px rgba(22,22,20,.08); }
.metric-top { display: flex; align-items: center; gap: 6px; color: #9CA3AF; }
.metric-top svg { width: 14px; height: 14px; flex: none; }
.metric-num { font-size: 27px; font-weight: 700; font-family: var(--font-display); line-height: 1; color: var(--ink); }
.metric-lbl { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: #9CA3AF; font-weight: 600; margin: 0; }
.metric-ctx { font-size: 10.5px; color: #A8A7A1; }
.metric-name { font-size: 16px; font-weight: 700; font-family: var(--font-display); line-height: 1.15; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Ranking de cobranza por cliente */
.cli-rank { overflow-x: auto; }
.cli-row {
  display: grid; grid-template-columns: minmax(140px, 1.4fr) repeat(5, minmax(80px, 1fr));
  gap: 8px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 12.5px;
}
.cli-row > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cli-row > span:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.cli-row:last-child { border-bottom: none; }
.cli-head { font-size: 10.5px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.card.metric.metric-primary { background: var(--marqa-tint); border-color: rgba(215,199,36,.45); }
.metric-primary .metric-num { color: var(--ink); }
.metric-primary .metric-top, .metric-primary .metric-lbl { color: #9A8B14; }
.metric-primary .metric-ctx { color: #A99A2E; }
.alerts { margin-bottom: 14px; display: flex; flex-direction: column; gap: 6px; }
.alert { padding: 9px 13px; border-radius: 8px; font-size: 13px; }
.alert.warn { background: #FBF0E5; color: #9A5B17; border: 1px solid #EDD9BE; }
.alert.ok { background: #E8F0E2; color: #4A7A35; border: 1px solid #CFE0C2; }
.alert.small { font-size: 12px; padding: 6px 10px; margin-bottom: 8px; }

/* ── Barras horizontales ── */
.hbar-row { display: flex; align-items: center; gap: 10px; margin: 7px 0; }
.hbar-row.clickable { cursor: pointer; }
.hbar-row.clickable:hover .hbar-label { text-decoration: underline; }
.hbar-label { width: 180px; flex: none; font-size: 12.5px; display: flex; align-items: center; gap: 7px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-track { flex: 1; height: 14px; background: #ECECEC; border-radius: 7px; position: relative; overflow: hidden; }
.hbar-track.small { height: 8px; max-width: 90px; }
.hbar-fill { height: 100%; border-radius: 7px; transition: width .25s; }
.hbar-100 { position: absolute; left: 76.9%; top: -2px; bottom: -2px; width: 2px; background: var(--red); }
.hbar-val { width: 120px; flex: none; font-size: 12px; text-align: right; }
.hbar-val small { color: var(--ink-soft); }
.hbar-pct { width: 44px; flex: none; font-size: 12.5px; font-weight: 600; text-align: right; }
.hbar-etapa {
  width: 210px; flex: none; font-size: 12px; color: var(--ink-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Lista compacta de proyectos ── */
.proj-mini-list { display: flex; flex-direction: column; }
.proj-mini {
  display: flex; align-items: center; gap: 10px; padding: 7px 6px;
  border-bottom: 1px solid var(--line); font-size: 13px;
}
.proj-mini:last-child { border-bottom: none; }
.proj-mini.clickable { cursor: pointer; }
.proj-mini.clickable:hover { background: #FAFAFA; }
.proj-mini-num { color: var(--ink-soft); width: 22px; text-align: right; flex: none; }
.proj-mini-name { font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-mini-cliente {
  color: var(--ink-soft); width: 150px; flex: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.proj-mini-etapa {
  color: var(--ink-soft); font-size: 12px; width: 235px; flex: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Gantt maestro ── */
.gantt-grid { display: grid; grid-template-columns: 240px 1fr; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.gantt-names { border-right: 1px solid var(--line); }
.gantt-name-header { height: 34px; border-bottom: 1px solid var(--line); }
.gantt-name {
  height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 10px;
  border-bottom: 1px solid var(--line); font-size: 13px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gantt-name:hover { background: #FAFAFA; }
.g-num { color: var(--ink-soft); font-size: 11px; width: 18px; text-align: right; flex: none; }
.gantt-timeline { position: relative; overflow: hidden; }
.gantt-months { position: relative; height: 34px; border-bottom: 1px solid var(--line); }
.gantt-month-label {
  position: absolute; top: 0; height: 100%; display: flex; align-items: center;
  justify-content: center; font-size: 11px; color: var(--ink-soft);
  border-left: 1px dotted transparent; overflow: hidden;
}
.gantt-gridline { position: absolute; top: 34px; bottom: 0; width: 1px; background: #ECECEC; }
.gantt-today { position: absolute; top: 34px; bottom: 0; width: 2px; background: var(--red); z-index: 5; }
.gantt-row { position: relative; height: 38px; border-bottom: 1px solid var(--line); cursor: pointer; }
.gantt-row:hover { background: #FAFAFA; }
.gantt-bar {
  position: absolute; top: 7px; height: 24px; border-radius: 5px;
  display: flex; align-items: center; overflow: visible; min-width: 4px;
}
.gantt-bar.clip-left { border-left: 2px dashed rgba(255,255,255,.9); border-top-left-radius: 0; border-bottom-left-radius: 0; }
.gantt-bar.clip-right { border-right: 2px dashed rgba(255,255,255,.9); border-top-right-radius: 0; border-bottom-right-radius: 0; }
.gantt-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: rgba(255,255,255,.35); border-radius: 5px 0 0 5px; pointer-events: none;
}
.gantt-bar-label {
  position: relative; color: #fff; font-size: 11px; font-weight: 600; padding: 0 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: calc(100% - 26px);
  text-shadow: 0 1px 1px rgba(0,0,0,.25);
}
.gantt-bar-avatar { position: absolute; right: -10px; top: 0; }
.gantt-bar-avatar .avatar { border: 2px solid #fff; box-shadow: var(--shadow); }

.pj-subtabs { margin-bottom: 12px; }
.pj-subtabs .pill { font-size: 13.5px; padding: 7px 18px; }

/* ── Mapa de proyectos ── */
.pj-layout.with-map {
  display: grid; grid-template-columns: minmax(0, 1fr) 460px;
  gap: 14px; align-items: start;
}
.pj-map-col { position: sticky; top: 70px; }
.pj-map-col .card { margin-bottom: 0; }
.marqa-map { height: calc(100vh - 220px); min-height: 360px; border-radius: 8px; z-index: 0; }
.map-status { margin: 8px 0 0; }
.map-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 8px; }
.map-leg-item { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--ink-soft); }
.map-leg-item i { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.rs-bottom {
  display: grid; grid-template-columns: minmax(0, 1fr) 460px;
  gap: 14px; align-items: stretch;
}
.rs-bottom .card { margin-bottom: 0; }
.rs-map-card { display: flex; flex-direction: column; }
.rs-map-card #rs-map-box { flex: 1; display: flex; flex-direction: column; }
.rs-map-card .marqa-map { flex: 1; height: auto; min-height: 320px; }
.geo-status { font-size: 11.5px; color: var(--ink-soft); padding-top: 3px; }
@media (max-width: 1000px) {
  .pj-layout.with-map, .rs-bottom { grid-template-columns: 1fr; }
  .pj-map-col { position: static; order: -1; }
  .marqa-map { height: 320px; }
}

/* ── Lista compacta de proyectos (fila clickeable) ── */
.proj-row-card {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  margin-bottom: 8px; cursor: pointer; transition: box-shadow .12s, transform .12s;
}
.proj-row-card:hover { box-shadow: 0 4px 14px rgba(22,22,20,.12); transform: translateX(2px); }
.proj-row-card .proj-num { color: var(--ink-soft); font-size: 12px; width: 22px; text-align: right; }
.proj-row-card .proj-name { font-weight: 700; font-size: 14px; }
.proj-row-card .proj-tags { display: flex; gap: 6px; flex: 1; flex-wrap: wrap; }
.proj-row-card .proj-head-right { display: flex; align-items: center; gap: 10px; }
.proj-row-card .chev { color: var(--ink-soft); font-size: 18px; }
.proj-row-card.is-new { outline: 2px solid var(--marqa); }

/* ── Página de proyecto ── */
.pp-header {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 4px 0 14px; border-bottom: 1px solid var(--line); margin-bottom: 12px;
}
.pp-header h2 { font-family: var(--font-display); font-size: 18px; margin: 0; }
.pp-header .proj-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.pp-num { color: var(--ink-soft); font-size: 13px; font-weight: 600; }
.pp-back { flex: none; }
.pp-header-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.pp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.pp-grid .pp-panel { margin-bottom: 0; min-width: 0; }
.pp-grid .pp-span2 { grid-column: 1 / -1; }
.pp-panel .proj-section { margin: 0; }
@media (max-width: 900px) {
  .pp-grid { grid-template-columns: 1fr; }
  .pp-grid .pp-panel { grid-column: 1 / -1; }
}

/* ── Tablero de tareas ── */
.tareas-add { display: flex; gap: 8px; margin-bottom: 14px; }
.tareas-add .tarea-nueva { flex: 1; max-width: 420px; }
.tareas-board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.tareas-col { flex: 0 0 220px; background: #F1F1F1; border-radius: 10px; padding: 8px; min-height: 90px; }
.tareas-col[data-estado="Por hacer"]   { background: #FBEAE6; } /* rojo tenue */
.tareas-col[data-estado="En curso"]    { background: #FBF3DC; } /* ámbar tenue */
.tareas-col[data-estado="En revisión"] { background: #E9EFF6; } /* azul tenue */
.tareas-col[data-estado="Hecho"]       { background: #E9F1E4; } /* verde tenue */
.tareas-col.drop-target { outline: 2px dashed var(--marqa); outline-offset: -2px; background: var(--marqa-soft); }
.tareas-col-head { font-family: var(--font-display); font-size: 12px; font-weight: 600; padding: 4px 6px 10px; display: flex; justify-content: space-between; align-items: center; }
.tareas-cards { display: flex; flex-direction: column; gap: 8px; min-height: 24px; }
.tarea-card { background: #fff; border-radius: 8px; box-shadow: var(--shadow); padding: 8px 9px; }
.tarea-card.hecha { opacity: .6; }
.tarea-card.dragging { opacity: .45; }
.tarea-top { display: flex; align-items: center; gap: 6px; }
.tk-handle { cursor: grab; color: var(--ink-soft); font-size: 13px; flex: none; }
.tk-handle:active { cursor: grabbing; }
.tk-titulo { flex: 1; min-width: 0; font-size: 12.5px; padding: 4px 6px; }
.tk-titulo-ro { flex: 1; font-size: 12.5px; }
.tarea-meta { display: flex; align-items: center; gap: 6px; margin-top: 7px; }
.tarea-meta .tk-pid { flex: 1; min-width: 0; font-size: 11.5px; padding: 3px 5px; }
.tarea-meta .tk-due { font-size: 11px; padding: 3px 4px; width: 120px; }

/* ── Fichas de proyecto ── */
.proj-card { padding: 0; overflow: hidden; }
.proj-card.is-new { outline: 2px solid var(--blue); }
.proj-head {
  display: flex; align-items: center; gap: 10px; padding: 13px 16px; cursor: pointer;
}
.proj-head:hover { background: #FAFAFA; }
.proj-num { color: var(--ink-soft); font-size: 12px; width: 20px; text-align: right; }
.proj-name { font-weight: 700; font-size: 14.5px; }
.proj-tags { display: flex; gap: 6px; flex: 1; flex-wrap: wrap; }
.proj-head-right { display: flex; align-items: center; gap: 10px; }
.badge-hh { background: #ECECEC; border-radius: 5px; padding: 2px 9px; font-size: 11.5px; font-weight: 600; color: var(--ink-soft); }
.chev { color: var(--ink-soft); }
.proj-body { border-top: 1px solid var(--line); padding: 16px; display: flex; flex-direction: column; gap: 18px; }
.proj-section h4 { margin-bottom: 8px; }
.proj-section h4 .st-toggle { margin-left: 10px; text-transform: none; letter-spacing: 0; font-weight: 500; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.fld { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--ink-soft); }
.fld.ro span { font-size: 13.5px; color: var(--ink); padding: 4px 0; }
.same-client { margin-top: 10px; font-size: 12.5px; color: var(--ink-soft); }
.same-client a { color: var(--blue); }
.proj-actions {
  display: flex; justify-content: space-between; align-items: center;
  border-top: 1px solid var(--line); padding-top: 14px;
}

.team-row, .bit-row, .link-row, .cab-row {
  display: flex; align-items: center; gap: 10px; padding: 7px 0;
  border-bottom: 1px solid var(--line); font-size: 13px;
}
.team-row:last-child, .bit-row:last-child, .link-row:last-child, .cab-row:last-child { border-bottom: none; }
.team-name { width: 170px; flex: none; }
.team-pct { font-weight: 600; }
.team-add, .bit-add, .link-add, .cab-add { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.bit-add input#bit-text, .link-add input#lk-url, .cab-add input#cb-nombre { flex: 1; min-width: 180px; }
.bit-row { align-items: flex-start; flex-direction: column; gap: 2px; position: relative; }
.bit-meta { font-size: 12px; color: var(--ink-soft); }
.bit-row .btn.icon { position: absolute; right: 0; top: 8px; }
/* Historial automático: encabezado colapsable + línea de tiempo */
.hist-toggle { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: none; padding: 0; cursor: pointer; color: var(--ink); }
.hist-chev { color: var(--ink-soft); font-size: 12px; }
.hist-list { max-height: 320px; overflow-y: auto; padding-left: 4px; margin-top: 10px; }
.hist-row { display: flex; gap: 10px; padding: 7px 0; position: relative; }
.hist-row::before { content: ''; position: absolute; left: 3px; top: 16px; bottom: -7px; width: 1px; background: var(--line); }
.hist-row:last-child::before { display: none; }
.hist-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--marqa); margin-top: 6px; z-index: 1; }
.hist-body { flex: 1; }
.hist-text { font-size: 13px; line-height: 1.35; }
.hist-meta { font-size: 11px; color: var(--ink-soft); margin-top: 1px; }
.link-chip {
  display: inline-block; background: var(--marqa-soft); color: var(--ink);
  border: 1px solid #E5DCA0; border-radius: 7px; padding: 6px 14px;
  font-size: 13px; font-weight: 600; text-decoration: none;
}
.link-chip:hover { background: var(--marqa); border-color: var(--marqa); }
.link-spacer { flex: 1; }
/* Cabidas con ficha general expandible */
.cab-row2 { border-bottom: 1px solid var(--line); padding: 4px 0; }
.cab-row2:last-child { border-bottom: none; }
.cab-head { display: flex; align-items: center; gap: 8px; }
.cab-nombre { font-size: 13.5px; }
.cab-sub { color: var(--ink-soft); font-size: 12px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cab-head-right { display: flex; align-items: center; gap: 8px; flex: none; }
.cab-detalle { padding: 10px 0 12px 32px; }
.cab-edit-bar { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.cab-ficha .fields { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.cab-links { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.cab-links-title { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); font-weight: 600; margin-bottom: 8px; }
.cab-main { flex: 1; min-width: 0; }
.cab-edit {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-top: 5px; font-size: 12px; color: var(--ink-soft);
}
.cab-edit .cb-pct { width: 58px; }
.cab-edit input[type=date] { font-size: 12px; padding: 3px 5px; width: 126px; }
.cab-meta { color: var(--ink-soft); font-size: 12px; }

/* ── Tablero Kanban ── */
.kanban-board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 10px; align-items: flex-start; }
.kanban-col {
  flex: 0 0 224px; background: #F1F1F1; border-radius: 10px;
  padding: 8px; min-height: 140px; transition: background .12s, outline .12s;
}
.kanban-col.drop-target { outline: 2px dashed var(--marqa); outline-offset: -2px; background: var(--marqa-soft); }
.kanban-col-head {
  font-family: var(--font-display); font-size: 12px; font-weight: 600;
  padding: 4px 6px 10px; display: flex; justify-content: space-between;
  align-items: center; color: var(--ink); gap: 6px;
}
.kanban-count { background: var(--negro); color: #fff; border-radius: 10px; padding: 1px 8px; font-size: 11px; font-weight: 600; }
.kanban-cards { display: flex; flex-direction: column; gap: 8px; min-height: 30px; }
.kanban-card {
  background: #fff; border-radius: 8px; box-shadow: var(--shadow);
  padding: 9px 10px; border-left: 4px solid #888; cursor: pointer;
}
.kanban-card.movable { cursor: grab; }
.kanban-card.movable:active { cursor: grabbing; }
.kanban-card.dragging { opacity: .45; }
.kanban-card-top { display: flex; align-items: center; gap: 6px; }
.kanban-card-name {
  font-weight: 600; font-size: 12.5px; flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kanban-mini-bar { height: 4px; background: #ECECEC; border-radius: 2px; margin: 7px 0 5px; overflow: hidden; }
.kanban-mini-fill { height: 100%; border-radius: 2px; }
.kanban-card-meta { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 11px; color: var(--ink-soft); }
/* Tarjetas de tarea del Tablero del estudio */
.movable-task .kanban-card-name { white-space: normal; font-size: 13px; margin-bottom: 5px; }
.movable-task .kt-proj { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kt-due { font-size: 10.5px; color: var(--ink-soft); margin-top: 5px; }
.kt-due.vencida { color: var(--red); font-weight: 600; }
.kanban-card[data-estado="Por hacer"]   { border-left-color: #C8401F; }
.kanban-card[data-estado="En curso"]    { border-left-color: var(--marqa); }
.kanban-card[data-estado="En revisión"] { border-left-color: #6E6E6E; }
.kanban-card[data-estado="Hecho"]       { border-left-color: #9C9C9C; }
.kanban-col-head[data-estado="En curso"] .kanban-count { background: var(--marqa); color: var(--negro); }

/* ── Gantt por proyecto ── */
.pgantt { margin-bottom: 4px; }
.pgantt-row { display: flex; align-items: center; gap: 10px; margin: 3px 0; }
.pgantt-label {
  width: 230px; flex: none; font-size: 12px; color: var(--ink-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pgantt-track { flex: 1; height: 16px; background: #F0F0F0; border-radius: 4px; position: relative; }
.pgantt-bar { position: absolute; top: 2px; bottom: 2px; border-radius: 3px; }
.pgantt-today { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--red); }
.pm-row .pm-email { width: 190px; }

/* ── Facturación ── */
.fact-section { border-top: 2px solid var(--marqa); padding-top: 12px; }
.fact-top { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.fact-top .fld input, .fact-top .fld select { width: 130px; }
.fact-top .fld .ft-ufm2 { width: 100px; }
.fact-x { font-size: 12.5px; color: var(--ink-soft); padding-bottom: 9px; white-space: nowrap; }
.fact-resumen { font-size: 12.5px; color: var(--ink-soft); padding-bottom: 6px; }
.fact-scroll { overflow-x: auto; margin-bottom: 8px; }
.fact-inner { min-width: 1020px; }
.fact-grid-head, .fact-row {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) 56px 84px 168px 110px 110px 84px 122px 26px 26px;
  gap: 6px; align-items: center;
}
/* Variante con columna CLP (moneda UF) */
.fact-inner.fc-clp { min-width: 1110px; }
.fact-inner.fc-clp .fact-grid-head, .fact-inner.fc-clp .fact-row {
  grid-template-columns: minmax(170px, 1fr) 56px 84px 88px 168px 110px 110px 84px 122px 26px 26px;
}
.fact-grid-head {
  font-size: 10.5px; color: var(--ink-soft); text-transform: uppercase;
  letter-spacing: .04em; font-weight: 600; padding: 2px 0 6px;
  border-bottom: 1px solid var(--line);
}
.fact-row { padding: 4px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.fact-row:last-child { border-bottom: none; }
.fact-row input, .fact-row select { width: 100%; font-size: 12px; padding: 4px 5px; }
.fact-row input:disabled { background: #F0F0F0; color: #B5B4AE; }
.fc-vence { font-size: 12px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fact-sum { font-size: 12px; font-weight: 600; }
.fact-sum.ok { color: #4A7A35; }
.fact-sum.warn { color: #C8401F; }
.ft-plantilla { margin-left: 8px; }
.fact-read-top { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.fact-inner-read { min-width: 880px; }
.fact-read-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 70px 110px 110px 100px 84px 100px;
  gap: 6px; align-items: center; padding: 5px 0;
  border-bottom: 1px solid var(--line); font-size: 12.5px;
}
.fact-read-row:last-child { border-bottom: none; }
.fact-read-row > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Variante con columna CLP (cuando hay valor UF) */
.fact-inner-read.fc-clp { min-width: 1000px; }
.fact-inner-read.fc-clp .fact-read-row {
  grid-template-columns: minmax(180px, 1fr) 70px 110px 110px 110px 100px 84px 100px;
}
/* Celda de concepto con check de "extra" */
.fc-con-cell { display: flex; align-items: center; gap: 6px; min-width: 0; }
.fact-row .fc-con-cell .fc-con { flex: 1; min-width: 0; width: auto; }
.fact-row input.fc-extra { flex: none; width: 15px; height: 15px; cursor: pointer; accent-color: var(--marqa); }
/* Reordenar hitos: flechas compactas apiladas */
.fc-move, .stage-move { display: inline-flex; flex-direction: column; flex: none; }
.stage-move .btn.icon { padding: 0 3px; font-size: 8px; line-height: 1.3; border: none; background: none; color: var(--ink-soft); }
.stage-move .btn.icon:hover:not(:disabled) { color: var(--ink); }
.stage-move .btn.icon:disabled { opacity: .25; cursor: default; }
.fact-row .fc-move .btn.icon { padding: 0 3px; font-size: 8px; line-height: 1.3; border: none; background: none; color: var(--ink-soft); width: auto; }
.fact-row .fc-move .btn.icon:hover:not(:disabled) { color: var(--ink); }
.fact-row .fc-move .btn.icon:disabled { opacity: .25; cursor: default; }
.tag.extra { background: #FBF0E5; color: #9A5B17; font-size: 10px; }
.fact-read-head {
  font-size: 10.5px; color: var(--ink-soft); text-transform: uppercase;
  letter-spacing: .04em; font-weight: 600;
}
.fact-inner-h { min-width: 880px; }
.fact-row-h {
  grid-template-columns: minmax(170px, 1fr) 70px 90px 122px 110px 84px 122px 26px;
}
.fact-actions { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
.ft-carta-fld { display: block; margin: 12px 0; font-size: 12px; color: var(--ink-soft); }
.ft-carta-fld input { display: block; width: 100%; max-width: 480px; margin-top: 4px; }
.fact-detalle { width: 320px; flex: none; font-size: 12px; color: var(--ink-soft); text-align: right; }
.fact-view .hbar-track { position: relative; }

/* ── Etapas ── */
.stage-row {
  display: flex; align-items: center; gap: 8px; row-gap: 6px; flex-wrap: wrap;
  padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px;
}
.stage-row:last-child { border-bottom: none; }
.stage-dot { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.stage-name { width: 230px; flex: none; }
.status-done .stage-name { color: var(--ink-soft); }
.status-active .stage-name { font-weight: 700; }
.stage-dates { flex: 1; color: var(--ink-soft); font-size: 12px; }
.stage-wks { width: 60px; }
.stage-active, .stage-block { font-size: 12px; color: var(--ink-soft); display: flex; align-items: center; gap: 3px; }
.st-label-in { width: 180px; flex: none; font-size: 13px; }
.st-modo { font-size: 12px; max-width: 140px; }
.st-ini, .st-fin { font-size: 12px; padding: 4px 5px; width: 128px; }
.stage-row .stage-wks { width: 50px; }
.pgantt-ms {
  position: absolute; top: 2px; width: 12px; height: 12px;
  transform: rotate(45deg); margin-left: -6px;
  border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.12);
}

.pm-2lines { flex: 1; min-width: 0; }
.pm-2lines .proj-mini-name {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pm-sub { font-size: 12px; color: var(--ink-soft); margin-top: 1px; }

/* ── Clientes ── */
.clients-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.client-card.multi { border-left: 4px solid #333333; }
.client-card.warn { border-left: 4px solid #E0A93C; }
.client-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; gap: 8px; }
.cab-mini { opacity: .7; }
.cab-mini:hover { opacity: 1; }

/* ── Gestión de personas ── */
.pm-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pm-row {
  display: flex; align-items: center; gap: 8px; padding: 6px 0;
  border-bottom: 1px solid var(--line); font-size: 13px;
}
.pm-row:last-child { border-bottom: none; }
.pm-row.inactive { opacity: .45; }
.pm-id { width: 36px; font-weight: 700; color: var(--ink-soft); font-size: 12px; }
.pm-row .pm-name { flex: 1; min-width: 140px; }
.pm-row .pm-role { width: 200px; }
.pm-active { font-size: 12px; color: var(--ink-soft); display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.pm-add { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.pm-add #pm-name { flex: 1; min-width: 180px; }
.btn[disabled] { opacity: .35; cursor: not-allowed; }

/* ── Equipo ── */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.person-card { margin: 0; }
.person-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.person-head > div { flex: 1; }
.person-total { font-size: 19px; font-weight: 700; }

/* ── Heatmap / tablas ── */
.heatmap-scroll { overflow-x: auto; }
.heatmap { border-collapse: collapse; width: 100%; font-size: 12px; }
.heatmap th, .heatmap td { border: 1px solid var(--line); padding: 5px 7px; text-align: center; min-width: 42px; }
.heatmap tbody th { text-align: left; white-space: nowrap; background: #FAFAFA; }
.heatmap thead th { background: #FAFAFA; color: var(--ink-soft); font-weight: 600; }
.hh-table td { min-width: 50px; }
.hh-rol { white-space: nowrap; color: var(--ink-soft); }
.hh-timeline { display: flex; height: 18px; border-radius: 5px; overflow: hidden; margin: 8px 0 4px; }
.hh-seg { height: 100%; }

/* ── Login / modal ── */
.login-overlay, .modal-overlay {
  position: fixed; inset: 0; background: rgba(43,42,40,.45);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.login-overlay { background: var(--negro); }
.login-box { width: 340px; text-align: center; padding: 34px 30px 28px; border-top: 4px solid var(--marqa); }
.login-logo { width: 230px; max-width: 100%; display: block; margin: 4px auto 2px; }
.btn.google {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  padding: 10px; font-size: 14px; font-weight: 600; margin-top: 10px;
}
.login-fallback { margin-top: 16px; text-align: left; }
.login-fallback summary { font-size: 12px; color: var(--ink-soft); cursor: pointer; text-align: center; }
.login-fallback form { margin-top: 10px; }
.login-fallback .fld { margin-bottom: 12px; }
.login-box .fld { text-align: left; margin-bottom: 12px; }
.login-error { color: var(--red); font-size: 12.5px; min-height: 18px; margin-bottom: 8px; }
.modal-box { width: 340px; }
.modal-box .fld { margin-bottom: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ── Tooltip / toast ── */
.tooltip {
  position: fixed; z-index: 200; background: var(--ink); color: #fff;
  border-radius: 8px; padding: 10px 12px; font-size: 12px; line-height: 1.5;
  max-width: 280px; pointer-events: none; box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
.toast {
  position: fixed; bottom: 22px; right: 22px; z-index: 300;
  background: var(--ink); color: #fff; border-radius: 8px; padding: 10px 16px;
  font-size: 13px; opacity: 0; transform: translateY(8px); transition: all .2s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: none; }
.toast.error { background: var(--red); }

/* ── Mis proyectos ── */
/* Zona superior: 2 columnas — izq (Hola + Advertencias + Gantt) | der (Mis tareas + Pendientes) */
.mp-top { display: flex; gap: 14px; align-items: stretch; margin-bottom: 14px; }
.mp-col { flex: 1; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.mp-col .card { margin-bottom: 0; }
.mp-head { flex-wrap: wrap; }
/* Cajas de alto fijo con scroll interno (Mis tareas / Pendientes) */
.mp-fix { display: flex; flex-direction: column; height: 300px; }
.mp-fix .mp-scroll { flex: 1; min-height: 0; overflow-y: auto; }
/* Advertencias crece para llenar la columna (alinea el Gantt al fondo) */
.mp-grow { display: flex; flex-direction: column; flex: 1; min-height: 200px; }
.mp-grow .mp-scroll { flex: 1; min-height: 0; overflow-y: auto; }
@media (max-width: 900px) {
  .mp-top { flex-direction: column; }
  .mp-fix { height: auto; max-height: 360px; }
  .mp-grow { flex: none; min-height: 200px; max-height: 360px; }
}
.pend-add { display: flex; gap: 8px; margin-bottom: 10px; }
.pend-add .pend-input { flex: 1; }
.pend-list { display: flex; flex-direction: column; }
.pend-item { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.pend-item:last-child { border-bottom: none; }
.pend-item .pend-check { flex: none; color: #4A7A35; border-color: #CFE0C2; }
.pend-item .pend-check:hover { background: #E8F0E2; }
.pend-item span { flex: 1; }
@media (max-width: 1000px) {
  .mp-2col { grid-template-columns: 1fr; }
  .mp-notas-card { grid-column: 1; }
}
.mp-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.mp-head-info { flex: 1; min-width: 180px; }
.mp-head-info h3 { margin-bottom: 2px; }
.mp-carga { width: 260px; }
.mp-carga .hbar-track { margin: 4px 0; }
.mp-carga-num { font-family: var(--font-display); font-weight: 700; font-size: 18px; }
.mp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; align-items: stretch; }
.mp-card { margin: 0; cursor: pointer; transition: transform .12s, box-shadow .12s; display: flex; flex-direction: column; height: 100%; }
.mp-card .mp-edit-hint { margin-top: auto; padding-top: 6px; }
.mp-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(43,42,40,.12); }
.mp-card-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.mp-card-top strong { flex: 1; font-family: var(--font-display); font-weight: 600; }
.mp-etapa { display: flex; align-items: center; gap: 10px; margin: 10px 0 4px; font-size: 12.5px; }
.mp-etapa span:first-child { width: 150px; flex: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-etapa .hbar-track { flex: 1; }
.mp-edit-hint { color: #717171; margin-top: 6px; }
.mp-notif { border-top: 3px solid var(--marqa); }
.mt-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.mt-row:last-child { border-bottom: none; }
.mt-titulo { flex: 1; min-width: 0; }
.mt-titulo.clickable { cursor: pointer; }
.mt-titulo.clickable:hover { text-decoration: underline; }
.mt-estado { flex: none; font-size: 12px; }
.cal-link { flex: none; text-decoration: none; font-size: 13px; opacity: .7; }
.cal-link:hover { opacity: 1; }
.tarea-tag { flex: none; }
.tarea-tag[data-estado="Por hacer"]   { background: #FBEAE6; color: #9A2B17; }
.tarea-tag[data-estado="En curso"]    { background: #FBF3DC; color: #8A6D1D; }
.tarea-tag[data-estado="En revisión"] { background: #E9EFF6; color: #1E3A5F; }
.tarea-tag[data-estado="Hecho"]       { background: #E9F1E4; color: #4A7A35; }
.mp-aviso-row { display: flex; align-items: center; gap: 8px; }
.mp-aviso-row .alert { flex: 1; margin-bottom: 6px; }
.mp-aviso-row .av-ok { flex: none; }
.av-restore { text-decoration: underline; cursor: pointer; }
