:root {
  --ink: #09090b;
  --surface: #111114;
  --surface-2: #17171b;
  --line: #232328;
  --line-strong: #3d3d46;
  --fg: #ededf0;
  --muted: #a1a1aa;
  --subtle: #85858f;
  --accent: #f2c14e;
  --accent-ink: #1a1405;
  --pos: #4ade80;
  --neg: #f87171;
  --alta: #f87171;
  --media: #f2c14e;
  --baja: #60a5fa;
  --radio: 12px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--ink);
  color: var(--fg);
  font: 15px/1.5 "Geist", ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 26px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
h2 { font-size: 17px; }
h3 { font-size: 16px; }
.tenue { color: var(--subtle); }
.nota { color: var(--subtle); font-size: 13px; margin: 6px 0 12px; }
.vacio { color: var(--subtle); padding: 18px 0; }
.espacio { flex: 1; }
.nowrap { white-space: nowrap; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }

.cargando { padding: 40px; color: var(--muted); }

/* ---------- marca ---------- */
.marca { text-decoration: none; font-weight: 700; letter-spacing: 0.04em; white-space: nowrap; }
.marca-t { color: var(--fg); }
.marca-s { color: var(--accent); font-weight: 500; letter-spacing: 0; }
.marca.grande { font-size: 30px; }

/* ---------- acceso ---------- */
.acceso { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.acceso-caja { width: min(380px, 100%); text-align: center; }
.acceso-caja .sub { color: var(--muted); margin: 8px 0 28px; }
.acceso-msg { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radio); padding: 12px; color: var(--muted); }
.acceso-botones { display: flex; gap: 10px; justify-content: center; }
.acceso-botones .btn { min-width: 120px; }
.etiqueta { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; }

/* ---------- cabecera ---------- */
.cabecera {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 20px;
  padding: 12px max(16px, calc((100vw - 1100px) / 2));
  background: rgba(9, 9, 11, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.menu { display: flex; gap: 4px; flex: 1; }
.menu a {
  text-decoration: none; color: var(--muted); padding: 7px 12px; border-radius: 8px; font-weight: 500;
}
.menu a:hover { color: var(--fg); background: var(--surface); }
.menu a.activo { color: var(--fg); background: var(--surface-2); box-shadow: inset 0 -2px 0 var(--accent); }
.usuario { position: relative; }
.chip-usuario {
  border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px;
  padding: 5px 14px; cursor: pointer; font-weight: 500;
}
.menu-usuario {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px;
  background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--radio);
  padding: 6px; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}
.menu-usuario button {
  display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 8px; cursor: pointer;
}
.menu-usuario button:hover { background: var(--line); }
.menu-usuario .nota { padding: 4px 10px; margin: 0 0 4px; }

/* ---------- contenido ---------- */
.contenido { max-width: 1100px; margin: 0 auto; padding: 24px 16px 100px; }
.titulo-vista { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.acciones { display: flex; gap: 8px; flex-wrap: wrap; }
.volver { display: inline-block; color: var(--muted); text-decoration: none; margin-bottom: 10px; font-size: 14px; }
.volver:hover { color: var(--fg); }
.concepto { color: var(--muted); margin: 6px 0 0; }
.concepto.grande { font-size: 16px; margin: -8px 0 22px; white-space: pre-line; }
.fecha-titulo { font-size: 16px; font-weight: 400; }
.sub-h { margin: 26px 0 10px; }

/* ---------- botones ---------- */
.btn {
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--fg);
  padding: 8px 14px; border-radius: 9px; cursor: pointer; font-weight: 500; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn.primario { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primario:hover { filter: brightness(1.08); }
.btn.peligro { color: var(--neg); border-color: rgba(248, 113, 113, 0.4); background: transparent; }
.btn.mini { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: 0.6; cursor: wait; }
.btn.google { width: 100%; padding: 12px; font-size: 16px; }
.enlace { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: none; font-size: 14px; }
.enlace:hover { text-decoration: underline; }

/* ---------- pills ---------- */
.pill {
  display: inline-flex; align-items: center; font-size: 12px; font-weight: 500; line-height: 1;
  padding: 5px 9px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--muted);
  background: transparent; text-decoration: none; white-space: nowrap;
}
.prio-alta { color: var(--alta); border-color: rgba(248, 113, 113, 0.45); }
.prio-media { color: var(--media); border-color: rgba(242, 193, 78, 0.45); }
.prio-baja { color: var(--baja); border-color: rgba(96, 165, 250, 0.45); }
.pill.persona { color: var(--fg); }
.pill.estado { cursor: pointer; }
.pill.proyecto-pill:hover, .pill.estado:hover { border-color: var(--muted); color: var(--fg); }
.contador { font-size: 13px; color: var(--subtle); font-weight: 400; margin-left: 6px; }

/* ---------- tarjetas ---------- */
.rejilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.tarjeta {
  display: block; text-decoration: none; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radio); padding: 16px; transition: border-color 0.15s, transform 0.15s;
}
.tarjeta:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.tarjeta-cab { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.tarjeta .concepto { font-size: 14px; min-height: 42px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mini-datos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.mini-datos span { font-family: "Geist Mono", ui-monospace, monospace; font-size: 14px; }
.mini-datos small, .kpi small, .dispositivos small { display: block; font-family: "Geist", sans-serif; color: var(--subtle); font-size: 12px; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radio); padding: 12px 16px; }
.kpi b { font-family: "Geist Mono", ui-monospace, monospace; font-size: 22px; font-weight: 500; }
.kpi.pos b { color: var(--pos); }
.kpi.neg b { color: var(--neg); }
.aportes { color: var(--muted); font-size: 14px; display: flex; gap: 16px; flex-wrap: wrap; margin: 0 0 14px; }
.aportes b { color: var(--fg); font-weight: 500; }

/* ---------- bloques ---------- */
.bloque { margin-top: 30px; }
.bloque-cab { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }

/* ---------- filtros y formularios en línea ---------- */
.filtros { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 16px; }
.filtros label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--subtle); }
select, input, textarea {
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 9px; padding: 8px 10px; min-width: 0;
}
select:focus, input:focus, textarea:focus { outline: 2px solid rgba(242, 193, 78, 0.5); outline-offset: 0; border-color: var(--accent); }
textarea { resize: vertical; width: 100%; }
.alta-rapida { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radio); }
.alta-rapida input[name=titulo] { flex: 1 1 240px; }
.alta-idea { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radio); padding: 10px; margin-bottom: 14px; }
.alta-idea textarea { border: 0; background: transparent; padding: 4px; }
.alta-idea textarea:focus { outline: none; }
.alta-idea-pie { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 6px; }
.notas-reunion { min-height: 120px; }

