/* panel.css — panel de gestión, portal de clientes y pantallas de acceso */

/* ───────── Acceso ───────── */
.auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 560px); min-height: 100vh; }
.auth-aside { position: relative; background-size: cover; background-position: center; display: flex; flex-direction: column; justify-content: space-between; padding: 40px; color: #fff; }
.auth-aside::before { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, .15) 0%, rgba(0, 0, 0, .65) 100%); }
.auth-aside > * { position: relative; }
.auth-logo { display: inline-flex; padding: 12px 16px; border-radius: 12px; align-self: flex-start; }
.auth-logo img { height: 22px; width: auto; }
.auth-aside-text { max-width: 30rem; display: flex; flex-direction: column; gap: 10px; font-size: 17px; }
.auth-aside-h { font-size: clamp(30px, 3.2vw, 46px); line-height: 1.02; font-weight: 800; font-stretch: 118%; letter-spacing: -.03em; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 48px clamp(24px, 5vw, 64px); }
.auth-box { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 28px; }
.auth-logo-sm { display: none; }
.auth-logo-sm img { height: 22px; width: auto; }
.auth-title { font-size: 32px; font-weight: 800; font-stretch: 112%; letter-spacing: -.03em; }
.auth-alt { padding-top: 24px; border-top: 1px solid var(--line); display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.input-pass { position: relative; }
.input-pass .input { padding-right: 52px; }
.input-pass .btn { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-logo-sm { display: block; }
}

/* ───────── Estructura del panel ───────── */
.app-body { background: #FAFAF9; }
.app { display: flex; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; width: 248px; flex: none; display: flex; flex-direction: column; background: var(--paper); border-right: 1px solid var(--line); padding: 18px 14px; z-index: 60; }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 22px; }
.sidebar-logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.sidebar-logo img { height: 20px; width: auto; }
.sidebar-logo span { font-size: 12px; font-weight: 600; color: var(--muted); padding: 2px 8px; border-radius: 999px; background: var(--surface); }
.sidebar-close { display: none; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.sidebar-nav a { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 12px; border-radius: 10px; text-decoration: none; color: #3D3D3D; font-size: 15px; font-weight: 500; }
.sidebar-nav a:hover { background: var(--surface); color: var(--ink); }
.sidebar-nav a.is-active { background: var(--ink); color: #fff; }
.sidebar-nav a.is-active .ico { color: var(--brand); }
.nav-count { margin-left: auto; font-style: normal; font-size: 12px; font-weight: 700; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--brand); color: #000; display: inline-flex; align-items: center; justify-content: center; }
.sidebar-sep { margin: 18px 12px 6px; font-size: 12px; font-weight: 600; color: var(--soft); }
.sidebar-user { display: flex; align-items: center; gap: 4px; padding-top: 14px; border-top: 1px solid var(--line); }
.sidebar-me { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 6px; border-radius: 10px; text-decoration: none; }
.sidebar-me:hover { background: var(--surface); }
.sidebar-me strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-me small { display: block; font-size: 12px; color: var(--muted); }
.sidebar-scrim { display: none; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 16px; min-height: 68px; padding: 0 clamp(16px, 3vw, 40px); background: rgba(250, 250, 249, .9); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar-menu { display: none; }
.topbar-search { flex: 1; max-width: 520px; display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--muted); }
.topbar-search:focus-within { border-color: var(--ink); }
.topbar-search input { flex: 1; border: 0; outline: none; background: none; min-width: 0; color: var(--text); font-size: 15px; }
.topbar-search kbd { font: inherit; font-size: 12px; padding: 1px 7px; border: 1px solid var(--line-2); border-radius: 6px; color: var(--muted); }
.topbar > .row { margin-left: auto; }
.content { padding: clamp(20px, 3vw, 40px); max-width: 1440px; width: 100%; display: flex; flex-direction: column; gap: 0; }
.content > .flash-stack { margin-bottom: 20px; }

@media (max-width: 1080px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow); }
  .sidebar.is-open { transform: none; }
  .sidebar-close, .topbar-menu { display: inline-flex; }
  .sidebar-scrim.is-open { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .3); z-index: 55; }
  .hide-md { display: none; }
}
@media (max-width: 640px) {
  .hide-sm { display: none !important; }
  .topbar-search kbd { display: none; }
}

/* ───────── Encabezados de página ───────── */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 28px; }
.page-title { font-size: clamp(26px, 2.6vw, 34px); font-weight: 750; font-stretch: 110%; letter-spacing: -.025em; line-height: 1.12; }
.crumb { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 14px; font-size: 14px; color: var(--muted); text-decoration: none; }
.crumb:hover { color: var(--ink); }
.h-sub { font-size: 17px; font-weight: 700; font-stretch: 100%; letter-spacing: -.01em; }

