/* River MKT OS · identidad provisional (reemplazable desde Configuración → Agencia) */
:root {
  --brand: #0E6E78;
  --brand-ink: color-mix(in srgb, var(--brand) 82%, #000);
  --brand-soft: color-mix(in srgb, var(--brand) 10%, #fff);
  --bg: #F5F6F8;
  --surface: #FFFFFF;
  --ink: #111C27;
  --ink-2: #33414E;
  --muted: #64717E;
  --line: #E2E6EB;
  --line-2: #EEF1F4;
  --side: #0E1A25;
  --side-ink: #C9D3DC;
  --side-muted: #7F8E9C;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 32, .05), 0 1px 1px rgba(16, 24, 32, .03);
  --blue: #1D5FD1; --blue-bg: #EAF1FD;
  --green: #18794E; --green-bg: #E7F5EE;
  --amber: #A15C07; --amber-bg: #FDF3E1;
  --red: #B42318; --red-bg: #FDECEA;
  --violet: #6741C6; --violet-bg: #F1ECFC;
  --teal: #0F766E; --teal-bg: #E4F4F2;
  --neutral: #4B5865; --neutral-bg: #EEF1F4;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--ink); background: var(--bg); }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 24px; font-weight: 680; }
h2 { font-size: 15px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
p { margin: 0 0 .6em; }
code { font-size: 12px; background: var(--line-2); padding: 1px 5px; border-radius: 4px; }
input, select, textarea, button { font: inherit; color: inherit; }
.icon { flex: none; vertical-align: -3px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.strong { font-weight: 600; }
.text-red { color: var(--red); }
.text-amber { color: var(--amber); }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.sep { margin: 0 6px; color: var(--muted); }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.plain { list-style: none; margin: 0; padding: 0; }
.plain > li { padding: 6px 0; border-bottom: 1px solid var(--line-2); }
.plain > li:last-child { border-bottom: 0; }

/* ---------- Estructura ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 236px; flex: none; background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 18px 16px 10px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand-logo { max-height: 30px; max-width: 150px; background: #fff; border-radius: 6px; padding: 2px; }
.nav { padding: 6px 10px 16px; flex: 1; }
.nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--side-muted); padding: 16px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; color: var(--side-ink); font-size: 14px; }
.nav a:hover { background: rgba(255, 255, 255, .06); text-decoration: none; color: #fff; }
.nav a.active { background: color-mix(in srgb, var(--brand) 55%, transparent); color: #fff; }
.nav-count { margin-left: auto; background: #E5484D; color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 0 7px; line-height: 18px; }
.sidebar-foot { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-top: 1px solid rgba(255, 255, 255, .08); }
.me { flex: 1; min-width: 0; display: flex; flex-direction: column; color: var(--side-ink); }
.me:hover { text-decoration: none; color: #fff; }
.me-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-role { font-size: 12px; color: var(--side-muted); }
.sidebar .icon-btn { color: var(--side-ink); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 28px; background: rgba(245, 246, 248, .92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.search { flex: 1; max-width: 520px; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 0 10px; color: var(--muted); }
.search input { border: 0; outline: 0; background: transparent; padding: 8px 0; width: 100%; color: var(--ink); }
.search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.content { padding: 22px 28px 60px; max-width: 1240px; width: 100%; }
.content-wide { max-width: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.subtitle { margin: 6px 0 0; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.split-main, .split-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-2 > .card { margin: 0; }
.scrim { display: none; }
.only-sm { display: none !important; }

/* ---------- Tarjetas ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0; }
.split-main > .card, .split-side > .card { margin: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--line-2); }
.card-head h2 { display: flex; align-items: baseline; gap: 8px; }
.card-body { padding: 14px 16px; }
.card-body > .table-wrap { margin: -14px -16px; }
.card-body > .table-wrap + * { margin-top: 26px; }
.card-body > .mini-kpis + .table-wrap { margin-top: 10px; margin-bottom: -14px; border-top: 1px solid var(--line-2); }
.notes { margin-top: 10px; padding: 10px 12px; background: var(--line-2); border-radius: 8px; font-size: 14px; color: var(--ink-2); white-space: normal; }
.empty { text-align: center; padding: 26px 16px; color: var(--muted); }
.empty-title { color: var(--ink-2); font-weight: 600; margin-bottom: 4px; }
.empty .btn { margin-top: 8px; }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 8px; padding: 8px 14px; font-weight: 600; font-size: 14px; line-height: 1.2; border: 1px solid transparent; cursor: pointer; white-space: nowrap; text-decoration: none !important; transition: background .12s, border-color .12s; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-ink); }
.btn-secondary { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-secondary:hover { border-color: #C9D0D8; background: #FAFBFC; }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--line-2); }
.btn-danger-ghost { background: transparent; color: var(--red); }
.btn-danger-ghost:hover { background: var(--red-bg); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--line-2); color: var(--ink); }
.inline-form { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.danger-zone { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 4px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; line-height: 18px; }
.badge-neutral { background: var(--neutral-bg); color: var(--neutral); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-violet { background: var(--violet-bg); color: var(--violet); }
.badge-teal { background: var(--teal-bg); color: var(--teal); }
.badge-demo { background: #FFF7D6; color: #7A5A00; font-weight: 600; font-size: 11px; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); font-size: 11px; font-weight: 700; flex: none; }
.avatar-empty { background: var(--line-2); color: var(--muted); }

/* ---------- Alertas ---------- */
.alert { border-radius: 9px; padding: 10px 14px; margin-bottom: 14px; font-size: 14px; border: 1px solid; }
.alert-ok { background: var(--green-bg); border-color: #BFE3D0; color: #0F5132; }
.alert-error { background: var(--red-bg); border-color: #F5C2BD; color: #7A1C14; }
.alert-info { background: var(--blue-bg); border-color: #C7D9F8; color: #173E80; }
.callout { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.check-inline { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-weight: 500; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { display: flex; flex-direction: column; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 15px; color: var(--ink); box-shadow: var(--shadow); border-left: 3px solid var(--line); }
a.kpi:hover { text-decoration: none; border-color: #C9D0D8; }
.kpi-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi-value { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.kpi-sub { font-size: 12px; color: var(--muted); }
.kpi-red { border-left-color: var(--red); } .kpi-red .kpi-value { color: var(--red); }
.kpi-amber { border-left-color: #E3A008; }
.kpi-blue { border-left-color: var(--blue); }
.kpi-green { border-left-color: var(--green); }
.kpi-violet { border-left-color: var(--violet); }
.mini-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px 16px; }
.mini-kpis > div { display: flex; flex-direction: column; }
.mini-kpis span { font-size: 12px; color: var(--muted); }
.mini-kpis strong { font-size: 16px; }
.three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.three > div { display: flex; flex-direction: column; gap: 3px; padding: 4px 0; }
.three strong { font-size: 18px; }
.three small { color: var(--muted); font-size: 12px; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line); background: #FAFBFC; white-space: nowrap; }
.table th.num { text-align: right; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr[data-href] { cursor: pointer; }
.table tr[data-href]:hover td { background: #FAFBFC; }
.table.compact td { padding: 6px 4px; }
.bar-cell { width: 55%; }
.hbar { display: inline-block; height: 8px; width: calc(100% - 40px); background: var(--line-2); border-radius: 4px; vertical-align: middle; overflow: hidden; }
.hbar > span { display: block; height: 100%; background: var(--brand); border-radius: 4px; }
.hbar-label { margin-left: 8px; font-size: 13px; font-weight: 600; }
.progress { display: inline-block; width: 70px; height: 6px; background: var(--line-2); border-radius: 3px; overflow: hidden; vertical-align: middle; }
.progress > span { display: block; height: 100%; background: var(--green); }
.progress-label { font-size: 12px; color: var(--muted); margin-left: 6px; }
.due.overdue { color: var(--red); font-weight: 600; }
.due.today { color: var(--amber); font-weight: 600; }
.due.soon { color: var(--amber); }
.dl { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 6px 12px; margin: 0; font-size: 14px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ---------- Toolbar, filtros, pestañas ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); font-size: 13px; font-weight: 500; cursor: pointer; }
.chip:hover { text-decoration: none; border-color: #C9D0D8; }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip .count, .tabs .count { font-size: 11px; opacity: .75; }
.seg { display: inline-flex; background: var(--line-2); border-radius: 9px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg a, .seg button, .seg label { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 7px; color: var(--ink-2); font-size: 13px; font-weight: 500; border: 0; background: transparent; cursor: pointer; }
.seg a:hover { text-decoration: none; }
.seg .active { background: var(--surface); box-shadow: var(--shadow); color: var(--ink); }
.seg label input { display: none; }
.seg-form { margin: 0; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--muted); font-weight: 500; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--ink); border-bottom-color: var(--brand); }
.inline-search input, .period input { padding: 7px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); min-width: 260px; }
.period { justify-content: flex-start; }
.period label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.period input { min-width: 0; }
.month-nav { display: flex; align-items: center; gap: 8px; }
.month-nav strong { text-transform: capitalize; min-width: 130px; text-align: center; }

/* ---------- Formularios ---------- */
.form { margin: 0; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field label, .field legend { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.req { color: var(--red); margin-left: 2px; }
.field input, .field select, .field textarea, .attach-form input[type=url], .attach-form input[type=text], .inline-add input, .inline-add textarea, .activity-form select, .activity-form input, .activity-form textarea, .follow-form input, .quick-task input, .quick-task select, .add-item select, .add-item input, .tpl-row input, .tpl-row select, .stages-form input, .stages-form select, .approval-form textarea, select[data-autosubmit] {
  width: 100%; padding: 8px 10px; border: 1px solid #D5DBE1; border-radius: 8px; background: var(--surface); outline: none; min-width: 0;
}
textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--red); }
.field .error { color: var(--red); font-size: 12px; }
.field .help { color: var(--muted); font-size: 12px; }
.field-check { justify-content: flex-end; }
.field-check label { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.field-check input, .check-grid input { width: auto; }
fieldset.field { border: 1px solid var(--line); border-radius: 9px; padding: 10px 14px 12px; margin: 14px 0 0; }
fieldset.subtle { background: #FAFBFC; }
fieldset .check-inline input[type=number] { width: 64px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px 12px; }
.check-grid label { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 14px; }
.input-xs { width: 64px !important; }
details.advanced { margin-top: 14px; }
details.advanced > summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 600; margin-bottom: 12px; }
.form-actions { display: flex; gap: 8px; align-items: center; margin-top: 18px; flex-wrap: wrap; }
.grid-form .form-actions { margin-top: 0; align-self: end; }
.inline-add { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.inline-add input:not([type=checkbox]), .inline-add textarea { flex: 1; min-width: 160px; }
.activity-form { display: grid; gap: 8px; margin-bottom: 14px; }
.activity-form .row { display: flex; gap: 8px; }
.activity-form .btn { justify-self: start; }
.follow-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.follow-form input[type=text] { flex: 2; min-width: 220px; }
.follow-form input[type=date] { flex: 0 0 160px; }
.quick-dates { display: flex; gap: 6px; }
.quick-task { display: grid; grid-template-columns: 1fr 120px 150px 150px auto; gap: 8px; margin-bottom: 12px; }
.attach { margin-top: 10px; }
.attach > summary { list-style: none; display: inline-flex; }
.attach > summary::-webkit-details-marker { display: none; }
.attach-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.attach-form input[type=url], .attach-form input[type=text] { flex: 1; min-width: 150px; }
.logo-preview { max-height: 60px; max-width: 240px; border: 1px solid var(--line); border-radius: 8px; padding: 6px; background: #fff; }

/* ---------- Menú desplegable ---------- */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 210px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(16, 24, 32, .14); padding: 6px; display: flex; flex-direction: column; }
.menu-panel > a { padding: 8px 10px; border-radius: 7px; color: var(--ink); font-size: 14px; }
.menu-panel > a:hover { background: var(--line-2); text-decoration: none; }
.menu-wide { min-width: 300px; padding: 12px; gap: 8px; }
.radio { display: flex; gap: 8px; align-items: center; padding: 5px 0; font-size: 14px; }

/* ---------- Kanban ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.kcol { background: #ECEFF3; border-radius: 12px; padding: 10px; min-height: 120px; }
.kcol > header { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 6px; }
.kcol > header .count { font-size: 12px; color: var(--muted); font-weight: 600; }
.kcol-total { font-size: 12px; color: var(--muted); padding: 0 4px 8px; min-height: 8px; }
.kcol-won { background: #E3F1EA; }
.kcol-lost { background: #F4E8E7; }
.kcol-body { display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.kcol.drop-target { outline: 2px dashed var(--brand); outline-offset: -4px; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 11px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; cursor: grab; }
.kcard.dragging { opacity: .5; }
.kcard.flag-red { border-left: 3px solid var(--red); }
.kcard.flag-amber { border-left: 3px solid #E3A008; }
.kcard.prio-urgent { border-left: 3px solid var(--red); }
.kcard.prio-high { border-left: 3px solid #E3A008; }
.kcard-title { font-weight: 600; color: var(--ink); font-size: 14px; line-height: 1.3; }
.kcard-sub { font-size: 12px; color: var(--muted); }
.kcard-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.kcard-alert { font-size: 12px; color: var(--red); font-weight: 600; }
.kcard-next { font-size: 12px; color: var(--ink-2); }
.kcard-move select { font-size: 12px; padding: 3px 6px; border-radius: 6px; color: var(--muted); }
.js .kanban:not(.kanban-content) .kcard-move { display: none; }
@media (hover: none) { .js .kanban .kcard-move { display: block !important; } }

/* ---------- Tareas ---------- */
.task-list { list-style: none; margin: -6px 0; padding: 0; }
.task { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-2); }
.task:last-child { border-bottom: 0; }
.task-check { margin: 0; }
.check-btn { width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid #B7C0CA; background: var(--surface); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; color: #fff; margin-top: 1px; }
.check-btn:hover { border-color: var(--green); }
.check-btn.sm { width: 18px; height: 18px; }
.task.done .check-btn, .checklist .done .check-btn { background: var(--green); border-color: var(--green); }
.task-main { flex: 1; min-width: 0; }
.task-title { color: var(--ink); font-weight: 500; }
.task.done .task-title { color: var(--muted); text-decoration: line-through; }
.task-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 3px; }
.task-side { display: flex; align-items: center; gap: 8px; font-size: 13px; white-space: nowrap; }
.task.prio-urgent .task-title::before { content: "!! "; color: var(--red); font-weight: 700; }
.checklist { list-style: none; margin: 0 0 6px; padding: 0; }
.checklist li { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.checklist li span { flex: 1; }
.checklist li.done span { color: var(--muted); text-decoration: line-through; }
.comments { list-style: none; margin: 0 0 10px; padding: 0; }
.comments li { padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.approval-form { display: grid; gap: 8px; }
.approval-form .btn { justify-self: start; }

/* ---------- Línea de tiempo ---------- */
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 14px 12px; }
.timeline li::before { content: ""; position: absolute; left: -20px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand); }
.tl-head { font-size: 13px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tl-head .muted { margin-left: auto; }
.tl-del { width: 24px; height: 24px; opacity: .4; }
.tl-del:hover { opacity: 1; }
.tl-body { font-size: 14px; color: var(--ink-2); margin-top: 2px; }

/* ---------- Listas varias ---------- */
.contact-list { list-style: none; margin: 0; padding: 0; }
.contact-list li { padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.contact-list li:last-child { border-bottom: 0; }
.contact-links { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; margin-top: 2px; }
.link-icon { display: inline-flex; align-items: center; gap: 5px; }
.file-list { list-style: none; margin: 0; padding: 0; }
.file-list li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.file-list li > a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.follow-list, .proj-mini, .agenda-mini { list-style: none; margin: 0; padding: 0; }
.follow-list li, .proj-mini li, .agenda-mini li { padding: 9px 0; border-bottom: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 3px; }
.follow-list li:last-child, .proj-mini li:last-child, .agenda-mini li:last-child { border-bottom: 0; }
.agenda-mini li { flex-direction: row; align-items: center; gap: 8px; flex-wrap: wrap; }
.agenda-mini .when { font-size: 12px; font-weight: 700; color: var(--brand-ink); min-width: 92px; }
.shortcuts { display: flex; flex-wrap: wrap; gap: 8px; }
.team li { display: flex; align-items: center; gap: 8px; }
.search-results li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

/* ---------- Ventas: etapas ---------- */
.stepper { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 4px; }
.step { flex: 1; min-width: 90px; padding: 8px 10px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; }
.step:hover { border-color: var(--brand); color: var(--ink); }
.step.past { background: var(--brand-soft); color: var(--brand-ink); border-color: transparent; }
.step.current { background: var(--brand); color: #fff; border-color: var(--brand); }
.step-won.current { background: var(--green); border-color: var(--green); }
.step-lost.current { background: var(--red); border-color: var(--red); }

/* ---------- Propuestas ---------- */
.options { display: flex; flex-direction: column; gap: 16px; margin-bottom: 16px; }
.option { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.opt-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.opt-totals { display: flex; gap: 18px; text-align: right; }
.opt-totals div { display: flex; flex-direction: column; }
.opt-totals span { font-size: 12px; color: var(--muted); }
.opt-totals strong { font-size: 17px; }
.items { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.item-row { display: grid; grid-template-columns: minmax(160px, 2fr) 70px 120px 120px 32px; grid-template-areas: "name qty price billing del" "desc desc desc desc del"; gap: 6px 8px; padding: 10px; background: #FAFBFC; border: 1px solid var(--line-2); border-radius: 8px; }
.item-name { grid-area: name; } .item-qty { grid-area: qty; } .item-price { grid-area: price; } .item-billing { grid-area: billing; } .item-desc { grid-area: desc; } .item-del { grid-area: del; align-self: center; }
.item-row .field label { font-size: 11px; }
.add-item { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.add-item select { flex: 2; min-width: 200px; }
.add-item input { flex: 1; min-width: 160px; }

.wa-msg { width: 100%; padding: 10px 12px; border: 1px solid #D5DBE1; border-radius: 8px; background: #F3FBF6; font: 14px/1.5 var(--font); resize: vertical; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 6px; }

/* ---------- Agenda ---------- */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.day { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; min-height: 160px; padding: 8px; }
.day.today { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.day.past { background: #FAFBFC; }
.day > header { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.day > header strong { font-size: 16px; color: var(--ink); }
.day > header .icon-btn { margin-left: auto; width: 24px; height: 24px; }
.day ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.ev { border-left: 3px solid var(--blue); background: var(--blue-bg); border-radius: 6px; padding: 5px 7px; font-size: 13px; line-height: 1.3; }
.ev a { color: var(--ink); display: block; }
.ev small { color: var(--muted); display: block; }
.ev .time { font-size: 11px; font-weight: 700; color: var(--ink-2); display: block; }
.ev-recording { border-color: var(--teal); background: var(--teal-bg); }
.ev-delivery { border-color: var(--violet); background: var(--violet-bg); }
.ev-followup { border-color: #E3A008; background: var(--amber-bg); }
.ev-other { border-color: var(--neutral); background: var(--neutral-bg); }
.ev.done { opacity: .55; }

/* ---------- Configuración ---------- */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.settings-card { display: flex; flex-direction: column; gap: 4px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); box-shadow: var(--shadow); }
.settings-card:hover { border-color: var(--brand); text-decoration: none; }
.settings-card span { font-size: 13px; color: var(--muted); }
.tpl-row { display: grid; grid-template-columns: 1fr 130px 90px 110px 32px; gap: 8px; align-items: center; margin-bottom: 6px; }
.tpl-row label { display: flex; align-items: center; gap: 4px; }

/* ---------- Acceso ---------- */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: linear-gradient(160deg, #0E1A25 0%, #13303A 60%, var(--brand) 140%); }
.auth-card { width: 100%; max-width: 440px; background: var(--surface); border-radius: 14px; padding: 28px; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.auth-card h1 { font-size: 21px; margin: 18px 0 12px; }
.auth-card .field { margin-bottom: 14px; }
.auth-card .grid-form { grid-template-columns: 1fr; }
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand div { display: flex; flex-direction: column; }
.auth-brand span { font-size: 13px; color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .split { grid-template-columns: 1fr; }
  .week { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
@media (max-width: 900px) {
  .only-sm { display: inline-flex !important; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 40; }
  .topbar { padding: 8px 14px; gap: 8px; }
  .content { padding: 16px 14px 60px; }
  h1 { font-size: 21px; }
  .grid-2, .three { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  .kanban { grid-auto-columns: 82%; scroll-snap-type: x mandatory; }
  .kcol { scroll-snap-align: start; }
  .quick-task { grid-template-columns: 1fr 1fr; }
  .quick-task input[name=title] { grid-column: 1 / -1; }
  .item-row { grid-template-columns: 1fr 70px 32px; grid-template-areas: "name name del" "price qty del" "billing billing billing" "desc desc desc"; }
  .tpl-row { grid-template-columns: 1fr 1fr; }
  .tpl-row input[name=title] { grid-column: 1 / -1; }
  .inline-search input { min-width: 0; width: 100%; }
  .inline-search { flex: 1; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-value { font-size: 19px; }
  .dl { grid-template-columns: 105px minmax(0, 1fr); }
  .task-side .avatar { display: none; }
}
@media (max-width: 480px) {
  .kpis { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi { padding: 10px 12px; }
  .page-head { align-items: flex-start; }
}
@media print {
  .sidebar, .topbar, .page-actions, .danger-zone, form { display: none !important; }
  .content { padding: 0; }
}
