/* Ocean Prospecting — diseño minimalista: lateral negra, área de trabajo clara, acento azul. */
@font-face {
  font-family: 'Inter';
  src: url('/static/fuentes/InterVariable.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #F5F4F0;
  --sidebar: #0A0A0A;
  --card: #FFFFFF;
  --accent: #2F5E8C;
  --accent-soft: #8FB4D9;
  --text: #16181B;
  --text-muted: #6B7076;
  --border: #E4E2DC;
  --danger: #B3372C;
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  font-feature-settings: 'tnum' 1;
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; }

.layout { display: flex; min-height: 100vh; }

/* ---------- sidebar ---------- */
.sidebar {
  background: var(--sidebar);
  color: #fff;
  width: 240px;
  flex: 0 0 240px;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 20px; }
.sidebar .brand img { width: 28px; height: 28px; }
.sidebar .brand .co { font-weight: 600; font-size: 13px; letter-spacing: 0; }
.sidebar .brand .sub { font-size: 11px; color: #9AA0A6; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a {
  color: #C9CCD1;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar nav a:hover { background: #1A1A1A; color: #fff; }
.sidebar nav a.active { background: var(--accent); color: #fff; }
.sidebar nav a .badge { margin-left: auto; background: var(--accent-soft); color: #0A0A0A; border-radius: 999px;
  font-size: 11px; padding: 1px 7px; font-weight: 600; }
.sidebar .foot { padding-top: 14px; border-top: 1px solid #222; font-size: 12px; color: #9AA0A6; }
.sidebar .foot .who { padding: 10px 12px 0; display: flex; justify-content: space-between; align-items: center; }
.sidebar .foot #logout { color: #C9CCD1; cursor: pointer; background: none; border: 0; padding: 0; margin: 0; font: inherit; }

/* ---------- main area ---------- */
.mainwrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; border-bottom: 1px solid var(--border); background: var(--card);
  position: sticky; top: 0; z-index: 5;
}
.menubtn { display: none; background: none; border: none; cursor: pointer; padding: 6px; }
.main { padding: 24px; flex: 1; }

.pagehead { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
.pagehead .eyebrow { font-size: 11px; letter-spacing: 0; color: var(--text-muted); margin-bottom: 2px; }
.pagehead h1 { font-size: 20px; margin: 0; font-weight: 650; }
.pagehead .actions { display: flex; gap: 8px; }
.backlink { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--text-muted); margin-bottom: 6px; }

/* ---------- botones ---------- */
.btn {
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  padding: 8px 14px; border-radius: 8px; font-size: 13.5px; cursor: pointer; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { border-color: #C9C6BC; }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { background: #274E76; }
.btn.danger { color: var(--danger); border-color: #E3C6C1; }
.btn.small { padding: 5px 10px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: default; }
.link-btn { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 13px; padding: 0; }

/* ---------- tarjetas / stats ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.stats { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; min-width: 140px; }
.stat .lab { font-size: 11.5px; color: var(--text-muted); letter-spacing: 0; }
.stat .val { font-size: 24px; font-weight: 650; margin-top: 4px; }
.stat.warn .val { color: var(--danger); }

/* ---------- tablas ---------- */
table.grid { width: 100%; border-collapse: collapse; font-size: 13.3px; background: var(--card); }
table.grid th, table.grid td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
table.grid th { color: var(--text-muted); font-weight: 600; font-size: 11.5px; letter-spacing: 0; }
table.grid tbody tr:hover { background: #FAFAF8; cursor: pointer; }
.tablewrap { border: 1px solid var(--border); border-radius: var(--radius); overflow: auto; background: var(--card); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: #EFEEE9; color: var(--text); }
.pill.accent { background: var(--accent-soft); color: #0A2A40; }

/* ---------- filtros ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filters select, .filters input {
  border: 1px solid var(--border); border-radius: 7px; padding: 7px 9px; font-size: 13px; background: var(--card); color: var(--text);
}
input, select, textarea {
  font-family: inherit; font-size: 13.5px; border: 1px solid var(--border); border-radius: 7px;
  padding: 7px 10px; background: var(--card); color: var(--text); width: 100%;
}
textarea { resize: vertical; }
label.field { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 3px; margin-top: 10px; }
.formgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

/* ---------- tareas (Hoy) ---------- */
.taskgroup { margin-bottom: 26px; }
.taskgroup h2 { font-size: 14px; margin: 0 0 10px; color: var(--text-muted); letter-spacing: 0; }
.taskcard { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px; }
.taskcard.overdue { border-left: 3px solid var(--danger); }
.taskcard .trow { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.taskcard .ttitle { font-weight: 600; font-size: 13.8px; }
.taskcard .tmeta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.taskcard .tactions { display: flex; gap: 6px; flex-wrap: wrap; }
.taskbody { margin-top: 10px; font-size: 13.2px; white-space: pre-wrap; }
.msgblock { background: #F7F6F2; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin: 8px 0;
  position: relative; white-space: pre-wrap; font-size: 13px; }
.msgblock { padding-right: 96px; }
.msgblock .copybtn { position: absolute; top: 8px; right: 8px; }
.emptystate { text-align: left; padding: 6px 2px 14px; color: var(--text-muted); font-size: 13px; font-weight: 400; }

/* ---------- ficha (detail) ---------- */
.detail3 { display: grid; grid-template-columns: 300px 1fr 280px; gap: 18px; align-items: start; }
.detail-props .propfield { padding: 7px 0; border-bottom: 1px solid var(--border); }
.detail-props .propfield .k { font-size: 11px; color: var(--text-muted); }
.detail-props .propfield .v { font-size: 13.5px; margin-top: 2px; }
.detail-props .propfield .v[contenteditable], .detail-props .propfield select { cursor: text; }
.side-section { margin-bottom: 16px; }
.side-section h3 { font-size: 12px; color: var(--text-muted); margin: 0 0 8px; display: flex; justify-content: space-between; }
.timeline-item { border-bottom: 1px solid var(--border); padding: 10px 0; font-size: 13px; }
.timeline-item .when { font-size: 11.5px; color: var(--text-muted); }

/* ---------- kanban ---------- */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 10px; }
.kcol { background: #EFEEE8; border-radius: var(--radius); min-width: 240px; flex: 0 0 240px; padding: 10px; }
.kcol h3 { font-size: 12.5px; margin: 0 0 8px; display: flex; justify-content: space-between; color: var(--text-muted); }
.kcard { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 10px; margin-bottom: 8px; cursor: grab; font-size: 13px; }
.kcard.dragging { opacity: .4; }
.kcol.dragover { background: #E4E9EE; }

/* ---------- modal / overlay ---------- */
/* .overlay es un <dialog> abierto con showModal(): se anulan los estilos del UA para que ocupe la ventana como antes. */
.overlay { display: none; position: fixed; inset: 0; width: auto; height: auto; max-width: none; max-height: none; margin: 0; border: 0;
  color: inherit; background: rgba(10,10,10,.45); z-index: 50; align-items: flex-start; justify-content: center; padding: 60px 16px; overflow-y: auto;
  overscroll-behavior: contain; }
.overlay[open] { display: flex; }
.overlay::backdrop { background: transparent; overflow: hidden; overscroll-behavior: contain; }
.modal { background: var(--card); border-radius: var(--radius); padding: 22px; width: 560px; max-width: 100%; }
.modal h3 { margin: 0 0 14px; font-size: 16px; display: flex; justify-content: space-between; }
.modal h3 .x { cursor: pointer; color: var(--text-muted); font-weight: 400; background: none; border: 0; padding: 0; margin: 0; font: inherit; font-weight: 400; display: inline; align-self: flex-start; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ---------- toast ---------- */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translate(-50%, 20px); background: #16181B; color: #fff;
  padding: 10px 18px; border-radius: 8px; font-size: 13px; opacity: 0; transition: opacity .2s; z-index: 100; }
@media (prefers-reduced-motion: no-preference) { .toast { transition: .2s; } }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }

/* ---------- login ---------- */
.loginwrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--sidebar); }
.loginbox { background: var(--card); border-radius: 12px; padding: 36px 32px; width: 340px; }
.loginbox img { width: 36px; height: auto; display: block; margin: 0 auto 8px; }
.loginbox h1 { font-size: 16px; text-align: center; margin: 0 0 22px; font-weight: 600; }
.loginbox label.field { margin-top: 14px; }
.loginbox .err { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 18px; }
.loginbox button { width: 100%; margin-top: 18px; }

/* ---------- utilidades ---------- */
.mono { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-muted); }
.right { text-align: right; }
.hidden { display: none !important; }
.loading { padding: 60px; text-align: center; color: var(--text-muted); }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  /* Cerrada: visibility hidden la saca del orden de tabulación y del árbol accesible (antes sus enlaces seguían enfocables fuera de pantalla). */
  .sidebar { position: fixed; left: -260px; top: 0; bottom: 0; z-index: 40; visibility: hidden; width: 220px; flex-basis: 220px; }
  .sidebar.open { left: 0; visibility: visible; }
  @media (prefers-reduced-motion: no-preference) {
    .sidebar { transition: left .18s, visibility 0s linear .18s; }
    .sidebar.open { transition: left .18s; }
  }
  .menubtn { display: inline-flex; }
  .detail3 { grid-template-columns: 1fr; }
  .main { padding: 14px; }
  table.grid { font-size: 12.6px; }
  .topbar { padding: 12px 14px; }
}

.taskcard.compact .taskbody, .taskcard.compact .msgblock { display: none; }
.taskcard.compact { padding-top: 10px; padding-bottom: 10px; }
.taskcard .expand { font-size: 12.5px; color: var(--accent, #2F5E8C); cursor: pointer; margin-top: 6px; display: inline-block;
  background: none; border: 0; padding: 0; font: inherit; font-size: 12.5px; text-align: left; }
.taskcard:not(.compact) .expand { display: none; }

.filters select, .filters input { width: auto; min-width: 150px; }
.filters input[type=search], .filters input:first-child { min-width: 240px; flex: 1 1 240px; }
@media (max-width: 700px) { .filters select, .filters input { flex: 1 1 100%; } }

/* ---------- tarea en grande + enlaces como botones ---------- */
.modal.wide { width: 1040px; max-width: 96vw; padding: 26px 28px; }
.overlay:has(.modal.wide) { padding-top: 28px; padding-bottom: 28px; }
.tdmeta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); margin: -4px 0 14px; }
.tdlinks { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tdbody { max-height: calc(100vh - 290px); overflow-y: auto; font-size: 14.5px; line-height: 1.55; padding-right: 4px; }
.tdbody .taskbody { font-size: 14.5px; }
.tdbody .msgblock { font-size: 14.5px; padding: 14px 16px; padding-right: 110px; line-height: 1.55; }
.modal.wide #f_body { min-height: 42vh; font-size: 14px; line-height: 1.5; }
.modal.wide .foot { align-items: center; }
.linkbtn { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; vertical-align: middle; margin: 2px 2px; }
.linkbtn svg { width: 14px; height: 14px; }
.btn.xs { padding: 1px 7px; font-size: 11px; margin-left: 6px; }
.msgblock .linkrow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; white-space: normal; }
.taskcard { cursor: default; }
@media (max-width: 700px) {
  .modal.wide { padding: 18px; }
  .tdbody { max-height: none; }
  .tdbody .msgblock { padding-right: 14px; padding-top: 44px; }
}
[hidden] { display: none !important; }
.taskcard .tactions .dd { display: inline-flex; position: relative; }

/* ---------- MWG 2026-11: controles nativos con el mismo aspecto que los enlaces/span anteriores ---------- */
.ddmenu .ddi { display: block; width: 100%; padding: 6px 10px; cursor: pointer; background: none; border: 0; margin: 0;
  font: inherit; color: var(--accent); text-align: left; white-space: nowrap; }
a.rowlink { color: inherit; }
.rowbtn { background: none; border: 0; padding: 0; margin: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; white-space: nowrap; }
.pill .pillx { background: none; border: 0; padding: 0; margin: 0; font: inherit; color: inherit; cursor: pointer; display: inline; vertical-align: baseline; }

/* ---------- Outbound (hub de email en frío) ---------- */
.vh { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.subnav { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; }
.subnav a { padding: 8px 12px; color: var(--text-muted); font-size: 13.5px; font-weight: 500; white-space: nowrap; position: relative; }
.subnav a:hover { color: var(--text); }
/* Selección con forma (subrayado con borde), no solo con color. */
.subnav a[aria-current="page"] { color: var(--accent); }
.subnav a[aria-current="page"]::after { content: ""; position: absolute; inset: auto 8px -1px 8px; border-bottom: 2px solid var(--accent); }
.obnotice { font-size: 12.5px; color: var(--text-muted); margin: -4px 0 14px; }
.obnotice.warn { color: var(--text); background: #FBEDEA; border: 1px solid #E3C6C1; border-radius: 8px; padding: 9px 12px; margin-top: 0; }
.obsec { margin-bottom: 22px; }
.obsec h2 { font-size: 14px; margin: 0 0 10px; font-weight: 600; }
.obgrid2 { display: grid; grid-template-columns: minmax(0, max-content) minmax(320px, 1fr); gap: 18px; align-items: start; }
table.grid td.num, table.grid th.num { text-align: right; }
table.grid td.wrap, table.grid .wrap { white-space: normal; min-width: 160px; max-width: 300px; }
table.grid td.subj { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
table.obbase td.signal { min-width: 260px; max-width: 420px; font-size: 12.6px; }
.sm { font-size: 11.8px; }
.tablewrap:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
th:has(> .sortbtn) { padding: 0; }
.sortbtn { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 5px; inline-size: 100%; min-block-size: 32px;
  padding: 9px 12px; cursor: pointer; font: inherit; color: inherit; }
.sortbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.sortbtn svg { opacity: .35; flex: none; }
th[aria-sort] .sortbtn svg { opacity: 1; }
th[aria-sort="ascending"] .sortbtn svg { transform: none; clip-path: inset(0 0 50% 0); }
th[aria-sort="descending"] .sortbtn svg { clip-path: inset(50% 0 0 0); }
.seg { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.filters .inl { font-size: 12px; color: var(--text-muted); }
.filters input[type=date] { min-width: 0; width: auto; }
.pill.ob-good { background: #E3EFE6; color: #1F5130; }
.pill.ob-accent { background: var(--accent-soft); color: #0A2A40; }
.pill.ob-warn { background: #F6EBD3; color: #6A4A0C; }
.pill.ob-bad { background: #F6E0DC; color: #7A2318; }
/* Embudo: una serie, barras finas con extremo redondeado de 4px; valor en el extremo con color de texto. */
.funnel { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.funnel li { display: grid; grid-template-columns: minmax(120px, 190px) 1fr 3ch; align-items: center; gap: 10px; font-size: 12.8px; }
.funnel .fbar { block-size: 14px; display: block; }
.funnel .fbar span { display: block; block-size: 100%; min-inline-size: 2px; background: var(--accent); border-radius: 0 4px 4px 0; }
.funnel li.closed .fbar span { background: #B9B6AD; }
.funnel .fv { text-align: right; font-weight: 600; }
.funnel li:hover .fl { color: var(--accent); }
/* Fichas */
.obwide { margin-top: 18px; display: grid; gap: 18px; }
.obwide .obsec { margin-bottom: 0; }
.obseq + .obseq { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 14px; }
.obseq-h { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.obsteps { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 10px; }
.obstep { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.obstep-h { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.obstep-n { font-weight: 600; font-size: 12.5px; }
.obstep-s { margin-top: 6px; font-weight: 500; }
.obstep details { margin-top: 6px; }
.obstep summary { cursor: pointer; color: var(--accent); font-size: 12.5px; }
.obstep .msgblock { padding-right: 12px; }
.obdossier { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 24px; }
.obdossier .md { font-size: 13.5px; line-height: 1.55; overflow-wrap: anywhere; }
.obdossier .md h3, .obdossier .md h4, .obdossier .md h5 { font-size: 13.5px; margin: 16px 0 6px; }
.obdossier .md p { margin: 0 0 10px; }
.obdossier .md code { background: #F1F0EB; padding: 0 4px; border-radius: 4px; }
.mdref { border-bottom: 1px dotted var(--text-muted); }
.obsig { font-size: 13px; }
.obsig h4 { font-size: 12px; color: var(--text-muted); margin: 14px 0 6px; }
.obsig ul { margin: 0; padding-left: 18px; }
.obsig li { margin-bottom: 4px; }
@media (max-width: 1100px) { .obgrid2, .obdossier { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 700px) {
  .funnel li { grid-template-columns: minmax(96px, 120px) 1fr 3ch; }
  .filters .inl { flex: 0 0 auto; }
  .seg { flex: 1 1 100%; }
}
.stat .val .sub { font-size: 14px; font-weight: 500; color: var(--text-muted); }
/* Sublíneas (cargo, dominio, segmento) en celdas: pueden partirse para no ensanchar la tabla. */
table.grid td .sm { white-space: normal; max-width: 240px; }
table.grid td.subj { max-width: 230px; }
table.obbase td:first-child { white-space: normal; min-width: 170px; max-width: 230px; }
table.obbase td:nth-child(2) { white-space: normal; min-width: 130px; max-width: 190px; }
.pagehead .actions { flex-wrap: wrap; }
@media (max-width: 700px) { .pagehead .actions > select { flex: 1 1 100%; } }

/* Outbound · Estado de envíos */
.obchips { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 18px; }
.obchip { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-inline-size: 150px; padding: 10px 14px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; font: inherit; color: var(--text); cursor: pointer; text-align: left; }
.obchip b { font-size: 22px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.obchip span { font-size: 12px; color: var(--text-muted); }
.obchip.marcha { border-inline-start: 4px solid #3C8A55; }
.obchip.cola { border-inline-start: 4px solid var(--accent-soft); }
.obchip.parado { border-inline-start: 4px solid #C2665A; }
.obchip.on { outline: 2px solid var(--accent); outline-offset: 1px; }
.obchip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
table.obenvios td { vertical-align: top; }
