:root {
  --bg: #f6f7fb; --surface: #ffffff; --surface-2: #f1f3f8; --border: #e3e6ef;
  --text: #171a26; --muted: #6b7185; --primary: #4f46e5; --primary-ink: #ffffff; --primary-soft: #eef0ff;
  --danger: #dc2626; --ok: #16a34a; --warn: #d97706;
  --in-bubble: #ffffff; --out-bubble: #4f46e5; --out-ink: #ffffff; --bot-bubble: #0f766e; --ai-bubble: #7c3aed;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 12px rgba(16, 24, 40, .05);
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1117; --surface: #171a23; --surface-2: #1e222d; --border: #2a2f3c;
    --text: #e8eaf1; --muted: #9298ab; --primary: #6d66ff; --primary-soft: #23244a;
    --in-bubble: #232733; --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: Inter, system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
h1 { font-size: 22px; margin: 0 0 4px; }
h3 { font-size: 15px; margin: 18px 0 8px; }
h3:first-child { margin-top: 0; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.hidden { display: none !important; }
.muted { color: var(--muted); margin: 0; }
.error { color: var(--danger); min-height: 18px; }
input, textarea, select {
  width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 11px; margin-top: 5px;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: transparent; }
label { display: block; font-weight: 500; margin-bottom: 12px; }
label.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
label.check input { width: auto; margin-top: 3px; }
.btn {
  font: inherit; font-weight: 600; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.full { width: 100%; padding: 11px; }
.btn:disabled { opacity: .6; cursor: wait; }
.link { background: none; border: none; color: var(--muted); cursor: pointer; padding: 0; font: inherit; text-decoration: underline; }
.pill { font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.pill.ok { background: #dcfce7; color: #166534; }
.pill.warn { background: #fef3c7; color: #92400e; }

/* Acceso */
.auth { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px; box-shadow: var(--shadow); }
.tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 10px; margin: 20px 0; }
.tab { flex: 1; border: none; background: none; padding: 8px; border-radius: 7px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* Estructura */
.layout { display: flex; height: 100%; }
.sidebar { width: 220px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 18px 12px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; padding: 0 8px 18px; }
.brand.big { font-size: 22px; padding: 0 0 6px; }
.logo { color: var(--primary); }
nav { display: flex; flex-direction: column; gap: 2px; }
.nav { display: flex; align-items: center; gap: 10px; border: none; background: none; text-align: left; padding: 9px 10px; border-radius: 8px; font: inherit; font-weight: 500; color: var(--muted); cursor: pointer; }
.nav span { width: 18px; text-align: center; }
.nav:hover { background: var(--surface-2); color: var(--text); }
.nav.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.badge { margin-left: auto; background: var(--danger); color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 999px; }
.sidebar-foot { margin-top: auto; padding: 0 8px; }
.acct-switch { display: grid; grid-template-columns: 1fr auto; align-items: center; text-align: left; width: 100%; margin: -6px 0 14px;
  padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border, #2a2f3a); background: rgba(99, 102, 241, .10); color: inherit; cursor: pointer; font: inherit; }
.acct-switch:hover { background: rgba(99, 102, 241, .18); }
.acct-switch small { grid-column: 1; opacity: .65; font-size: 11px; }
.acct-switch b { grid-column: 1; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-switch .acct-caret { grid-column: 2; grid-row: 1 / span 2; opacity: .7; }
.acct-list { display: grid; gap: 8px; margin: 12px 0; }
.acct-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--border, #2a2f3a); background: transparent; color: inherit; font: inherit; cursor: pointer; text-align: left; }
.acct-item:hover { border-color: #6366f1; }
.acct-item.on { border-color: #6366f1; background: rgba(99, 102, 241, .12); }
.acct-item small { opacity: .65; }
.account-name { font-weight: 600; margin-bottom: 6px; overflow-wrap: anywhere; }
.main { flex: 1; min-width: 0; overflow: auto; }
.view { padding: 24px; min-height: 100%; display: flex; flex-direction: column; }
.view-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.search { width: 200px; margin: 0; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; max-width: 760px; }
.copy-row { display: flex; gap: 8px; align-items: center; }
.copy-row input { margin: 0; }

/* Embudo */
.board { display: flex; gap: 14px; overflow-x: auto; flex: 1; padding-bottom: 8px; align-items: flex-start; }
.column { width: 270px; flex-shrink: 0; background: var(--surface-2); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 140px); }
.column-head { padding: 12px 14px 8px; border-top: 3px solid var(--c); border-radius: var(--radius) var(--radius) 0 0; }
.column-head .title { display: flex; justify-content: space-between; font-weight: 600; }
.column-head .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.column-body { padding: 6px 10px 12px; overflow-y: auto; min-height: 60px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.column.drag-over { outline: 2px dashed var(--primary); outline-offset: -2px; }
.lead-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; cursor: grab; box-shadow: var(--shadow); }
.lead-card:active { cursor: grabbing; }
.lead-card.dragging { opacity: .4; }
.lead-card .row { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.lead-card .name { font-weight: 600; overflow-wrap: anywhere; }
.lead-card .snippet { color: var(--muted); font-size: 12.5px; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lead-card .meta { display: flex; gap: 6px; margin-top: 8px; font-size: 12px; color: var(--muted); align-items: center; flex-wrap: wrap; }
.ch { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.ch.whatsapp { background: #dcfce7; color: #166534; }
.ch.instagram { background: #fce7f3; color: #9d174d; }
.ch.formulario { background: #e0f2fe; color: #075985; }
.ch.human { background: #fee2e2; color: #991b1b; }
.push-box { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; margin: 4px 0 14px; }
.qr-list { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow-y: auto; margin: 10px 0; }
.qr-item { text-align: left; border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 10px 12px; cursor: pointer; font: inherit; color: var(--text); }
.qr-item:hover { border-color: var(--primary); }
.qr-item strong { display: block; margin-bottom: 2px; }
.qr-item span { font-size: 12.5px; color: var(--muted); white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.qr-row { display: flex; gap: 6px; align-items: stretch; }
.qr-row .qr-item { flex: 1; }
.followup-panel { margin-bottom: 16px; max-width: none; }
.stage-checks { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: -4px 0 12px; }
.stage-checks label { margin: 0; font-weight: 400; }
.scope-opts { display: flex; flex-direction: column; gap: 2px; margin: -6px 0 6px; }
.scope-opts label { margin-bottom: 4px; }
.media-pick { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); max-height: 300px; overflow-y: auto; padding: 2px; }
.media-scope-card { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.media-scope-card img { width: 26px; height: 40px; object-fit: cover; border-radius: 4px; }
.bg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin: -4px 0 14px; }
.bg-opt { position: relative; aspect-ratio: 9 / 16; border-radius: 10px; overflow: hidden; border: 2px solid transparent; cursor: pointer; padding: 0; background: var(--surface-2); color: var(--muted); font: inherit; font-size: 12px; }
.bg-opt img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bg-opt.on { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 30%, transparent); }
.bg-opt.on::after { content: '✓'; position: absolute; top: 4px; right: 6px; background: var(--primary); color: #fff; border-radius: 999px; width: 20px; height: 20px; display: grid; place-items: center; font-size: 12px; }
.bg-opt .badge-type { position: absolute; left: 4px; bottom: 4px; background: rgba(0,0,0,.6); color: #fff; font-size: 10px; padding: 1px 6px; border-radius: 6px; }
body.agent .manager-only { display: none !important; }
.team-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.member { display: grid; grid-template-columns: 1fr auto auto auto auto; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.member .who strong { display: block; }
.member .who span { font-size: 12px; color: var(--muted); }
.member select, .member input { margin: 0; width: auto; padding: 5px 8px; font-size: 13px; }
.member .weight { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.member .weight input { width: 56px; }
.member .switch { display: flex; align-items: center; gap: 6px; font-size: 12px; margin: 0; font-weight: 500; }
.member .switch input { width: auto; margin: 0; }
.owner-chip { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); }
.tag { display: inline-flex; align-items: center; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  color: var(--t); background: color-mix(in srgb, var(--t) 16%, transparent); border: 1px solid color-mix(in srgb, var(--t) 35%, transparent); }
.lead-card .tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.tag-picker { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: -6px 0 14px; }
.tag.pick { cursor: pointer; font: inherit; font-size: 12px; font-weight: 600; opacity: .45; }
.tag.pick.on { opacity: 1; box-shadow: 0 0 0 2px color-mix(in srgb, var(--t) 45%, transparent); }
.tag.pick.on::before { content: '✓ '; }
.new-tag { display: inline-flex; gap: 4px; align-items: center; }
.new-tag input { width: 130px; margin: 0; padding: 4px 8px; font-size: 12px; }
.tag-filter { width: 180px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); display: inline-block; }

/* Bandeja */
.inbox { display: flex; flex: 1; min-height: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; height: calc(100vh - 130px); }
.conv-list { width: 300px; flex-shrink: 0; border-right: 1px solid var(--border); overflow-y: auto; }
.conv { padding: 12px 14px; border-bottom: 1px solid var(--border); cursor: pointer; }
.conv:hover { background: var(--surface-2); }
.conv.active { background: var(--primary-soft); }
.conv .row { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.conv .name { font-weight: 600; }
.conv .time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.conv .snippet { color: var(--muted); font-size: 13px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat .empty, .empty { margin: auto; color: var(--muted); text-align: center; padding: 30px; }
.chat-head { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.chat-head .name { font-weight: 700; font-size: 15px; }
.messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; background: var(--bg); }
.msg { max-width: 72%; padding: 8px 12px; border-radius: 12px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.in { align-self: flex-start; background: var(--in-bubble); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg.out { align-self: flex-end; background: var(--out-bubble); color: var(--out-ink); border-bottom-right-radius: 4px; }
.msg.out.bot { background: var(--bot-bubble); }
.msg.out.ia { background: var(--ai-bubble); }
.msg .info { font-size: 11px; opacity: .75; margin-top: 4px; }
.summary { margin: 0 16px; padding: 10px 12px; background: var(--primary-soft); border-radius: 10px; white-space: pre-wrap; font-size: 13px; }
.composer { border-top: 1px solid var(--border); padding: 10px; display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { margin: 0; resize: none; }
.legend { display: flex; gap: 12px; font-size: 12px; color: var(--muted); padding: 6px 16px 0; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }

/* Automatizaciones */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.auto-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.auto-card .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.auto-card .kw { display: flex; gap: 4px; flex-wrap: wrap; }
.auto-card .kw span { background: var(--primary-soft); color: var(--primary); font-size: 12px; padding: 2px 8px; border-radius: 999px; }
.auto-card .reply { background: var(--surface-2); padding: 8px 10px; border-radius: 8px; white-space: pre-wrap; font-size: 13px; }
.auto-card.off { opacity: .55; }

/* Formulario */
.form-preview { width: 100%; height: 520px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
.settings .save-bar { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; display: flex; gap: 12px; align-items: center; max-width: 760px; }

/* Ventana emergente y avisos */
.modal { position: fixed; inset: 0; background: rgba(10, 12, 20, .5); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal-card { position: relative; background: var(--surface); border-radius: 16px; padding: 24px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; }
.modal-close { position: absolute; top: 10px; right: 14px; border: none; background: none; font-size: 24px; color: var(--muted); cursor: pointer; }
.modal-card h2 { margin: 0 0 16px; font-size: 18px; }
.modal-actions { display: flex; gap: 8px; justify-content: space-between; margin-top: 8px; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.stage-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.stage-row input[type=text] { margin: 0; }
.stage-row input[type=color] { width: 42px; height: 38px; padding: 2px; margin: 0; }
.install { width: 100%; margin-bottom: 10px; }
.offline { position: fixed; top: 0; left: 0; right: 0; background: #fef3c7; color: #92400e; padding: 10px 16px; text-align: center; z-index: 70; font-weight: 500; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 10px; z-index: 60; max-width: calc(100% - 32px); }

.nav i { font-style: normal; }
.nav i.short, .mobile-only { display: none; }

/* Celular: barra de navegación abajo, como una app */
@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .sidebar {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; width: 100%;
    flex-direction: row; padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
    border-right: none; border-top: 1px solid var(--border);
  }
  .brand, .sidebar-foot { display: none; }
  nav { flex-direction: row; width: 100%; justify-content: space-around; }
  .nav { flex: 1; flex-direction: column; gap: 2px; padding: 6px 2px; font-size: 11px; position: relative; min-width: 0; }
  .nav span { font-size: 18px; width: auto; }
  .nav i.long { display: none; }
  .nav i.short { display: inline; }
  .nav .badge { position: absolute; top: 2px; right: calc(50% - 22px); margin: 0; }
  .mobile-only { display: block; }
  .main { padding-bottom: calc(70px + env(safe-area-inset-bottom)); padding-top: env(safe-area-inset-top); }
  .view { padding: 16px; }
  .settings .save-bar { bottom: calc(64px + env(safe-area-inset-bottom)); }
  #settings-form { padding-bottom: 70px; }
  .member { grid-template-columns: 1fr 1fr; }
  .member .who { grid-column: 1 / -1; }
  .mobile-only.btn { display: inline-block; }
  .toast { bottom: calc(80px + env(safe-area-inset-bottom)); }
  .search { width: 100%; }
  .inbox { flex-direction: column; height: auto; }
  .conv-list { width: 100%; max-height: 240px; border-right: none; border-bottom: 1px solid var(--border); }
  .chat { min-height: 60vh; }
  .msg { max-width: 88%; }
  .grid2 { grid-template-columns: 1fr; }
  .column { max-height: none; width: 82vw; scroll-snap-align: start; }
  .board { scroll-snap-type: x mandatory; }
}

/* Seguimiento propio dentro de cada automatización */
.auto-fu { background: var(--bg, #f6f7fb); border: 1px dashed rgba(127,127,127,.35); border-radius: 12px; padding: 12px 12px 2px; margin-bottom: 12px; }


/* Tareas */
.task-list { max-width: 760px; }
.task-group { margin-bottom: 18px; }
.task-group h3 { font-size: 14px; margin: 0 0 8px; }
.task-group.late h3 { color: var(--danger); }
.task { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.task input[type=checkbox] { width: 20px; height: 20px; flex: none; accent-color: var(--ok); }
.task-main { flex: 1; min-width: 0; }
.task-title { font-weight: 600; overflow-wrap: anywhere; }
.task.done .task-title { text-decoration: line-through; color: var(--muted); font-weight: 400; }
.task-meta { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 2px; }
.task-meta a { color: var(--primary); text-decoration: none; }
.task-meta .due.late { color: var(--danger); font-weight: 600; }
.task-meta .due.today { color: var(--warn); font-weight: 600; }
.quick-dates { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 14px; }

/* Reportes */
#view-reports .panel { max-width: none; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.kpi span { display: block; font-size: 12px; color: var(--muted); }
.kpi strong { font-size: 22px; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 160px; padding-top: 6px; }
.bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 0; }
.bar i { display: block; width: 100%; max-width: 26px; background: var(--primary); border-radius: 4px 4px 0 0; }
.bar span { font-size: 10px; color: var(--muted); margin-top: 3px; }
.bars.dense .bar span { visibility: hidden; }
.bars.dense .bar:nth-child(7n+1) span { visibility: visible; }
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 16px; }
.hbar { margin-bottom: 10px; }
.hbar-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; margin-bottom: 3px; }
.hbar-track { height: 8px; background: var(--surface-2, rgba(127,127,127,.15)); border-radius: 99px; overflow: hidden; }
.hbar-track i { display: block; height: 100%; border-radius: 99px; }
.rtable { width: 100%; border-collapse: collapse; font-size: 13px; }
.rtable th, .rtable td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--border); }
.rtable th { color: var(--muted); font-weight: 500; }
.media-row { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; font-size: 13px; }
.media-row img, .media-ph { width: 44px; height: 56px; object-fit: cover; border-radius: 6px; flex: none; display: grid; place-items: center; background: var(--surface-2, #eee); }

/* Horario de atención */
.hours-days { margin: 6px 0 12px; }
.hours-day { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.hours-day .check { width: 120px; margin: 0; }
.hours-day input[type=time] { width: auto; margin: 0; }

@media (max-width: 760px) {
  .nav.desk-only { display: none; }
  .kpi strong { font-size: 18px; }
  .rtable { font-size: 12px; }
}

.hours-day { flex-wrap: nowrap; }
.hours-day .check { width: 96px; flex: none; font-size: 13px; }
.hours-day input[type=time] { flex: 1; min-width: 0; padding: 6px; font-size: 13px; }

@media (max-width: 760px) {
  .hours-day { flex-wrap: wrap; gap: 4px 8px; margin-bottom: 10px; }
  .hours-day .check { width: 100%; }
}


/* Agenda */
.appt { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--border); }
.appt:last-child { border-bottom: none; }
.appt-when { flex: none; width: 74px; text-align: center; background: var(--primary-soft); border-radius: 10px; padding: 6px 4px; display: flex; flex-direction: column; font-size: 13px; }
.appt-when b { text-transform: capitalize; }
.appt-main { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.appt-main a { color: var(--primary); }
.appt.past, .appt.cancelled { opacity: .55; }
.appt .actions { flex-direction: column; }

/* Cobros */
.pay-pending { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(245,158,11,.12); border: 1px solid rgba(245,158,11,.35); font-size: 13px; }
.pay-pending .actions { display: flex; gap: 6px; }
.pay-preview { white-space: pre-wrap; background: var(--surface-2, rgba(127,127,127,.12)); border-radius: 12px; padding: 12px; font-size: 14px; margin: 4px 0 14px; }
.msg-img { display: block; max-width: 220px; max-height: 260px; border-radius: 10px; margin-top: 6px; }

.pay-pending.receipt { background: rgba(34,197,94,.12); border-color: rgba(34,197,94,.45); }
.pay-pending a, .task-meta a { color: var(--primary); }


.receipt-note { display: inline-block; margin-top: 4px; font-size: 12px; }


/* Importar contactos */
.imp-map { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0 12px; }
.imp-preview { overflow-x: auto; margin-bottom: 12px; max-width: 100%; }
.imp-preview td { white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }


/* Campos personalizados */
.field-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.field-row .who { display: flex; flex-direction: column; min-width: 0; }
.field-row .who span { font-size: 12px; }
.custom-fields { border-top: 1px dashed var(--border); padding-top: 10px; margin-bottom: 4px; }


.ch.messenger { background: #e0ecff; color: #1d4ed8; }


/* Inicio (panel) */
.hkpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-bottom: 16px; }
.hkpi { text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; color: var(--text); font: inherit; transition: transform .1s, border-color .1s; }
.hkpi:hover { border-color: var(--primary); transform: translateY(-1px); }
.hkpi.warn { border-color: rgba(245,158,11,.6); background: linear-gradient(0deg, rgba(245,158,11,.08), rgba(245,158,11,.08)), var(--surface); }
.hk-ico { font-size: 18px; }
.hk-label { font-size: 12px; color: var(--muted); }
.hkpi strong { font-size: 24px; line-height: 1.15; }
.hkpi small { font-size: 12px; color: var(--muted); }
.hgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.hcard { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; min-width: 0; }
.hcard-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.hcard-head h3 { margin: 0; font-size: 15px; }
.hcard .link { font-size: 13px; color: var(--primary); }
.hl-row { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 10px; cursor: pointer; }
.hl-row:hover { background: var(--surface-2, rgba(127,127,127,.1)); }
.hl-row > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hl-row strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hl-row small { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hl-row .badge { margin-left: 0; }
.hl-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); flex: none; }
.hl-dot.late { background: var(--danger); }
.hl-dot.new { background: var(--ok); }
.hl-date { flex: none; width: 44px; text-align: center; background: var(--primary-soft); border-radius: 10px; padding: 4px 0; font-size: 11px; display: flex; flex-direction: column; text-transform: capitalize; }
.hl-date b { font-size: 17px; }
.hl-empty { padding: 8px 6px; }
.hspark { display: flex; align-items: flex-end; gap: 4px; height: 80px; }
.hspark i { flex: 1; background: var(--primary); border-radius: 4px 4px 0 0; opacity: .85; }
.hs-list { display: flex; flex-direction: column; }
.hs-row { display: grid; grid-template-columns: 22px 1fr auto; gap: 6px; align-items: center; padding: 6px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.hs-row:hover { background: var(--surface-2, rgba(127,127,127,.1)); }
.hs-row small { color: var(--muted); font-size: 12px; text-align: right; }
.hshorts { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.hshort { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2, transparent); color: var(--text); font: inherit; font-size: 12px; cursor: pointer; }
.hshort span { font-size: 20px; }
.hshort:hover { border-color: var(--primary); }
@media (max-width: 760px) {
  .hkpis { grid-template-columns: 1fr 1fr; gap: 8px; }
  .hkpi { padding: 10px 12px; }
  .hkpi strong { font-size: 20px; }
  .hgrid { grid-template-columns: 1fr; }
}

/* Inicio: análisis del periodo */
.hsection { font-size: 17px; margin: 22px 0 10px; }
.hsection small { font-weight: 400; color: var(--muted); font-size: 13px; }
.hgrid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-bottom: 14px; }
.hgrid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; margin-bottom: 14px; }
.hgrid { margin-bottom: 14px; }
.dwrap { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.donut { width: 132px; height: 132px; flex: none; }
.donut-n { font-size: 24px; font-weight: 700; fill: var(--text); }
.donut-s { font-size: 11px; fill: var(--muted); }
.dlegend { flex: 1; min-width: 140px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.dlegend div { display: flex; align-items: center; gap: 8px; }
.dlegend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.dlegend span { flex: 1; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vbar { margin-bottom: 12px; }
.vbar-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.fhead, .frow { display: grid; grid-template-columns: 1fr 64px 96px; gap: 8px; align-items: center; }
.fhead { font-size: 11px; color: var(--muted); margin-bottom: 4px; text-align: center; }
.frow { margin-bottom: 6px; }
.fbar-wrap { position: relative; background: var(--surface-2, rgba(127,127,127,.12)); border-radius: 8px; min-height: 42px; overflow: hidden; }
.fbar { position: absolute; inset: 0 auto 0 0; opacity: .35; border-radius: 8px; }
.flabel { position: relative; padding: 5px 10px; display: flex; flex-direction: column; }
.flabel b { font-size: 13px; }
.flabel small { font-size: 11px; color: var(--muted); }
.fpct { text-align: center; font-size: 12px; font-weight: 600; background: var(--surface-2, rgba(127,127,127,.12)); border-radius: 8px; padding: 6px 2px; clip-path: polygon(0 0, 100% 0, 100% 75%, 50% 100%, 0 75%); }
.fpct.next { color: var(--primary); }
.stable td small { display: block; color: var(--muted); font-size: 11px; }
.stable td, .stable th { white-space: nowrap; }
.eff { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.eff div { display: flex; flex-direction: column; }
.eff strong { font-size: 20px; }
.eff span { font-size: 12px; color: var(--muted); }
@media (max-width: 760px) {
  .hgrid2, .hgrid3 { grid-template-columns: 1fr; }
  .donut { width: 112px; height: 112px; }
  .fhead, .frow { grid-template-columns: 1fr 52px 70px; }
}

/* Marketing */
.mk-tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.mk-tab { background: var(--surface); border: 1px solid var(--border); color: var(--text); border-radius: 999px; padding: 7px 14px; font: inherit; font-size: 13px; cursor: pointer; }
.mk-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.mk-list { display: flex; flex-direction: column; gap: 8px; }
.mk-row { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px; }
.mk-thumb { position: relative; width: 64px; height: 64px; flex: none; border-radius: 8px; overflow: hidden; background: var(--surface-2, #222); display: grid; place-items: center; }
.mk-thumb img { width: 100%; height: 100%; object-fit: cover; }
.mk-thumb b { position: absolute; right: 3px; top: 3px; background: rgba(0,0,0,.65); color: #fff; font-size: 11px; border-radius: 6px; padding: 0 5px; }
.mk-vid { font-size: 22px; display: grid; place-items: center; }
.mk-vid.big { height: 200px; background: var(--surface-2, #222); }
.mk-main { flex: 1; min-width: 0; }
.mk-cap { font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.mk-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: 12px; color: var(--muted); margin-top: 4px; }
.mk-meta a { color: var(--primary); }
.mk-err { color: var(--danger); font-size: 12px; margin-top: 4px; }
.mk-note { color: var(--text); background: var(--surface-2); border-radius: 8px; padding: 6px 8px; font-size: 12px; margin-top: 6px; }
.tt-head { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; margin-bottom: 14px; font-size: 14px; }
.tt-mode { border: 0; padding: 0; margin: 0 0 12px; }
.tt-mode legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
.tt-mode .check { margin-bottom: 8px; line-height: 1.4; }
.mk-stats { font-size: 13px; margin-top: 4px; display: flex; gap: 12px; flex-wrap: wrap; }
.mk-row .actions { flex-direction: column; align-items: stretch; }
.pill.danger { background: rgba(239,68,68,.15); color: var(--danger); }
.mk-calhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.mk-calhead h3 { margin: 0; }
.mk-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.mk-dow { text-align: center; font-size: 12px; color: var(--muted); padding: 4px 0; }
.mk-cell { min-height: 92px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 4px; display: flex; flex-direction: column; gap: 3px; cursor: pointer; min-width: 0; }
.mk-cell.empty { background: transparent; border: none; cursor: default; }
.mk-cell.today { border-color: var(--primary); }
.mk-cell:hover:not(.empty) { border-color: var(--primary); }
.mk-dn { font-size: 12px; color: var(--muted); }
.mk-chip { font: inherit; font-size: 11px; text-align: left; border: none; border-radius: 5px; padding: 2px 5px; background: var(--primary-soft); color: var(--text); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; }
.mk-chip.published { background: rgba(34,197,94,.18); }
.mk-chip.error, .mk-chip.partial { background: rgba(239,68,68,.18); }
.mk-iggrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.mk-ig { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; color: var(--text); text-decoration: none; }
.mk-ig img { width: 100%; aspect-ratio: 4/5; object-fit: cover; display: block; }
.mk-ig .badge-type { position: absolute; top: 6px; left: 6px; }
.mk-ig-info { display: flex; justify-content: space-between; padding: 6px 8px 0; font-size: 12px; }
.mk-ig p { font-size: 12px; color: var(--muted); padding: 2px 8px 8px; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mk-editor { display: grid; grid-template-columns: 1fr 260px; gap: 18px; }
.mk-nets, .mk-when { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 10px; }
.mk-nets .check, .mk-when .check { margin: 0; }
.mk-media { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.mk-mi { position: relative; width: 84px; height: 84px; border-radius: 8px; overflow: hidden; background: var(--surface-2, #222); display: grid; place-items: center; font-size: 12px; }
.mk-mi img { width: 100%; height: 100%; object-fit: cover; }
.mk-mi-btns { position: absolute; top: 3px; right: 3px; display: flex; gap: 3px; }
.mk-mi-btns button { border: none; border-radius: 6px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; padding: 1px 6px; cursor: pointer; }
.mk-upload { display: inline-block; cursor: pointer; }
.mk-preview label { display: block; }
.mk-phone { border: 1px solid var(--border); border-radius: 16px; overflow: hidden; background: var(--surface); }
.mk-ph-head { padding: 8px 10px; font-size: 13px; }
.mk-phone img { width: 100%; aspect-ratio: 4/5; object-fit: cover; display: block; }
.mk-phone p { font-size: 13px; padding: 8px 10px; margin: 0; white-space: pre-line; max-height: 180px; overflow: auto; }
.mk-tag { color: var(--primary); }
.mk-dots { display: flex; justify-content: center; gap: 4px; padding: 6px 0 0; }
.mk-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--border); }
.mk-dots i.on { background: var(--primary); }
@media (max-width: 760px) {
  .mk-editor { grid-template-columns: 1fr; }
  .mk-preview { display: none; }
  .mk-cell { min-height: 58px; }
  .mk-chip { font-size: 0; padding: 3px; }
  .mk-chip::first-letter { font-size: 11px; }
  .mk-row { flex-wrap: wrap; }
  .mk-row .actions { flex-direction: row; flex-wrap: wrap; width: 100%; }
}

/* ---------- Páginas / Sitios ---------- */
.pg-list { display: grid; gap: 14px; }
.pg-card h3 { margin: 0 0 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pg-top { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.pg-warn { color: var(--warn); font-size: 13px; margin: 2px 0 0; }
.pg-stats { display: flex; gap: 8px; }
.pg-stats div { background: var(--surface-2); border-radius: 10px; padding: 6px 12px; text-align: center; min-width: 74px; }
.pg-stats b { display: block; font-size: 18px; }
.pg-stats span { font-size: 11px; color: var(--muted); }
.pg-card .copy-row input { flex: 1; min-width: 0; }
.pg-actions { margin-top: 10px; flex-wrap: wrap; align-items: center; }
.pg-actions label.btn { cursor: pointer; }
.pg-files { margin-top: 10px; font-size: 13px; }
.pg-files summary { cursor: pointer; color: var(--muted); }
.pg-file { display: flex; gap: 10px; align-items: center; padding: 4px 0; border-bottom: 1px solid var(--border); }
.pg-file a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-slug { display: flex; align-items: center; gap: 4px; }
.pg-slug input { flex: 1; margin: 0; }
.pg-code { width: 100%; min-height: 50vh; font: 12px/1.45 ui-monospace, Consolas, monospace; white-space: pre; }
.pg-help { margin-top: 16px; font-size: 14px; }
.pg-help summary { cursor: pointer; font-weight: 600; }
.pg-help ol { padding-left: 20px; }
@media (max-width: 700px) { .pg-stats { width: 100%; } .pg-stats div { flex: 1; } }.pg-file a { color: var(--primary); }
.modal-card:has(.pg-code) { max-width: 900px; }
.hdown { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--ok); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 14px; font-size: 14px; line-height: 1.5; }
.hdown.warn { border-left-color: var(--warn); }
.hdown .link { font-weight: 600; }


/* ===================== Diseño nuevo (dic-2026): estilo panel moderno con los colores de MiEmbudo ===================== */
:root { --side-1: #1e1b4b; --side-2: #312e81; --accent-2: #5eead4; --radius-lg: 20px;
  --shadow-soft: 0 8px 30px rgba(40, 40, 120, .07); --shadow-lift: 0 14px 40px rgba(40, 40, 120, .14); }
@media (prefers-color-scheme: dark) { :root { --shadow-soft: 0 6px 24px rgba(0, 0, 0, .35); --shadow-lift: 0 12px 36px rgba(0, 0, 0, .5); } }
body { font-family: "Plus Jakarta Sans", Inter, system-ui, sans-serif; }
#app.layout { background: radial-gradient(1100px 520px at 25% -10%, color-mix(in srgb, var(--primary) 14%, transparent) 0, transparent 60%), var(--bg); }
h1 { font-weight: 800; letter-spacing: -.02em; }

/* Barra lateral oscura (computador) */
@media (min-width: 761px) {
  #app.layout { padding: 14px 0 14px 14px; }
  .sidebar { background: linear-gradient(180deg, var(--side-1), var(--side-2)); border: 0; border-radius: 24px; color: #e0e7ff; padding: 18px 10px; overflow-y: auto; }
  .sidebar .brand { color: #fff; }
  .sidebar .logo { color: var(--accent-2); }
  .sidebar .nav { color: #c7d2fe; border-radius: 12px; transition: background .2s, color .2s; }
  .sidebar .nav:hover { background: rgba(255, 255, 255, .09); color: #fff; }
  .sidebar .nav.active { background: #fff; color: var(--side-1); font-weight: 700; }
  .sidebar .acct-switch { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .16); color: #fff; }
  .sidebar .acct-switch:hover { background: rgba(255, 255, 255, .14); }
  .sidebar .account-name { color: #fff; }
  .sidebar .link { color: #c7d2fe; }
  .sidebar .btn.install { background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .2); }
}

/* Tarjetas y botones más suaves */
.btn { border-radius: 999px; }
.hcard, .hkpi, .panel, .kpi { border-radius: var(--radius-lg); box-shadow: var(--shadow-soft); border-color: transparent; }
.hkpi { transition: transform .2s, box-shadow .2s; }
.hkpi:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); border-color: transparent; }
.hkpi.warn { border-color: rgba(217, 119, 6, .45); }
.column { border-radius: var(--radius-lg); }
.lead-card { border-radius: 14px; transition: transform .2s, box-shadow .2s; }
.lead-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.view:not(.hidden) { animation: vin .35s ease; }
@keyframes vin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Inicio: franja de saludo */
.hhero { position: relative; overflow: hidden; display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  background: linear-gradient(120deg, #1e1b4b, #3730a3 70%, #4f46e5); color: #fff; border-radius: 22px; padding: 22px 24px; margin-bottom: 16px; }
.hhero::after { content: ""; position: absolute; right: -70px; top: -70px; width: 240px; height: 240px; border-radius: 50%;
  background: radial-gradient(rgba(129, 140, 248, .55), transparent 70%); pointer-events: none; }
.hhero-txt { flex: 1; min-width: 240px; position: relative; z-index: 1; }
.hhero h2 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.hhero h2 em { font-family: Georgia, "Times New Roman", serif; font-weight: 400; color: var(--accent-2); }
.hhero p { margin: 6px 0 14px; color: #e0e7ff; line-height: 1.5; }
.hhero p b { color: #fff; }
.hhero .btn { background: var(--accent-2); color: #134e4a; border: 0; padding: 9px 18px; font-weight: 700; }
.hhero .btn:hover { background: #99f6e4; }
.hhero-team { position: relative; z-index: 1; text-align: right; }
.hhero-team small { color: #c7d2fe; display: block; margin-top: 6px; font-size: 12px; }
.havs { display: flex; justify-content: flex-end; padding-left: 10px; }
.hav { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 12px; border: 3px solid #3730a3; margin-left: -10px; }
.hkpi.feat { background: linear-gradient(160deg, #1e1b4b, #312e81); color: #fff; }
.hkpi.feat .hk-label, .hkpi.feat small { color: #c7d2fe; }
.hspark i { background: linear-gradient(180deg, #818cf8, #4f46e5); border-radius: 6px; opacity: 1; transform-origin: bottom; animation: hgrow .7s ease both; }
@keyframes hgrow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.hweek { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; margin-bottom: 8px; }
.hweek div { padding: 7px 0 9px; border-radius: 14px; font-size: 11.5px; color: var(--muted); position: relative; text-transform: capitalize; }
.hweek b { display: block; font-size: 15px; color: var(--text); }
.hweek .today { background: var(--side-1); color: #c7d2fe; }
.hweek .today b { color: #fff; }
.hweek .has::after { content: ""; position: absolute; bottom: 3px; left: 50%; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: #0d9488; }
.hweek .today.has::after { background: var(--accent-2); }
@media (max-width: 760px) {
  .hhero { padding: 18px; border-radius: 18px; }
  .hhero h2 { font-size: 22px; }
  .hhero-team { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .view:not(.hidden), .hspark i { animation: none; }
  .hkpi, .lead-card, .sidebar .nav { transition: none; }
  .hkpi:hover, .lead-card:hover { transform: none; }
}
#view-home .view-head .actions select { width: auto; margin: 0; }

/* Diseño nuevo · Embudo */
.pipe-alert { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: linear-gradient(120deg, var(--side-1), var(--side-2)); color: #fff; border-radius: 18px; padding: 12px 16px; margin-bottom: 14px; }
.pipe-alert .pa-ico { width: 38px; height: 38px; border-radius: 12px; background: var(--accent-2); color: #134e4a; display: grid; place-items: center; font-weight: 800; font-size: 18px; flex: none; }
.pipe-alert .pa-txt { flex: 1; min-width: 200px; }
.pipe-alert small { display: block; color: #c7d2fe; font-size: 12.5px; margin-top: 2px; }
.pipe-alert .btn { background: var(--accent-2); color: #134e4a; border: 0; font-weight: 700; }
.pipe-alert .btn:hover { background: #99f6e4; }
.column { background: color-mix(in srgb, var(--surface) 55%, var(--surface-2)); border: 1px solid var(--border); }
.column-head { border-top: 0; padding: 14px 14px 8px; }
.column-head .title { justify-content: flex-start; gap: 8px; align-items: center; }
.st-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.st-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-n { font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 2px 9px; background: var(--primary-soft); color: var(--primary); }
.column-head .sub { padding-left: 18px; }
.lead-card { border-color: transparent; padding: 12px 14px; box-shadow: var(--shadow-soft); }
.lc-money { font-weight: 800; font-size: 15px; margin-top: 8px; letter-spacing: -.01em; }
/* Diseño nuevo · Bandeja */
.av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px; flex: none; }
.inbox { background: transparent; border: 0; border-radius: 0; gap: 16px; overflow: visible; }
.conv-list, .chat { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-soft); }
.conv-list { border-right: 0; padding: 8px; }
.chat { overflow: hidden; }
.conv { display: flex; gap: 10px; align-items: flex-start; border-bottom: 0; border-radius: 14px; padding: 10px; margin-bottom: 2px; transition: background .15s; }
.conv-main { flex: 1; min-width: 0; }
.conv .av { margin-top: 2px; }
.conv.active { background: var(--primary-soft); }
.chat-head { padding: 14px 18px; }
.chat-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.messages { gap: 10px; padding: 18px; background: color-mix(in srgb, var(--bg) 60%, var(--surface)); }
.msg { border-radius: 18px; padding: 10px 14px; }
.msg.in { background: var(--surface); border-color: transparent; box-shadow: 0 2px 8px rgba(40, 40, 120, .07); border-bottom-left-radius: 6px; }
.msg.out { border-bottom-right-radius: 6px; }
.msg.out.bot { background: linear-gradient(120deg, #0f766e, #0d9488); }
.summary { border-radius: 14px; }
.composer { padding: 12px 14px; align-items: center; }
.composer textarea { border-radius: 18px; border: 1.5px solid #8a90a6; padding: 10px 16px; }
.composer textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
.legend i { border-radius: 50%; }
@media (max-width: 760px) {
  .inbox { gap: 12px; }
  .conv-list { border-bottom: 0; }
}
/* Diseño nuevo · Reportes */
#view-reports .kpis { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
#view-reports .kpi { padding: 16px 18px; }
#view-reports .kpi span { font-size: 12.5px; }
#view-reports .kpi strong { font-size: 26px; font-weight: 800; letter-spacing: -.02em; display: block; margin-top: 4px; }
.kpi.feat { background: linear-gradient(160deg, var(--side-1), var(--side-2)); color: #fff; }
.kpi.feat span { color: #c7d2fe; }
.report-top { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; }
.report-top .panel, .report-grid .panel { max-width: none; }
.rarea { width: 100%; height: auto; display: block; }
.rarea-grid { stroke: var(--border); stroke-width: 1; }
.rarea-dot { fill: var(--surface); stroke: var(--primary); stroke-width: 2; }
.rarea-x { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.dlegend b { font-size: 12.5px; white-space: nowrap; }
.rtable th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.rtable tr:last-child td { border-bottom: 0; }
@media (max-width: 900px) { .report-top { grid-template-columns: 1fr; } }#view-reports .kpis { grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); }
#view-reports .kpi strong { font-size: clamp(18px, 1.55vw, 26px); overflow-wrap: anywhere; }
.report-grid .panel { overflow-x: auto; }
#view-reports .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
#view-reports .kpi strong { font-size: 26px; overflow-wrap: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) { #view-reports .kpis { grid-template-columns: 1fr 1fr; } #view-reports .kpi strong { font-size: 20px; } }

/* Diseño nuevo · Equipo y permisos */
.roles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.role-card { border-radius: 16px; padding: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.role-card.on { background: linear-gradient(160deg, var(--side-1), var(--side-2)); color: #fff; border-color: transparent; }
.role-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.role-n { font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 2px 9px; background: var(--primary-soft); color: var(--primary); }
.role-card.on .role-n { background: rgba(255, 255, 255, .15); color: #fff; }
.role-card ul { margin: 0; padding: 0; list-style: none; font-size: 12.5px; display: grid; gap: 5px; }
.role-card li { padding-left: 20px; position: relative; line-height: 1.35; }
.role-card li::before { position: absolute; left: 0; font-weight: 800; }
.role-card li.y::before { content: "✓"; color: #0f766e; }
.role-card li.n::before { content: "✕"; color: var(--danger); }
.role-card.on li.y::before { color: var(--accent-2); }
.role-card.on li.n::before { color: #fca5a5; }
.member { background: var(--surface); border-color: transparent; border-radius: 16px; box-shadow: var(--shadow-soft); padding: 12px 14px; }
.member .who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.member .who > div { min-width: 0; }
.member .who > div > span { display: block; overflow: hidden; text-overflow: ellipsis; }
.member .who .av { color: #fff; font-size: 13px; }
.member select { border-radius: 999px; }
input.tgl { appearance: none; -webkit-appearance: none; width: 40px !important; height: 23px; border-radius: 99px; background: #9298ab; position: relative; cursor: pointer; border: 0; padding: 0; flex: none; transition: background .2s; }
input.tgl::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; transition: left .2s; }
input.tgl:checked { background: var(--primary); }
input.tgl:checked::after { left: 20px; }
input.tgl:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
@media (max-width: 760px) { .roles { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { input.tgl, input.tgl::after { transition: none; } }.member > .owner-chip { justify-self: start; }
