/* =====================================================================
   Paradigma app — sistema visual
   Tonos de marca: #000000 / #FFFFFF (manual de identidad).
   El único color fuera de la paleta es --alert, funcional: marca
   vencimientos. Tipografías: Poppins (sustituta de Monstral/Dozed)
   y DM Mono (sustituta de Genio Mono).
   ===================================================================== */

:root,
:root[data-theme="dark"] {
  --bg: #000000;
  --surface: #0B0B0B;
  --surface-2: #131313;
  --border: #262626;
  --border-strong: #3D3D3D;
  --text: #FFFFFF;
  --muted: #8A8A8A;
  --accent: #FFFFFF;
  --on-accent: #000000;
  --alert: #FF5545;
  --grain: .05;
  --shadow: 0 12px 40px rgba(0,0,0,.6);
}

:root[data-theme="light"] {
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #F5F5F5;
  --border: #E4E4E4;
  --border-strong: #C4C4C4;
  --text: #000000;
  --muted: #6E6E6E;
  --accent: #000000;
  --on-accent: #FFFFFF;
  --alert: #D5281A;
  --grain: .035;
  --shadow: 0 12px 40px rgba(0,0,0,.12);
}

:root {
  --radius: 4px;
  --sidebar-w: 252px;
  --mono: "DM Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 13.5px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  letter-spacing: -.005em;
}

/* Grano: textura constante en el material de marca. */
body::after {
  content: "";
  position: fixed; inset: 0; z-index: 999; pointer-events: none;
  opacity: var(--grain);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.hidden { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--text); }

/* Etiqueta de sistema: mayúsculas, mono, tracking abierto. */
.label, .side-head, .group-title, .col-head, .drawer h3, .seg button,
.chip, .field label, .app-tag, .auth-foot, .auth-tagline {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 10.5px;
  font-weight: 400;
}

/* ---------------------------- botones ---------------------------- */

.btn {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .1em;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text);
  padding: 8px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: transparent; color: var(--text); border-color: var(--text); }
.btn-danger { border-color: transparent; color: var(--alert); }
.btn-danger:hover { border-color: var(--alert); }
.btn-block { width: 100%; padding: 11px; }

.icon-btn {
  width: 26px; height: 26px; line-height: 1;
  border: none; background: transparent; color: var(--muted);
  border-radius: var(--radius); cursor: pointer; font-size: 15px;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.link-btn {
  font-family: var(--mono); font-size: 10.5px;
  text-transform: uppercase; letter-spacing: .12em;
  background: none; border: none; color: var(--muted);
  cursor: pointer; padding: 4px 0;
}
.link-btn:hover { color: var(--text); }

/* ------------------------- marca / logo -------------------------- */

.brand {
  display: flex; align-items: center; gap: 9px; padding: 4px 8px 20px;
  width: 100%; text-align: left; cursor: pointer;
  background: none; border: 0; color: inherit; font: inherit;
}
.brand:hover .brand-name { opacity: .6; }
.brand:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; border-radius: 3px; }
.brand-mark, .auth-mark { display: block; color: var(--text); }
.brand-mark { width: 30px; flex: 0 0 30px; }
.brand-mark svg, .auth-mark svg { width: 100%; height: auto; display: block; }
.brand-name { font-weight: 600; font-size: 15px; letter-spacing: -.02em; }
.app-tag { color: var(--muted); margin-left: 6px; text-transform: lowercase; letter-spacing: .05em; }

/* ---------------------------- acceso ----------------------------- */

.auth {
  min-height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 26px; padding: 40px 24px;
}
.auth-mark { width: 84px; }
.auth-card { width: 100%; max-width: 350px; }
.auth-logo { margin: 0; font-size: 26px; font-weight: 600; letter-spacing: -.03em; text-align: center; }
.auth-logo .app-tag { font-size: 11px; }
.auth-tagline { margin: 6px 0 0; text-align: center; color: var(--muted); }
.auth-sub { margin: 22px 0 22px; color: var(--muted); font-size: 12.5px; text-align: center; }
.auth-error { color: var(--alert); font-size: 12.5px; margin: 0 0 14px; text-align: center; }
.auth-toggle { text-align: center; margin: 16px 0 0; font-size: 12px; }
.auth-toggle a { color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--border-strong); }
.auth-toggle a:hover { color: var(--text); border-color: var(--text); }
.auth-foot { color: var(--muted); margin: 0; }

/* ---------------------------- campos ----------------------------- */

.field { margin-bottom: 15px; }
.field label {
  display: block; color: var(--muted); margin-bottom: 6px;
  font-size: 9.5px; letter-spacing: .14em;
}
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 11px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); color: var(--text);
  font-family: var(--sans); font-size: 13px;
}
.field textarea { font-size: 13px; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--text); background: var(--surface);
}
.field input[type=date] { font-family: var(--mono); font-size: 12px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------------------------- layout ----------------------------- */

.app { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 12px;
}
.nav { display: flex; flex-direction: column; gap: 1px; margin-bottom: 22px; }
.nav-item, .project-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 8px 9px; border: none; background: none;
  border-radius: var(--radius); cursor: pointer; text-align: left;
  color: var(--muted); font-size: 13px; font-family: var(--sans);
}
.nav-item:hover, .project-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active, .project-item.active { background: var(--accent); color: var(--on-accent); font-weight: 500; }
.nav-item.active .pcount, .project-item.active .pcount { color: var(--on-accent); opacity: .65; }
.nav-item.active .monogram, .project-item.active .monogram {
  border-color: var(--on-accent); color: var(--on-accent);
}

.side-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 9px 8px; color: var(--muted);
}
.project-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; }
.project-item .pname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-item .pcount { font-family: var(--mono); font-size: 10px; color: var(--muted); }

/* Identidad de proyecto sin color: monograma en mono. */
.monogram {
  width: 21px; height: 21px; flex: 0 0 21px;
  border: 1px solid var(--border-strong); border-radius: 2px;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 8.5px; letter-spacing: .04em;
  color: var(--muted); text-transform: uppercase;
}

.sidebar-foot { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 14px; }
.me { font-size: 12px; color: var(--muted); padding-bottom: 10px; }
.me strong { display: block; color: var(--text); font-size: 13px; font-weight: 500; }
.me .role { font-family: var(--mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: .12em; }
.foot-links { display: flex; gap: 14px; }

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 15px 22px; border-bottom: 1px solid var(--border);
  background: var(--surface); flex-wrap: wrap;
}
.titles { flex: 1; min-width: 150px; }
.titles h2 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -.025em; }
.titles p { margin: 1px 0 0; font-size: 11.5px; color: var(--muted); }

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar input[type=search], .toolbar select {
  padding: 7px 11px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); font-size: 12.5px;
}
.toolbar input[type=search] { width: 165px; }
.toolbar input[type=search]:focus, .toolbar select:focus { outline: none; border-color: var(--text); }
.seg { display: flex; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; }
.seg button { border: none; background: transparent; color: var(--muted); padding: 8px 13px; cursor: pointer; }
.seg button.active { background: var(--accent); color: var(--on-accent); }