/* ---------- tareas ---------- */
.tareas, .ideas { list-style: none; margin: 0; padding: 0; }
.tarea {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; margin-bottom: 6px; background: var(--surface); flex-wrap: wrap;
}
.tarea input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; flex: none; }
.tarea-titulo { flex: 1 1 200px; text-align: left; background: none; border: 0; padding: 0; cursor: pointer; }
.tarea-titulo:hover { color: var(--accent); }
.tarea-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tarea.estado-hecha .tarea-titulo { text-decoration: line-through; color: var(--subtle); }
.tarea.estado-en_curso { border-left: 3px solid var(--accent); }
.tarea.estado-en_curso .pill.estado { color: var(--accent); border-color: rgba(242, 193, 78, 0.45); }

/* ---------- tablas ---------- */
.tabla-envoltura { overflow-x: auto; }
.tabla { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabla th { text-align: left; color: var(--subtle); font-weight: 500; font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line-strong); }
.tabla td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tabla .num { text-align: right; font-family: "Geist Mono", ui-monospace, monospace; }
.tabla.resumen { margin-bottom: 8px; }
.tabla.resumen a { text-decoration: none; }
.tabla.resumen a:hover { color: var(--accent); }
.fila-click { cursor: pointer; }
.fila-click:hover td { background: var(--surface); }

/* ---------- canales ---------- */
.canales { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 10px; }
.canal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radio); padding: 14px; }
.canal-cab { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 14px; }
.dispositivos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 8px; }
.dispositivos span { font-family: "Geist Mono", ui-monospace, monospace; font-size: 18px; }
.historial summary { cursor: pointer; color: var(--muted); font-size: 14px; margin: 8px 0; }

