/* OneStep · Identidad Corporativa
   Paleta de marca: Azul marino #0B2D63 · Azul #0D6EFD · Verde teal #00A9A5 · Gris #6B7280 · Gris claro #E5E7EB */
:root {
  --navy: #0B2D63;
  --navy-2: #16407F;
  --blue: #0D6EFD;
  --teal: #00A9A5;
  --gray: #6B7280;
  --gray-light: #E5E7EB;
  --bg: #F4F6FA;
  --surface: #FFFFFF;
  --column: #EEF1F6;
  --text: #14213D;
  --muted: #4B5563;
  --danger: #B42318;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(11, 45, 99, .10);
  /* Colores de prioridad (se sobrescriben desde la configuración) */
  --p-high: #E5484D;
  --p-medium: #F5A524;
  --p-low: #30A46C;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font: 14px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--blue); }
a:hover { color: var(--navy); }
h1, h2, h3 { margin: 0; line-height: 1.2; font-family: Montserrat, Inter, sans-serif; color: var(--navy); }
h1 { font-size: 28px; font-weight: 800; }
button, input, select, textarea { font: inherit; }

/* ---------- Barra superior ---------- */
.topbar {
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  padding: 12px 28px;
  background: var(--navy);
  color: #FFFFFF;
}
.brand img { display: block; height: 32px; width: auto; }
.mainnav { display: flex; gap: 4px; flex-wrap: wrap; }
.mainnav a {
  color: #C9D6EE; text-decoration: none; padding: 9px 16px; border-radius: 8px; font-weight: 500;
}
.mainnav a:hover { background: var(--navy-2); color: #FFFFFF; }
.mainnav a.active { background: var(--blue); color: #FFFFFF; font-weight: 600; }
.topbar-right { flex: 1 1 200px; display: flex; justify-content: flex-end; }
.search {
  display: flex; align-items: center; gap: 8px; color: #C9D6EE;
  background: var(--navy-2); border-radius: 8px; padding: 8px 12px; min-width: 260px;
}
.search input { background: transparent; border: none; color: #FFFFFF; outline: none; width: 100%; }
.search input::placeholder { color: #A9BBDC; }

/* ---------- Mensajes ---------- */
.messages { max-width: 1440px; margin: 0 auto; padding: 12px 28px 0; }
.msg { padding: 10px 14px; border-radius: 8px; background: var(--surface); border-left: 4px solid var(--teal); margin-bottom: 6px; box-shadow: var(--shadow); }
.msg-error { border-left-color: var(--danger); }

/* ---------- Inicio / lista de tableros ---------- */
.container { max-width: 1040px; margin: 0 auto; padding: 28px 20px; }
.hero { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 0 28px; }
.hero-logo { width: min(440px, 90%); height: auto; }
.hero-tagline { margin: 0; font-family: Montserrat, sans-serif; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; font-size: 13px; color: var(--navy); }
.eyebrow { margin: 0 0 4px; color: var(--muted); font-size: 13px; font-weight: 500; }
.page-head { margin-bottom: 16px; }
.board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-bottom: 28px; }
.board-tile {
  display: flex; flex-direction: column; gap: 6px; padding: 18px; min-height: 120px;
  background: var(--surface); border: 1px solid var(--gray-light); border-top: 4px solid var(--teal);
  border-radius: var(--radius); text-decoration: none; color: var(--text); box-shadow: var(--shadow);
  transition: transform .12s, box-shadow .12s;
}
.board-tile:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(11, 45, 99, .12); color: var(--text); }
.board-tile h2 { font-size: 16px; }
.board-tile p { margin: 0; color: var(--muted); font-size: 13px; }
.board-tile .meta { margin-top: auto; font-size: 12px; color: var(--muted); }
.empty { color: var(--muted); }

.panel { background: var(--surface); border: 1px solid var(--gray-light); border-radius: 14px; padding: 22px; }
.panel.narrow { max-width: 600px; margin: 0 auto; }
.panel h1, .panel h2 { margin-bottom: 10px; }
.panel h2 { font-size: 18px; }
.hint { color: var(--muted); margin: 0 0 12px; font-size: 13px; }

/* ---------- Formularios ---------- */
.stack p { margin: 0 0 14px; }
.stack label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; color: var(--navy); }
.stack input, .stack textarea, .stack select {
  width: 100%; padding: 9px 11px; border: 1px solid #CBD2DC; border-radius: 8px;
  background: var(--surface); color: var(--text);
}
.stack input:focus, .stack textarea:focus, .stack select:focus { outline: 2px solid var(--blue); outline-offset: 0; border-color: var(--blue); }
.stack .helptext { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.stack .errorlist { color: var(--danger); margin: 0 0 4px; padding-left: 18px; font-size: 13px; }
.stack.compact { display: flex; flex-direction: column; gap: 6px; }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; }
.row > .btn { flex: 0 0 auto; }
.btn {
  display: inline-block; padding: 9px 16px; border-radius: 8px; cursor: pointer;
  border: 1px solid #CBD2DC; background: var(--surface); color: var(--navy);
  font-weight: 600; text-decoration: none; text-align: center;
}
.btn:hover { border-color: var(--navy); color: var(--navy); }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #FFFFFF; }
.btn-primary:hover { background: var(--navy-2); color: #FFFFFF; }
.link { background: none; border: none; padding: 0; cursor: pointer; color: var(--muted); text-decoration: underline; font-size: 13px; }
.danger { color: var(--danger) !important; }
.delete-form { margin-top: 18px; }

/* ---------- Cabecera del tablero ---------- */
.board-main { max-width: 1600px; margin: 0 auto; padding: 22px 28px 28px; }
.board-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.board-title { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.board-title form { margin: 0; }
.board-desc { margin: 6px 0 0; color: var(--muted); max-width: 640px; }

.prio-picker {
  display: flex; flex-wrap: wrap; align-items: center; gap: 18px;
  background: var(--surface); border: 1px solid var(--gray-light); border-radius: 12px; padding: 10px 16px;
}
.prio-picker-title { font-weight: 600; color: var(--navy); }
.prio-group { display: flex; align-items: center; gap: 8px; }
.prio-name { font-size: 12px; font-weight: 600; color: var(--muted); width: 40px; }
.swatch {
  width: 24px; height: 24px; border-radius: 50%; border: none; padding: 0; cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
}
.swatch.is-active { box-shadow: 0 0 0 2px #FFFFFF, 0 0 0 4px var(--navy); }
.swatch:focus-visible { outline: 2px solid var(--blue); outline-offset: 4px; }

/* ---------- Área de trabajo ---------- */
.workspace { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.board-scroll { flex: 999 1 720px; min-width: 0; overflow-x: auto; padding-bottom: 6px; }
.board { display: flex; gap: 14px; align-items: flex-start; }

.column {
  flex: 0 0 280px; display: flex; flex-direction: column; gap: 10px;
  background: var(--column); border-radius: var(--radius); padding: 10px;
  border: 2px solid transparent; max-height: calc(100vh - 220px);
}
.column.over-limit { border-color: var(--danger); }
.column-head {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; background: #E2E6EE;
}
.column:nth-of-type(4n+2) .column-head { background: #CFE0FF; }
.column:nth-of-type(4n+3) .column-head { background: #FDEBC8; }
.column:nth-of-type(4n+4) .column-head { background: #CDEFDC; }
.column-head h2 { font-size: 14px; font-weight: 700; color: var(--text); flex: 1; }
.count { font-size: 12px; font-weight: 700; background: var(--surface); border-radius: 999px; padding: 2px 9px; }
.over-limit .count { color: var(--danger); }

.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; padding: 0 6px; border-radius: 6px; color: var(--muted); font-weight: 700; }
.menu summary::-webkit-details-marker { display: none; }
.menu-body {
  position: absolute; right: 0; top: 26px; z-index: 5; min-width: 180px;
  background: var(--surface); border: 1px solid var(--gray-light); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(11, 45, 99, .14); padding: 6px;
}
.menu-body a, .menu-body button {
  display: block; width: 100%; text-align: left; padding: 7px 9px; border-radius: 6px;
  background: none; border: none; cursor: pointer; text-decoration: none; color: var(--text);
}
.menu-body a:hover, .menu-body button:hover { background: var(--bg); }
.menu-body form { margin: 0; }

/* ---------- Tarjetas ---------- */
.cards {
  list-style: none; margin: 0; padding: 2px; min-height: 48px;
  display: flex; flex-direction: column; gap: 10px; overflow-y: auto; border-radius: 8px;
}
.cards.drop-target { background: rgba(13, 110, 253, .08); }
.card {
  --pc: var(--p-medium);
  background: var(--surface); border-radius: 10px; box-shadow: var(--shadow);
  border-left: 5px solid var(--pc); cursor: grab;
}
.card.prio-high, .prio-high { --pc: var(--p-high); }
.card.prio-medium, .prio-medium { --pc: var(--p-medium); }
.card.prio-low, .prio-low { --pc: var(--p-low); }
.card.is-selected { box-shadow: 0 0 0 2px var(--blue); }
.card.dragging { opacity: .4; }
.card-link {
  display: flex; flex-direction: column; gap: 10px; padding: 12px 14px;
  color: var(--text); text-decoration: none;
}
.card-link:hover { color: var(--text); }
.card-link:hover .card-title { text-decoration: underline; }
.card-title { font-weight: 600; font-size: 14px; line-height: 1.35; }
.card-fields { display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.field { display: flex; gap: 6px; align-items: center; }
.field-label { color: var(--gray); width: 82px; flex: none; }
.field-value { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; min-width: 0; }
.field-value.project { font-weight: 600; color: var(--navy); }
.avatar {
  display: inline-grid; place-items: center; width: 20px; height: 20px; flex: none;
  border-radius: 50%; background: var(--navy); color: #FFFFFF; font-size: 9px; font-weight: 700;
}
.card-meta { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px;
  font-weight: 600; color: var(--text);
  background: color-mix(in srgb, var(--pc, var(--p-medium)) 16%, white);
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--pc, var(--p-medium)); }
.due { display: inline-flex; align-items: center; gap: 4px; }
.due.today { color: #8A5A00; font-weight: 700; }
.due.overdue { color: var(--danger); font-weight: 700; }
.pdf-count { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-weight: 600; color: var(--navy); }

.add-card summary { cursor: pointer; color: var(--blue); font-weight: 600; padding: 6px 4px; border-radius: 6px; list-style: none; }
.add-card summary::-webkit-details-marker { display: none; }
.add-card summary:hover { background: var(--surface); }
.add-card form { margin-top: 6px; }
.add-card input, .add-card textarea, .add-card select, .column-new input {
  width: 100%; padding: 8px 10px; border: 1px solid #CBD2DC; border-radius: 8px; background: var(--surface); color: var(--text);
}
.column-new { background: transparent; border: 2px dashed #CBD2DC; }

/* ---------- Panel de detalle ---------- */
.detail {
  flex: 1 1 360px; background: var(--surface); border: 1px solid var(--gray-light);
  border-radius: 14px; overflow: hidden; position: sticky; top: 16px;
}
.detail-bar { height: 6px; background: var(--pc); }
.detail-body { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.detail-top { display: flex; align-items: center; justify-content: space-between; }
.detail-top .chip { font-size: 12px; padding: 3px 10px; }
.close { font-size: 24px; line-height: 1; text-decoration: none; color: var(--muted); padding: 4px 10px; border-radius: 8px; }
.close:hover { background: var(--bg); }
.detail h2 { font-size: 20px; }
.detail-fields { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.detail-fields dt { font-size: 12px; color: var(--gray); }
.detail-fields dd { margin: 4px 0 0; font-weight: 600; }
.detail-desc { margin: 0; color: var(--muted); }
.detail > .detail-body > .btn { align-self: flex-start; }

.docs { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--gray-light); padding-top: 16px; }
.docs h3 { font-size: 15px; }
.doc { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--gray-light); border-radius: 10px; }
.doc form { margin: 0; }
.doc-icon {
  width: 34px; height: 40px; flex: none; border-radius: 6px; display: grid; place-items: center;
  background: #FDECEC; color: var(--danger); font-size: 10px; font-weight: 800;
}
.doc-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.doc-info a { font-weight: 600; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-meta { font-size: 12px; color: var(--gray); }
.icon-btn {
  width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px;
  border: none; background: none; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--bg); color: var(--navy); }

.dropzone {
  display: flex; flex-direction: column; gap: 10px; align-items: stretch;
  border: 2px dashed #A9C4F5; border-radius: 12px; background: #F3F8FF; padding: 16px;
  transition: background .12s, border-color .12s;
}
.dropzone.is-over { background: #E3EEFF; border-color: var(--blue); }
.dropzone label { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; cursor: pointer; color: var(--navy); }
.dropzone label svg { color: var(--blue); }
.dropzone label span { font-size: 12px; color: var(--muted); }
.dropzone input[type=file] { font-size: 13px; }
.dz-files { font-size: 12px; color: var(--navy); font-weight: 600; }
.dz-files:empty { display: none; }

.detail-empty { padding: 40px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.detail-empty h2 { font-size: 18px; }
.detail-empty p { margin: 0; color: var(--muted); max-width: 260px; }

@media (max-width: 700px) {
  .topbar { padding: 12px 16px; }
  .search { min-width: 0; width: 100%; }
  .board-main { padding: 16px; }
  .column { flex-basis: 82vw; }
  .detail { position: static; }
}

/* ---------- Usuario en la barra superior ---------- */
.user-menu { display: flex; align-items: center; gap: 10px; margin-left: 14px; }
.user-menu form { margin: 0; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--teal); color: #04302E;
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.user-name { color: #FFFFFF; font-weight: 600; font-size: 13px; }
.logout-btn { background: none; border: 1px solid #3B5C93; color: #C9D6EE; border-radius: 8px; padding: 7px 12px; cursor: pointer; }
.logout-btn:hover { background: var(--navy-2); color: #FFFFFF; }

/* ---------- Inicio de sesión ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: #E9EDF4; }
.login-shell {
  width: min(980px, 100%); min-height: 560px; display: flex; flex-wrap: wrap;
  background: var(--surface); border-radius: 18px; overflow: hidden;
  box-shadow: 0 20px 60px rgba(11, 45, 99, .18);
}
.login-brand {
  flex: 1 1 380px; position: relative; overflow: hidden;
  background: var(--navy); color: #FFFFFF; padding: 44px 40px;
  display: flex; flex-direction: column; gap: 28px;
}
.login-logo { width: min(330px, 100%); height: auto; position: relative; z-index: 1; }
.login-tagline { position: relative; z-index: 1; margin: -18px 0 0; font-family: Montserrat, sans-serif; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; font-size: 12px; color: #C9D6EE; }
.login-illustration { position: relative; z-index: 1; align-self: center; margin-top: 8px; }
.mini-board {
  display: flex; gap: 10px; padding: 16px; border-radius: 12px;
  background: #16407F; box-shadow: 0 12px 30px rgba(0, 0, 0, .25);
}
.mini-col { width: 70px; display: flex; flex-direction: column; gap: 8px; background: #1E4A8A; border-radius: 8px; padding: 8px; }
.mini-col span { display: block; height: 22px; border-radius: 5px; background: #FFFFFF; opacity: .9; border-left: 4px solid var(--teal); }
.mini-col .c1 { border-left-color: var(--p-high); }
.mini-col .c2 { border-left-color: var(--p-medium); }
.mini-col .c3 { border-left-color: var(--p-low); }
.mini-col .c4 { border-left-color: var(--blue); height: 34px; }
.mini-col .c5 { border-left-color: var(--teal); height: 30px; }
.mini-check {
  position: absolute; right: -22px; bottom: -22px; width: 64px; height: 64px; border-radius: 50%;
  background: var(--teal); display: grid; place-items: center; box-shadow: 0 8px 20px rgba(0, 0, 0, .25);
}
.login-claim { position: relative; z-index: 1; margin: auto 0 0; color: #C9D6EE; font-size: 15px; max-width: 320px; }
.login-wave {
  position: absolute; left: -10%; right: -10%; bottom: -120px; height: 220px; border-radius: 50%;
  background: var(--teal); opacity: .35;
}

.login-form-wrap { flex: 1 1 380px; display: grid; place-items: center; padding: 44px 40px; }
.login-form { width: min(360px, 100%); display: flex; flex-direction: column; gap: 14px; }
.login-form h1 { font-size: 26px; }
.login-sub { margin: -6px 0 8px; color: var(--muted); }
.login-error { background: #FDECEC; color: var(--danger); border-radius: 8px; padding: 10px 12px; font-weight: 600; font-size: 13px; }
.login-field {
  display: flex; align-items: center; gap: 10px; color: var(--gray);
  border: 1px solid #CBD2DC; border-radius: 10px; padding: 0 6px 0 14px; background: var(--surface);
}
.login-field:focus-within { border-color: var(--blue); outline: 2px solid rgba(13, 110, 253, .25); }
.login-field input { flex: 1; border: none; outline: none; padding: 13px 0; background: transparent; color: var(--text); min-width: 0; }
.toggle-pass { width: 40px; height: 40px; border: none; background: none; color: var(--gray); cursor: pointer; border-radius: 8px; display: grid; place-items: center; }
.toggle-pass:hover, .toggle-pass[aria-pressed="true"] { color: var(--navy); background: var(--bg); }
.login-submit { padding: 13px; font-size: 15px; margin-top: 6px; }
.login-help { text-align: center; font-size: 13px; }
.login-help summary { cursor: pointer; color: var(--blue); font-weight: 500; list-style: none; }
.login-help summary::-webkit-details-marker { display: none; }
.login-help p { margin: 8px 0 0; color: var(--muted); }

@media (max-width: 760px) {
  .login-brand { padding: 28px; min-height: 0; }
  .login-illustration, .login-claim { display: none; }
  .login-form-wrap { padding: 32px 24px; }
}

/* ---------- Visibilidad de tableros ---------- */
.board-section { margin-bottom: 8px; }
.section-title { font-size: 22px; font-weight: 800; }
.board-tile { position: relative; }
.board-tile.is-private { border-top-color: var(--navy); }
.board-tile .vis-badge { align-self: flex-start; }
.vis-badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.vis-public { background: #DDF4F3; color: #035E5B; }
.vis-private { background: #E3E9F4; color: var(--navy); }
.board-owner { margin: 6px 0 0; color: var(--muted); font-size: 13px; }

#id_visibility { list-style: none; padding: 0; margin: 4px 0 0; display: flex; flex-direction: column; gap: 8px; }
#id_visibility div, #id_visibility li { margin: 0; }
#id_visibility label {
  display: flex; align-items: center; gap: 10px; font-weight: 500; color: var(--text);
  border: 1px solid #CBD2DC; border-radius: 10px; padding: 10px 12px; cursor: pointer; margin: 0;
}
#id_visibility label:has(input:checked) { border-color: var(--blue); background: #F3F8FF; }
.stack #id_visibility input { width: auto; margin: 0; accent-color: var(--blue); }

/* ---------- Solo lectura ---------- */
.readonly-note {
  display: inline-flex; align-items: center; gap: 6px; margin: 10px 0 0;
  padding: 6px 12px; border-radius: 8px; background: #FFF4D6; color: #6B4B00; font-size: 13px; font-weight: 600;
}
.card[draggable="false"] { cursor: default; }

/* ---------- Herramientas del tablero y vistas de tarjeta ---------- */
.board-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 12px; }
.view-switch {
  display: inline-flex; align-items: center; gap: 2px; padding: 3px;
  background: var(--surface); border: 1px solid var(--gray-light); border-radius: 10px;
}
.view-switch-label { font-size: 12px; font-weight: 600; color: var(--muted); padding: 0 8px 0 6px; }
.view-switch button {
  border: none; background: none; cursor: pointer; padding: 6px 12px; border-radius: 7px;
  font-weight: 600; font-size: 13px; color: var(--muted);
}
.view-switch button:hover { color: var(--navy); background: var(--bg); }
.view-switch button[aria-pressed="true"] { background: var(--navy); color: #FFFFFF; }
.btn-small { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; font-size: 13px; }

.card-desc { display: none; font-size: 13px; line-height: 1.45; }
.card-desc-label { display: block; font-size: 12px; color: var(--gray); margin-bottom: 2px; }
.card-desc-text { display: block; color: var(--muted); white-space: pre-line; }
.card-desc-text.is-empty { font-style: italic; color: var(--gray); }
.card-extra { display: none; font-size: 11px; color: var(--gray); border-top: 1px solid var(--gray-light); padding-top: 8px; }

/* Amplia: todo el detalle y columnas más anchas */
.board.view-amplia .column { flex-basis: 340px; }
.board.view-amplia .card-desc,
.board.view-amplia .card-extra { display: block; }
.board.view-amplia .card-link { padding: 14px 16px; gap: 12px; }
.board.view-amplia .card-title { font-size: 15px; }

/* Mediana: título, proyecto, investigador y metadatos (la vista original) */
.board.view-mediana .column { flex-basis: 280px; }

/* Corta: una línea por tarjeta para ver muchas a la vez */
.board.view-corta .column { flex-basis: 240px; }
.board.view-corta .cards { gap: 6px; }
.board.view-corta .card { border-left-width: 4px; }
.board.view-corta .card-link { flex-direction: row; align-items: center; gap: 8px; padding: 8px 10px; }
.board.view-corta .card-title {
  flex: 1; min-width: 0; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.board.view-corta .card-fields,
.board.view-corta .card-desc,
.board.view-corta .card-extra,
.board.view-corta .chip-label,
.board.view-corta .pdf-label,
.board.view-corta .due svg { display: none; }
.board.view-corta .card-meta { flex-wrap: nowrap; gap: 6px; flex: none; }
.board.view-corta .chip { padding: 0; background: none; }
.board.view-corta .chip .dot { width: 9px; height: 9px; }
.board.view-corta .pdf-count { margin-left: 0; }

/* ---------- Reporte de pendientes ---------- */
.report-main { max-width: 1180px; margin: 0 auto; padding: 24px 20px 40px; display: flex; flex-direction: column; gap: 20px; }
.report-filters { background: var(--surface); border: 1px solid var(--gray-light); border-radius: 14px; padding: 20px; }
.report-filters-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.report-filters-head h1 { font-size: 24px; }
.report-filters-head .btn { display: inline-flex; align-items: center; gap: 8px; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin: 14px 0; }
.filter-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--navy); }
.filter-grid select { padding: 8px 10px; border: 1px solid #CBD2DC; border-radius: 8px; background: var(--surface); color: var(--text); font-weight: 400; }
.filter-actions { justify-content: flex-start; }
.filter-actions > * { flex: 0 0 auto; }

.report-sheet {
  background: #FFFFFF; color: #14213D; border: 1px solid var(--gray-light); border-radius: 14px;
  padding: 32px 36px; box-shadow: var(--shadow);
}
.report-header { display: flex; flex-wrap: wrap; align-items: center; gap: 24px; padding-bottom: 18px; border-bottom: 3px solid var(--navy); }
.report-logo { width: 190px; height: auto; }
.report-title h2 { font-size: 22px; margin-bottom: 4px; }
.report-title p { margin: 0; color: #4B5563; font-size: 13px; }
.report-applied { font-weight: 600; color: var(--navy) !important; margin-top: 4px !important; }

.report-summary { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin: 18px 0 6px; }
.stat { border: 1px solid var(--gray-light); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; }
.stat-n { font-family: Montserrat, sans-serif; font-size: 24px; font-weight: 800; color: var(--navy); line-height: 1.1; }
.stat-l { font-size: 12px; color: #4B5563; }
.stat-overdue .stat-n { color: #B42318; }
.stat-soon .stat-n { color: #8A5A00; }

.report-group { margin-top: 20px; }
.report-group h3 { font-size: 15px; padding: 6px 10px; background: #EEF1F6; border-left: 4px solid var(--teal); border-radius: 4px; margin-bottom: 8px; }
.group-count { color: #4B5563; font-weight: 600; }
.report-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.report-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: #4B5563; border-bottom: 2px solid #CBD2DC; padding: 6px 8px;
}
.report-table td { border-bottom: 1px solid #E5E7EB; padding: 7px 8px; vertical-align: top; }
.report-table tr { break-inside: avoid; }
.c-n { width: 28px; color: #6B7280; }
.c-pdf { width: 40px; text-align: center; }
.c-due { white-space: nowrap; }
.r-desc { display: block; color: #4B5563; font-size: 11.5px; margin-top: 2px; }
.r-sub { display: block; color: #6B7280; font-size: 11px; }
.r-status { display: block; font-size: 11px; color: #4B5563; }
.due-overdue .r-status { color: #B42318; font-weight: 700; }
.due-today .r-status, .due-soon .r-status { color: #8A5A00; font-weight: 700; }
.r-prio { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.r-prio .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--pc); }
.report-empty { text-align: center; color: #4B5563; padding: 30px 0; }
.report-footer { margin-top: 24px; padding-top: 10px; border-top: 1px solid #E5E7EB; font-size: 11px; color: #6B7280; text-align: right; }

@media (max-width: 700px) {
  .report-sheet { padding: 20px 16px; overflow-x: auto; }
  .report-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Impresión ---------- */
@page { size: letter landscape; margin: 12mm; }
@media print {
  body { background: #FFFFFF; }
  .topbar, .messages, .no-print { display: none !important; }
  .report-main { max-width: none; padding: 0; }
  .report-sheet { border: none; box-shadow: none; border-radius: 0; padding: 0; }
  .report-group h3 { break-after: avoid; }
  .report-table thead { display: table-header-group; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { color: inherit; text-decoration: none; }
}
.done-badge { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #1F7A4D; color: #FFFFFF; }
.stack input[type="checkbox"] { width: auto; margin-right: 6px; }

.sort-badge { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--blue); color: #FFFFFF; }
.auto-high-note {
  display: flex; align-items: center; gap: 6px; margin: -6px 0 0; padding: 7px 10px; border-radius: 8px;
  background: color-mix(in srgb, var(--p-high) 12%, white); color: #7A1F1A; font-size: 13px; font-weight: 600;
}

/* ---------- Comentarios ---------- */
.comment-count { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; color: var(--navy); }
.comments { display: flex; flex-direction: column; gap: 12px; border-top: 1px solid var(--gray-light); padding-top: 16px; }
.comments h3 { font-size: 15px; }
.comment { display: flex; gap: 10px; align-items: flex-start; }
.comment-avatar {
  width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--teal); color: #04302E; font-size: 12px; font-weight: 700;
}
.comment-body { flex: 1; min-width: 0; background: var(--bg); border-radius: 10px; padding: 8px 12px; }
.comment-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.comment-head time { color: var(--gray); font-size: 12px; }
.comment-head form { margin: 0 0 0 auto; }
.icon-btn.small { width: 28px; height: 28px; }
.comment-text { margin: 4px 0 0; font-size: 13.5px; overflow-wrap: anywhere; }
.comment-form { display: flex; flex-direction: column; gap: 8px; }
.comment-form textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #CBD2DC; border-radius: 8px; resize: vertical; color: var(--text); background: var(--surface);
}
.comment-form textarea:focus { outline: 2px solid var(--blue); border-color: var(--blue); }
.comment-form .btn { align-self: flex-end; }

/* ---------- Dependencia ---------- */
.user-dep {
  display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px;
  background: var(--navy-2); color: #C9D6EE; font-size: 11px; font-weight: 600;
}
.report-dep-logo { max-height: 80px; max-width: 240px; width: auto; height: auto; object-fit: contain; }
.report-dep-name {
  margin: 0 0 2px !important; font-family: Montserrat, sans-serif; font-weight: 700; font-size: 14px !important;
  color: var(--navy) !important; text-transform: uppercase; letter-spacing: .04em;
}
.report-header.has-dep .report-title { flex: 1; min-width: 240px; }
.report-logo-small { width: 110px; height: auto; opacity: .9; margin-left: auto; }

/* ---------- Detalle de la tarjeta: panel inferior (opción A) ---------- */
.workspace { flex-direction: column; align-items: stretch; flex-wrap: nowrap; }
.board-scroll { flex: none; width: 100%; }
.board .column { flex-grow: 1; max-width: 460px; }
.detail.detail-bottom {
  flex: none; position: static; width: 100%; scroll-margin-top: 12px;
  box-shadow: 0 -6px 24px rgba(11, 45, 99, .08);
}
.detail-head { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; padding: 16px 22px 0; }
.detail-head h2 { font-size: 20px; flex: 0 1 auto; min-width: 0; }
.detail-head .close { margin-left: auto; }
.detail-grid { display: grid; grid-template-columns: 1.1fr 1fr 1.2fr; padding: 16px 0 22px; }
.detail-col { padding: 0 22px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.detail-col + .detail-col { border-left: 1px solid var(--gray-light); }
.detail-grid .docs, .detail-grid .comments { border-top: none; padding-top: 0; }
.detail-desc-label { display: block; font-size: 12px; color: var(--gray); margin-bottom: 4px; }
.detail-desc.is-empty { font-style: italic; color: var(--gray); }
@media (max-width: 1000px) {
  .detail-grid { grid-template-columns: 1fr; gap: 18px; }
  .detail-col + .detail-col { border-left: none; border-top: 1px solid var(--gray-light); padding-top: 16px; }
}

/* =====================================================================
   Panel de Administración
   ===================================================================== */
.adm { max-width: 1400px; margin: 0 auto; padding: 24px 28px 60px; display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 24px; }
.adm-nav { background: var(--surface); border: 1px solid var(--gray-light); border-radius: 14px; padding: 14px; align-self: start; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 16px; }
.adm-nav-title { font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--gray); padding: 6px 10px; }
.adm-nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 9px; text-decoration: none; color: var(--text); font-weight: 500; }
.adm-nav a:hover { background: var(--bg); color: var(--navy); }
.adm-nav a.on { background: var(--navy); color: #FFFFFF; font-weight: 700; }
.adm-nav a .n { margin-left: auto; font-size: 12px; background: #EEF1F6; color: var(--muted); padding: 1px 8px; border-radius: 999px; }
.adm-nav a.on .n { background: var(--navy-2); color: #C9D6EE; }
.adm-nav a.adm-nav-advanced { margin-top: 8px; border-top: 1px solid var(--gray-light); border-radius: 0 0 9px 9px; padding-top: 14px; font-size: 13px; color: var(--muted); }
.adm-content { min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.adm-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.adm-head h1 { font-size: 26px; }
.adm-head .eyebrow a { text-decoration: none; font-weight: 600; }
.adm-head-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.adm-head-actions form { margin: 0; }
.adm-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.adm-tools input, .adm-tools select { padding: 9px 12px; border: 1px solid #CBD2DC; border-radius: 9px; background: var(--surface); color: var(--text); }
.adm-tools input { min-width: 280px; flex: 1 1 280px; max-width: 420px; }
.adm-table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--gray-light); border-radius: 14px; }
.adm-table { width: 100%; border-collapse: collapse; }
.adm-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--bg); padding: 10px 14px; border-bottom: 1px solid var(--gray-light); white-space: nowrap; }
.adm-table td { padding: 12px 14px; border-bottom: 1px solid #EEF1F6; vertical-align: middle; font-size: 14px; }
.adm-table tr:last-child td { border-bottom: none; }
.adm-table select { padding: 7px 9px; border: 1px solid #CBD2DC; border-radius: 8px; background: var(--surface); max-width: 220px; }
.adm-table .c-text { max-width: 420px; }
.who { display: flex; align-items: center; gap: 10px; }
.who-av { width: 34px; height: 34px; flex: none; border-radius: 50%; background: var(--teal); color: #04302E; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.who small, .block { display: block; }
.who small { color: var(--gray); font-size: 12px; }
.muted { color: var(--gray); }
small.muted { font-size: 12px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; margin: 2px 4px 2px 0; }
.g-sup { background: var(--navy); color: #FFFFFF; }
.g-ed { background: #DDEBFF; color: #0B3D91; }
.g-ro { background: #FFF4D6; color: #6B4B00; }
.g-co { background: #DDF4F3; color: #035E5B; }
.g-ot { background: #EEF1F6; color: var(--text); }
.on-dot, .off-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 4px; }
.on-dot { background: #1F7A4D; } .off-dot { background: #9CA3AF; }
.acts { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.acts.left { justify-content: flex-start; }
.btn-danger-outline { color: var(--danger); border-color: #F1B8B2; }
.btn-danger-outline:hover { color: var(--danger); border-color: var(--danger); }

.adm-card { background: var(--surface); border: 1px solid var(--gray-light); border-radius: 14px; padding: 20px; }
.adm-card.narrow { max-width: 620px; }
.adm-card h2 { font-size: 16px; margin-bottom: 14px; }
.adm-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.adm-grid2.tight { gap: 12px; }
.adm-content form > .adm-card + .adm-card, .adm-content form > .adm-grid2 + .adm-card { margin-top: 18px; }
.f { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.f label { font-size: 13px; font-weight: 600; color: var(--navy); }
.f input, .f select { padding: 9px 11px; border: 1px solid #CBD2DC; border-radius: 8px; background: var(--surface); color: var(--text); width: 100%; }
.f input[type="file"] { padding: 7px; }
.f input:focus, .f select:focus { outline: 2px solid var(--blue); border-color: var(--blue); }
.f small { color: var(--gray); font-size: 12px; }
.f.has-error input, .f.has-error select { border-color: var(--danger); }
.err, .f small.err { color: var(--danger); font-size: 12px; font-weight: 600; margin: 0; }
.f ul { margin: 0; padding-left: 18px; font-size: 13px; }

.sw { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid #EEF1F6; cursor: pointer; }
.adm-card h2 + .sw { border-top: none; }
.sw b { display: block; font-size: 14px; } .sw span span { display: block; font-size: 12px; color: var(--gray); }
.tg { appearance: none; -webkit-appearance: none; width: 42px; height: 24px; flex: none; border-radius: 999px; background: #CBD2DC; position: relative; cursor: pointer; margin: 0; transition: background .15s; }
.tg::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #FFFFFF; transition: left .15s; }
.tg:checked { background: var(--navy); } .tg:checked::after { left: 21px; }
.tg:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.roles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.role { border: 2px solid var(--gray-light); border-radius: 12px; padding: 12px; font-size: 13px; cursor: pointer; display: grid; grid-template-columns: auto 1fr; column-gap: 8px; row-gap: 4px; align-items: center; }
.role input { margin: 0; accent-color: var(--blue); width: 16px; height: 16px; }
.role b { font-size: 14px; color: var(--navy); }
.role span { grid-column: 1 / -1; color: var(--muted); }
.role.sel { border-color: var(--blue); background: #F3F8FF; }

.perm { width: 100%; border-collapse: collapse; font-size: 13px; }
.perm th, .perm td { padding: 8px 10px; border-bottom: 1px solid #EEF1F6; text-align: center; }
.perm th[scope="row"] { text-align: left; font-weight: 500; }
.perm thead th { font-size: 11px; text-transform: uppercase; color: var(--muted); letter-spacing: .05em; }
.perm-na { color: var(--gray); }
.pm { width: 18px; height: 18px; accent-color: var(--blue); cursor: pointer; vertical-align: middle; }
.ck { width: 18px; height: 18px; border-radius: 5px; border: 2px solid #9DBDF5; background: #CFE0FF; display: inline-block; vertical-align: middle; }
.legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 12px; align-items: center; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.adm-save { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.adm-note { font-size: 13px; color: var(--muted); background: var(--surface); border: 1px solid var(--gray-light); border-radius: 12px; padding: 12px 16px; margin: 0; }
.member { font-weight: 500; }

.deps { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.dep { background: var(--surface); border: 1px solid var(--gray-light); border-radius: 14px; overflow: hidden; }
.dep-logo { height: 120px; display: grid; place-items: center; background: var(--bg); border-bottom: 1px solid var(--gray-light); padding: 12px; }
.dep-logo img { max-height: 96px; max-width: 100%; object-fit: contain; }
.dep-ph { width: 160px; height: 70px; border: 2px dashed #CBD2DC; border-radius: 10px; display: grid; place-items: center; color: var(--gray); font-size: 12px; }
.dep-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.dep-body h3 { font-size: 15px; }
.dep-meta { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.dep-new { border: 2px dashed #A9C4F5; background: #F3F8FF; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; color: var(--navy); min-height: 236px; font-weight: 700; text-decoration: none; }
.dep-new span { font-weight: 400; font-size: 13px; color: var(--muted); }
.dep-current { background: var(--bg); border-radius: 10px; padding: 12px; margin-bottom: 12px; display: grid; place-items: center; }
.dep-current img { max-height: 90px; max-width: 100%; }

.color-row { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-top: 1px solid #EEF1F6; }
.color-label { width: 60px; font-weight: 600; color: var(--navy); }
.color-row input[type="color"] { width: 56px; height: 36px; border: 1px solid #CBD2DC; border-radius: 8px; padding: 2px; background: var(--surface); cursor: pointer; }
.color-prev { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-weight: 600; font-size: 13px; background: color-mix(in srgb, var(--pc) 16%, white); }
.color-prev .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--pc); }

@media (max-width: 900px) {
  .adm { grid-template-columns: 1fr; padding: 16px; }
  .adm-nav { position: static; flex-direction: row; flex-wrap: wrap; }
  .adm-nav-title { width: 100%; }
  .adm-grid2 { grid-template-columns: 1fr; }
}

/* Detalle de la tarjeta arriba del tablero */
.detail.detail-top-panel { box-shadow: 0 6px 24px rgba(11, 45, 99, .08); margin-bottom: 4px; }

/* ---------- Columnas: repartir todo el ancho (con mínimo legible) ---------- */
.board .column,
.board.view-mediana .column { flex: 1 1 0; min-width: 240px; max-width: none; }
.board.view-amplia .column { flex: 1 1 0; min-width: 300px; }
.board.view-corta .column { flex: 1 1 0; min-width: 200px; }
.board .column.column-new { flex: 0 0 210px; min-width: 210px; }

/* ---------- Vista previa al pasar el cursor ---------- */
.card-pop {
  position: fixed; z-index: 200; width: 340px; max-width: calc(100vw - 16px);
  background: var(--surface); border-radius: 12px; overflow: hidden; pointer-events: none;
  box-shadow: 0 14px 40px rgba(11, 45, 99, .25), 0 0 0 1px rgba(11, 45, 99, .08);
  font-size: 13px; color: var(--text);
}
.card-pop[hidden] { display: none; }
.card-pop .pop-bar { height: 5px; background: var(--pc, var(--p-medium)); }
.card-pop .pop-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.card-pop .pop-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-pop .chip { font-size: 12px; padding: 3px 10px; }
.pop-auto { font-size: 11px; font-weight: 700; color: #7A1F1A; background: color-mix(in srgb, var(--p-high) 14%, white); padding: 2px 8px; border-radius: 999px; }
.card-pop h4 { margin: 0; font: 700 16px/1.3 Montserrat, Inter, sans-serif; color: var(--navy); }
.pop-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin: 0; }
.pop-fields dt { font-size: 11px; color: var(--gray); }
.pop-fields dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.pop-due { display: block; color: var(--danger); font-weight: 700; font-size: 12px; }
.pop-due.ok { color: var(--muted); font-weight: 600; }
.pop-desc { border-top: 1px solid #EEF1F6; padding-top: 8px; overflow-wrap: anywhere; }
.pop-desc .lbl { display: block; font-size: 11px; color: var(--gray); margin-bottom: 2px; }
.pop-meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12px; border-top: 1px solid #EEF1F6; padding-top: 8px; }
.pop-meta b { color: var(--navy); }
.pop-files { margin: 0; padding-left: 18px; color: var(--navy); font-size: 12px; }
.pop-comment { background: var(--bg); border-radius: 8px; padding: 8px 10px; font-size: 12px; overflow-wrap: anywhere; }
.pop-comment b { color: var(--navy); }
.pop-comment time { color: var(--gray); font-size: 11px; margin-left: 4px; }
.pop-hint { font-size: 11px; color: var(--gray); text-align: right; }
.report-back { margin: 0 0 8px; }
.report-back a { font-weight: 600; text-decoration: none; }
.report-back a:hover { text-decoration: underline; }