.content { flex: 1; overflow: auto; padding: 22px; }

/* ----------------------------- lista ----------------------------- */

.group-title {
  display: flex; align-items: center; gap: 10px;
  color: var(--muted); margin: 26px 2px 10px;
}
.group-title:first-child { margin-top: 0; }
.group-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.task-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 5px; cursor: pointer;
  transition: border-color .12s;
}
.task-row:hover { border-color: var(--border-strong); }
.task-row.done .t-title { color: var(--muted); text-decoration: line-through; }

.check {
  width: 17px; height: 17px; flex: 0 0 17px;
  border: 1px solid var(--border-strong); border-radius: 50%;
  background: transparent; cursor: pointer; padding: 0;
  display: grid; place-items: center;
  font-size: 9px; line-height: 1; color: transparent;
}
.check:hover { border-color: var(--text); color: var(--muted); }
.check.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.t-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }

.chip {
  padding: 3px 7px; border: 1px solid var(--border);
  border-radius: 2px; color: var(--muted); white-space: nowrap;
}
.chip.due-soon { border-color: var(--border-strong); color: var(--text); }
.chip.overdue { border-color: var(--alert); color: var(--alert); }

.avatar {
  width: 23px; height: 23px; flex: 0 0 23px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 9px; letter-spacing: .02em;
  background: var(--accent); color: var(--on-accent);
}
.avatar.none { background: transparent; border: 1px dashed var(--border-strong); color: var(--muted); }

/* ---------------------------- tablero ---------------------------- */

.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(215px, 1fr); gap: 12px; height: 100%; }
.col {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); display: flex; flex-direction: column; min-height: 120px;
}
.col-head {
  display: flex; align-items: center; gap: 8px;
  padding: 13px 14px 10px; color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.col-head .idx { color: var(--border-strong); }
.col-head .cnt { margin-left: auto; }
.col-body { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 7px; }
.col.drag-over { border-color: var(--text); }

.card {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 11px 12px; cursor: pointer;
  transition: border-color .12s;
}
.card:hover { border-color: var(--border-strong); }
.card.dragging { opacity: .35; }
.card-title { margin-bottom: 9px; word-break: break-word; font-size: 13px; }
.card-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-project {
  font-family: var(--mono); font-size: 9.5px; text-transform: uppercase;
  letter-spacing: .1em; color: var(--muted); margin-bottom: 7px;
}

/* ----------------------------- panel ----------------------------- */

.drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(470px, 100%);
  background: var(--surface); border-left: 1px solid var(--border);
  z-index: 50; display: flex; flex-direction: column; box-shadow: var(--shadow);
}
.drawer-head {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 17px 18px; border-bottom: 1px solid var(--border);
}
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 18px 40px; }
/* Cabecera de apartado: manda sobre las etiquetas de campo, para que el panel
   se lea de un vistazo. */
.drawer h3 {
  display: flex; align-items: center; gap: 10px;
  margin: 30px 0 14px;
  padding-top: 18px;
  border-top: 1px solid var(--border-strong);
  color: var(--text);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .18em;
}
.drawer h3::before {
  content: ""; width: 6px; height: 6px; flex: 0 0 6px;
  background: var(--text); border-radius: 1px;
}
.drawer h3:first-child { margin-top: 0; }

.title-input {
  flex: 1; border: 1px solid transparent; background: transparent;
  font-family: var(--sans); font-size: 16px; font-weight: 500;
  letter-spacing: -.02em; padding: 3px 6px; border-radius: var(--radius);
  resize: none; line-height: 1.4;
}
.title-input:hover { border-color: var(--border); }
.title-input:focus { outline: none; border-color: var(--text); background: var(--bg); }
.notes-input { min-height: 84px; resize: vertical; }

.sub-row { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-bottom: 1px solid var(--border); }
.sub-row .t-title { font-size: 12.5px; }
.sub-row.done .t-title { color: var(--muted); text-decoration: line-through; }
.inline-add { margin-top: 10px; }
.inline-add input {
  width: 100%; padding: 9px 11px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius); font-size: 12.5px;
}
.inline-add input:focus { outline: none; border-color: var(--text); }

.comment { padding: 12px 0; border-bottom: 1px solid var(--border); }
.comment-head { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; }
.comment-head strong { font-size: 12.5px; font-weight: 500; }
.comment-head time {
  font-family: var(--mono); font-size: 9.5px; text-transform: uppercase;
  letter-spacing: .1em; color: var(--muted);
}
.comment-body { white-space: pre-wrap; word-break: break-word; font-size: 13px; }
.comment .del { margin-left: auto; visibility: hidden; }
.comment:hover .del { visibility: visible; }

/* ----------------------------- modal ----------------------------- */

