@charset "UTF-8";
:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --ink: #1c2333;
  --muted: #6b7280;
  --line: #e3e6ec;
  --primary: #2563eb;
  --danger: #dc2626;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

a { color: var(--primary); }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: .95rem; margin: 1rem 0 .35rem; }

.topbar {
  display: flex; align-items: center; gap: 1.25rem;
  background: #fff; border-bottom: 1px solid var(--line);
  padding: .65rem 1.25rem; flex-wrap: wrap;
}
.brand { font-weight: 700; text-decoration: none; color: var(--ink); }
.nav { display: flex; gap: .85rem; flex: 1; flex-wrap: wrap; }
.nav a { text-decoration: none; color: var(--muted); padding: .25rem 0; }
.nav a.active, .nav a:hover { color: var(--ink); border-bottom: 2px solid var(--primary); }
.logout { display: flex; align-items: center; gap: .6rem; }
.who { color: var(--muted); font-size: .85rem; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 1.25rem; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.15rem; margin-bottom: 1rem; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 860px) { .cols { grid-template-columns: 1fr; } }

.btn {
  display: inline-block; border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: .45rem .8rem; border-radius: 8px; text-decoration: none; cursor: pointer; font-size: .9rem;
}
.btn:hover { border-color: #c9cedb; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-small { padding: .25rem .55rem; font-size: .8rem; }

.stack { display: flex; flex-direction: column; gap: .8rem; }
label { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 8px; padding: .45rem .6rem; width: 100%;
}
input[type="color"] { padding: .15rem; height: 38px; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(37, 99, 235, .35); border-color: var(--primary); }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: .8rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; align-items: end; }
.span-4 { grid-column: 1 / -1; }
.field-end { display: flex; align-items: flex-end; }
@media (max-width: 760px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.filters { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 1rem; }
.filters label { min-width: 160px; }
.inline-form { display: flex; gap: .5rem; align-items: flex-end; margin-top: .75rem; }

.muted { color: var(--muted); }
.small { font-size: .82rem; }
.alert { background: #fee2e2; border: 1px solid #fecaca; color: #991b1b; padding: .55rem .75rem; border-radius: 8px; }

.login-card { max-width: 380px; margin: 8vh auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.75rem; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; margin-bottom: 1rem; }
@media (max-width: 760px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--muted); border-radius: var(--radius); padding: .85rem 1rem; text-decoration: none; color: var(--ink); }
.kpi-n { display: block; font-size: 1.7rem; font-weight: 700; }
.kpi-l { color: var(--muted); font-size: .85rem; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: .45rem 0; border-bottom: 1px solid var(--line); display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.list li:last-child { border-bottom: 0; }
.late { color: var(--danger); font-weight: 600; }

.chips { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; padding: 0; margin: 0; }
.chip { display: inline-block; border: 2px solid var(--line); border-radius: 999px; padding: .2rem .7rem; text-decoration: none; color: var(--ink); font-size: .85rem; }

.pill { display: inline-block; color: #fff; border-radius: 999px; padding: .1rem .55rem; font-size: .78rem; }
.tag { display: inline-block; border-radius: 6px; padding: .1rem .5rem; font-size: .78rem; border: 1px solid var(--line); }

.status-pendiente { border-left-color: #9ca3af; background-color: #f3f4f6; }
.status-en_progreso { border-left-color: #f59e0b; background-color: #fef3c7; }
.status-revision { border-left-color: #8b5cf6; background-color: #ede9fe; }
.status-publicado { border-left-color: #10b981; background-color: #d1fae5; }
.kpi.status-pendiente, .kpi.status-en_progreso, .kpi.status-revision, .kpi.status-publicado { background-color: #fff; }

.table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: .55rem .7rem; border-bottom: 1px solid var(--line); font-size: .9rem; vertical-align: middle; }
.table th { background: #fafbfc; color: var(--muted); font-weight: 600; }
.table tr:last-child td { border-bottom: 0; }

.cal-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-bottom: 4px; color: var(--muted); font-size: .8rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-cell { background: #fff; border: 1px solid var(--line); border-radius: 8px; min-height: 110px; padding: .35rem; min-width: 0; overflow: hidden; }
.cal-cell.empty { background: transparent; border: 0; }
.cal-cell.today { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.cal-day { font-size: .78rem; color: var(--muted); margin-bottom: .25rem; }
.cal-item { display: block; font-size: .78rem; text-decoration: none; color: var(--ink); border-radius: 6px; padding: .2rem .35rem; margin-bottom: .2rem; border-left: 3px solid var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .3rem; }
.legend { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .75rem; }
.legend-item { font-size: .78rem; border-radius: 6px; padding: .15rem .5rem; border-left: 3px solid var(--muted); }

.meta { display: grid; grid-template-columns: 150px 1fr; gap: .35rem .75rem; margin: 0; }
.meta dt { color: var(--muted); font-size: .85rem; }
.meta dd { margin: 0; font-size: .9rem; word-break: break-word; }

.text-block { white-space: pre-wrap; word-wrap: break-word; background: #fafbfc; border: 1px solid var(--line); border-radius: 8px; padding: .75rem; font: inherit; margin: 0; }

.upload { display: block; margin-bottom: .75rem; }
.upload-fields { margin-bottom: .6rem; }
.upload input[type="file"] { width: 100%; }
.upload-box { border: 1px dashed var(--line); border-radius: 8px; padding: .85rem 1rem; margin: 0; }
.upload-box legend { font-size: .85rem; color: var(--muted); padding: 0 .35rem; }
.upload-box input[type="file"] { width: 100%; }
/* Tablero: artículos agrupados por estado, con el mismo aspecto que el listado */
.group { margin-bottom: 1.6rem; --st: #64748b; --st-soft: #f1f5f9; }
.group-pendiente   { --st: #64748b; --st-soft: #f1f5f9; }
.group-en_progreso { --st: #d97706; --st-soft: #fff7ed; }
.group-revision    { --st: #7c3aed; --st-soft: #f5f3ff; }
.group-publicado   { --st: #059669; --st-soft: #ecfdf5; }

.group-head {
  display: flex; align-items: center; gap: .5rem;
  background: var(--st-soft); border: 1px solid var(--line); border-left: 4px solid var(--st);
  border-radius: 10px 10px 0 0; padding: .5rem .8rem; margin-bottom: -1px;
}
.group-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--st); flex: none; }
.group-name { font-size: .95rem; margin: 0; flex: 1; }
.group-count {
  background: #fff; color: var(--st); border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 999px; padding: 0 .5rem; font-size: .78rem; font-weight: 700;
  font-variant-numeric: tabular-nums; min-width: 24px; text-align: center;
}
.group .table { border-radius: 0 0 10px 10px; }
.group-empty {
  background: #fff; border: 1px solid var(--line); border-radius: 0 0 10px 10px;
  margin: 0; padding: .7rem .8rem; color: var(--muted); font-size: .87rem;
}

.site-chip {
  display: inline-flex; align-items: center; gap: .35rem; max-width: 100%;
  background: #f8fafc; border: 1px solid rgba(15, 23, 42, .07); border-radius: 999px;
  padding: .1rem .55rem .1rem .4rem; font-size: .8rem; color: #334155; white-space: nowrap;
}
.site-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }

.date-chip {
  display: inline-block; font-size: .82rem; color: #475569; background: #f8fafc;
  border-radius: 6px; padding: .1rem .4rem; font-variant-numeric: tabular-nums;
}
.date-chip.soon { background: #fef3c7; color: #92400e; }
.date-chip.late { background: #fee2e2; color: #b91c1c; font-weight: 600; }
.date-chip.none { color: #94a3b8; background: transparent; }

.who-cell { display: inline-flex; align-items: center; gap: .4rem; }
.avatar {
  width: 22px; height: 22px; border-radius: 50%; background: #e2e8f0; color: #334155;
  display: grid; place-items: center; font-size: .66rem; font-weight: 700; flex: none;
}

/* Planificación en bloque */
.plan-category { max-width: 320px; margin-bottom: 1rem; }
.plan-table td { padding: .3rem .35rem; }
.plan-table input, .plan-table select { padding: .3rem .4rem; font-size: .88rem; }

/* Miniaturas de imágenes */
.thumb { display: block; flex: none; }
.thumb img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; }

/* Cuerpo del artículo con formato */
.prose { overflow-wrap: anywhere; }
.prose > *:first-child { margin-top: 0; }
.prose > *:last-child { margin-bottom: 0; }
.prose h1, .prose h2, .prose h3 { margin: 1.2rem 0 .4rem; line-height: 1.25; }
.prose h1 { font-size: 1.35rem; }
.prose h2 { font-size: 1.15rem; }
.prose h3 { font-size: 1rem; }
.prose p, .prose ul, .prose ol, .prose blockquote { margin: 0 0 .8rem; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li { margin-bottom: .25rem; }
.prose blockquote { border-left: 3px solid var(--line); padding-left: .8rem; color: var(--muted); }
.prose code { background: #f1f3f7; padding: .1em .35em; border-radius: 4px; font-size: .9em; }
.prose pre { background: #fafbfc; border: 1px solid var(--line); border-radius: 8px; padding: .75rem; overflow-x: auto; }
.prose img { max-width: 100%; height: auto; border-radius: 8px; }
.prose table { width: 100%; border-collapse: collapse; }
.prose th, .prose td { border: 1px solid var(--line); padding: .35rem .5rem; text-align: left; }
.raw { margin-top: 1rem; }
.raw summary { cursor: pointer; color: var(--muted); font-size: .85rem; }
.raw .text-block { margin-top: .5rem; }

.tag.lang { font-size: .7rem; color: var(--muted); }
.alert.ok { background: #d1fae5; border-color: #a7f3d0; color: #065f46; }
.alert.warn-alert { background: #fef3c7; border-color: #fde68a; color: #92400e; }

.check { flex-direction: row; align-items: center; gap: .4rem; color: var(--ink); font-size: .9rem; }
.check input { width: auto; }

.seo { list-style: none; padding: 0; margin: 0; }
.seo li { display: flex; align-items: center; gap: .5rem; padding: .3rem 0; border-bottom: 1px solid var(--line); font-size: .88rem; }
.seo li:last-child { border-bottom: 0; }
.seo-label { flex: 1; }
.seo-value { font-variant-numeric: tabular-nums; color: var(--muted); }
.seo-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: #9ca3af; }
.seo-ok .seo-dot { background: #10b981; }
.seo-warn .seo-dot { background: #f59e0b; }
.seo-bad .seo-dot { background: #dc2626; }

.comments { list-style: none; padding: 0; margin: 0 0 1rem; }
.comments li { border-left: 3px solid var(--line); padding: .35rem 0 .5rem .7rem; margin-bottom: .6rem; }
.comment-head { display: flex; align-items: center; gap: .5rem; }
.comment-body { margin: .15rem 0 0; white-space: pre-wrap; }

.row-actions { display: flex; gap: .4rem; flex-wrap: wrap; }

.files { list-style: none; padding: 0; margin: 0; }
.files li { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; padding: .4rem 0; border-bottom: 1px solid var(--line); }
.files li:last-child { border-bottom: 0; }

/* Filtros rápidos por fecha */
.quick-filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .9rem; }
.quick {
  display: inline-block; border: 1px solid var(--line); background: #fff; color: #475569;
  border-radius: 999px; padding: .22rem .75rem; font-size: .85rem; text-decoration: none;
}
.quick:hover { border-color: #c9cedb; }
.quick.late { color: #b91c1c; border-color: #fecaca; background: #fef2f2; }
.quick.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.quick.on.late { background: #b91c1c; border-color: #b91c1c; color: #fff; }

/* Normas por web */
.span-2 { grid-column: span 2; }
@media (max-width: 760px) { .span-2 { grid-column: 1 / -1; } }
.rules-legend { grid-column: 1 / -1; color: var(--ink); font-weight: 600; gap: .1rem; }
.site-rules-item {
  background: #f8fafc; border: 1px solid var(--line); border-left: 3px solid var(--primary);
  border-radius: 8px; padding: .7rem .9rem;
}
.site-rules-item h3 { margin-top: 0; }
.site-rules-item p { margin: .2rem 0; }
.rules { margin-top: .9rem; }
.rules summary { cursor: pointer; color: var(--muted); font-size: .85rem; }
.rules p, .rules pre { margin: .35rem 0; }

/* Historial del artículo */
.timeline { list-style: none; margin: 0; padding: 0; font-size: .87rem; }
.timeline li { padding: .35rem 0; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline .when { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: .4rem; }

/* Comparación de versiones */
.diff { border: 1px solid var(--line); border-radius: 8px; overflow: auto; background: #fff; }
.diff-line {
  white-space: pre-wrap; word-wrap: break-word; padding: .1rem .6rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82rem;
}
.diff-same { color: #475569; }
.diff-add { background: #ecfdf5; color: #065f46; }
.diff-del { background: #fef2f2; color: #b91c1c; text-decoration: line-through; }

a.who { text-decoration: none; }
a.who:hover { text-decoration: underline; }

/* Etiquetas libres */
.tag-chip {
  display: inline-block; background: #eef2ff; color: #3730a3; border: 1px solid #e0e7ff;
  border-radius: 999px; padding: .05rem .5rem; font-size: .75rem; text-decoration: none;
  margin-left: .25rem; white-space: nowrap;
}
.tag-chip:hover { background: #e0e7ff; }
.tag-filters { align-items: center; }

/* Editor: contador de palabras y plantilla */
.body-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .25rem; }

/* Calendario arrastrable */
.cal-item { cursor: grab; }
.cal-item.dragging { opacity: .45; }
.cal-cell.drop-target { border-color: var(--primary); background: #eff6ff; }
.drag-hint { margin: -.5rem 0 .6rem; }

/* Estado de los enlaces publicados */
.link-state {
  display: inline-block; border-radius: 6px; padding: .05rem .45rem; font-size: .78rem;
  font-weight: 700; font-variant-numeric: tabular-nums;
}
.link-ok { background: #d1fae5; color: #065f46; }
.link-warn { background: #fef3c7; color: #92400e; }
.link-bad { background: #fee2e2; color: #b91c1c; }
.check-url { margin-top: .3rem; flex-wrap: wrap; }

/* Tablas que se desplazan de lado en pantallas estrechas */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* --- Móvil ---------------------------------------------------------------- */
@media (max-width: 760px) {
  .wrap { padding: .85rem; }
  .filters label { min-width: 0; flex: 1 1 100%; }
  .meta { grid-template-columns: 1fr; gap: .1rem .5rem; }
  .meta dt { margin-top: .5rem; }
  .cal { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .cal-head, .cal-grid { min-width: 620px; }
  .drag-hint { display: none; }
  .page-head h1 { font-size: 1.25rem; }
}

@media (max-width: 700px) {
  /* El listado y el tablero pasan de tabla a fichas apiladas */
  .table.cards thead { display: none; }
  .table.cards, .table.cards tbody, .table.cards tr, .table.cards td { display: block; width: 100%; }
  .table.cards tr {
    border-bottom: 1px solid var(--line); padding: .5rem .2rem;
  }
  .table.cards tr:last-child { border-bottom: 0; }
  .table.cards td {
    border-bottom: 0; padding: .18rem .55rem; display: flex; gap: .6rem;
    align-items: baseline; justify-content: space-between;
  }
  .table.cards td::before {
    content: attr(data-label); color: var(--muted); font-size: .78rem; flex: none;
  }
  .table.cards td[data-label=""]::before { content: none; }
  .table.cards td.cell-main { display: block; font-size: .95rem; padding-bottom: .3rem; }
  .table.cards td.cell-main::before { content: none; }
}

/* Un título larguísimo no debe estirar la tabla ni la página */
.table { table-layout: auto; }
.table td, .table th { overflow-wrap: anywhere; word-break: break-word; }
.table td a { overflow-wrap: anywhere; }
.group .table { display: table; width: 100%; }
