:root {
  --bg: #f6f6fb;
  --sidebar-bg: #1a1b2e;
  --sidebar-bg-2: #23243d;
  --sidebar-fg: #b7bad1;
  --sidebar-fg-strong: #ffffff;
  --accent: #7b5cf0;
  --accent-2: #6a47e8;
  --accent-soft: #efe9ff;
  --border: #e6e6f0;
  --card-bg: #ffffff;
  --text: #20212f;
  --muted: #7a7d94;
  --danger: #e0403f;
  --danger-soft: #fde8e8;
  --success: #1ea672;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(20,20,50,.04), 0 1px 1px rgba(20,20,50,.03);
  --shadow-md: 0 4px 14px rgba(30,20,80,.08);
  --milestone: #a8710a;
  --milestone-soft: #fff3de;
  --milestone-line: #e8c07f;
  --grid-line: #ececf5;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font-family: inherit; cursor: pointer; }
h1, h2, h3 { line-height: 1.25; }

.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px;
  background: var(--sidebar-bg);
  color: var(--sidebar-fg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  padding: 18px 14px;
}
.sidebar-logo {
  background: #ffffff; border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 14px;
  display: flex; align-items: center; justify-content: center;
}
.sidebar-logo img { max-width: 100%; height: 34px; display: block; }
.company-switcher select {
  width: 100%; padding: 9px 10px; border-radius: var(--radius-sm); border: 1px solid #33355a;
  background: var(--sidebar-bg-2); color: white; margin-bottom: 18px; font-size: 13px;
  appearance: none;
}
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.navlink { padding: 9px 10px; border-radius: var(--radius-sm); text-decoration: none; color: var(--sidebar-fg); font-size: 13px; transition: background .12s, color .12s; display: flex; align-items: center; gap: 9px; }
.navlink:hover { background: var(--sidebar-bg-2); color: white; }
.navlink.active { background: var(--accent); color: white; font-weight: 600; }
.navlink-icon { font-size: 13px; width: 16px; text-align: center; flex-shrink: 0; }
.sidebar-spaces { flex: 1; overflow-y: auto; margin-top: 14px; padding-top: 12px; border-top: 1px solid #2f3052; }
.sidebar-section-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #6d7096; padding: 0 10px 8px; }
.sidebar-space summary {
  list-style: none; padding: 7px 10px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
  color: var(--sidebar-fg-strong); display: flex; align-items: center; gap: 8px;
}
.sidebar-space summary::-webkit-details-marker { display: none; }
.sidebar-space summary:hover { background: var(--sidebar-bg-2); }
.sidebar-space .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.sidebar-space-projects { display: flex; flex-direction: column; padding: 2px 0 6px 26px; }
.sidebar-project-link { padding: 6px 8px; font-size: 12.5px; color: var(--sidebar-fg); text-decoration: none; border-radius: var(--radius-sm); }
.sidebar-project-link:hover { background: var(--sidebar-bg-2); color: white; }
.sidebar-project-empty { padding: 4px 8px; font-size: 12px; }
.sidebar-footer { border-top: 1px solid #2f3052; padding-top: 12px; margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.user-chip { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--sidebar-fg-strong); }
.linklike { background: none; border: none; color: var(--sidebar-fg); padding: 4px 0; text-align: left; font-size: 13px; }
.linklike:hover { color: white; }

.content { flex: 1; padding: 28px 32px; min-width: 0; max-width: 1400px; }
/* La Lista (grilla tipo tabla dinamica) puede tener muchas columnas — el limite de 1400px de
   arriba la obligaba a hacer scroll horizontal aunque sobrara pantalla a la derecha. Se le quita
   el limite solo a ella (marcada por el layout con content-wide); el resto de las paginas
   conserva el ancho maximo de 1400px sin cambios. */
.content.content-wide { max-width: none; }

.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: white; font-size: 10.5px; font-weight: 700;
  flex-shrink: 0; border: 2px solid white; box-shadow: 0 0 0 1px var(--border);
}

.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 12px; }
.topbar h1 { font-size: 21px; margin: 0; font-weight: 700; letter-spacing: -.01em; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 22px; }
.tab { padding: 9px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; font-size: 13.5px; font-weight: 500; transition: color .12s; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent-2); border-color: var(--accent); font-weight: 700; }