.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.65); display: grid; place-items: center; z-index: 60; padding: 20px; }
.modal {
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); padding: 24px; width: 100%; max-width: 450px;
  box-shadow: var(--shadow); max-height: 86vh; overflow-y: auto;
}
.modal h2 { margin: 0 0 20px; font-size: 17px; font-weight: 600; letter-spacing: -.02em; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

.member-row {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
  flex-wrap: wrap; row-gap: 8px;
}
/* El nombre y el correo mandan; si no caben, los controles bajan de línea. */
.member-row .info { flex: 1 1 210px; min-width: 0; }
.member-row .info div { font-size: 13px; }
.member-row .info small { color: var(--muted); font-family: var(--mono); font-size: 10px; }

/* ----------------------------- varios ---------------------------- */

.empty { text-align: center; color: var(--muted); padding: 70px 20px; }
.empty svg { width: 46px; height: 46px; opacity: .35; margin-bottom: 18px; }
.empty h3 { margin: 0 0 8px; color: var(--text); font-size: 15px; font-weight: 500; }
.empty p { margin: 0; font-size: 12.5px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: var(--on-accent);
  font-family: var(--mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: .1em;
  padding: 11px 20px; border-radius: var(--radius); z-index: 90;
}

.only-mobile { display: none; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

::selection { background: var(--accent); color: var(--on-accent); }

@media (max-width: 860px) {
  .only-mobile { display: block; }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 70; transform: translateX(-100%); transition: transform .18s ease; }
  .sidebar.open { transform: none; }
  .content { padding: 14px; }
  .board { grid-auto-columns: 82vw; }

  /* La barra superior en una sola fila que se desliza: antes se apilaba en
     cuatro alturas y se comía un cuarto de la pantalla. */
  .topbar { padding: 10px 14px; gap: 10px; }
  .titles p { display: none; }
  .toolbar {
    flex: 1 0 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .toolbar::-webkit-scrollbar { display: none; }
  .toolbar > * { flex: 0 0 auto; }
  .toolbar input[type=search] { width: 130px; }
}

/* =====================================================================
   Secciones de la vista lista
   ===================================================================== */

.sec { margin-bottom: 26px; }
.sec.drag-over .sec-body { outline: 1px dashed var(--border-strong); outline-offset: 4px; }

.sec-head {
  display: flex; align-items: center; gap: 10px;
  margin: 0 2px 10px; color: var(--muted);
}
.sec-head::after { content: ""; flex: 1; height: 1px; background: var(--border); order: 3; }
.sec-name, .sec-count {
  font-family: var(--mono); font-size: 10.5px;
  text-transform: uppercase; letter-spacing: .12em;
}
.sec-name-input {
  font-family: var(--mono); font-size: 10.5px;
  text-transform: uppercase; letter-spacing: .12em;
  background: transparent; border: 1px solid transparent; color: var(--muted);
  padding: 2px 5px; border-radius: 2px; width: auto; min-width: 90px; max-width: 260px;
}
.sec-name-input:hover { border-color: var(--border); }
.sec-name-input:focus { outline: none; border-color: var(--text); color: var(--text); background: var(--surface-2); }
.sec-actions { display: flex; gap: 2px; order: 4; opacity: 0; transition: opacity .12s; }
.sec:hover .sec-actions { opacity: 1; }
.sec-empty {
  font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--muted); border: 1px dashed var(--border); border-radius: var(--radius);
  padding: 14px; text-align: center; margin: 0;
}
.add-section { margin-top: 4px; }
.task-row.dragging { opacity: .35; }
.task-row[draggable="true"] { cursor: grab; }

.chip.status { border-color: transparent; background: var(--surface-2); }
.chip.date em { font-style: normal; opacity: .55; margin-right: 3px; }

.hint { font-size: 11px; color: var(--muted); margin: 6px 0 0; }
.muted-note { color: var(--muted); font-size: 12.5px; margin: 0; }
.modal-sub { font-size: 13px; font-weight: 500; margin: 22px 0 12px; }
.drawer-danger {
  margin-top: 26px; border-top: 1px solid var(--border); padding-top: 16px;
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}
.drawer-danger .btn-danger { margin-left: auto; }

/* =====================================================================
   Calendario — producción vs. publicación sin recurrir al color
   ===================================================================== */

/* min-height y no height:100%: el calendario ocupa lo que necesite y la página
   hace scroll, en vez de comprimirse y esconder días. */
.cal { display: flex; flex-direction: column; min-height: 520px; }

.cal-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.cal-title {
  font-family: var(--mono); font-size: 12px; text-transform: uppercase;
  letter-spacing: .14em; min-width: 165px;
}
.cal-legend { margin-left: auto; display: flex; gap: 14px; }
.lg {
  font-family: var(--mono); font-size: 10px; text-transform: uppercase;
  letter-spacing: .12em; color: var(--muted); display: flex; align-items: center; gap: 7px;
}
.lg::before { content: ""; width: 14px; height: 0; border-top: 2px solid var(--text); }
.lg.prod::before { border-top-style: dashed; }

.cal-grid {
  /* 'auto' y no '1fr': la semana crece hasta caber su día más cargado. Con 1fr
     todas las filas medían igual y los días llenos escondían entradas. */
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-rows: minmax(96px, auto);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.cal-dow {
  font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--muted); padding: 9px 10px; background: var(--surface);
  border-bottom: 1px solid var(--border); text-align: center;
}
.cal-grid > .cal-dow { grid-row: 1; }

.cal-day {
  border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: 7px; display: flex; flex-direction: column; gap: 5px; min-width: 0;
  background: var(--surface);
}
.cal-day:nth-child(7n) { border-right: none; }
.cal-day.out { background: var(--bg); }
.cal-day.out .cal-num { opacity: .3; }
.cal-num {
  font-family: var(--mono); font-size: 10.5px; color: var(--muted);
  width: 19px; height: 19px; display: grid; place-items: center; border-radius: 50%;
}
.cal-day.today .cal-num { background: var(--accent); color: var(--on-accent); }
.cal-items { display: flex; flex-direction: column; gap: 4px; }

.cal-item {
  display: flex; align-items: baseline; gap: 6px; width: 100%;
  text-align: left; cursor: pointer; padding: 4px 6px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-left-width: 3px;
  border-radius: 2px; font-size: 11px; line-height: 1.3;
}
.cal-item:hover { border-color: var(--text); border-left-width: 3px; }
.cal-item.prod { border-left-style: dashed; background: transparent; }
.cal-item.pub { border-left-color: var(--text); }
.cal-item.done .ct { text-decoration: line-through; color: var(--muted); }
.cal-item .k {
  font-family: var(--mono); font-size: 8.5px; text-transform: uppercase;
  letter-spacing: .1em; color: var(--muted); flex: 0 0 auto;
}
.cal-item .ct { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Calendario del resumen: cada entrada dice de qué proyecto viene, bajo el título.
   Rejilla de dos columnas para que "Ent/Pub" no se caiga a su propia línea. */
.cal-item.con-proy {
  display: grid; grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline; column-gap: 6px; row-gap: 1px;
}
.cal-item.con-proy .k { grid-area: 1 / 1; }
.cal-item.con-proy .ct { grid-area: 1 / 2; }
.cal-item.con-proy .cp { grid-area: 2 / 2; }
.cal-item .cp {
  min-width: 0;
  font-family: var(--mono); font-size: 8.5px; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Las subtareas se marcan con un borde más fino: se distinguen de la tarea madre. */
.cal-item.sub { border-left-width: 2px; opacity: .88; }
/* Con dos líneas por entrada, el día necesita algo más de alto para que quepan. */
.cal-grid.con-proy { grid-auto-rows: minmax(150px, auto); }
.cal-hint { color: var(--muted); font-size: 12px; margin: 14px 0 0; text-align: center; }

@media (max-width: 860px) {
  .cal-grid { grid-auto-rows: minmax(78px, auto); }
  .cal-grid.con-proy { grid-auto-rows: minmax(104px, auto); }
  .cal-item .k { display: none; }
  .cal-legend { margin-left: 0; }
}

/* =====================================================================
   Adjuntos
   ===================================================================== */

.atts { display: flex; flex-direction: column; gap: 6px; }

.att {
  display: flex; align-items: center; gap: 11px;
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px 10px; background: var(--surface-2);
}
.att:hover { border-color: var(--border-strong); }

.att-thumb {
  width: 40px; height: 40px; flex: 0 0 40px;
  border: 1px solid var(--border); border-radius: 2px;
  display: grid; place-items: center; overflow: hidden;
  background: var(--bg);
}
.att-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att-thumb .ext {
  font-family: var(--mono); font-size: 9px; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted);
}

.att-info { flex: 1; min-width: 0; }
.att-info a {
  display: block; font-size: 12.5px; text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  border-bottom: 1px solid transparent;
}
.att-info a:hover { border-bottom-color: var(--text); }
.att-info small {
  display: block; font-family: var(--mono); font-size: 9.5px;
  text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-top: 2px;
}

.att-actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 10px; }

.drawer-body.drop-target {
  outline: 2px dashed var(--text); outline-offset: -8px;
}

/* =====================================================================
   Visor de archivos
   ===================================================================== */

.viewer {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(0, 0, 0, .93);
  display: flex; flex-direction: column;
}
:root[data-theme="light"] .viewer { background: rgba(255, 255, 255, .97); }

.viewer-bar {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 18px; border-bottom: 1px solid var(--border);
  flex: 0 0 auto; background: var(--surface);
}
.v-meta { flex: 1; min-width: 0; }
.v-meta strong {
  display: block; font-size: 13.5px; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.v-meta small {
  display: block; font-family: var(--mono); font-size: 9.5px;
  text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-top: 2px;
}
.v-count {
  font-family: var(--mono); font-size: 10.5px;
  letter-spacing: .12em; color: var(--muted); flex: 0 0 auto;
}
#v-download { text-decoration: none; }

.viewer-body {
  flex: 1; display: flex; align-items: center; gap: 8px;
  padding: 20px; min-height: 0;
}
.viewer-stage {
  flex: 1; height: 100%; min-width: 0;
  display: flex; align-items: center; justify-content: center;
}
.viewer-stage img,
.viewer-stage video {
  max-width: 100%; max-height: 100%;
  object-fit: contain; display: block;
}
.viewer-stage iframe {
  width: 100%; height: 100%; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface);
}
.v-audio {
  width: min(460px, 100%); padding: 26px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
}
.v-audio audio { width: 100%; display: block; }
.v-text {
  width: 100%; height: 100%; overflow: auto; margin: 0;
  padding: 20px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-family: var(--mono); font-size: 12px; line-height: 1.6;
  white-space: pre-wrap; word-break: break-word;
}

.v-nav {
  flex: 0 0 42px; height: 72px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--muted);
  font-size: 22px; line-height: 1; cursor: pointer;
}
.v-nav:hover { color: var(--text); border-color: var(--text); }
.v-nav[hidden] { display: none; }

.att.viewable .att-thumb, .att.viewable .att-info a { cursor: zoom-in; }

@media (max-width: 860px) {
  .viewer-body { padding: 10px; gap: 4px; }
  .v-nav { flex: 0 0 32px; height: 56px; font-size: 18px; }
}

/* =====================================================================
   Plantillas
   ===================================================================== */

.tpl-row {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 0; border-bottom: 1px solid var(--border);
}
.tpl-row .info { flex: 1; min-width: 0; }
.tpl-row .info div { font-size: 13px; }
.tpl-row .info small {
  display: block; font-family: var(--mono); font-size: 9.5px;
  text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-top: 2px;
}
.tpl-desc { margin: 6px 0 0; font-size: 12px; color: var(--muted); }

.tpl-detail {
  border-bottom: 1px solid var(--border);
  padding: 4px 0 12px;
}
.tpl-task {
  display: flex; align-items: baseline; gap: 10px;
  padding: 5px 0 5px 10px; font-size: 12.5px;
  border-left: 1px solid var(--border);
}
.tpl-task.sub { padding-left: 26px; color: var(--muted); font-size: 12px; }
.tpl-task .tt-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpl-task .tt-sec, .tpl-task .tt-off {
  font-family: var(--mono); font-size: 9.5px; text-transform: uppercase;
  letter-spacing: .1em; color: var(--muted); flex: 0 0 auto;
}
.tpl-task .tt-sec { border: 1px solid var(--border); border-radius: 2px; padding: 2px 6px; }

.check-line {
  display: flex; align-items: center; gap: 9px;
  font-size: 12.5px; color: var(--muted); cursor: pointer; margin-bottom: 4px;
}
.check-line input { accent-color: var(--accent); }

/* =====================================================================
   Responsable y co-responsable
   ===================================================================== */

.avatars { display: inline-flex; align-items: center; flex: 0 0 auto; }
.avatars .avatar + .avatar { margin-left: -7px; }
.avatar.co {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--text);
}
:root[data-theme="light"] .avatar.co { background: var(--surface); }

