:root {
  --bg: #f6f7f9; --panel: #fff; --ink: #18202c; --muted: #667085; --line: #e3e6eb;
  --brand: #1f4bd8; --brand-ink: #fff; --bad: #c4321c; --good: #12805c; --warn: #b26b00;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #11151c; --panel: #1a2029; --ink: #e7eaf0; --muted: #98a2b3; --line: #2a323e; --brand: #6d8dff; --brand-ink: #0b1020; --bad: #ff7b63; --good: #4fd1a1; --warn: #f5b04c; color-scheme: dark; }
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
button { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 7px 12px; cursor: pointer; }
button:hover { border-color: var(--muted); }
button.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-weight: 600; }
button.ghost { background: transparent; border-color: transparent; }
button.small { padding: 4px 9px; font-size: 12.5px; }
button.danger { color: var(--bad); }
input, select, textarea { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 7px 9px; width: 100%; min-width: 0; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 1px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.err { color: var(--bad); min-height: 1em; }
.boot { padding: 40px; color: var(--muted); }

/* layout */
.top { display: flex; align-items: center; gap: 18px; padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 8px; }
.brand .logo { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--brand); color: var(--brand-ink); font-weight: 800; }
.brand.big { margin-bottom: 10px; } .brand.big b { display: block; font-size: 18px; } .brand.big small { color: var(--muted); }
.top nav { display: flex; gap: 2px; overflow-x: auto; flex: 1; }
.top nav a { padding: 6px 11px; border-radius: 7px; text-decoration: none; color: var(--muted); white-space: nowrap; }
.top nav a.active { background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand); font-weight: 600; }
.me { display: flex; align-items: center; gap: 6px; color: var(--muted); white-space: nowrap; }
.page { padding: 18px 20px 60px; max-width: 1500px; margin: 0 auto; }
.head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 8px 0 10px; }
.head h1 { margin: 0; font-size: 22px; } .head p { margin: 0; flex-basis: 100%; }
.head .primary { margin-left: auto; }
.count { display: inline-block; margin-left: 8px; padding: 0 7px; border-radius: 99px; background: var(--line); font-size: 12px; font-weight: 600; vertical-align: middle; color: var(--muted); }
.filters { display: flex; gap: 8px; margin: 10px 0 16px; flex-wrap: wrap; }
.filters input { max-width: 320px; } .filters select { width: auto; }
.empty { padding: 40px; text-align: center; color: var(--muted); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 16px; } .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .row input[type=file] { width: auto; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login form { width: min(360px, 100%); padding: 24px; display: grid; gap: 12px; }
.login label { display: grid; gap: 4px; font-weight: 500; }

/* kpis */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.kpi b { display: block; font-size: 24px; font-variant-numeric: tabular-nums; } .kpi span { color: var(--muted); font-size: 12.5px; }
.kpi.bad b { color: var(--bad); } .kpi.good b { color: var(--good); }

/* seguimientos */
.group { margin-bottom: 18px; }
.group h2 { font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 6px; }
.group.overdue h2 { color: var(--bad); } .group.today h2 { color: var(--warn); }
.rows { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.fu { display: grid; grid-template-columns: 70px 1fr auto auto; gap: 12px; align-items: center; padding: 9px 12px; border-top: 1px solid var(--line); }
.fu:first-child { border-top: 0; }
.fu .date { font-weight: 600; font-variant-numeric: tabular-nums; }
.group.overdue .fu .date { color: var(--bad); }
.fu .what a { text-decoration: none; color: inherit; } .fu .what a:hover b { text-decoration: underline; }
.fu .meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.who { font-size: 12px; padding: 1px 7px; border-radius: 99px; background: color-mix(in srgb, var(--brand) 10%, transparent); color: var(--brand); }
.who.none { background: transparent; color: var(--muted); border: 1px dashed var(--line); }
.prio { font-size: 11px; font-weight: 700; padding: 0 5px; border-radius: 4px; border: 1px solid var(--line); }
.prio.p1 { color: var(--bad); border-color: currentColor; } .prio.p2 { color: var(--warn); } .prio.p3 { color: var(--muted); }

/* pills por estado */
.pill { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 99px; background: var(--line); white-space: nowrap; }
.st-publicado, .st-aceptado, .st-contribucion-aceptada { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); }
.st-enviado, .st-contactado, .st-seguimiento-1, .st-seguimiento-2, .st-en-conversacion, .st-revision-editorial { background: color-mix(in srgb, var(--brand) 15%, transparent); color: var(--brand); }
.st-listo-para-enviar, .st-calificado, .st-pitch-en-preparacion, .st-aprobacion-interna, .st-aprobado-para-pitch { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.st-rechazado, .st-no-encaja, .st-cerrado, .st-pausado, .st-archivado { color: var(--muted); text-decoration: none; opacity: .85; }

/* tablero */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; } .seg button.on { background: var(--brand); color: var(--brand-ink); }
.board { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.col { flex: 0 0 250px; background: color-mix(in srgb, var(--line) 45%, transparent); border-radius: var(--radius); padding: 8px; min-height: 120px; }
.col.over { outline: 2px dashed var(--brand); }
.colhead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.cards { display: grid; gap: 8px; }
.kcard { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; cursor: grab; box-shadow: var(--shadow); }
.kcard.drag { opacity: .4; }
.ktop { display: flex; justify-content: space-between; gap: 6px; }
.ktitle { margin: 4px 0 6px; font-size: 13px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.kfoot { display: flex; gap: 6px; align-items: center; font-size: 12px; flex-wrap: wrap; }
.kdate { margin-left: auto; font-weight: 600; } .kdate.late { color: var(--bad); }
.kmove { margin-top: 6px; font-size: 12px; padding: 3px 5px; display: none; }
@media (hover: none) { .kmove { display: block; } }

/* tablas */
.tablewrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--panel); position: sticky; top: 0; }
tbody tr { cursor: pointer; } tbody tr:hover { background: color-mix(in srgb, var(--brand) 5%, transparent); }
td.c-id { white-space: nowrap; color: var(--muted); } td.c-outlet { font-weight: 600; }
table.mini { width: auto; margin: 10px 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }

/* bitácora */
.log { list-style: none; padding: 0; margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.log li { display: grid; grid-template-columns: 70px 1fr auto; gap: 12px; padding: 10px 12px; border-top: 1px solid var(--line); cursor: pointer; }
.log li:first-child { border-top: 0; }
.log li.sys { color: var(--muted); font-size: 13px; }
.log .ld { font-weight: 600; font-variant-numeric: tabular-nums; }
.log.compact li { grid-template-columns: 56px 1fr auto; padding: 7px 8px; }
.tag { font-size: 11.5px; border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; margin-right: 4px; color: var(--muted); }

/* ficha */
.drawer-bg { position: fixed; inset: 0; background: rgba(10, 14, 22, .35); z-index: 20; display: flex; justify-content: flex-end; }
.drawer { width: min(720px, 100%); height: 100%; overflow-y: auto; background: var(--bg); padding: 16px 20px 40px; box-shadow: -8px 0 30px rgba(0,0,0,.15); }
.dhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.dhead h2 { margin: 0; font-size: 18px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; margin-top: 10px; }
.f { display: grid; gap: 3px; font-size: 12.5px; color: var(--muted); }
.f > span { display: flex; gap: 8px; } .f .ext { margin-left: auto; }
.f input, .f select, .f textarea { color: var(--ink); font-size: 14px; }
.f-longtext { grid-column: 1 / -1; }
.dactions { display: flex; gap: 8px; margin: 14px 0; position: sticky; bottom: -40px; background: var(--bg); padding: 10px 0; }
.spacer { flex: 1; }
.drawer section { margin-top: 16px; } .drawer h3 { font-size: 14px; margin: 0 0 8px; }
.rel { list-style: none; padding: 0; margin: 0 0 8px; } .rel li { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; background: var(--panel); cursor: pointer; }
.drawer .log { margin-top: 8px; }

.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 9px 14px; border-radius: 8px; z-index: 50; box-shadow: var(--shadow); }
.toast.bad { background: var(--bad); color: #fff; }

@media (max-width: 760px) {
  .top { flex-wrap: wrap; padding: 8px 16px; gap: 8px; } .top nav { order: 3; flex-basis: 100%; } .me { margin-left: auto; }
  .page { padding: 12px 16px 60px; }
  .fu { grid-template-columns: 56px 1fr; } .fu .meta, .fu .acts { grid-column: 2; justify-content: flex-start; }
  .grid { grid-template-columns: 1fr; }
  .log li { grid-template-columns: 56px 1fr; } .log li .who { grid-column: 2; justify-self: start; }
  .col { flex-basis: 78vw; }
}