.btn {
  background: var(--accent); color: white; border: none; padding: 9px 16px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 13.5px; transition: background .12s, transform .05s; box-shadow: var(--shadow);
}
.btn:hover { background: var(--accent-2); }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: white; color: var(--text); border: 1px solid var(--border); box-shadow: none; }
.btn.secondary:hover { background: #fafafe; border-color: #d5d5e6; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #c53535; }
.btn.small { padding: 6px 12px; font-size: 12.5px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:disabled:hover { background: var(--accent); }
.btn.danger:disabled:hover { background: var(--danger); }

.card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }

.empty-state {
  text-align: center; padding: 48px 20px; color: var(--muted); border: 1.5px dashed var(--border);
  border-radius: var(--radius); background: #fbfbfe;
}
.empty-state .big { font-size: 32px; margin-bottom: 8px; }

/* Kanban */
.board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.board-col { width: 278px; flex-shrink: 0; background: #eeeef7; border-radius: var(--radius); padding: 10px; }
.board-col-header { display: flex; align-items: center; justify-content: space-between; padding: 6px 6px 12px; font-weight: 700; font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; color: #44465f; }
.board-col-count { background: rgba(30,20,80,.08); border-radius: 10px; padding: 1px 8px; font-size: 11.5px; font-weight: 700; }
.board-cards { display: flex; flex-direction: column; gap: 8px; min-height: 30px; }
.task-card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px 12px; cursor: grab; box-shadow: var(--shadow); transition: box-shadow .12s, border-color .12s;
}
.task-card:hover { border-color: var(--accent); box-shadow: var(--shadow-md); }
.task-card.dragging { opacity: .4; }
.task-card .name { font-weight: 600; margin-bottom: 8px; font-size: 13.5px; }
.task-card .meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.priority-flag { font-size: 11px; }
.priority-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.add-task-link { display: block; padding: 8px 6px; color: var(--muted); text-decoration: none; font-size: 12.5px; border-radius: var(--radius-sm); font-weight: 600; }
.add-task-link:hover { color: var(--accent-2); background: rgba(123,92,240,.08); }

/* Table / List */
table.list { width: 100%; border-collapse: collapse; background: var(--card-bg); border-radius: var(--radius); overflow: hidden; }
table.list th, table.list td { padding: 11px 14px; border-bottom: 1px solid var(--border); text-align: left; font-size: 13px; }
table.list th { background: #fafafd; color: var(--muted); font-weight: 700; text-transform: uppercase; font-size: 10.5px; letter-spacing: .05em; }
table.list tbody tr:hover { background: #fafafe; }
table.list tr:last-child td { border-bottom: none; }
table.list tbody tr { cursor: pointer; }
table.list tbody tr.dragging { opacity: .4; }
table.list tbody tr.subtask td:first-child { padding-left: 30px; }
.drag-handle { cursor: grab; color: var(--muted); margin-right: 6px; display: inline-block; width: 12px; }
.add-subtask-link {
  margin-left: 10px; font-size: 11px; font-weight: 700; color: var(--accent-2); text-decoration: none;
  opacity: 0; transition: opacity .12s;
}
table.list tbody tr:hover .add-subtask-link { opacity: 1; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 700; color: white; }

.list-group { margin-bottom: 18px; padding: 4px 16px 0; overflow: hidden; }
.list-group-header {
  display: flex; align-items: center; gap: 8px; padding: 10px 2px; font-weight: 700; font-size: 12.5px;
  text-transform: uppercase; letter-spacing: .03em; color: #44465f;
}
.list-group-header .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.list-group-count { color: var(--muted); font-weight: 500; text-transform: none; letter-spacing: 0; }
.list-group table.list { margin: 0 -16px; width: calc(100% + 32px); box-shadow: none; border-radius: 0; }
.list-group table.list th { background: transparent; }
.list-add-row {
  margin: 0 -16px; padding: 9px 16px; color: var(--muted); font-size: 12.5px; font-weight: 600; cursor: pointer;
  border-top: 1px solid var(--border);
}
.list-add-row:hover { color: var(--accent-2); background: #fafafe; }

/* Lista: grilla tipo Excel (lineas verticales + filas compactas), solo dentro de .list-group
   para no afectar las demas tablas del sitio (Equipo, Configuracion, Panel de empresa). */
.list-group table.list th, .list-group table.list td { padding: 6px 10px; height: 32px; border-right: 1px solid var(--grid-line, #ececf5); }
.list-group table.list th:last-child, .list-group table.list td:last-child { border-right: none; }
.list-group table.list td { vertical-align: middle; }
.list-group table.list tbody tr.dragging { opacity: .35; }
.list-group table.list tbody tr.drop-target td { box-shadow: inset 0 2px 0 var(--accent); }
.list-group table.list .drag-handle { opacity: 0; }
.list-group table.list tbody tr:hover .drag-handle { opacity: 1; }
.list-hito-col { min-width: 130px; }
.col-head { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.col-menu-btn { width: 18px; height: 18px; font-size: 12px; flex-shrink: 0; opacity: .5; }
.col-menu-btn:hover { opacity: 1; }
.th-add { width: 34px; text-align: center; cursor: pointer; color: var(--accent-2); font-size: 14px; }
.th-add:hover { background: var(--accent-soft); }
.task-phase-select {
  width: 100%; font-size: 11.5px; padding: 4px 6px; border: 1px solid transparent; border-radius: 5px;
  color: var(--muted); background: transparent;
}
.task-phase-select:hover, .task-phase-select:focus { border-color: var(--border); background: white; outline: none; }

/* Hito cabecera: fila/banda estructural, deliberadamente distinta de una fila de tarea
   (no es clicable como tarea, no tiene checkbox/prioridad/responsable). */
.phase-row td {
  background: var(--milestone-soft, #fff3de) !important; border-top: 1px solid var(--milestone-line, #e8c07f);
  border-bottom: 1px solid var(--milestone-line, #e8c07f); border-right: none !important; height: auto !important;
  padding: 8px 10px !important; cursor: default !important;
}
.phase-row:hover td { background: var(--milestone-soft, #fff3de) !important; }
.phase-row-inner { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 12.5px; color: #7a5206; flex-wrap: wrap; }
.phase-badge {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; background: #fff;
  border: 1px solid var(--milestone-line, #e8c07f); color: var(--milestone, #a8710a); border-radius: 10px; padding: 1px 8px;
}
.phase-progress { font-weight: 500; color: #8a6a12; font-size: 11.5px; margin-left: auto; }
.phase-row .row-menu-btn { color: #8a6a12; }
.phase-empty-hint { padding: 10px 16px; color: var(--muted); font-size: 12px; font-style: italic; }

/* Ronda 10: agrupar arrastrando el encabezado de cualquier columna (con sub-agrupacion),
   reordenar columnas entre si, y ajustar su ancho. */
.groupbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; border: 1.5px dashed #bcdcf3;
  background: #e8f2fb; border-radius: var(--radius); padding: 8px 10px; margin-bottom: 12px; min-height: 20px;
  transition: background .12s, border-color .12s;
}
.groupbar.dragover { background: #d9ecfa; border-color: #2f6fa8; }
.gb-label { font-size: 12px; color: #2f6fa8; font-weight: 700; white-space: nowrap; display: flex; align-items: center; gap: 5px; }
.gb-empty { font-size: 12.5px; color: #4a7ea3; font-style: italic; }
.pill {
  display: flex; align-items: center; gap: 6px; background: #fff; border: 1px solid #bcdcf3; color: #2f6fa8;
  border-radius: 20px; padding: 4px 6px 4px 12px; font-size: 12.5px; font-weight: 600; cursor: grab; box-shadow: var(--shadow);
}
.pill .lvl {
  background: #2f6fa8; color: #fff; border-radius: 50%; width: 16px; height: 16px; display: inline-flex;
  align-items: center; justify-content: center; font-size: 10px; font-weight: 700; flex-shrink: 0;
}
.pill-x { border: none; background: none; color: #2f6fa8; opacity: .6; width: 18px; height: 18px; border-radius: 50%; font-size: 13px; line-height: 1; cursor: pointer; }
.pill-x:hover { opacity: 1; background: #e8f2fb; }
.pill-arrow { color: #bcdcf3; font-size: 14px; }

.list-group table.list th { position: relative; }
.th-inner { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.list-group table.list th[draggable="true"] { cursor: grab; }
.list-group table.list th.col-dragover { background: var(--accent-soft); }
.resize-handle { position: absolute; right: 0; top: 0; bottom: 0; width: 6px; cursor: col-resize; }
.resize-handle:hover, .resize-handle.active { background: var(--accent); opacity: .5; }

.pivot-band-head { display: flex; align-items: center; gap: 8px; padding: 7px 12px; font-size: 12.5px; font-weight: 700; background: #f1eefc; color: #5b3fc7; }
.pivot-band-head.lvl-1 { padding-left: 28px; font-size: 12px; }
.pivot-band-head.lvl-2 { padding-left: 44px; font-size: 11.5px; background: #f6f6fb; color: #666; }
.pivot-band-count { font-weight: 500; opacity: .75; font-size: 11.5px; }

tr.dropready .pivot-band-head { outline: 2px dashed var(--accent); outline-offset: -2px; }
tr.phase-row.dropready .phase-row-inner { outline: 2px dashed var(--accent); outline-offset: -2px; }
tr[data-task-id].dropready td { background: var(--accent-soft) !important; }
.list-add-tr .list-add-row { margin: 0; }

/* Ronda 10: popover "Vista" (varias vistas con nombre por cuenta) */
.view-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--radius-sm); font-size: 13px; }
.view-row:hover { background: var(--bg); }
.view-row .vname { flex: 1; font-weight: 600; color: var(--text); text-decoration: none; }
.view-row .vname:hover { color: var(--accent-2); }
.view-badge { font-size: 10px; padding: 2px 6px; border-radius: 20px; background: var(--bg); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.view-badge.pub { color: var(--success); border-color: #bfe9d7; background: #eafbf3; }
.view-menu-btn { flex-shrink: 0; }
.view-divider { height: 1px; background: var(--border); margin: 6px 2px; }

/* Lista: barra de herramientas (Agrupar por / Vista / Guardar vista) */
.list-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.tb-field { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.tb-field select {
  padding: 6px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: #fff;
  font-size: 13px; color: var(--text); font-weight: 600;
}
.tb-field select:disabled { opacity: .5; cursor: not-allowed; }
.lock-banner {
  display: flex; align-items: center; gap: 8px; background: #fff8ea; border: 1px solid #f0dca8; color: #8a6a12;
  font-size: 12.5px; padding: 8px 12px; border-radius: var(--radius-sm); margin-bottom: 14px; font-weight: 600;
}
.radio-row { display: flex; gap: 14px; font-size: 12.5px; }
.radio-row label { display: flex; align-items: center; gap: 5px; font-weight: 500; color: var(--text); text-transform: none; }

/* Lista: panel lateral "+" para añadir columnas */
.overlay { position: fixed; inset: 0; background: rgba(20,18,40,.28); opacity: 0; pointer-events: none; transition: opacity .18s; z-index: 40; }
.overlay.open { opacity: 1; pointer-events: auto; }
.slideover {
  position: fixed; top: 0; right: 0; bottom: 0; width: 340px; background: #fff; box-shadow: -8px 0 30px rgba(20,18,40,.18);
  transform: translateX(100%); transition: transform .22s ease; z-index: 41; display: flex; flex-direction: column;
}
.slideover.open { transform: translateX(0); }
.so-head { padding: 18px 18px 12px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.so-close { background: none; border: none; font-size: 18px; color: var(--muted); }
.so-body { padding: 14px 18px; overflow-y: auto; flex: 1; }
.so-section-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 8px; }
.field-opt {
  display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-size: 13px; font-weight: 600; margin-bottom: 2px; width: 100%; background: none; text-align: left; font-family: inherit; cursor: pointer;
}
.field-opt:not(.disabled):hover { background: var(--accent-soft); border-color: var(--accent); }
.field-opt .fi { width: 26px; height: 26px; border-radius: 7px; background: var(--accent-soft); color: var(--accent-2); display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; }
.field-opt.disabled { opacity: .5; cursor: not-allowed; }
.field-opt.disabled .fi { background: #f0f0f6; color: var(--muted); }
.soon-badge { margin-left: auto; background: #f0f0f6; color: var(--muted); font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 7px; border-radius: 9px; }
.so-divider { height: 1px; background: var(--border); margin: 14px 0; }
.so-newfield-form { display: none; border-top: 1px solid var(--border); padding-top: 14px; margin-top: 6px; }
.so-newfield-form.open { display: block; }

/* Panel / dashboard */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.stat-card .num { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.stat-card .label { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* Gantt */
.gantt-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; flex-wrap: wrap; }
.segmented { display: inline-flex; background: #eeeef7; border-radius: var(--radius-sm); padding: 3px; gap: 2px; }
.segmented a { padding: 6px 12px; border-radius: 5px; font-size: 12.5px; font-weight: 600; color: var(--muted); text-decoration: none; }
.segmented a.active { background: white; color: var(--accent-2); box-shadow: var(--shadow); }
.gantt-wrap { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; overflow-x: auto; box-shadow: var(--shadow); }
.gantt-group-header { font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: #44465f; padding: 10px 0 6px; }
.gantt-row { display: flex; align-items: center; height: 36px; border-bottom: 1px solid var(--border); }
.gantt-row:last-child { border-bottom: none; }
.gantt-row.alt { background: #fafafe; }
.gantt-row.gantt-phase-row { background: #f5f4ff; font-size: 13px; border-bottom: 1px solid #e4e1fb; }
.gantt-label { flex-shrink: 0; padding-right: 10px; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.gantt-label-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gantt-avatars { display: inline-flex; margin-left: auto; flex-shrink: 0; }
.gantt-avatars .avatar { margin-left: -6px; border: 2px solid var(--card-bg); }
.gantt-row.alt .gantt-avatars .avatar { border-color: #fafafe; }
.gantt-track { position: relative; flex: 1; height: 20px; background: #f1f1f8; border-radius: 4px; }
.gantt-bar { position: absolute; height: 100%; border-radius: 4px; min-width: 6px; box-shadow: 0 1px 2px rgba(20,20,50,.15); cursor: grab; }
.gantt-bar:active { cursor: grabbing; }
.gantt-bar-phase { height: 14px; top: 3px; border-radius: 7px; opacity: .9; cursor: default; }
.gantt-handle { position: absolute; top: 0; bottom: 0; width: 7px; cursor: ew-resize; }
.gantt-handle.left { left: 0; }
.gantt-handle.right { right: 0; }
.gantt-milestone {
  position: absolute; top: 50%; width: 14px; height: 14px; margin-left: -7px; margin-top: -7px;
  transform: rotate(45deg); border-radius: 3px; box-shadow: 0 1px 2px rgba(20,20,50,.25); cursor: grab;
}
.gantt-milestone:active { cursor: grabbing; }
.gantt-gridlines { position: absolute; top: 0; bottom: 0; left: 0; right: 0; z-index: 0; }
.gantt-gridline { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--border); opacity: .7; }
body.gantt-dragging { user-select: none; }
.gantt-drag-tip {
  position: fixed; background: #23243d; color: #fff; font-size: 12px; font-weight: 600; padding: 4px 9px;
  border-radius: 6px; pointer-events: none; z-index: 50; transform: translate(-50%, -130%); white-space: nowrap;
}
.gantt-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--danger); z-index: 2; }

/* Forms */
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 12.5px; font-weight: 700; margin-bottom: 5px; color: #44465f; }
.form-row input, .form-row select, .form-row textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-family: inherit; font-size: 13.5px;
  transition: border-color .12s;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { outline: none; border-color: var(--accent); }
.form-actions { display: flex; gap: 8px; margin-top: 18px; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-card { width: 380px; background: var(--card-bg); border: 1px solid var(--border); border-radius: 14px; padding: 36px; box-shadow: var(--shadow-md); }
.login-card h1 { text-align: center; margin-top: 0; letter-spacing: -.02em; }
.error-msg { background: var(--danger-soft); color: #a12b2b; padding: 10px 12px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 13px; }
.success-msg { background: #e4f7ef; color: #146c48; padding: 10px 12px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 13px; }

.subtask-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.subtask-row:last-child { border-bottom: none; }

.muted { color: var(--muted); }
.mt-0 { margin-top: 0; }
.flex { display: flex; }
.gap-8 { gap: 8px; }
.between { justify-content: space-between; }
.items-center { align-items: center; }

details > summary { cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }

.activity-row { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); align-items: flex-start; }
.activity-row:last-child { border-bottom: none; }

/* Popovers (details/summary) usados en varios formularios rapidos */
.popover-card { padding: 16px; margin-top: 10px; max-width: 380px; }

/* Espacios (/app) */
.space-section { margin-bottom: 26px; }
.space-section-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.space-edit-form { flex: 1; min-width: 220px; }
.space-edit-form .space-name-input { font-weight: 700; font-size: 15px; border: 1px solid transparent; background: transparent; padding: 4px 6px; max-width: 260px; }
.space-edit-form .space-name-input:hover, .space-edit-form .space-name-input:focus { border-color: var(--border); background: white; outline: none; }
.space-edit-form .btn { opacity: 0; transition: opacity .12s; }
.space-section-header:hover .space-edit-form .btn { opacity: 1; }
.color-swatch-input { width: 30px; height: 30px; padding: 2px; border: 1px solid var(--border); border-radius: 6px; flex-shrink: 0; }
.space-project-count { font-size: 12px; margin-left: auto; }
.new-project-summary { display: inline-block; list-style: none; margin-top: 8px; }
.new-project-summary::-webkit-details-marker { display: none; }

/* Espacios: lista compacta de proyectos (en vez de tarjetas grandes) — pensada para
   funcionar bien con decenas de proyectos por espacio, no solo un puñado. */
.space-projects-list { display: flex; flex-direction: column; gap: 1px; background: var(--border); border-radius: var(--radius); overflow: visible; border: 1px solid var(--border); }
.project-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--card-bg);
  position: relative;
}
.project-row:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.project-row:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.project-row:hover { background: #fafafe; }
.project-row-icon {
  width: 26px; height: 26px; border-radius: 7px; display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0;
}
.project-row-title { font-weight: 700; font-size: 13.5px; text-decoration: none; color: var(--text); flex-shrink: 0; }
.project-row-title:hover { color: var(--accent-2); }
.project-row-desc { font-size: 12.5px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.project-move-form { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; }
.menu-item-label { font-size: 11px; }
.project-move-select { font-size: 12px; padding: 5px 6px; border: 1px solid var(--border); border-radius: 5px; }

/* Menú "⋯" flotante por fila (no empuja el resto de la lista al abrirse) */
.row-menu { flex-shrink: 0; }
.row-menu-btn {
  display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 6px;
  color: var(--muted); font-weight: 700; font-size: 16px; line-height: 1; cursor: pointer; list-style: none;
}
.row-menu-btn::-webkit-details-marker { display: none; }
.row-menu-btn:hover { background: var(--border); color: var(--text); }
.row-menu-popover {
  position: absolute; right: 14px; top: 38px; z-index: 30; min-width: 210px; padding: 6px;
  box-shadow: 0 10px 30px rgba(20,20,50,.18);
}
.row-menu .menu-item {
  display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 6px; font-size: 13px;
  border: none; background: none; cursor: pointer; text-decoration: none; color: var(--text); font-family: inherit;
}
.row-menu .menu-item:hover { background: #f1f1f8; }
.row-menu .menu-item.danger { color: var(--danger); }
.row-menu .menu-item-form { padding: 2px 4px; }
.menu-divider { height: 1px; background: var(--border); margin: 4px 2px; }

/* Equipo: fila de miembro editable inline (nombre/correo/rol) + menú "⋯" */
.member-edit-row { padding: 6px 8px; }
.member-edit-form { flex: 1; flex-wrap: wrap; }
.member-edit-form select { padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
.member-edit-form .member-name-input, .member-edit-form .member-email-input {
  border: 1px solid var(--border); background: white; padding: 6px 8px; border-radius: 6px; font-size: 13px;
}
.member-name-input { max-width: 160px; }
.member-email-input { max-width: 220px; }
.row-menu-popover .menu-item-form input {
  margin-bottom: 0; width: 100%; border: 1px solid var(--border); background: white; padding: 6px 8px;
  border-radius: 6px; font-size: 13px; box-sizing: border-box;
}
.row-menu-popover .menu-item-form label { display: block; margin-bottom: 4px; }

/* Tablero: cambio de grupo, subtareas y "agregar grupo" */
.card-status-select {
  width: 100%; margin-top: 9px; font-size: 11.5px; padding: 5px 7px; border: 1px solid var(--border);
  border-radius: 5px; color: var(--muted); background: #fafafd;
}
.card-subtasks { margin-top: 8px; }
.card-subtasks summary { font-size: 11.5px; color: var(--muted); font-weight: 600; list-style: none; }
.card-subtasks summary::-webkit-details-marker { display: none; }
.card-subtasks summary:hover { color: var(--accent-2); }
.card-subtask-row { display: flex; align-items: center; gap: 6px; padding: 5px 2px 5px 10px; font-size: 12px; color: var(--text); border-top: 1px solid var(--border); }
.card-subtask-row .dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.board-col-add { background: transparent; }
.add-group-summary {
  display: block; padding: 10px 12px; color: var(--muted); font-weight: 700; font-size: 12.5px; list-style: none;
  border: 1.5px dashed var(--border); border-radius: var(--radius); text-align: center; cursor: pointer;
}
.add-group-summary:hover { color: var(--accent-2); border-color: var(--accent); }
.add-group-summary::-webkit-details-marker { display: none; }
.color-swatch-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.color-swatch-opt { width: 26px; height: 26px; border-radius: 50%; display: inline-block; cursor: pointer; position: relative; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.6); }
.color-swatch-opt input { position: absolute; opacity: 0; width: 100%; height: 100%; cursor: pointer; margin: 0; }
.color-swatch-opt:has(input:checked) { box-shadow: 0 0 0 2px white, 0 0 0 4px var(--accent); }

/* Lista: scroll horizontal cuando hay campos personalizados */
.list-table-scroll { overflow-x: auto; margin: 0 -16px; }
.list-table-scroll table.list { margin: 0; width: max-content; min-width: 100%; }
.field-input { border: 1px solid transparent; background: transparent; padding: 5px 6px; border-radius: 5px; font-size: 13px; width: 110px; }
.field-input:hover, .field-input:focus { border-color: var(--border); background: white; outline: none; }