/* --------------------------- subtareas ricas ------------------------- */

.sub-row {
  cursor: pointer; border-radius: var(--radius);
  flex-wrap: wrap; row-gap: 6px; padding: 9px 6px;
}
.sub-row:hover { background: var(--surface-2); }
.sub-row .t-title { flex: 1 1 auto; min-width: 0; }
/* La metainformación baja a una segunda línea, alineada bajo el título. */
.sub-meta {
  flex: 1 0 100%; display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap; padding-left: 27px;
}
.sub-meta .chip { padding: 2px 6px; }

.drawer-crumb {
  padding: 10px 18px 0;
  border-bottom: none;
}
.drawer-crumb .link-btn { padding: 0; }

/* =====================================================================
   Barra de filtros
   ===================================================================== */

.toolbar select { max-width: 165px; }
.toolbar input[type=search] { width: 140px; }

.btn-clear {
  border-color: var(--text);
  font-size: 10px;
  padding: 7px 11px;
}

@media (max-width: 1100px) {
  .toolbar select { max-width: 130px; font-size: 12px; }
}

/* =====================================================================
   Descripción enriquecida
   ===================================================================== */

.notes-block { position: relative; }
.notes-block.drop-target { outline: 2px dashed var(--text); outline-offset: 4px; border-radius: var(--radius); }