/* Indicadores */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 24px; }
.kpi { display: flex; flex-direction: column; gap: 6px; padding: 20px 22px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); text-decoration: none; transition: border-color .15s; }
a.kpi:hover { border-color: var(--ink); }
.kpi-label { font-size: 14px; color: var(--muted); font-weight: 500; }
.kpi-value { font-size: clamp(30px, 2.8vw, 40px); line-height: 1.05; font-weight: 800; font-stretch: 112%; letter-spacing: -.03em; color: var(--ink); }
.kpi-foot { font-size: 13px; color: var(--muted); }
.kpi-alert { border-color: #F5C6C2; background: #FFFBFA; }
.kpi-alert .kpi-value { color: #B42318; }
.kpis-sm .kpi-value { font-size: 30px; }

.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: 20px; align-items: start; }

/* Listas */
.list { list-style: none; margin: 0; padding: 6px 0; }
.list > li + li { border-top: 1px solid var(--line); }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 24px; text-decoration: none; min-height: 56px; }
a.list-row:hover { background: #FAFAF9; }
.list-row .grow { display: flex; flex-direction: column; min-width: 0; }
.list-row .grow strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row small { font-size: 13px; }
.list-flat .list-row { padding: 10px 24px; min-height: 0; }
.due { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--surface); white-space: nowrap; }
.due-soon { background: #FFF4DE; color: #8A5300; }
.due-late { background: #FDECEC; color: #B42318; }
.prio { display: inline-flex; font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 6px; }
.prio-alta { background: #FFEEDD; color: #A84D00; }
.prio-urgente { background: #B42318; color: #fff; }

/* Barras por etapa y mini gráfico */
.bar-row { display: grid; grid-template-columns: 110px 1fr 32px; align-items: center; gap: 12px; text-decoration: none; font-size: 14px; }
.bar { height: 10px; border-radius: 999px; background: var(--surface); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: inherit; min-width: 4px; }
.bar-n { text-align: right; font-weight: 600; }
.bar-gray { background: #8E8E8B; } .bar-blue { background: #3B66F5; } .bar-amber { background: #E2A200; }
.bar-orange { background: var(--brand); } .bar-violet { background: #7C4DFF; } .bar-green { background: #12A26C; }
.chart-mini { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; border-top: 1px solid var(--line); }
.chart-col { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; min-width: 36px; font-size: 12px; color: var(--muted); }
.chart-col b { color: var(--ink); font-weight: 600; }
.chart-bar { width: 100%; max-width: 34px; background: var(--ink); border-radius: 6px 6px 2px 2px; }
.chart-col:last-of-type .chart-bar { background: var(--brand); }
.chart-note { flex-basis: 100%; font-size: 14px; color: var(--muted); }
.chart-note strong { color: var(--ink); }

/* Actividad y tareas */
.feed { list-style: none; margin: 0; padding: 8px 0; }
.feed li { display: flex; align-items: flex-start; gap: 12px; padding: 12px 24px; }
.feed p { font-size: 14px; line-height: 1.45; }
.task-check { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line-2); background: var(--paper); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; color: #fff; }
.task-check:hover { border-color: var(--ink); }
.task-check.is-on { background: #12A26C; border-color: #12A26C; }
.tasks .is-done .task-t { text-decoration: line-through; color: var(--muted); }
.task-t { font-weight: 500; }

/* Pestañas y filtros */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.tabs a { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; font-size: 15px; font-weight: 500; color: var(--muted); text-decoration: none; }
.tabs a:hover { color: var(--ink); }
.tabs a.is-active { color: var(--ink); }
.tabs a.is-active::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--ink); border-radius: 2px; }
.tabs em { font-style: normal; font-size: 12px; font-weight: 600; padding: 0 7px; border-radius: 999px; background: var(--surface); color: var(--muted); }
.tabs-in { margin-bottom: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 4px; gap: 2px; }
.tabs-in a { border-radius: 10px; padding: 8px 14px; }
.tabs-in a.is-active { background: var(--ink); color: #fff; }
.tabs-in a.is-active::after { display: none; }
.tabs-in a.is-active em { background: rgba(255, 255, 255, .18); color: #fff; }
.tab-chip { display: inline-flex; align-items: center; gap: 6px; margin: 6px 0 6px auto; padding: 4px 10px; border-radius: 999px; background: var(--surface); font-size: 13px; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.filters .input { max-width: 320px; }
.filters .select { width: auto; min-width: 180px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }

/* Fichas */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
@media (max-width: 1180px) { .split { grid-template-columns: 1fr; } }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px 24px; margin: 0; }
.facts dt { font-size: 13px; color: var(--muted); margin-bottom: 2px; }
.facts dd { margin: 0; font-size: 15px; overflow-wrap: anywhere; }
.facts-col { grid-template-columns: 1fr; gap: 14px; }
.quote-box, .prose { white-space: normal; }
.quote-box { padding: 16px 18px; border-radius: var(--r); background: var(--surface); }
.money-big { font-size: 30px; font-weight: 800; font-stretch: 110%; letter-spacing: -.02em; color: var(--ink); }
.card-sub { padding: 22px 24px; border-top: 1px solid var(--line); background: #FCFCFB; border-radius: 0 0 var(--r-lg) var(--r-lg); }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; border-top: 1px solid var(--line); }
.inline-form .field { flex: 1 1 150px; }
.inline-form .grow-2 { flex: 3 1 240px; }
.inline-form .field-sm { flex: 0 1 140px; }
.inline-form .field-xs { flex: 0 1 80px; }
.inline-form .field label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.subform { padding: 16px; border-radius: var(--r); background: var(--surface); }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: inline-flex; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-2); font-size: 13.5px; font-weight: 500; }
.seg input:checked + span { background: var(--ink); color: #fff; border-color: var(--ink); }
.seg input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.timeline { list-style: none; margin: 0; padding: 8px 24px 20px; }
.timeline li { position: relative; display: flex; gap: 14px; padding: 12px 0 12px 0; }
.timeline li + li::before { content: ''; position: absolute; left: 5px; top: -12px; height: 24px; width: 2px; background: var(--line); }
.tl-dot { flex: none; width: 12px; height: 12px; margin-top: 5px; border-radius: 50%; background: var(--ink); }
.timeline .is-system .tl-dot { background: var(--line-2); }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px; padding: 2px 8px; border-radius: 6px; background: #fff; cursor: copy; }
.is-off td { opacity: .55; }

/* Etapas del proyecto */
.pipeline-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.pipeline { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.pipeline li { position: relative; }
.pipeline button, .pipeline-ro li { width: 100%; display: flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; text-align: left; }
.pipeline button:hover { border-color: var(--ink); color: var(--ink); }
.pipeline .is-done button, .pipeline-ro .is-done { color: var(--ink); background: var(--surface); border-color: var(--surface); }
.pipeline .is-current button, .pipeline-ro .is-current { color: #fff; background: var(--ink); border-color: var(--ink); cursor: default; }
.pipeline-ro { margin-bottom: 24px; }
.pipeline-ro li { cursor: default; }
.pl-dot { flex: none; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid currentColor; display: inline-flex; align-items: center; justify-content: center; }
.is-done .pl-dot { background: #12A26C; border-color: #12A26C; color: #fff; }
.is-current .pl-dot { border-color: var(--brand); background: var(--brand); }
@media (max-width: 900px) { .pipeline { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 520px) { .pipeline { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Archivos */
.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 28px 20px; border: 1.5px dashed var(--line-2); border-radius: var(--r); background: #FCFCFB; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.is-over { border-color: var(--ink); background: var(--surface); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone-sm { flex-direction: row; padding: 16px; gap: 10px; }
.dropzone-list { font-size: 13px; color: var(--ink); font-weight: 600; }
.files { list-style: none; margin: 0; padding: 8px 16px 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.file { display: flex; align-items: center; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: var(--r); min-width: 0; }
.file-thumb { flex: none; width: 52px; height: 52px; border-radius: 10px; background: var(--surface); overflow: hidden; display: flex; align-items: center; justify-content: center; text-decoration: none; font-size: 11px; font-weight: 700; color: var(--muted); }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.file-name { font-weight: 600; font-size: 14px; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-name:hover { text-decoration: underline; }

/* Conversación */
.chat { display: flex; flex-direction: column; gap: 12px; padding: 18px 24px; max-height: 560px; overflow-y: auto; }
.msg { max-width: 82%; display: flex; flex-direction: column; gap: 4px; }
.msg-meta { display: flex; gap: 8px; align-items: baseline; font-size: 12.5px; color: var(--muted); }
.msg-meta strong { color: var(--ink); font-size: 13px; }
.msg-body { padding: 12px 14px; border-radius: 14px; font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.msg-client { align-self: flex-start; }
.msg-client .msg-body { background: var(--surface); border-top-left-radius: 4px; }
.msg-out { align-self: flex-end; align-items: flex-end; }
.msg-out .msg-body { background: var(--ink); color: #fff; border-top-right-radius: 4px; }
.msg-note { align-self: flex-end; align-items: flex-end; }
.msg-note .msg-body { background: #FFF6E8; border: 1px dashed #F0C27A; border-top-right-radius: 4px; }
.chat-sys { align-self: center; font-size: 12.5px; color: var(--muted); padding: 4px 12px; border-radius: 999px; background: var(--surface); text-align: center; }
.chat-sys span { color: var(--soft); }
.composer { border-top: 1px solid var(--line); }

/* Kanban */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(270px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.kb-col { background: #F2F2F0; border-radius: var(--r-lg); padding: 10px; display: flex; flex-direction: column; min-height: 420px; }
.kb-head { display: flex; align-items: center; gap: 8px; padding: 6px 6px 12px; }
.kb-head h2 { font-size: 15px; font-stretch: 100%; letter-spacing: 0; }
.kb-dot { width: 10px; height: 10px; border-radius: 50%; }
.kb-count { margin-left: auto; font-size: 13px; font-weight: 600; color: var(--muted); background: var(--paper); padding: 0 8px; border-radius: 999px; }
.kb-list { flex: 1; display: flex; flex-direction: column; gap: 8px; min-height: 80px; border-radius: 12px; transition: background .15s; }
.kb-list.is-over { background: rgba(240, 127, 11, .1); outline: 2px dashed var(--brand); outline-offset: -2px; }
.kb-card { background: var(--paper); border: 1px solid var(--line); border-left: 3px solid var(--line); border-radius: 12px; padding: 12px 12px 10px; display: flex; flex-direction: column; gap: 6px; cursor: grab; box-shadow: 0 1px 2px rgba(0, 0, 0, .03); }
.kb-card:hover { border-color: var(--line-2); }
.kb-card.is-dragging { opacity: .45; }
.kb-card.is-saving { opacity: .7; }
.prio-b-alta { border-left-color: var(--brand); }
.prio-b-urgente { border-left-color: #B42318; }
.kb-title { font-weight: 650; font-size: 15px; line-height: 1.3; text-decoration: none; color: var(--ink); }
.kb-title:hover { text-decoration: underline; }
.kb-progress { height: 4px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-top: 2px; }
.kb-progress span { display: block; height: 100%; background: #12A26C; }
.kb-foot { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.kb-foot .due { margin-left: auto; font-size: 12px; }
.avatar-sm { width: 24px; height: 24px; font-size: 10px; }
.kb-move { margin-top: 6px; width: 100%; min-height: 32px; font-size: 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); display: none; }
.kb-empty { margin: 0; padding: 18px; text-align: center; font-size: 13px; color: var(--soft); border: 1.5px dashed var(--line-2); border-radius: 12px; }
@media (hover: none) { .kb-move { display: block; } }

/* Campañas */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 460px); gap: 24px; align-items: start; }
@media (max-width: 1180px) { .editor { grid-template-columns: 1fr; } }
.textarea-tall { min-height: 280px; font-size: 15px; }
.preview-frame { border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: var(--paper); }
.preview-bar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #FCFCFB; }
.preview-bar > span { width: 9px; height: 9px; border-radius: 50%; background: var(--line-2); }
.preview-bar small { margin-left: 8px; color: var(--muted); font-size: 12.5px; }
.preview-frame iframe { display: block; width: 100%; height: 640px; border: 0; background: #F5F5F3; }
.send-box { border-color: var(--ink); }
.progress-lg { height: 12px; }
.progress-lg > span { background: var(--brand); transition: width .4s ease; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: 12px 18px; border-radius: 12px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 500; box-shadow: var(--shadow); transition: opacity .2s, transform .2s; z-index: 100; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: #B42318; }

/* ───────── Portal de clientes ───────── */
.portal-body { background: #FAFAF9; }
.portal-wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding-inline: clamp(16px, 4vw, 48px); }
.portal-header { position: sticky; top: 0; z-index: 40; background: rgba(255, 255, 255, .92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.portal-header-in { display: flex; align-items: center; gap: 24px; min-height: 68px; }
.portal-logo { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.portal-logo img { height: 22px; width: auto; }
.portal-logo span { font-size: 13px; color: var(--muted); font-weight: 500; }
.portal-nav { display: flex; gap: 4px; margin-right: auto; }
.portal-nav a { padding: 8px 14px; border-radius: 999px; text-decoration: none; font-size: 15px; font-weight: 500; color: #3D3D3D; }
.portal-nav a:hover { background: var(--surface); }
.portal-nav a.is-active { background: var(--ink); color: #fff; }
.portal-who { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; }
.portal-main { padding-top: clamp(24px, 4vw, 48px); padding-bottom: 64px; min-height: 70vh; }
.portal-main > .flash-stack { margin-bottom: 20px; }
.portal-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding-top: 24px; padding-bottom: 32px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
@media (max-width: 860px) {
  .portal-header-in { flex-wrap: wrap; gap: 8px 16px; padding-block: 10px; }
  .portal-logo span { display: none; }
  .portal-nav { order: 3; width: 100%; overflow-x: auto; }
}
.pcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.pcard { display: flex; flex-direction: column; gap: 12px; padding: 24px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); text-decoration: none; transition: border-color .15s; }
.pcard:hover { border-color: var(--ink); }
.pcard h2 { font-size: 21px; line-height: 1.2; }
.action-banner { display: flex; align-items: center; gap: 16px; padding: 16px 20px; margin-bottom: 16px; border-radius: var(--r-lg); background: var(--brand-soft); border: 1px solid #F8CFA0; text-decoration: none; }
.action-banner .grow { display: flex; flex-direction: column; }
.action-banner small { color: #6B4A20; }
.action-ico { flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--brand); display: inline-flex; align-items: center; justify-content: center; }
.approve { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 20px 40px; margin-bottom: 24px; border: 2px solid var(--brand); }
.approve > .stack { flex: 1 1 280px; }
.approve-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; flex: 2 1 460px; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; }
.choice span { display: flex; flex-direction: column; gap: 4px; min-height: 64px; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--paper); justify-content: center; }
.choice small { color: var(--muted); font-size: 13.5px; }
.choice:hover span { border-color: var(--line-2); }
.choice input:checked + span { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.choice input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ═════════ v2: fluidez, Mi día, planificación, facturación y web ═════════ */

/* Transiciones entre páginas y barra de progreso */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .16s; }
.navbar-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 200; background: var(--brand); opacity: 0; pointer-events: none; }
.navbar-progress.is-on { opacity: 1; animation: carga 8s cubic-bezier(.1, .7, .2, 1) forwards; }
.navbar-progress.is-done { width: 100% !important; opacity: 0; animation: none; transition: width .2s, opacity .3s .15s; }
@keyframes carga { from { width: 0; } to { width: 88%; } }
form.is-sending .is-busy[disabled] { opacity: .6; cursor: progress; }
.content > * { animation: entra .18s ease-out both; }
@keyframes entra { from { opacity: .75; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.impersonate { position: relative; z-index: 70; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 10px clamp(16px, 3vw, 40px); background: #2B1B5A; color: #fff; font-size: 14px; }
.impersonate span { flex: 1; min-width: 220px; }
.impersonate .btn { background: #fff; border-color: #fff; }
.avatar-dark { background: #2B1B5A; color: #fff; }
.fieldset { border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px 16px; margin: 0; }
.fieldset legend { padding: 0 6px; }
.text-red { color: #B42318; }
.text-amber { color: #8A5300; }
.req { color: #B42318; }
.between-foot { justify-content: space-between; }
.table-sm th, .table-sm td { padding: 7px 10px; }

/* ───── Mi día ───── */
.day-note { display: flex; gap: 14px; align-items: flex-start; padding: 16px 20px; margin-bottom: 20px; border-radius: var(--r-lg); background: var(--brand-soft); border: 1px solid #F8CFA0; }
.day-note p { margin-top: 4px; white-space: normal; }
.day-note-ico { flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--brand); display: inline-flex; align-items: center; justify-content: center; }
.split-day { grid-template-columns: minmax(0, 1fr) 360px; }
@media (max-width: 1180px) { .split-day { grid-template-columns: 1fr; } }
.tsec { display: flex; flex-direction: column; gap: 10px; }
.tsec-h { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 700; font-stretch: 100%; letter-spacing: 0; color: var(--muted); text-transform: none; }
.tsec-n { font-size: 12px; padding: 0 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink); }
.tsec-empty { padding: 28px; text-align: center; border: 1.5px dashed var(--line-2); border-radius: var(--r-lg); color: var(--muted); }
.tsec-done > summary { cursor: pointer; list-style: none; }
.tsec-done > summary::-webkit-details-marker { display: none; }
.tsec-done[open] > summary { margin-bottom: 10px; }
.tlist { display: flex; flex-direction: column; gap: 10px; }
.tcard { display: flex; gap: 16px; align-items: flex-start; padding: 18px 20px; background: var(--paper); border: 1px solid var(--line); border-left: 4px solid var(--line-2); border-radius: var(--r-lg); transition: border-color .15s, box-shadow .15s; }
.tcard:hover { box-shadow: var(--shadow); }
.tcard.prio-b-alta { border-left-color: var(--brand); }
.tcard.prio-b-urgente { border-left-color: #B42318; }
.tcard.is-running { border-color: var(--brand); border-left-color: var(--brand); background: linear-gradient(0deg, #FFFBF6, #FFFBF6); box-shadow: 0 0 0 3px rgba(240, 127, 11, .12); }
.tcard.is-late:not(.is-running) { background: #FFFBFA; }
.tcard.is-done { opacity: .7; }
.tcard.is-done .tcard-t { text-decoration: line-through; text-decoration-color: var(--line-2); }
.tcard-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.tcard-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tcard-proj { font-size: 13px; color: var(--muted); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
a.tcard-proj:hover { color: var(--ink); text-decoration: underline; }
.tcard-t { font-size: 18px; font-weight: 700; font-stretch: 104%; letter-spacing: -.01em; line-height: 1.25; }
.tcard-d { font-size: 15px; color: #3D3D3D; }
.tcard-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.tcard-meta > span { display: inline-flex; align-items: center; gap: 5px; }
.tcard-live { color: #A84D00; font-weight: 600; }
.tcard-live .ico { animation: late 1.6s ease-in-out infinite; }
@keyframes late { 50% { opacity: .3; } }
.tcard-nota { font-size: 14px; color: var(--muted); font-style: italic; }
.tcard-more { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 8px; }
.tcard-more summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--ink); padding: 4px 0; }
.tcard-more .table-wrap { margin-top: 8px; border: 1px solid var(--line); border-radius: var(--r); }
.tcard-links { margin-top: 8px; }
.tcard-actions { flex: none; display: flex; flex-direction: column; gap: 8px; align-items: stretch; min-width: 128px; }
@media (max-width: 640px) {
  .tcard { flex-direction: column; padding: 16px; }
  .tcard-actions { flex-direction: row; width: 100%; }
  .tcard-actions .btn { flex: 1; min-height: 44px; }
}
.day-chip { flex: none; width: 42px; display: flex; flex-direction: column; align-items: center; line-height: 1.1; padding: 5px 0; border-radius: 10px; background: var(--surface); }
.day-chip b { font-size: 16px; color: var(--ink); }
.day-chip small { font-size: 11px; color: var(--muted); text-transform: capitalize; }

/* ───── Planificación ───── */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-bottom: 20px; }
.week-day { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 10px 4px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); text-decoration: none; transition: border-color .15s; }
.week-day:hover { border-color: var(--ink); }
.week-day small { font-size: 12px; color: var(--muted); text-transform: capitalize; }
.week-day b { font-size: 20px; color: var(--ink); line-height: 1.2; }
.week-day em { font-style: normal; font-size: 11.5px; color: var(--muted); }
.week-day.is-today b { color: var(--brand); }
.week-day.is-active { background: var(--ink); border-color: var(--ink); }
.week-day.is-active small, .week-day.is-active b, .week-day.is-active em { color: #fff; }
.plan-top { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(280px, 1fr); gap: 16px; margin-bottom: 20px; align-items: start; }
@media (max-width: 1080px) { .plan-top { grid-template-columns: 1fr; } }
.plan-add-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.plan-add-grid .pa-t, .plan-add-grid .pa-p, .plan-add-grid .pa-d { grid-column: span 2; }
@media (max-width: 720px) { .plan-add-grid { grid-template-columns: 1fr 1fr; } }
.plan-add-grid .field label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.plan { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.pl-col { background: #F2F2F0; border-radius: var(--r-lg); padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 360px; }
.pl-col-inbox { background: #FFF6EA; }
.pl-head { display: flex; align-items: center; gap: 10px; padding: 4px 4px 2px; }
.pl-head .grow { display: flex; flex-direction: column; line-height: 1.25; }
.pl-head strong { font-size: 14.5px; }
.pl-head small { font-size: 12px; }
.pl-load { display: flex; flex-direction: column; gap: 4px; padding: 0 4px 4px; }
.pl-load-bar { height: 6px; border-radius: 999px; background: #E2E2DE; overflow: hidden; }
.pl-load-bar span { display: block; height: 100%; width: 0; background: #12A26C; border-radius: inherit; transition: width .3s ease; }
.pl-load.is-over .pl-load-bar span { background: #B42318; }
.pl-load.is-over small { color: #B42318; font-weight: 600; }
.pl-list { flex: 1; display: flex; flex-direction: column; gap: 8px; min-height: 80px; border-radius: 12px; transition: background .15s; }
.pl-list.is-over { background: rgba(240, 127, 11, .1); outline: 2px dashed var(--brand); outline-offset: -2px; }
.pl-card { background: var(--paper); border: 1px solid var(--line); border-left: 3px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; cursor: grab; box-shadow: 0 1px 2px rgba(0, 0, 0, .03); transition: border-color .15s, transform .15s; }
.pl-card:hover { border-color: var(--line-2); transform: translateY(-1px); }
.pl-card.prio-b-alta { border-left-color: var(--brand); }
.pl-card.prio-b-urgente { border-left-color: #B42318; }
.pl-card.is-late { background: #FFF7F6; border-color: #F5C6C2; }
.pl-card.is-done { opacity: .55; cursor: pointer; }
.pl-card.is-dragging { opacity: .4; }
.pl-title { font-size: 14.5px; line-height: 1.3; color: var(--ink); }
.pl-foot { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 2px; }
.pl-foot span { display: inline-flex; align-items: center; gap: 4px; }

/* ───── Facturación ───── */
.seg-links { display: inline-flex; padding: 4px; gap: 2px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); }
.seg-links a { padding: 7px 16px; border-radius: 999px; text-decoration: none; font-size: 14px; font-weight: 600; color: var(--muted); }
.seg-links a.is-active { background: var(--ink); color: #fff; }
.rules-box { padding: 14px 16px; border-radius: var(--r); background: #F4F0FF; border: 1px solid #DCD0FB; color: #3A2378; font-size: 14px; }
.rules-list { margin: 8px 0 0; padding-left: 20px; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 4px 20px; }
.rules-note { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: #FFF4DE; color: #6B4300; font-size: 14px; white-space: normal; }
.rules-note::before { content: 'Recordatorio: '; font-weight: 700; }
.items-table td { vertical-align: top; padding: 8px 10px; }
.items-table td:first-child { padding-left: 24px; }
.items-table .input.num { text-align: right; }
.item-desc { min-height: 46px; resize: none; overflow: hidden; }
.items-table [data-monto] { padding-top: 18px; font-weight: 600; }
.doc-aside { position: sticky; top: 88px; }
@media (max-width: 1180px) { .doc-aside { position: static; } }
.grid-form-2 { grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-form-2 .field label { font-size: 13px; }
.doc-totals { gap: 8px; display: flex; flex-direction: column; }
.tot-row { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.tot-row span:first-child { color: var(--muted); }
.tot-big { padding-top: 10px; margin-top: 4px; border-top: 1px solid var(--line); font-size: 22px; }
.tot-big span:first-child { color: var(--ink); font-weight: 700; }
.tot-ref { font-size: 13px; }
.doc-preview { border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: #E9E9E6; }
.doc-preview iframe { display: block; width: 100%; aspect-ratio: 216 / 279; border: 0; background: #fff; }

/* ───── Web ───── */
.logo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.logo-card { overflow: hidden; }
.logo-card.is-off { opacity: .6; }
.logo-prev { height: 120px; display: flex; align-items: center; justify-content: center; padding: 20px; background: repeating-conic-gradient(#F5F5F3 0 25%, #fff 0 50%) 0 0 / 16px 16px; border-bottom: 1px solid var(--line); }
.logo-prev img { max-height: 70px; max-width: 80%; width: auto; object-fit: contain; }
.logo-txt { font-weight: 700; font-stretch: 110%; font-size: 20px; color: #9A9A96; text-align: center; }

/* ───── Web: contenido editable ───── */
.web-tabs { margin-bottom: 24px; overflow-x: auto; flex-wrap: nowrap; }
.web-tabs a { white-space: nowrap; }
.gap-6 { gap: 6px; }
.web-grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 24px; align-items: start; }
.media-edit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.media-edit { display: flex; flex-direction: column; gap: 12px; }
.media-edit-prev, .web-item-media, .wp-cover, .gal-img { position: relative; overflow: hidden; border-radius: var(--r); background: var(--surface); }
.media-edit-prev { aspect-ratio: 16 / 9; }
.media-edit-prev img, .media-edit-prev video, .web-item-media img, .web-item-media video, .wp-cover img, .gal-img img { width: 100%; height: 100%; object-fit: cover; }
.media-tag { position: absolute; left: 8px; top: 8px; display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; background: rgba(0, 0, 0, .65); color: #fff; font-size: 12px; font-weight: 600; }
.media-tag-r { left: auto; right: 8px; background: rgba(180, 35, 24, .85); }
.web-item-empty { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--soft); font-size: 12px; }

.web-item { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 20px; padding: 16px; }
.web-item.is-off { opacity: .6; }
.web-item-media { aspect-ratio: 4 / 3; align-self: start; }
.web-item-body { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.wp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.wp-card { overflow: hidden; display: flex; flex-direction: column; }
.wp-card.is-off { opacity: .6; }
.wp-cover { display: block; aspect-ratio: 4 / 3; border-radius: 0; }
.wp-cover-lg { aspect-ratio: 1; border-radius: var(--r); }
.wp-body { padding: 14px 16px 6px; display: flex; flex-direction: column; gap: 2px; }
.wp-body .row-link { text-decoration: none; color: var(--ink); }
.wp-body .row-link:hover { text-decoration: underline; }
.wp-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px 12px; margin-top: auto; }

.gal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.gal-item { display: flex; flex-direction: column; gap: 8px; }
.gal-img { aspect-ratio: 1; }

.legal-editor { font-size: 14.5px; line-height: 1.6; min-height: 380px; }
code { padding: 1px 5px; border-radius: 5px; background: rgba(0, 0, 0, .06); font-size: .92em; }

/* ───── Armador del asistente ───── */
.bot-builder { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.bot-builder-aside { position: sticky; top: 24px; }
.bot-avatar-prev { width: 46px; height: 46px; border-radius: 50%; object-fit: contain; background: var(--surface); padding: 6px; flex: none; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch span { position: relative; width: 40px; height: 24px; border-radius: 999px; background: var(--line-2); transition: background .2s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .2s; }
.switch input:checked + span { background: var(--ink); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }

.flow { list-style: none; margin: 0; padding: 18px 24px 24px; display: flex; flex-direction: column; }
.flow-step { position: relative; display: flex; align-items: flex-start; gap: 14px; padding: 12px 0; }
.flow-step + .flow-step { border-top: 1px dashed var(--line); }
.flow-step.is-off { opacity: .5; }
.flow-step.is-cond { margin-left: 28px; padding-left: 14px; border-left: 2px solid var(--brand); }
.flow-step.is-cond + .flow-step.is-cond { border-top-style: dashed; }
.flow-n { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--surface); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.flow-end .flow-n { background: var(--ink); color: #fff; }
.flow-if { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: #A84D00; }
.flow-ops { display: flex; flex-wrap: wrap; gap: 4px; }
.flow-ops span { padding: 2px 9px; border: 1px solid var(--line-2); border-radius: 999px; font-size: 12.5px; color: var(--muted); }
.flow-actions { flex: none; display: flex; align-items: center; gap: 2px; }
.list-row.is-off { opacity: .55; }

/* ───── Créditos ───── */
.made-by { display: block; padding: 10px 6px 0; font-size: 11.5px; color: var(--soft); text-decoration: none; line-height: 1.4; }
.made-by strong { color: var(--muted); font-weight: 600; }
.made-by:hover strong { color: var(--ink); text-decoration: underline; text-decoration-color: var(--brand); }
.auth-credit { margin-top: 8px; font-size: 12.5px; color: var(--soft); }
.auth-credit a { color: var(--muted); font-weight: 600; }

@media (max-width: 1100px) {
  .web-grid-2, .bot-builder { grid-template-columns: 1fr; }
  .bot-builder-aside { position: static; }
}
@media (max-width: 640px) {
  .web-item { grid-template-columns: 1fr; }
  .flow-step { flex-wrap: wrap; }
  .flow-step.is-cond { margin-left: 8px; }
  .flow-actions { width: 100%; justify-content: flex-end; }
}