/* ---------- reuniones e ideas ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs button { background: none; border: 0; padding: 8px 14px; color: var(--muted); cursor: pointer; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.activo { color: var(--fg); border-bottom-color: var(--accent); }
.reuniones { display: grid; gap: 10px; }
.tarjeta.reunion { display: flex; gap: 16px; align-items: center; }
.tarjeta.reunion p { margin: 2px 0 0; font-size: 14px; }
.fecha-caja { width: 64px; flex: none; text-align: center; border-right: 1px solid var(--line); padding-right: 14px; }
.fecha-caja b { display: block; font-size: 24px; font-family: "Geist Mono", ui-monospace, monospace; font-weight: 500; line-height: 1.1; }
.fecha-caja small { color: var(--subtle); font-size: 12px; text-transform: uppercase; }
.idea { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--line-strong); border-radius: 10px; padding: 12px 14px; margin-bottom: 8px; }
.idea.destino-nuevo { border-left-color: var(--accent); }
.idea.destino-proyecto { border-left-color: var(--pos); }
.idea-texto { white-space: normal; }
.idea-pie { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; font-size: 13px; }
.idea-pie a { text-decoration: none; }
.idea-pie select { padding: 4px 8px; font-size: 13px; }
.hecho { color: var(--pos); font-size: 13px; }

/* ---------- modal ---------- */
dialog {
  border: 1px solid var(--line-strong); border-radius: 16px; background: var(--surface-2); color: var(--fg);
  padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 24px);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(2px); }
.formulario { padding: 20px; }
.formulario h2 { margin-bottom: 16px; font-size: 19px; }
.campos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.campo { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
.campo.ancho { grid-column: 1 / -1; }
.campo input, .campo select, .campo textarea { color: var(--fg); font-size: 15px; width: 100%; }
.campo input[type=file] { padding: 6px; }
.factura-actual { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--fg); padding: 6px 0; }
.check { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); }
.check input { width: auto; }
.pie-modal { display: flex; gap: 8px; margin-top: 20px; flex-wrap: wrap; }

/* ---------- aviso ---------- */
#aviso {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--fg); color: var(--ink); padding: 10px 18px; border-radius: 999px; font-weight: 500;
  transition: opacity 0.2s, transform 0.2s; z-index: 100; max-width: calc(100vw - 32px);
}
#aviso.visible { opacity: 1; transform: translate(-50%, 0); }
#aviso.error { background: var(--neg); color: #fff; }

/* ---------- móvil ---------- */
@media (max-width: 760px) {
  .cabecera { flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
  .menu {
    order: 3; flex-basis: 100%; overflow-x: auto;
  }
  .menu a { flex: 1; text-align: center; padding: 7px 8px; }
  .usuario { margin-left: auto; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi.pos, .kpi.neg { grid-column: 1 / -1; }
  .kpi b { font-size: 19px; }
  .canales { grid-template-columns: 1fr; }
  .campos { grid-template-columns: 1fr; }
  .alta-rapida select { flex: 1 1 30%; }
  h1 { font-size: 22px; }
}

/* ---------- documentos ---------- */
.documentos { list-style: none; margin: 0; padding: 0; }
.documento {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px; margin-bottom: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
}
.doc-tipo {
  flex: none; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 9px;
  font: 600 12px "Geist Mono", ui-monospace, monospace; background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--muted);
}
.doc-pdf { color: #f87171; border-color: rgba(248, 113, 113, 0.4); }
.doc-img { color: #4ade80; border-color: rgba(74, 222, 128, 0.4); }
.doc-doc { color: #60a5fa; border-color: rgba(96, 165, 250, 0.4); }
.doc-xls { color: #34d399; border-color: rgba(52, 211, 153, 0.4); }
.doc-ppt { color: #fb923c; border-color: rgba(251, 146, 60, 0.4); }
.doc-cuerpo { flex: 1; min-width: 0; }
.doc-nombre { background: none; border: 0; padding: 0; cursor: pointer; text-align: left; font-weight: 500; overflow-wrap: anywhere; }
.doc-nombre:hover { color: var(--accent); }
.doc-nota { color: var(--muted); font-size: 14px; margin-top: 2px; }
.doc-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; margin-top: 6px; }
.doc-acciones { display: flex; gap: 10px; align-items: center; flex: none; }
@media (max-width: 760px) {
  .documento { flex-wrap: wrap; }
  .doc-acciones { width: 100%; justify-content: flex-end; }
  .menu a { padding: 7px 2px; font-size: 14px; flex: 1 1 0; min-width: 0; }
  .menu .largo { display: none; }
}
.menu .corto { display: none; }
@media (max-width: 760px) { .menu .corto { display: inline; } }

/* ---------- botón de web en tarjetas ---------- */
.tarjeta.proyecto { cursor: pointer; }
.cab-derecha { display: flex; gap: 6px; align-items: center; flex: none; }
.btn-web {
  font-size: 12px; font-weight: 500; line-height: 1; padding: 5px 8px; border-radius: 999px; text-decoration: none;
  color: var(--accent); border: 1px solid rgba(242, 193, 78, 0.45); white-space: nowrap;
}
.btn-web:hover { background: var(--accent); color: var(--accent-ink); }