.notes-view {
  min-height: 150px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  cursor: text;
  font-size: 13px;
  line-height: 1.65;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.notes-view:hover { border-color: var(--border-strong); }
.notes-view a { color: var(--text); text-decoration: none; border-bottom: 1px solid var(--border-strong); }
.notes-view a:hover { border-bottom-color: var(--text); }

.notes-empty { color: var(--muted); margin: 0; font-size: 12.5px; }

.notes-img {
  display: block;
  max-width: 100%;
  max-height: 320px;
  margin: 10px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: zoom-in;
  object-fit: contain;
}

.notes-file {
  display: inline-flex; align-items: center; gap: 7px;
  margin: 4px 0;
  padding: 5px 10px;
  border: 1px solid var(--border-strong) !important;
  border-radius: var(--radius);
  font-family: var(--mono); font-size: 11px;
  text-decoration: none;
}
.notes-file::before { content: "↓"; color: var(--muted); }
.notes-file:hover { border-color: var(--text) !important; }

.notes-input {
  width: 100%;
  min-height: 170px;
  padding: 11px 12px;
  border: 1px solid var(--text);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.65;
  resize: vertical;
}
.notes-input:focus { outline: none; }

.notes-actions { display: flex; gap: 7px; margin-top: 8px; flex-wrap: wrap; }

/* "opcional" en las etiquetas de campo */
.field label em {
  font-style: normal;
  text-transform: none;
  letter-spacing: 0;
  opacity: .6;
  margin-left: 5px;
}

/* =====================================================================
   Panel de subtarea: se distingue del de una tarea principal
   ===================================================================== */

:root, :root[data-theme="dark"] { --subtask-bg: #17161A; }
:root[data-theme="light"] { --subtask-bg: #F4F3F7; }

.drawer.is-subtask { background: var(--subtask-bg); border-left: 3px solid var(--alert); }
.drawer.is-subtask .drawer-head,
.drawer.is-subtask .notes-view,
.drawer.is-subtask .att,
.drawer.is-subtask .field input,
.drawer.is-subtask .field select,
.drawer.is-subtask .inline-add input { background: var(--subtask-bg); }

.drawer-crumb {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px 0;
}
.crumb-tag {
  font-family: var(--mono); font-size: 9.5px;
  text-transform: uppercase; letter-spacing: .14em; color: var(--alert);
}

.btn-back {
  border-color: var(--alert);
  color: var(--alert);
  padding: 6px 11px;
}
.btn-back:hover { background: var(--alert); color: #fff; border-color: var(--alert); }

/* =====================================================================
   Calendario: entrega y publicación se distinguen por color
   (además del filo continuo o discontinuo, que sigue ahí)
   ===================================================================== */

:root {
  --cal-entrega: #4E92C8;      /* azul  */
  --cal-publicacion: #D9A038;  /* ámbar */
}

.cal-item.prod {
  border-left-color: var(--cal-entrega);
  background: color-mix(in srgb, var(--cal-entrega) 10%, transparent);
}
.cal-item.prod .k { color: var(--cal-entrega); }
.cal-item.pub {
  border-left-color: var(--cal-publicacion);
  background: color-mix(in srgb, var(--cal-publicacion) 12%, transparent);
}
.cal-item.pub .k { color: var(--cal-publicacion); }
.cal-item.prod:hover { border-color: var(--cal-entrega); }
.cal-item.pub:hover { border-color: var(--cal-publicacion); }

.lg.prod::before { border-top-color: var(--cal-entrega); }
.lg.pub::before { border-top-color: var(--cal-publicacion); }
.lg.prod { color: var(--cal-entrega); }
.lg.pub { color: var(--cal-publicacion); }

/* =====================================================================
   Filtros en un solo botón
   ===================================================================== */

.filtros { position: relative; }

#btn-filters { display: inline-flex; align-items: center; gap: 8px; }
#btn-filters.activo { border-color: var(--text); background: var(--surface-2); }
.filtros-badge {
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: var(--accent); color: var(--on-accent);
  font-size: 9.5px; line-height: 16px; text-align: center;
}

.filtros-panel {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 65;
  width: 250px; padding: 16px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.filtros-panel .field { margin-bottom: 12px; }
.filtros-panel select { max-width: none; width: 100%; }
.filtros-pie { display: flex; justify-content: flex-end; margin-top: 4px; }

/* El grupo "Nueva tarea" + botón de plantillas */
.seg.nueva { border: none; gap: 1px; }
.seg.nueva .btn { border-radius: 0; }
.seg.nueva .btn:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.btn-tpl {
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 8px 12px; font-size: 14px; line-height: 1;
  border-left: 1px solid var(--on-accent);
}

/* =====================================================================
   Menú contextual
   ===================================================================== */

.context-menu {
  position: fixed; z-index: 95; min-width: 200px; padding: 5px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.context-menu button {
  display: block; width: 100%; text-align: left;
  padding: 8px 10px; border: none; background: none; cursor: pointer;
  border-radius: 2px; color: var(--text); font-size: 12.5px;
}
.context-menu button:hover { background: var(--surface-2); }

/* La subtarea rápida lleva su fecha de entrega al lado */
.inline-add { display: flex; gap: 6px; }
.inline-add input[type=date] {
  flex: 0 0 auto; width: auto;
  font-family: var(--mono); font-size: 11px;
  padding: 9px 10px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius); color: var(--text);
}

/* =====================================================================
   Avisos de campo obligatorio
   ===================================================================== */

.field-warn {
  margin: 6px 0 0;
  font-family: var(--mono); font-size: 9.5px;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--alert);
}
.field-warn::before { content: "! "; font-weight: 700; }

input.sin-fecha, input[type=date].sin-fecha {
  border-color: var(--alert) !important;
}

.chip.sin-entrega {
  border-color: var(--alert);
  color: var(--alert);
}

/* =====================================================================
   Celebración al terminar una tarea
   La estrella de la marca sale disparada desde la propia casilla.
   ===================================================================== */

#celebracion {
  position: fixed; inset: 0; z-index: 200;
  pointer-events: none; overflow: hidden;
}

.chispa {
  position: absolute;
  width: var(--tam); height: var(--tam);
  margin-left: calc(var(--tam) / -2);
  margin-top: calc(var(--tam) / -2);
  color: var(--text);
  animation: chispa-vuela 780ms cubic-bezier(.15,.75,.3,1) var(--retraso) both;
}
.chispa svg { width: 100%; height: 100%; display: block; }

@keyframes chispa-vuela {
  0%   { transform: translate(0,0) scale(.15) rotate(0deg); opacity: 0; }
  18%  { opacity: 1; }
  60%  { opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(1) rotate(var(--rot)); opacity: 0; }
}

.anillo {
  position: absolute; width: 16px; height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid var(--text); border-radius: 50%;
  animation: anillo-expande 560ms cubic-bezier(.2,.7,.3,1) both;
}
@keyframes anillo-expande {
  0%   { transform: scale(.25); opacity: .95; }
  100% { transform: scale(5); opacity: 0; }
}

/* Golpe de la casilla al marcarla */
.check.celebrando { animation: check-pop 420ms cubic-bezier(.34,1.6,.5,1) both; }
@keyframes check-pop {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.45); }
  70%  { transform: scale(.92); }
  100% { transform: scale(1); }
}

/* Cuando no queda nada pendiente, el símbolo cruza la pantalla */
.vuelo {
  position: absolute; top: 42%; left: -140px;
  width: 118px; color: var(--text);
  animation: vuelo-cruza 1.8s cubic-bezier(.4,.05,.5,.95) both;
}
.vuelo svg { width: 100%; height: auto; display: block; }
@keyframes vuelo-cruza {
  0%   { transform: translateX(0) translateY(0) rotate(-8deg); opacity: 0; }
  12%  { opacity: 1; }
  50%  { transform: translateX(calc(50vw + 70px)) translateY(-42px) rotate(4deg); }
  88%  { opacity: 1; }
  100% { transform: translateX(calc(100vw + 200px)) translateY(18px) rotate(-6deg); opacity: 0; }
}

.chispa.estela { animation-duration: 900ms; }

@media (prefers-reduced-motion: reduce) {
  .chispa, .anillo, .vuelo, .check.celebrando { animation: none !important; }
}

/* La tarea se despide al completarse, en vez de desaparecer de golpe */
.task-row.completada, .card.completada {
  animation: tarea-completada 320ms cubic-bezier(.4,0,.6,1) both;
}
@keyframes tarea-completada {
  0%   { transform: scale(1); opacity: 1; }
  30%  { transform: scale(1.015); }
  100% { transform: scale(.97); opacity: 0; filter: blur(1px); }
}
@media (prefers-reduced-motion: reduce) {
  .task-row.completada, .card.completada { animation: none !important; opacity: .4; }
}

/* =====================================================================
   Arrastrar secciones
   ===================================================================== */

.sec-grip {
  cursor: grab; color: var(--border-strong);
  font-size: 13px; line-height: 1; padding: 2px 1px;
  opacity: 0; transition: opacity .12s, color .12s;
}
.sec:hover .sec-grip { opacity: 1; }
.sec-grip:hover { color: var(--text); }
.sec-grip:active { cursor: grabbing; }
.sec.sec-arrastrando { opacity: .45; }

/* =====================================================================
   Recursos clave del proyecto
   ===================================================================== */

.rec-tabs { display: flex; gap: 1px; margin: 4px 0 10px; flex-wrap: wrap; }
.rec-tabs button {
  flex: 1; min-width: 110px;
  font-family: var(--mono); font-size: 9.5px;
  text-transform: uppercase; letter-spacing: .1em;
  padding: 9px 8px; cursor: pointer;
  background: transparent; color: var(--muted);
  border: 1px solid var(--border);
}
.rec-tabs button:hover { color: var(--text); border-color: var(--border-strong); }
.rec-tabs button.active { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

.rec-list {
  display: flex; flex-direction: column; gap: 6px;
  min-height: 120px; max-height: 44vh; overflow-y: auto;
  padding: 8px; margin-bottom: 12px;
  border: 1px dashed var(--border); border-radius: var(--radius);
}
.rec-list.drop-target { border-color: var(--text); border-style: solid; }

/* =====================================================================
   Texto con formato: barra, menú "/" y bloques
   ===================================================================== */

.slash-menu {
  position: fixed; z-index: 96; width: 210px; max-height: 280px; overflow-y: auto;
  padding: 5px; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.slash-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 7px 9px; border: none; background: none; cursor: pointer;
  border-radius: 2px; color: var(--text); font-size: 12.5px; text-align: left;
}
.slash-menu button:hover { background: var(--surface-2); }
.slash-menu .ic {
  flex: 0 0 22px; text-align: center;
  font-family: var(--mono); font-size: 10px; color: var(--muted);
}

/* Bloques dentro de una descripción o comentario ya renderizados */
.notes-view p, .comment-body p { margin: 0 0 6px; }
.notes-view .nh, .comment-body .nh {
  margin: 12px 0 6px; font-weight: 600; letter-spacing: -.02em;
  text-transform: none;
}
.notes-view .nh1, .comment-body .nh1 { font-size: 19px; }
.notes-view .nh2, .comment-body .nh2 { font-size: 16px; }
.notes-view .nh3, .comment-body .nh3 { font-size: 14px; }
.notes-view ul, .notes-view ol, .comment-body ul, .comment-body ol { margin: 4px 0 8px; padding-left: 22px; }
.notes-view li, .comment-body li { margin: 2px 0; }
.notes-view blockquote, .comment-body blockquote {
  margin: 6px 0; padding: 4px 0 4px 12px;
  border-left: 2px solid var(--border-strong); color: var(--muted);
}
.notes-view code, .comment-body code {
  font-family: var(--mono); font-size: .9em;
  background: var(--surface-2); padding: 1px 5px; border-radius: 2px;
}
.notes-view .nsep, .comment-body .nsep { height: 8px; }
.comment-body { white-space: normal; }

/* Subtareas dentro del formulario de nueva tarea */
.m-subs { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.m-sub {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 9px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius); font-size: 12.5px;
}
.m-sub span:first-child { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* =====================================================================
   Editor visual: se escribe sobre el texto ya formateado
   ===================================================================== */

.notes-rich {
  min-height: 150px;
  padding: 12px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 13px; line-height: 1.65;
  word-break: break-word; overflow-wrap: anywhere;
  outline: none;
  cursor: text;
}
.notes-rich:hover { border-color: var(--border-strong); }
.notes-rich:focus { border-color: var(--text); background: var(--surface); }
.notes-rich.compacto { min-height: 90px; }
.notes-rich.comentario { min-height: 70px; }

/* Marca de agua cuando está vacío */
.notes-rich:empty::before,
.notes-rich > div:only-child:empty::before {
  content: attr(data-vacio); color: var(--muted);
}
.notes-rich:has(> div:only-child > br:only-child)::before {
  content: attr(data-vacio); color: var(--muted); position: absolute; pointer-events: none;
}
.notes-block { position: relative; }

/* Bloques dentro del editor y de lo ya publicado */
.notes-rich h1, .notes-view .nh1, .comment-body .nh1 { font-size: 19px; }
.notes-rich h2, .notes-view .nh2, .comment-body .nh2 { font-size: 16px; }
.notes-rich h3, .notes-view .nh3, .comment-body .nh3 { font-size: 14px; }
.notes-rich h1, .notes-rich h2, .notes-rich h3 {
  margin: 12px 0 6px; font-weight: 600; letter-spacing: -.02em;
}
.notes-rich > div { margin: 0 0 2px; }
.notes-rich ul, .notes-rich ol { margin: 4px 0 8px; padding-left: 22px; }
.notes-rich li { margin: 2px 0; }
.notes-rich blockquote {
  margin: 6px 0; padding: 4px 0 4px 12px;
  border-left: 2px solid var(--border-strong); color: var(--muted);
}
.notes-rich code {
  font-family: var(--mono); font-size: .9em;
  background: var(--bg); padding: 1px 5px; border-radius: 2px;
}
.notes-rich a { color: var(--text); border-bottom: 1px solid var(--border-strong); text-decoration: none; }
.notes-rich img.notes-img { max-height: 260px; }

/* El elegido del menú "/" con las flechas */
.slash-menu button.sel { background: var(--accent); color: var(--on-accent); }
.slash-menu button.sel .ic { color: var(--on-accent); }

/* Menú contextual del proyecto: nombre y etiqueta de color */
.context-menu .menu-titulo {
  font-family: var(--mono); font-size: 9.5px;
  text-transform: uppercase; letter-spacing: .12em; color: var(--muted);
  padding: 6px 10px 8px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px;
}
.context-menu .menu-separador { height: 1px; background: var(--border); margin: 4px 0; }
.context-menu .menu-etiqueta {
  font-family: var(--mono); font-size: 9.5px;
  text-transform: uppercase; letter-spacing: .12em; color: var(--muted);
  padding: 6px 10px 4px;
}
.context-menu .colores {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 10px 8px; max-width: 220px;
}
.context-menu .colores .color {
  width: 20px; height: 20px; padding: 0; border-radius: 50%;
  border: 2px solid transparent; cursor: pointer;
}
.context-menu .colores .color[data-vacio] {
  background: transparent; border: 1px dashed var(--border-strong); position: relative;
}
.context-menu .colores .color.sel { border-color: var(--text); }
.context-menu .colores .color:hover { transform: scale(1.12); }

/* Descripción en modo lectura, para quien no la puede cambiar */
.notes-rich.solo-lectura {
  background: transparent;
  border-style: dashed;
  cursor: default;
}
.notes-rich.solo-lectura:hover { border-color: var(--border); }
.hint.bloqueado { color: var(--muted); }
.hint.bloqueado::before { content: "🔒 "; }
.field input:disabled, .field select:disabled {
  opacity: .55; cursor: not-allowed;
}

/* =====================================================================
   Resumen general
   ===================================================================== */

.resumen { max-width: 980px; }
.res-h {
  display: flex; align-items: center; gap: 10px;
  margin: 32px 0 12px; padding-top: 16px;
  border-top: 1px solid var(--border-strong);
  font-family: var(--mono); font-size: 11.5px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .18em; color: var(--text);
}
.res-h::before { content: ""; width: 6px; height: 6px; background: var(--text); border-radius: 1px; }

.tarjetas { display: flex; gap: 10px; flex-wrap: wrap; }
.tarjeta {
  flex: 1; min-width: 120px;
  padding: 16px 14px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface);
}
.tarjeta strong { display: block; font-size: 26px; font-weight: 600; letter-spacing: -.03em; }
.tarjeta span {
  display: block; margin-top: 3px;
  font-family: var(--mono); font-size: 9.5px;
  text-transform: uppercase; letter-spacing: .12em; color: var(--muted);
}
.tarjeta.alerta { border-color: var(--alert); }
.tarjeta.alerta strong { color: var(--alert); }

.tabla { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tabla th {
  text-align: left; padding: 8px 10px;
  font-family: var(--mono); font-size: 9.5px; font-weight: 400;
  text-transform: uppercase; letter-spacing: .12em; color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.tabla td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tabla td:first-child { display: flex; align-items: center; gap: 9px; }
.tabla tbody tr[data-ir-proyecto] { cursor: pointer; }
.tabla tbody tr:hover { background: var(--surface); }
.tabla .alerta-txt { color: var(--alert); font-weight: 500; }
.tabla .col-barra { width: 130px; white-space: nowrap; }
.tabla .sin-duenio td { color: var(--muted); font-style: italic; }

.barra {
  display: inline-block; width: 84px; height: 6px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 99px; overflow: hidden; vertical-align: middle;
}
.barra > span { display: block; height: 100%; background: var(--text); }
.barra.carga > span { background: var(--muted); }
.barra-pct { font-family: var(--mono); font-size: 10px; color: var(--muted); margin-left: 7px; }

.proximas { display: flex; flex-direction: column; gap: 5px; }
.prox {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer; font-size: 12.5px;
}
.prox:hover { border-color: var(--border-strong); }
.prox.vencida { border-left: 3px solid var(--alert); }
.prox-fecha {
  flex: 0 0 78px; font-family: var(--mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: .1em; color: var(--muted);
}
.prox.vencida .prox-fecha { color: var(--alert); }
.prox-titulo { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* La cabecera de columna admite el color del proyecto */
.col-head { border-bottom: 1px solid var(--border); }

/* Una subtarea dentro de "Mis tareas": se distingue sin dejar de ser una fila más */
.task-row.es-subtarea { border-left: 2px solid var(--border-strong); }
.chip.padre {
  border-style: dashed;
  max-width: 190px; overflow: hidden; text-overflow: ellipsis;
}

/* Acción destructiva dentro de un menú contextual */
.context-menu button.peligro { color: var(--alert); }
.context-menu button.peligro:hover { background: rgba(220,38,38,.12); }

/* Subtarea mientras se arrastra */
.sub-row[draggable="true"] { cursor: grab; }
.sub-row.dragging { opacity: .4; }

/* Proyectos archivados en la barra lateral */
.archivados-cab {
  width: 100%; text-align: left; margin-top: 10px; padding: 7px 9px;
  background: none; border: none; cursor: pointer;
  font-family: var(--mono); font-size: 9.5px;
  text-transform: uppercase; letter-spacing: .12em; color: var(--muted);
}
.archivados-cab:hover { color: var(--text); }
.project-item.archivado { opacity: .55; }
.project-item.archivado .pname { text-decoration: line-through; }

/* Nota explicativa dentro de un menú contextual */
.context-menu .menu-nota {
  padding: 7px 10px; font-size: 11px; color: var(--muted); font-style: italic;
}

/* =====================================================================
   Avisos
   ===================================================================== */

/* Avisos: bajo el logo y fuera de los proyectos, porque son de toda la agencia. */
.avisos-btn {
  position: relative;
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 9px 9px; margin-bottom: 14px;
  background: transparent; border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer; color: var(--muted);
  font-family: var(--mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: .12em;
}
.avisos-btn:hover { color: var(--text); border-color: var(--border-strong); }
.avisos-btn .campana { font-size: 14px; line-height: 1; width: 18px; text-align: center; }
.avisos-txt { flex: 1; text-align: left; }
.avisos-btn.con-avisos { color: var(--text); border-color: var(--alert); }
.avisos-btn.con-avisos .campana { color: var(--alert); }
.avisos-num {
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--alert); color: #fff; border-radius: 999px;
  font-size: 9.5px; line-height: 18px; text-align: center; letter-spacing: 0;
}
.avisos-btn.con-avisos .campana { animation: campana-llama 1.4s ease-in-out 2; }
@keyframes campana-llama {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-12deg); }
  40% { transform: rotate(9deg); }
  60% { transform: rotate(-6deg); }
  80% { transform: rotate(4deg); }
}

.avisos-panel {
  position: fixed; top: 108px; left: 268px; z-index: 96;
  width: 300px; max-height: 60vh; overflow: hidden;
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.avisos-cab {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 12px; border-bottom: 1px solid var(--border);
  font-family: var(--mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: .12em; color: var(--muted);
}
.avisos-lista { overflow-y: auto; padding: 5px; }
.aviso {
  display: block; width: 100%; text-align: left;
  padding: 9px 10px; border: none; background: none; cursor: pointer;
  border-radius: 2px; color: var(--muted); font-size: 12.5px;
}
.aviso:hover { background: var(--surface-2); }
.aviso.sin-leer { color: var(--text); }
.aviso.sin-leer .aviso-texto::before {
  content: ""; display: inline-block; width: 6px; height: 6px;
  background: var(--alert); border-radius: 50%; margin-right: 7px; vertical-align: middle;
}
.aviso time {
  display: block; margin-top: 3px;
  font-family: var(--mono); font-size: 9px;
  text-transform: uppercase; letter-spacing: .1em; color: var(--muted);
}

/* =====================================================================
   Título compuesto: formato - tema
   ===================================================================== */

.titulo-partes { display: flex; align-items: center; gap: 7px; }
.titulo-partes input {
  flex: 1; min-width: 0;
  padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); color: var(--text); font-size: 13px;
}
.titulo-partes input:focus { outline: none; border-color: var(--text); background: var(--surface); }
.titulo-partes #m-formato { flex: 0 0 32%; }
.titulo-partes span { color: var(--muted); }
.titulo-vista {
  margin: 7px 0 0; font-family: var(--mono); font-size: 10px;
  letter-spacing: .1em; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Gestión del equipo */
.member-row .info { display: flex; flex-direction: column; gap: 4px; }
.member-row .m-nombre, .member-row .m-email {
  width: 100%; padding: 6px 8px;
  border: 1px solid transparent; border-radius: 2px;
  background: transparent; color: var(--text); font-size: 12.5px;
}
.member-row .m-email { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.member-row .m-nombre:hover, .member-row .m-email:hover { border-color: var(--border); }
.member-row .m-nombre:focus, .member-row .m-email:focus {
  outline: none; border-color: var(--text); background: var(--surface-2);
}
.member-row .m-rol {
  flex: 0 0 auto; padding: 6px 8px; font-size: 11px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
}

/* En pantalla estrecha la barra lateral se oculta: el panel de avisos no puede
   quedarse anclado donde estaba. */
@media (max-width: 860px) {
  .avisos-panel {
    left: 12px; right: 12px; top: 92px;
    width: auto;
  }
}

/* Día del calendario que recibe una entrada arrastrada */
.cal-day.drag-over { outline: 2px dashed var(--text); outline-offset: -3px; }
.cal-item.dragging { opacity: .4; }
.cal-item[draggable="true"] { cursor: grab; }

/* Editor de plantillas */
.tpl-editor-cab { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.tpl-editor-cab h2 { margin: 0; }
.tpl-editor-cab .btn-back { font-size: 11px; padding: 6px 10px; }

.tpl-sub-row {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 0; border-bottom: 1px solid var(--border);
}
.tpl-sub-row input.tpl-sub-title {
  flex: 1; min-width: 0;
  padding: 7px 9px; border: 1px solid transparent; border-radius: 2px;
  background: transparent; color: var(--text); font-size: 12.5px;
}
.tpl-sub-row input.tpl-sub-title:hover { border-color: var(--border); }
.tpl-sub-row input.tpl-sub-title:focus {
  outline: none; border-color: var(--text); background: var(--surface-2);
}
.tpl-sub-row .tpl-sub-resp {
  flex: 0 0 140px;
  padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); color: var(--text); font-size: 11px;
}
.tpl-sub-row .tpl-sub-off {
  flex: 0 0 88px;
  padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); color: var(--text); font-size: 11px;
  font-family: var(--mono); text-align: right;
}

/* Recursos clave: fila con pestañas + botón de edición */
.rec-tabs-fila { display: flex; align-items: center; gap: 6px; margin: 4px 0 10px; }
.rec-tabs-fila .rec-tabs { flex: 1; margin: 0; }
.rec-tabs-fila #rec-cats-toggle {
  flex: 0 0 auto; font-size: 15px; color: var(--muted);
  border: 1px solid var(--border); border-radius: var(--radius); width: 30px; height: 30px;
}
.rec-tabs-fila #rec-cats-toggle:hover { color: var(--text); border-color: var(--border-strong); }
.rec-tabs-fila #rec-cats-toggle.activo { background: var(--surface-2); color: var(--text); border-color: var(--text); }

/* Editor de categorías */
#rec-cats-editor {
  margin: 0 0 12px; padding: 12px;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius);
}
.rec-cat-row {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 0; border-bottom: 1px solid var(--border);
}
.rec-cat-row .rec-cat-name {
  flex: 0 0 160px;
  padding: 6px 9px; border: 1px solid transparent; border-radius: 2px;
  background: transparent; color: var(--text); font-size: 12.5px; font-weight: 500;
}
.rec-cat-row .rec-cat-hint {
  flex: 1; min-width: 0;
  padding: 6px 9px; border: 1px solid transparent; border-radius: 2px;
  background: transparent; color: var(--muted); font-size: 11.5px;
}
.rec-cat-row input:hover { border-color: var(--border); }
.rec-cat-row input:focus { outline: none; border-color: var(--text); background: var(--surface); color: var(--text); }
.rec-cat-add { display: flex; align-items: center; gap: 6px; padding-top: 10px; }
.rec-cat-add input {
  flex: 1; padding: 7px 9px; font-size: 12.5px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text);
}
.rec-cat-add input:focus { outline: none; border-color: var(--text); }

/* Segunda línea del aviso: proyecto · fecha */
.aviso-pie {
  display: block; margin-top: 3px;
  font-family: var(--mono); font-size: 9px;
  text-transform: uppercase; letter-spacing: .1em; color: var(--muted);
}
.aviso.sin-leer .aviso-pie { color: var(--muted); }

/* Barra de guardado del panel de tarea: pegada bajo la cabecera para que se vea
   siempre que haya algo pendiente, por largo que sea el contenido. */
.drawer-guardar {
  position: sticky; top: 0; z-index: 6;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--text);
}
.drawer-guardar.hidden { display: none; }
.drawer-guardar .guardar-txt {
  flex: 1; min-width: 0;
  font-family: var(--mono); font-size: 10px; text-transform: uppercase;
  letter-spacing: .1em; color: var(--text);
}
.drawer-guardar .btn { flex: 0 0 auto; }

@media (max-width: 640px) {
  .drawer-guardar { flex-wrap: wrap; }
  .drawer-guardar .guardar-txt { flex: 0 0 100%; }
}
