/* Marca Fliprop; tipografía de interfaz nativa para lectura prolongada. */
:root {
  font-family:
    "Segoe UI",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    Arial,
    sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #24344b;
  background: #f5f6f8;
  --brand-orange: #ff7844;
  --brand-navy: #000c2a;
  --brand-blue: #001b4b;
  --primary: #001b4b;
  --text: #24344b;
  --muted: #586779;
  --border: #dce2e9;
  --surface: #ffffff;
  --surface-soft: #f5f6f8;
  --accent-soft: #fff0e9;
  --radius: 8px;
  --sidebar-width: 224px;
}
::selection {
  background: #ffd9c9;
  color: #000c2a;
}

/* Base: una sola escala para texto y controles. */
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
  font-size: 13px;
  line-height: 1.4;
}
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid #cbd4df;
  border-radius: 6px;
  background: white;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background-color 0.15s,
    border-color 0.15s;
}
button:hover:not(:disabled) {
  background: #edf1f6;
  border-color: #aab8c9;
  color: #142b49;
}
button.primary,
.accent button {
  background: var(--brand-orange);
  border-color: var(--brand-orange);
  color: var(--brand-navy);
}
button.primary:hover:not(:disabled),
.accent button:hover:not(:disabled) {
  background: #ff9166;
  border-color: #ff9166;
  color: var(--brand-navy);
}
button:disabled,
button.primary:disabled {
  opacity: 1;
  color: #637084;
  background: #eef1f5;
  border-color: #dce2e9;
  cursor: not-allowed;
}
button:focus-visible,
a:focus-visible,
summary:focus-visible,
.table-scroll:focus-visible {
  outline: 2px solid var(--brand-blue);
  outline-offset: 3px;
}
input,
select,
textarea {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 9px 11px;
  border: 1px solid #c7d1de;
  border-radius: 6px;
  background: white;
  color: var(--text);
  font-weight: 400;
}
input::placeholder,
textarea::placeholder {
  color: #667589;
  opacity: 1;
}
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #49688e;
  outline-offset: 1px;
}
input:disabled,
select:disabled,
textarea:disabled {
  color: #637084;
  background: #eef1f5;
  border-color: var(--border);
  opacity: 1;
}
textarea {
  min-height: 96px;
  resize: vertical;
}
input[type="checkbox"] {
  display: inline-block;
  width: 16px;
  height: 16px;
  min-height: 0;
  margin: 0;
  flex: none;
  accent-color: var(--brand-blue);
}
input[type="color"] {
  height: 38px;
  padding: 4px;
}
input[type="file"] {
  padding: 6px;
}
input::file-selector-button {
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: #edf1f6;
  border: 0;
  border-radius: 4px;
  padding: 6px 10px;
  margin-right: 10px;
  cursor: pointer;
}
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 16px 0 8px;
}
label input,
label select,
label textarea {
  margin-top: 6px;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1,
h2,
h3 {
  color: var(--text);
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
h1 {
  font-size: 24px;
  letter-spacing: -0.5px;
  margin-bottom: 7px;
}
h2 {
  font-size: 17px;
  letter-spacing: -0.2px;
  margin-bottom: 12px;
}
h3 {
  font-size: 14px;
  margin-bottom: 8px;
}
p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 16px;
  overflow-wrap: anywhere;
}
small {
  display: block;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
  overflow-wrap: anywhere;
}
a {
  color: var(--brand-blue);
}
hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}
/* Desplegables: separación exterior y aire entre el título y su contenido. */
:where(details) {
  margin-block: 16px;
}
:where(details > summary) {
  cursor: pointer;
}
:where(details[open] > summary) {
  margin-bottom: 12px;
}

pre {
  max-width: 100%;
  max-height: 350px;
  overflow: auto;
  padding: 16px;
  background: #f0f3f7;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
}
button,
input,
select,
textarea,
.panel,
.metric,
.mini-panel {
  max-width: 100%;
}

/* Marco y navegación. */
.shell {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  padding: 24px 14px 16px;
  background: var(--brand-navy);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 5;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px;
  text-decoration: none;
  color: white;
  flex: none;
}
.brand img {
  display: block;
  width: 140px;
  max-width: 100%;
  height: auto;
  flex-shrink: 1;
}
.brand span {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  color: #c8d3e3;
  border-left: 1px solid #40516e;
  padding-left: 10px;
  line-height: 22px;
}
.sidebar nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #40516e transparent;
  padding: 0 0 12px;
}
.sidebar nav button {
  display: flex;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  margin: 2px 0;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-left: 3px solid transparent;
  color: #cbd6e7;
  background: transparent;
  text-align: left;
  font-size: 13px;
  font-weight: 400;
}
.sidebar nav button.active,
.sidebar nav button.active:hover {
  background: #17253f;
  color: white;
  border-color: transparent;
  border-left-color: var(--brand-orange);
  font-weight: 600;
}
.sidebar nav button:hover:not(.active) {
  background: #111f39;
  color: white;
  border-color: transparent;
}
.sidebar nav button span {
  display: flex;
  align-items: center;
  flex: none;
}
.nav-icon {
  width: 18px;
  height: 18px;
  flex: none;
}
.sidebar nav small {
  margin-left: auto;
  min-width: 20px;
  padding: 1px 5px;
  border-radius: 4px;
  background: #ff7844;
  color: #000c2a;
  font-size: 11px;
  text-align: center;
}
.sidebar button:focus-visible,
.sidebar a:focus-visible {
  outline-color: var(--brand-orange);
}
.profile {
  display: flex;
  align-items: center;
  gap: 9px;
  border-top: 1px solid #293850;
  padding-top: 14px;
  font-size: 12px;
  flex: none;
}
.profile > div {
  min-width: 0;
}
.profile > div:not(.avatar) {
  overflow: hidden;
}
.profile b,
.profile small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile small {
  color: #b2c1d7;
}
.avatar {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: #fff0e9;
  color: #853b20;
  border-radius: 50%;
  font-weight: 600;
  flex: none;
}
.profile button {
  min-width: 32px;
  padding: 6px;
  margin-left: 0;
  border-color: transparent;
  background: transparent;
  color: #d2dceb;
}
.profile > button:first-of-type {
  margin-left: auto;
}
.profile button:hover {
  background: #17253f;
  color: white;
  border-color: #293850;
}
.menu-toggle {
  display: none;
}
.body {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
}
.eyebrow {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.2px;
  color: var(--muted);
  margin-bottom: 8px;
  line-height: 1.5;
}
main {
  padding: 0 32px 32px;
  min-height: 70vh;
}
.body > main {
  padding-top: 32px;
}
.toolbar-create {
  margin-left: auto;
}
.actions,
.toolbar,
.section-title,
.form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.actions input {
  flex: 1 1 150px;
  width: 150px;
}
.toolbar {
  gap: 10px;
  margin-bottom: 16px;
}
.toolbar > input {
  flex: 1 1 200px;
  max-width: 370px;
}
.toolbar > select {
  flex: 1 1 180px;
  max-width: 260px;
}
.toolbar label {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  font-size: 13px;
  font-weight: 400;
}
.toolbar p {
  flex: 1 1 200px;
  margin: 0;
}
.toolbar input[type="checkbox"] {
  margin: 0;
}
.section-title {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.section-title h2 {
  margin: 0;
  flex: 1 1 150px;
}
.section-title button {
  flex-shrink: 0;
}

/* Cartera, indicadores y tablas. */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.metric,
.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: white;
  min-width: 0;
}
.metric {
  padding: 18px;
  border-top: 2px solid var(--brand-orange);
}
.metric p {
  font-size: 13px;
  margin-bottom: 12px;
}
.metric strong {
  display: block;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -0.6px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--brand-blue);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.metric small {
  font-size: 12px;
}
.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.panel {
  padding: 20px;
  margin-bottom: 20px;
}
.panel.accent {
  background: var(--brand-blue);
  border-color: var(--brand-blue);
  color: white;
  padding: 24px;
}
.accent h2 {
  color: white;
  font-size: 22px;
  line-height: 1.35;
}
.accent .eyebrow {
  color: #ffa480;
}
.accent p {
  color: #d4deed;
  font-size: 14px;
  max-width: 440px;
}
.pill {
  border-top: 1px solid #3d5274;
  padding-top: 14px;
  margin-top: 20px;
  color: #c8d4e6;
  font-size: 12px;
}
.status-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 22px;
  font-size: 13px;
  color: var(--muted);
  margin: 16px 0;
}
.activity-line {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid #e9edf2;
}
.activity-line > div {
  min-width: 0;
}
.activity-line b {
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.activity-line small {
  margin-top: 4px;
}
.calendar-icon {
  padding: 8px;
  background: #fff0e9;
  color: #853b20;
  border-radius: 6px;
  flex: none;
}
.table-panel {
  padding: 0;
}
.table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border-radius: 6px;
  scrollbar-width: thin;
  scrollbar-color: #acb8c8 #f5f6f8;
}
table {
  width: 100%;
  min-width: 540px;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}
th {
  padding: 12px 16px;
  font-size: 11px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-weight: 600;
  color: #526276;
  background: #f7f8fa;
}
td {
  padding: 14px 16px;
  border-top: 1px solid #e9edf2;
  vertical-align: middle;
  overflow-wrap: anywhere;
}
td button {
  margin: 3px 5px 3px 0;
  min-height: 32px;
  padding: 6px 10px;
}
.text-button {
  display: inline;
  padding: 0;
  min-height: 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--brand-blue);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}
.text-button:hover:not(:disabled) {
  background: transparent;
  color: #173f76;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.badge {
  display: inline-block;
  padding: 3px 7px;
  margin: 3px 3px 3px 0;
  border-radius: 4px;
  background: #edf1f6;
  color: #43546b;
  font-size: 12px;
  line-height: 1.5;
}
.kanban {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  align-items: flex-start;
  padding-bottom: 16px;
  scrollbar-width: thin;
}
.column {
  flex: 0 0 260px;
  min-width: 0;
  background: #edf0f5;
  padding: 12px;
  border-radius: 8px;
}
.column-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.column-title h3 {
  margin: 0;
  min-width: 0;
}
.column-title span {
  background: white;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 12px;
  flex: none;
}
.column > small {
  font-size: 12px;
  margin: 7px 0 12px;
}
.op-card {
  background: white;
  border: 1px solid #d7dfe9;
  border-top: 2px solid #aebdd1;
  border-radius: 6px;
  padding: 14px;
  margin: 10px 0;
}
.op-card p {
  font-size: 13px;
  margin: 8px 0;
}
.op-card strong {
  font-size: 16px;
  font-weight: 600;
}
.op-card select {
  margin-top: 10px;
}
.card-meta {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
}
.empty {
  text-align: center;
  padding: 32px 16px;
  min-width: 0;
}
.empty > span {
  font-size: 28px;
  color: #a24421;
}
.empty h3 {
  margin: 12px 0 8px;
  font-size: 15px;
}
.empty p {
  font-size: 13px;
  margin: 0 auto 16px;
  max-width: 360px;
}
.empty button {
  white-space: normal;
}

/* Formularios, estados y agenda. */
.alert {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  border: 1px solid;
  border-radius: 6px;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.alert button {
  border: 0;
  padding: 0;
  min-height: 24px;
  min-width: 24px;
  background: transparent;
  color: inherit;
  flex: none;
}
.error {
  background: #fff1ee;
  color: #8b3025;
  border-color: #e9bdb4;
}
.success {
  background: #edf5ef;
  color: #315e40;
  border-color: #c5decd;
}
.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  justify-content: flex-end;
  background: #000c2a70;
}
.drawer {
  width: 540px;
  max-width: 100vw;
  background: white;
  padding: 28px;
  overflow-y: auto;
  overscroll-behavior: contain;
  box-shadow: -8px 0 32px #000c2a20;
}
.close {
  float: right;
  min-width: 32px;
  min-height: 32px;
  padding: 3px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
}
.drawer h2 {
  font-size: 21px;
}
.drawer h3 {
  margin-top: 22px;
}
.drawer > p,
.drawer > small {
  overflow-wrap: anywhere;
}
.form-actions {
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 12px;
  margin-top: 6px;
  background: #f7f8fa;
  border: 1px solid var(--border);
  border-radius: 6px;
  min-width: 0;
}
.checks label {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  font-size: 13px;
  font-weight: 400;
}
.checks input {
  margin: 0;
}
.checks:empty {
  display: none;
}
.mini-panel {
  padding: 16px;
  margin: 16px 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  min-width: 0;
}
.mini-panel button {
  margin: 6px 6px 0 0;
  white-space: normal;
}
.mini-panel input {
  margin: 8px 0;
}
.timeline {
  border-left: 2px solid var(--border);
  padding-left: 16px;
}
.timeline > div {
  padding: 10px 0;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.prewrap {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 4px;
  border-radius: 6px;
  background: #e9eef5;
}
.segmented button {
  background: transparent;
  border-color: transparent;
  color: #43546b;
  min-height: 32px;
  padding: 6px 12px;
}
.segmented button:hover:not(:disabled) {
  background: #dce4ef;
  border-color: transparent;
  color: #142b49;
}
.segmented button.active,
.segmented button.active:hover:not(:disabled) {
  background: white;
  color: var(--brand-blue);
  border-color: #d1dae6;
}
.agenda-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  border-top: 1px solid var(--border);
  padding: 16px 0;
}
.agenda-row > div:first-child {
  flex: 1 1 220px;
  min-width: 0;
}
.agenda-row h3 {
  margin: 8px 0;
}
.agenda-row .actions {
  flex: 0 1 auto;
}
.agenda-toolbar {
  margin-bottom: 10px;
}
.agenda-toolbar > input {
  flex: 0 1 150px;
  min-width: 145px;
}
.agenda-toolbar > select {
  flex: 0 1 185px;
  min-width: 150px;
}
.agenda-period-nav {
  display: inline-flex;
  gap: 4px;
}
.agenda-period-nav button {
  min-width: 32px;
  min-height: 32px;
  padding: 4px 8px;
}
.agenda-panel {
  padding: 0;
  overflow: hidden;
}
.agenda-panel > h2 {
  margin: 0;
  padding: 14px 16px 0;
  font-size: 17px;
}
.agenda-calendar-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 16px 12px;
}
.agenda-calendar-heading h2 {
  margin: 0;
  color: var(--brand-navy);
  font-size: 17px;
}
.agenda-calendar-heading small {
  color: var(--muted);
  font-size: 11px;
}
.agenda-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-top: 1px solid var(--border);
}
.agenda-weekday {
  padding: 7px 5px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: #f3f6fa;
  color: #53667d;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
}
.agenda-calendar-cell {
  min-width: 0;
  min-height: 100px;
  padding: 5px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.agenda-calendar-cell.is-outside {
  background: #f8fafc;
}
.agenda-calendar-cell.is-selected {
  background: #fff8f3;
  box-shadow: inset 0 0 0 2px #f3a077;
}
.agenda-calendar-cell.is-today .agenda-day-number {
  color: #a8431b;
  font-weight: 800;
}
.agenda-day-number {
  width: 27px;
  height: 27px;
  min-height: 27px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--brand-navy);
  font-size: 12px;
}
.agenda-day-number[aria-pressed="true"] {
  background: var(--brand-orange);
  color: var(--brand-navy);
}
.agenda-calendar-events {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 3px;
}
.agenda-calendar-event {
  display: flex;
  justify-content: flex-start;
  width: 100%;
  min-height: 23px;
  padding: 3px 5px;
  overflow: hidden;
  border-color: #c0d0e2;
  background: #edf3fa;
  color: #183969;
  font-size: 10px;
  font-weight: 600;
  text-align: left;
}
.agenda-calendar-event time {
  flex: none;
  font-variant-numeric: tabular-nums;
}
.agenda-calendar-event span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.agenda-calendar-event.is-completed {
  border-color: #bad8cc;
  background: #e9f5ef;
  color: #19664e;
}
.agenda-calendar-event.is-cancelled {
  border-color: #d8dde4;
  background: #f2f4f6;
  color: #667487;
  text-decoration: line-through;
}
.agenda-more {
  justify-content: flex-start;
  min-height: 20px;
  padding: 1px 4px;
  border: 0;
  color: var(--brand-blue);
  font-size: 10px;
}
.agenda-day-detail {
  padding: 14px 16px 4px;
}
.agenda-day-detail > h3 {
  margin: 0 0 10px;
  color: var(--brand-navy);
  font-size: 14px;
}
.agenda-day-detail > .agenda-row:first-of-type {
  border-top: 0;
}
.agenda-day-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 0 16px;
  color: var(--muted);
  font-size: 12px;
}
.agenda-day-empty button {
  min-height: 30px;
  padding: 4px 8px;
  font-size: 11px;
}
.agenda-reminders {
  padding: 0;
}
.agenda-reminders > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  color: var(--brand-navy);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.agenda-reminders > summary span {
  padding: 2px 6px;
  border-radius: 9px;
  background: #edf1f6;
  color: #53667d;
  font-size: 10px;
}
.agenda-reminders-content {
  padding: 0 16px 12px;
}
.agenda-reminders-content > p {
  margin: 8px 0;
  color: var(--muted);
  font-size: 12px;
}
@media (max-width: 600px) {
  .agenda-calendar-heading {
    padding: 11px 10px;
  }
  .agenda-calendar-cell {
    min-height: 62px;
    padding: 3px;
  }
  .agenda-day-number {
    width: 24px;
    height: 24px;
    min-height: 24px;
  }
  .agenda-calendar-events {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 3px;
  }
  .agenda-calendar-event {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    min-height: 18px;
    padding: 0;
    border: 0;
    background: transparent;
    font-size: 0;
  }
  .agenda-calendar-event::before {
    content: "";
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #295b90;
  }
  .agenda-calendar-event.is-completed::before {
    background: #1c8062;
  }
  .agenda-calendar-event.is-cancelled::before {
    background: #798699;
  }
  .agenda-calendar-event time,
  .agenda-calendar-event span {
    display: none;
  }
  .agenda-more {
    min-height: 18px;
    padding: 0;
    font-size: 9px;
  }
  .agenda-more span {
    display: none;
  }
  .agenda-day-detail {
    padding: 12px 10px 4px;
  }
}
.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.tabs button.active,
.tabs button.active:hover:not(:disabled) {
  background: var(--brand-blue);
  color: white;
  border-color: var(--brand-blue);
}
.filter-builder summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.filter-builder[open] summary {
  margin-bottom: 16px;
}
.filter-builder .toolbar {
  padding-bottom: 12px;
  border-bottom: 1px solid #e9edf2;
}
.filter-builder .toolbar > input,
.filter-builder .toolbar > select {
  flex: 1 1 160px;
}
.hint {
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}

/* Bandeja: cada zona puede encogerse sin empujar ni cortar el contenido. */
.inbox {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: 540px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
}
.conversation-list {
  min-width: 0;
  max-height: 760px;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: #fafbfc;
  border-radius: 8px 0 0 8px;
}
.conversation-list > .conversation-row > button.conversation-item {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 16px;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}
.conversation-list > .conversation-row > button.conversation-item.selected,
.conversation-list
  > .conversation-row
  > button.conversation-item.selected:hover {
  background: #fff0e9;
  color: var(--brand-navy);
  box-shadow: inset 3px 0 var(--brand-orange);
}
.conversation-list small {
  margin: 6px 0;
  font-weight: 400;
}
.conversation-list span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}
.chat {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.chat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.chat-header > div {
  flex: 1 1 220px;
  min-width: 0;
}
.chat-header h2 {
  font-size: 16px;
  margin-bottom: 5px;
}
.chat-header select {
  flex: 0 0 125px;
}
.claim {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  background: #f7f8fa;
}
.claim input {
  flex: 1 1 180px;
}
.messages {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 12px;
  min-height: 220px;
  max-height: 420px;
  overflow-y: auto;
  padding: 18px;
  background: #f2f4f7;
}
.bubble {
  align-self: flex-start;
  max-width: 88%;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid #d7dfe9;
  border-radius: 8px;
  background: white;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.bubble p {
  margin: 6px 0;
  color: var(--text);
  font-size: 14px;
}
.bubble small {
  font-size: 12px;
}
.bubble.out {
  align-self: flex-end;
  background: #e9eff9;
  border-color: #cdd9eb;
}
.bubble.note {
  width: 100%;
  max-width: 100%;
  background: #fff4da;
  border-color: #e9d7a7;
}
.composer {
  padding: 16px;
  border-top: 1px solid var(--border);
}
.composer textarea {
  margin: 12px 0;
}
.composer .actions {
  justify-content: space-between;
}
.composer .toolbar {
  margin: 12px 0;
}
.composer .toolbar select {
  flex: 1 1 210px;
  width: auto;
  max-width: 100%;
}
.composer .toolbar input {
  flex: 1 1 140px;
  width: auto;
  max-width: 100%;
}
.composer .segmented {
  display: flex;
}

/* Acceso y carga. */
.login {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: 100vh;
  background: white;
}
.login-story {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
  padding: 48px;
  background: var(--brand-navy);
}
.login-story .brand {
  padding: 0;
}
.login-story .brand img {
  width: 175px;
}
.login-story h1 {
  color: white;
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.2;
  letter-spacing: -0.8px;
  max-width: 560px;
}
.login-story h1 span {
  color: #ff9166;
}
.login-story p {
  color: #ccd8e9;
  font-size: 15px;
  margin-bottom: 0;
}
.login-story .eyebrow {
  color: #ffa480;
}
.login-story > small {
  color: #b2c1d7;
}
.login-form {
  align-self: center;
  justify-self: center;
  width: 360px;
  max-width: calc(100% - 48px);
  padding: 36px 0;
}
.login-form h2 {
  font-size: 22px;
  margin-bottom: 12px;
}
.login-form > p {
  font-size: 13px;
}
.login-form form {
  margin: 24px 0 20px;
}
.login-form form button {
  width: 100%;
  margin-top: 20px;
  min-height: 40px;
}
.login-form .text-button {
  font-size: 13px;
}
.loading {
  padding: 40px;
  color: var(--brand-blue);
}

/* Breakpoints coherentes: evitar columnas estrechas y acciones comprimidas. */
@media (max-width: 1180px) {
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .two-col {
    grid-template-columns: minmax(0, 1fr);
  }
  .inbox {
    grid-template-columns: 220px minmax(0, 1fr);
  }
  main {
    padding: 0 24px 28px;
  }
  .body > main {
    padding-top: 24px;
  }
}
@media (max-width: 960px) {
  .inbox {
    grid-template-columns: minmax(0, 1fr);
  }
  .conversation-list {
    max-height: 180px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    border-radius: 8px 8px 0 0;
  }
  .login-story {
    padding: 32px;
  }
}
@media (max-width: 760px) {
  .shell {
    display: block;
  }
  .sidebar {
    position: static;
    width: 100%;
    padding: 14px 16px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0 12px;
  }
  .sidebar .brand {
    padding: 0;
  }
  .sidebar .brand img {
    width: 132px;
  }
  .menu-toggle {
    display: inline-flex;
    min-height: 36px;
    padding: 7px 10px;
    color: #e6edf7;
    background: #17253f;
    border-color: #34445e;
    font-size: 13px;
  }
  .menu-toggle:hover:not(:disabled) {
    color: white;
    background: #253652;
    border-color: #52627b;
  }
  .sidebar nav,
  .sidebar .profile {
    display: none;
  }
  .sidebar.nav-open nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-column: 1 / -1;
    gap: 4px;
    padding: 14px 0 10px;
    overflow: visible;
  }
  .sidebar nav button {
    white-space: normal;
    margin: 0;
    padding: 10px 8px;
    gap: 8px;
    min-height: 42px;
  }
  .sidebar.nav-open .profile {
    display: flex;
    grid-column: 1 / -1;
  }
  .body {
    margin-left: 0;
  }
  h1 {
    font-size: 22px;
  }
  main {
    padding: 0 16px 24px;
  }
  .body > main {
    padding-top: 16px;
  }
  .metrics {
    gap: 10px;
  }
  .metric {
    padding: 14px;
  }
  .metric strong {
    font-size: 25px;
  }
  .metric p {
    min-height: 38px;
    margin-bottom: 8px;
  }
  .panel {
    padding: 16px;
    margin-bottom: 16px;
  }
  .table-panel {
    padding: 0;
  }
  .section-title h2 {
    flex-basis: 140px;
  }
  .panel.accent {
    padding: 20px;
  }
  .accent h2 {
    font-size: 20px;
  }
  .toolbar > input,
  .toolbar > select {
    max-width: 100%;
  }
  .drawer {
    width: 100%;
    max-width: 100vw;
    padding: 20px;
  }
  .drawer h2 {
    font-size: 20px;
  }
  .drawer button {
    white-space: normal;
  }
  .activity-line {
    flex-wrap: wrap;
  }
  .activity-line > div {
    flex: 1 1 200px;
  }
  .chat-header,
  .composer {
    padding: 14px;
  }
  .claim {
    padding: 12px 14px;
  }
  .messages {
    padding: 14px;
  }
  .bubble {
    max-width: 95%;
  }
  .composer .actions > button {
    width: 100%;
    min-height: 40px;
  }
  .tabs {
    gap: 6px;
  }
  .tabs button {
    flex: 1 1 auto;
    padding: 8px 10px;
  }
  .login {
    grid-template-columns: minmax(0, 1fr);
  }
  .login-story {
    padding: 24px;
    gap: 24px;
  }
  .login-story h1 {
    font-size: 28px;
    margin-bottom: 0;
  }
  .login-story p,
  .login-story > small {
    display: none;
  }
  .login-story .brand img {
    width: 152px;
  }
  .login-form {
    padding: 30px 0;
  }
  .actions,
  .toolbar,
  .form-actions {
    gap: 8px;
  }
}
@media (max-width: 380px) {
  .sidebar .brand img {
    width: 112px;
  }
  .sidebar .brand {
    gap: 8px;
  }
  .sidebar .brand span {
    padding-left: 8px;
  }
  .metric {
    padding: 12px;
  }
  .metric p,
  .metric small {
    font-size: 12px;
  }
  .metric strong {
    font-size: 23px;
  }
  .sidebar nav .nav-icon {
    width: 16px;
    height: 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

.attention-hint {
  margin: 0;
  padding: 10px 16px;
  font-size: 13px;
}
.attention-options {
  padding: 0 16px 12px;
  font-size: 13px;
}
.attention-options summary {
  cursor: pointer;
  color: var(--text);
}
.attention-options > p {
  margin: 10px 0;
  font-size: 13px;
}
.attention-options .claim {
  padding: 10px 0;
  background: transparent;
}

.inbox-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.inbox-filters > .actions {
  grid-column: 1 / -1;
}
.conversation-context {
  padding: 12px 16px;
  display: grid;
  grid-template-columns: minmax(130px, 180px) minmax(0, 1fr);
  gap: 16px;
  border-bottom: 1px solid var(--border);
}
.conversation-context p {
  font-size: 13px;
  margin: 4px 0;
  overflow-wrap: anywhere;
}
.message-preview {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
}
.message-pagination {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 16px;
}
.day-picker {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 12px 0;
}
.day-picker label {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0;
}
.day-picker input {
  width: 16px;
}
.bot-preview {
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
  padding-bottom: 22px;
}
.bot-preview > p,
.bot-preview > small {
  font-size: 13px;
}
.preview-transcript {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 360px;
  overflow-y: auto;
  padding: 12px;
  margin: 14px 0;
  background: #f2f4f7;
  border-radius: 6px;
}
@media (max-width: 1100px) {
  .inbox-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 520px) {
  .inbox-filters,
  .conversation-context {
    grid-template-columns: minmax(0, 1fr);
  }
}

.metric-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}
.metric-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 16px 0;
}
.metric-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 8px;
  padding: 18px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  min-width: 0;
  white-space: normal;
}
.metric-card strong {
  font-size: 23px;
  line-height: 1.2;
  color: var(--navy);
  font-weight: 600;
}
.metric-card span {
  font-size: 13px;
  line-height: 1.4;
}
.metric-card small {
  font-size: 12px;
  line-height: 1.4;
  font-weight: 400;
  color: var(--muted);
}
.metric-scope {
  border-left: 3px solid #ff7844;
  background: #fff4ec;
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.7;
}
.notification-row {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.notification-row > div {
  min-width: 0;
}
.notification-row p {
  margin: 6px 0;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.presence-notice {
  font-size: 13px;
  background: #fff4da;
  border: 1px solid #e9d7a7;
  padding: 10px 12px;
  border-radius: 6px;
}
.message-actions {
  white-space: normal;
  margin-top: 10px;
  border-top: 1px solid #cdd9eb;
  padding-top: 8px;
}
.message-actions summary,
.simulation-options summary {
  cursor: pointer;
  font-size: 13px;
}
.message-actions textarea {
  min-height: 70px;
}
.message-actions .check-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.5;
  font-size: 12px;
}
.message-actions .check-line input {
  width: 16px;
  flex: 0 0 16px;
  margin-top: 2px;
}
.simulation-options {
  margin-top: 12px;
}
@media (max-width: 1100px) {
  .metric-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .metric-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 600px) {
  .metric-cards,
  .metric-filters {
    grid-template-columns: minmax(0, 1fr);
  }
  .notification-row {
    align-items: flex-start;
    flex-direction: column;
  }
  .metric-card strong {
    font-size: 22px;
  }
}

.resource-files {
  margin-top: 20px;
}
.resource-files input[type="file"] {
  max-width: 100%;
  padding: 9px;
  background: #fff;
}
.file-version {
  border: 1px solid var(--line, #d9dee5);
  border-radius: 8px;
  padding: 14px;
  margin: 12px 0;
  overflow-wrap: anywhere;
}
.file-version strong,
.file-version small {
  display: block;
}
.file-version small {
  margin-top: 5px;
}
.file-version code {
  overflow-wrap: anywhere;
  font-size: 12px;
}
.file-link {
  display: inline-block;
  color: #174e78;
  text-decoration: underline;
  padding: 7px 0;
  font-weight: 600;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 0 20px;
  margin-bottom: 16px;
  align-items: start;
}
.form-grid > label {
  min-width: 0;
}
.form-grid textarea {
  min-height: 105px;
}

.marketing-lab h3 {
  margin-top: 1.5rem;
}

/* Editor conjunto de pipelines */
.pipeline-cards {
  display: grid;
  gap: 16px;
}
.pipeline-card {
  border: 1px solid #dce1e7;
  border-radius: 10px;
  padding: 16px;
}
.pipeline-card h3 {
  margin: 0 0 4px;
}
.pipeline-stage-summary {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 14px 0 0;
  padding: 0;
}
.pipeline-stage-summary li {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
}
.stage-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid #0002;
}
.pipeline-dialog {
  width: min(900px, calc(100vw - 32px));
  max-width: 900px;
  height: min(820px, calc(100dvh - 32px));
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  border: 1px solid #dce1e7;
  border-radius: 14px;
  box-shadow: 0 24px 80px #08162e40;
  color: #172b43;
  background: white;
}
.pipeline-dialog[open] {
  display: flex;
  flex-direction: column;
}
.pipeline-dialog::backdrop {
  background: #07152c80;
}
.pipeline-dialog-header,
.pipeline-dialog-footer {
  display: flex;
  gap: 16px;
  padding: 18px 22px;
  align-items: center;
  flex-shrink: 0;
}
.pipeline-dialog-header {
  justify-content: space-between;
  border-bottom: 1px solid #e1e5eb;
}
.pipeline-dialog-header h2 {
  font-size: 19px;
  margin: 0;
}
.pipeline-dialog-header p {
  margin: 4px 0 0;
  font-size: 13px;
}
.pipeline-dialog-body {
  padding: 20px 22px;
  overflow: auto;
  min-height: 0;
  overscroll-behavior: contain;
}
.pipeline-dialog-footer {
  justify-content: flex-end;
  border-top: 1px solid #e1e5eb;
  background: #f7f9fb;
}
.pipeline-fields {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}
.pipeline-fields > .section-title {
  margin-top: 22px;
}
.pipeline-stage-list {
  padding: 0;
  margin: 14px 0;
  list-style: none;
  display: grid;
  gap: 10px;
}
.pipeline-stage {
  border: 1px solid #dce1e7;
  border-left: 5px solid;
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  min-width: 0;
}
.pipeline-stage.is-dragging {
  box-shadow: 0 4px 14px #1234;
  background: #f1f5fb;
}
.pipeline-stage-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.pipeline-stage-main input.stage-name {
  flex: 1;
  min-width: 70px;
  width: 0;
}
.pipeline-stage-main .stage-drag {
  cursor: grab;
  touch-action: none;
  font-size: 24px;
  padding: 2px 5px;
  min-width: 28px;
  border: 0;
  background: transparent;
  color: #637080;
  user-select: none;
}
.pipeline-stage-main .stage-drag:active {
  cursor: grabbing;
}
.stage-position {
  font-size: 12px;
  color: #637080;
  width: 16px;
  text-align: center;
  flex-shrink: 0;
}
.stage-color {
  margin: 0;
  flex-shrink: 0;
}
.stage-color input[type="color"] {
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 3px;
  cursor: pointer;
}
.stage-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.stage-actions button {
  padding: 6px 9px;
}
.stage-options {
  margin: 12px 0 0 50px;
  font-size: 12px;
}
.stage-options summary {
  cursor: pointer;
  color: #43576f;
}
.stage-options .checks {
  margin: 8px 0;
}
.stage-palette {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}
.stage-palette .stage-swatch {
  flex: 0 0 28px;
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  aspect-ratio: 1;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
}
.stage-swatch[aria-pressed="true"] {
  outline: 2px solid #102841;
  outline-offset: 2px;
}
.pipeline-removals,
.pipeline-review {
  border: 1px solid #e7d8c7;
  background: #fff9f2;
  border-radius: 8px;
  padding: 14px;
  margin-top: 18px;
}
.pipeline-removals p,
.pipeline-review p {
  font-size: 13px;
}
.pipeline-removal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 12px 0;
  border-top: 1px solid #e3e6ec;
}
.pipeline-removal label {
  flex-basis: 100%;
}
.pipeline-removal > span {
  font-size: 12px;
}
.pipeline-archived {
  margin-top: 18px;
}
.pipeline-error {
  color: #8b2434;
  background: #fff1f2;
  padding: 12px;
  border-radius: 6px;
}
@media (max-width: 600px) {
  .pipeline-dialog {
    width: calc(100vw - 12px);
    height: calc(100dvh - 12px);
    max-height: calc(100dvh - 12px);
  }
  .pipeline-dialog-header,
  .pipeline-dialog-footer {
    padding: 12px;
    gap: 8px;
  }
  .pipeline-dialog-body {
    padding: 12px;
  }
  .pipeline-stage-main {
    flex-wrap: wrap;
    gap: 6px;
  }
  .stage-actions {
    width: 100%;
    justify-content: flex-end;
  }
  .stage-options {
    margin-left: 0;
  }
  .pipeline-card .section-title {
    flex-wrap: wrap;
  }
  .pipeline-dialog-header h2 {
    font-size: 18px;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.pipeline-dialog {
  overflow: hidden;
}
.pipeline-fields h3 small {
  display: inline;
  font-size: 12px;
  margin-left: 4px;
}

/* Rediseño compacto: navegación, tablero y tablas. */
.sidebar .brand img {
  width: 116px;
}
.sidebar .brand span {
  font-size: 9px;
  padding-left: 7px;
}
.sidebar-collapse {
  display: flex;
  justify-content: flex-start;
  width: 100%;
  margin-top: 14px;
  background: transparent;
  color: #cbd6e7;
  border-color: #293850;
  min-height: 32px;
  padding: 5px 10px;
  font-size: 12px;
}
.sidebar-collapse:hover:not(:disabled) {
  color: white;
  background: #17253f;
  border-color: #40516e;
}
.nav-separator {
  height: 1px;
  margin: 10px 10px;
  background: #34445e;
}
.shell.nav-collapsed {
  --sidebar-width: 64px;
}
.nav-collapsed .sidebar {
  padding-inline: 7px;
}
.nav-collapsed .sidebar .brand {
  justify-content: center;
  padding: 0;
}
.nav-collapsed .sidebar .brand img {
  width: 42px;
  height: 28px;
  object-fit: cover;
  object-position: left center;
}
.nav-collapsed .sidebar .brand span,
.nav-collapsed .sidebar .nav-label,
.nav-collapsed .sidebar .profile > div:not(.avatar) {
  display: none;
}
.nav-collapsed .sidebar-collapse,
.nav-collapsed .sidebar nav button {
  justify-content: center;
  padding-inline: 4px;
}
.nav-collapsed .sidebar nav button {
  position: relative;
}
.nav-collapsed .sidebar nav small {
  position: absolute;
  top: 1px;
  right: 0;
  min-width: 14px;
  padding: 0 2px;
  font-size: 9px;
}
.nav-collapsed .sidebar .profile {
  flex-wrap: wrap;
  justify-content: center;
}
.nav-collapsed .sidebar .profile button {
  margin: 0;
}
.nav-collapsed .nav-separator {
  margin-inline: 7px;
}
/* El contenido extenso se desplaza por etapa, no en toda la página. */
.kanban {
  align-items: stretch;
}
.column {
  height: clamp(420px, calc(100dvh - 205px), 800px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding: 8px;
}
.column-title {
  position: sticky;
  top: -8px;
  z-index: 1;
  padding: 7px 3px 9px;
  background: #edf0f5;
}
.column-title h3 {
  font-size: 13px;
}
.op-card {
  padding: 0;
  margin: 5px 0;
  border-top-width: 1px;
}
.op-summary {
  width: 100%;
  min-height: 63px;
  padding: 8px 9px;
  border: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  white-space: normal;
  text-align: left;
  background: transparent;
}
.op-summary:hover:not(:disabled) {
  background: #fff3ed;
  border: 0;
}
.op-summary-text {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.op-summary-text b,
.op-summary-text span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.op-summary-text b {
  color: var(--text);
  font-size: 13px;
}
.op-summary-text span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}
.op-chevron {
  flex: none;
  color: var(--brand-blue);
  font-size: 17px;
}
.op-detail {
  padding: 7px 9px 9px;
  border-top: 1px solid var(--border);
}
.op-detail p {
  margin: 2px 0;
  font-size: 12px;
}
.op-links {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
}
.op-links button {
  min-height: 30px;
  padding: 4px 7px;
  font-size: 12px;
}

/* Variantes de densidad para listados. */
th {
  padding: 9px 11px;
}
td {
  padding: 6px 11px;
}
td button {
  min-height: 30px;
  padding: 4px 7px;
  margin: 0;
}
td small {
  display: block;
  margin-top: 2px;
}
.row-action-icons {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 5px;
  white-space: nowrap;
}
td .row-action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  min-height: 30px;
  margin: 0;
  padding: 0;
  border-radius: 6px;
}
.row-action-icon svg {
  display: block;
}
.row-action-edit {
  color: #183969;
  border-color: #b9cbe2;
  background: #eef3f9;
}
.row-action-archive,
.row-action-deactivate {
  color: #8a5700;
  border-color: #e6d3a5;
  background: #fff7e4;
}
.row-action-restore {
  color: #166c54;
  border-color: #b5d8cb;
  background: #eaf7f1;
}
.row-action-delete {
  color: #a3333b;
  border-color: #e9c0c4;
  background: #fff0f1;
}
.row-action-icon:hover:not(:disabled) {
  filter: brightness(0.94);
}
.row-action-icon:focus-visible {
  outline: 2px solid var(--brand-blue);
  outline-offset: 2px;
}

@media (max-width: 760px) {
  .sidebar-collapse {
    display: none;
  }
  .shell.nav-collapsed {
    --sidebar-width: 224px;
  }
  .nav-collapsed .sidebar {
    padding: 14px 16px;
  }
  .nav-collapsed .sidebar .brand img {
    width: 116px;
    height: auto;
    object-fit: contain;
  }
  .nav-collapsed .sidebar .brand span,
  .nav-collapsed .sidebar .nav-label,
  .nav-collapsed .sidebar .profile > div:not(.avatar) {
    display: initial;
  }
  .nav-collapsed .sidebar nav button {
    justify-content: flex-start;
  }
  .nav-collapsed .sidebar nav small {
    position: static;
  }
  .column {
    height: min(68dvh, 650px);
  }
}

/* Bandeja: el historial y la respuesta ocupan el espacio principal. */
.inbox-filter-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 8px;
}
.inbox-filter-bar input {
  max-width: 330px;
  min-height: 34px;
  padding: 6px 9px;
}
.inbox-filter-bar button {
  min-height: 34px;
  padding: 6px 9px;
}
.inbox-filters {
  padding: 10px 12px;
  gap: 7px 10px;
  margin-bottom: 8px;
}
.inbox-filters label {
  margin: 0;
  font-size: 12px;
}
.inbox-filters label select,
.inbox-filters label input {
  margin-top: 3px;
  min-height: 34px;
  padding: 5px 8px;
}
.inbox-filters > .actions {
  margin-top: 3px;
}
.inbox-filters > .actions button {
  min-height: 30px;
}
.inbox {
  height: clamp(440px, calc(100dvh - 239px), 900px);
  min-height: 0;
  grid-template-columns: 260px minmax(0, 1fr);
  overflow: visible;
}
.conversation-list {
  max-height: none;
  height: 100%;
  min-height: 0;
}
.conversation-list > .conversation-row > button.conversation-item {
  display: block;
  min-height: 60px;
  padding: 8px 9px;
  border-left: 3px solid #8793a3;
  overflow: hidden;
}
.conversation-item.channel-border-whatsapp {
  border-left-color: #24845c !important;
}
.conversation-item.channel-border-instagram {
  border-left-color: #9c4d83 !important;
}
.conversation-item.channel-border-messenger {
  border-left-color: #3975ce !important;
}
.conversation-item.selected {
  box-shadow: none !important;
  background: #fff0e9;
}
.conversation-row {
  position: relative;
}
.conversation-row:has(.conversation-contact-action) .conversation-bottom {
  padding-right: 83px;
}
.conversation-contact-action {
  position: absolute;
  right: 7px;
  bottom: 7px;
  z-index: 1;
  min-height: 25px;
  padding: 3px 5px;
  border-color: #aebed0;
  background: #fff;
  color: var(--brand-navy);
  font-size: 10px;
  line-height: 1.2;
}
.conversation-contact-action:hover {
  background: #eaf1f8;
}
.conversation-top,
.conversation-bottom {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 5px;
}
.conversation-top b {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
.conversation-top time {
  flex: none;
  font-size: 10px;
  color: #657388;
  font-weight: 400;
}
.conversation-bottom {
  margin-left: 23px;
  margin-top: 3px;
}
.conversation-bottom .message-preview {
  display: block;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
}
.channel-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex: none;
}
.channel-icon svg {
  width: 16px;
  height: 16px;
}
.channel-whatsapp {
  color: #1d7651;
}
.channel-instagram {
  color: #914278;
}
.channel-messenger {
  color: #2865bb;
}
.unread-count {
  display: inline-grid;
  place-items: center;
  min-width: 17px;
  min-height: 17px;
  padding: 0 3px;
  border-radius: 9px;
  background: var(--brand-blue);
  color: white !important;
  font-size: 10px !important;
}
.priority-mark {
  color: #b34725 !important;
  font-weight: 700 !important;
}
.conversation-item.has-unread .conversation-top b {
  font-weight: 700;
}
.chat {
  min-height: 0;
  height: 100%;
}
.chat-header {
  align-items: center;
  padding: 8px 12px;
  gap: 8px;
}
.chat-header h2 {
  margin: 0;
  font-size: 15px;
}
.chat-header select {
  min-height: 32px;
  padding: 4px 7px;
  font-size: 12px;
}
.chat-channel {
  display: flex;
  align-items: center;
  gap: 3px;
  text-transform: capitalize;
  color: var(--muted);
  font-size: 11px;
}
.chat-details {
  margin: 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.chat-details > summary {
  padding: 6px 12px;
  color: var(--brand-blue);
  font-weight: 600;
}
.chat-details[open] > summary {
  margin-bottom: 0;
}
.chat-details .conversation-context {
  padding: 7px 12px;
  gap: 7px;
}
.chat-details .attention-hint {
  padding: 7px 12px;
}
.chat-details .attention-options {
  padding: 0 12px 8px;
}
.chat-details label {
  margin: 4px 0;
}
.message-pagination {
  padding: 4px 12px;
  min-height: 30px;
}
.message-pagination button {
  min-height: 26px;
  padding: 2px 7px;
  font-size: 11px;
}
.messages {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  gap: 7px;
  padding: 10px 14px;
}
.bubble {
  max-width: 76%;
  padding: 7px 10px;
  border-radius: 9px;
}
.bubble p {
  margin: 2px 0;
  font-size: 13px;
  line-height: 1.4;
}
.bubble-author {
  display: block;
  color: var(--brand-blue);
  font-weight: 700;
  font-size: 11px;
}
.bubble-meta {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  align-items: center;
  color: #68768a;
  font-size: 10px;
}
.message-status {
  font-size: 11px;
  font-weight: 700;
  color: #355875;
}
.message-status.status-failed,
.message-status.status-uncertain {
  color: #9c3b21;
}
.timeline-note {
  align-self: center;
  max-width: 86%;
  min-width: 0;
  padding: 6px 9px;
  border-radius: 6px;
  background: #fff8e8;
  border: 1px solid #e9d9b1;
  color: #594b2f;
  font-size: 11px;
}
.timeline-note div {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.timeline-note time {
  margin-left: auto;
}
.timeline-note p {
  margin: 2px 0;
  font-size: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.timeline-note .text-button {
  font-size: 11px;
}
.composer {
  flex: none;
  padding: 8px 12px 10px;
}
.composer textarea {
  min-height: 48px;
  max-height: 140px;
  margin: 0 0 6px;
  padding: 7px 9px;
  font-size: 13px;
}
.composer .actions {
  align-items: center;
  justify-content: space-between;
  gap: 7px;
}
.composer .actions button {
  min-height: 32px;
  padding: 5px 10px;
}
.composer .actions small {
  color: var(--muted);
  font-size: 11px;
}
.note-mode-label {
  color: #725a21;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 4px;
}
.composer-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 7px;
}
.composer-tools > button,
.composer-tools > details > summary {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  color: var(--brand-blue);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.composer-tools > details {
  margin: 0;
  position: relative;
}
.composer-tools > details[open] > summary {
  margin-bottom: 0;
}
.composer-tools > details > summary {
  list-style: none;
}
.composer-tools > details > summary::-webkit-details-marker {
  display: none;
}
.composer-tools svg {
  width: 17px;
  height: 17px;
}
.note-toggle.active {
  background: #fff4da;
  border-color: #d6b969;
}
.resource-menu {
  position: absolute;
  bottom: calc(100% + 5px);
  left: 0;
  z-index: 4;
  width: min(290px, 82vw);
  padding: 8px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 30px #000c2a22;
}
.resource-menu input {
  min-height: 32px;
  padding: 5px 8px;
}
.resource-menu-list {
  max-height: 190px;
  overflow-y: auto;
  margin-top: 5px;
  display: grid;
  gap: 2px;
}
.resource-menu-list button {
  white-space: normal;
  text-align: left;
  justify-content: flex-start;
  min-height: 30px;
  padding: 4px 7px;
}
.composer-options[open] {
  padding: 0 8px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
}
.composer-options[open] > summary {
  margin-inline: -8px;
  border: 0;
  border-bottom: 1px solid var(--border);
}
.composer-options label {
  margin: 5px 0 0;
  font-size: 11px;
}
.composer-options select,
.composer-options input {
  min-height: 32px;
  padding: 5px 7px;
  margin-top: 3px;
}
.mobile-list-back {
  display: none;
}
@media (max-width: 960px) {
  .inbox {
    height: auto;
    display: block;
  }
  .conversation-list {
    height: 180px;
    max-height: 180px;
  }
  .chat {
    height: min(68dvh, 670px);
    min-height: 420px;
  }
  .mobile-list-back {
    display: inline-flex;
    min-height: 28px;
    padding: 4px 7px;
    font-size: 11px;
  }
}
@media (max-width: 520px) {
  .inbox-filter-bar {
    flex-wrap: wrap;
  }
  .inbox-filter-bar input {
    flex: 1 1 100%;
    max-width: none;
  }
  .chat-header {
    padding: 7px 9px;
  }
  .chat-header > div {
    flex-basis: 170px;
  }
  .messages {
    padding: 9px;
  }
  .bubble {
    max-width: 92%;
  }
  .composer {
    padding: 8px;
  }
}

/* Fichas y edición centradas; el contenido largo se desplaza dentro del modal. */
.app-dialog {
  width: min(700px, calc(100vw - 32px));
  max-width: 700px;
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  border: 1px solid #dce1e7;
  border-radius: 12px;
  background: white;
  color: var(--text);
  box-shadow: 0 24px 70px #08162e45;
  overflow: hidden;
}
.app-dialog[open] {
  display: flex;
  flex-direction: column;
}
.app-dialog::backdrop {
  background: #07152c80;
}
.app-dialog .drawer {
  width: 100%;
  max-width: none;
  max-height: calc(100dvh - 32px);
  min-height: 0;
  padding: 18px 22px;
  overflow-y: auto;
  box-shadow: none;
}
.app-dialog .drawer h2 {
  font-size: 19px;
  margin-bottom: 10px;
}
.app-dialog .drawer h3 {
  margin-top: 15px;
}
.app-dialog .drawer label {
  margin: 10px 0 6px;
}
.app-dialog .drawer input,
.app-dialog .drawer select {
  min-height: 34px;
  padding: 6px 9px;
}
.app-dialog .drawer textarea {
  min-height: 70px;
  padding: 7px 9px;
}
.app-dialog .drawer .form-actions {
  position: sticky;
  bottom: -18px;
  z-index: 2;
  margin-top: 14px;
  padding: 10px 0;
  background: white;
}
.app-dialog .drawer .form-actions button {
  min-height: 34px;
}
@media (max-width: 760px) {
  .app-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
  }
  .app-dialog .drawer {
    max-height: calc(100dvh - 16px);
    padding: 14px;
  }
}
.editor-stage-change {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 0;
  margin-top: 10px;
  border-top: 1px solid var(--border);
}
.editor-stage-change label {
  flex: 1 1 210px;
  margin: 0 !important;
}
.editor-stage-change button {
  min-height: 34px;
}

.op-summary-text .op-exception {
  display: inline-block;
  width: fit-content;
  padding: 1px 5px;
  margin-top: 2px;
  border-radius: 4px;
  background: #edf1f6;
  color: #233e60;
  font-size: 11px;
  font-weight: 700;
}
.chat-details[open] {
  max-height: min(45dvh, 320px);
  overflow-y: auto;
}

/* Flujo diario y controles progresivos */
.global-search-trigger {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  margin: 14px 0 9px;
  padding: 6px 10px;
  border-color: #40516e;
  color: #edf2fa;
  background: #17253f;
  text-align: left;
}
.global-search-trigger > span:first-child {
  font-size: 22px;
  line-height: 16px;
}
.global-search-trigger .nav-label {
  flex: 1;
}
.global-search-trigger kbd {
  flex: none;
  padding: 1px 4px;
  border: 1px solid #52627c;
  border-radius: 3px;
  color: #bdcce0;
  font-size: 10px;
}
.nav-collapsed .global-search-trigger {
  justify-content: center;
  padding: 5px;
}
.quick-views {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 5px 0 8px;
}
.quick-views button {
  min-height: 29px;
  padding: 4px 9px;
  border-color: #cbd5e1;
  color: #354961;
  background: #fff;
  font-size: 11px;
}
.quick-views button.active,
.quick-views button[aria-pressed="true"] {
  border-color: #183969;
  color: #fff;
  background: #183969;
}
.active-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: -2px 0 7px;
}
.active-filter-chips button {
  min-height: 25px;
  padding: 3px 7px;
  border-color: #c7d2e1;
  border-radius: 5px;
  color: #244466;
  background: #eef3f9;
  font-size: 10px;
}
.app-dialog label[hidden] {
  display: none !important;
}
.advanced-toggle {
  align-self: flex-start;
  margin-top: 7px;
  min-height: 30px;
  font-size: 12px;
}
.related-record,
.global-search-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  margin: 3px 0;
  padding: 8px 10px;
  border: 1px solid #d8e1ec;
  border-radius: 6px;
  color: #15365f;
  background: #f8fafd;
  text-align: left;
  font-size: 12px;
}
.related-record:hover:not(:disabled),
.global-search-result:hover:not(:disabled) {
  background: #edf3fa;
}
.related-record small,
.global-search-result small {
  display: block;
  margin-top: 2px;
  color: #627188;
}
.chat-contact-link {
  min-height: 27px;
  padding: 4px 7px;
  font-size: 11px;
}
.global-search-dialog {
  padding-top: 12px !important;
}
.global-search-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.global-search-dialog input[type="search"] {
  width: 100%;
  margin: 7px 0 10px;
}
.global-search-results {
  max-height: min(52dvh, 430px);
  overflow-y: auto;
}
.global-search-results > p {
  font-size: 12px;
}
@media (max-width: 760px) {
}

/* Filtros comerciales: disparador en la barra y opciones bajo demanda. */
.commercial-toolbar {
  position: relative;
  margin-bottom: 10px;
}
.opportunity-toolbar {
  margin-bottom: 18px;
}
.opportunity-toolbar .pipeline-picker {
  flex: 0 1 300px;
  min-width: 225px;
  min-height: 40px;
  padding: 4px 6px 4px 10px;
  border: 1px solid #b8c6d8;
  border-left: 4px solid var(--brand-orange);
  border-radius: 7px;
  background: #eef3f9;
  gap: 9px;
}
.pipeline-picker > span {
  flex: none;
  color: var(--brand-navy);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.opportunity-toolbar .pipeline-picker select {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  min-height: 30px;
  margin: 0;
  padding: 4px 7px;
  border-color: #aebed1;
  color: var(--brand-navy);
  font-size: 12px;
  font-weight: 700;
}
.filter-quick-views {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 12px;
  padding-bottom: 11px;
  border-bottom: 1px solid #e0e6ee;
}
.filter-quick-views > span {
  color: #53667d;
  font-size: 11px;
  font-weight: 600;
}
.filter-quick-views .quick-views {
  margin: 0;
}
@media (max-width: 600px) {
  .opportunity-toolbar .pipeline-picker {
    flex: 1 1 100%;
  }
  .opportunity-toolbar > input {
    max-width: none;
  }
}
.filter-builder-popover {
  flex: 0 0 auto;
  width: auto;
  max-width: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.filter-builder-popover > summary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid #cbd4df;
  border-radius: 6px;
  background: white;
  color: #244466;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  list-style: none;
}
.filter-builder-popover > summary::-webkit-details-marker {
  display: none;
}
.filter-active-view {
  padding: 2px 6px;
  border-radius: 9px;
  background: #e8eef6;
  color: var(--brand-navy);
  font-size: 10px;
  font-weight: 700;
}
.filter-builder-popover > summary::after {
  content: "⌄";
  font-size: 14px;
  line-height: 1;
}
.filter-builder-popover[open] > summary {
  margin-bottom: 0;
  border-color: #183969;
  background: #eef3f9;
}
.filter-builder-popover[open] > summary::after {
  content: "⌃";
}
.filter-builder-popover > summary:hover {
  background: #edf1f6;
}
.filter-builder-popover > summary:focus-visible {
  outline: 2px solid var(--brand-blue);
  outline-offset: 2px;
}
.filter-builder-popover .filter-builder-content {
  position: absolute;
  z-index: 25;
  top: calc(100% + 6px);
  right: 0;
  width: min(720px, 100%);
  max-height: min(65dvh, 520px);
  overflow-y: auto;
  padding: 14px;
  border: 1px solid #cbd4df;
  border-radius: 8px;
  background: white;
  box-shadow: 0 12px 30px #08162e2b;
}
.filter-builder-content .filter-combine {
  display: flex;
  align-items: center;
  gap: 9px;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 11px;
  font-size: 12px;
  white-space: nowrap;
}
.filter-builder-content .filter-combine select {
  width: 150px;
  min-height: 32px;
  margin: 0;
  padding: 5px 7px;
}
.filter-builder-content .toolbar {
  gap: 6px;
  margin: 0 0 9px;
  padding-bottom: 9px;
}
.filter-builder-content .toolbar > input,
.filter-builder-content .toolbar > select {
  flex: 1 1 135px;
  min-height: 33px;
  max-width: none;
  padding: 5px 7px;
}
.filter-builder-content .toolbar > button,
.filter-builder-content .actions > button {
  min-height: 32px;
  padding: 5px 8px;
  font-size: 11px;
}
.filter-builder-content .actions {
  gap: 6px;
}
@media (max-width: 520px) {
  .filter-builder-popover .filter-builder-content {
    padding: 10px;
  }
  .filter-builder-content .filter-combine {
    flex-wrap: wrap;
    white-space: normal;
  }
}

/* Bandeja: controles en una barra y conversación con prioridad de altura. */
.inbox-controls {
  position: relative;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 8px;
}
.inbox-controls .quick-views {
  flex: 0 0 auto;
  margin: 0;
}
.inbox-controls .inbox-filter-bar {
  flex: 1 1 320px;
  min-width: 0;
  justify-content: flex-end;
  margin: 0;
}
.inbox-controls .inbox-filter-bar input {
  flex: 1 1 180px;
  width: auto;
  max-width: 340px;
}
.inbox-controls .inbox-filter-bar button {
  min-height: 32px;
  padding: 5px 8px;
  font-size: 11px;
}
.inbox-controls .inbox-sim-trigger {
  color: #244466;
  background: #f8fafd;
}
.inbox-controls .active-filter-chips {
  flex: 1 1 100%;
  margin: 0;
}
.inbox-controls .inbox-filters {
  position: absolute;
  z-index: 25;
  top: calc(100% + 5px);
  right: 0;
  width: min(760px, 100%);
  max-height: min(65dvh, 520px);
  overflow-y: auto;
  margin: 0;
  border-color: #cbd4df;
  box-shadow: 0 12px 30px #08162e2b;
}
.inbox {
  height: clamp(620px, calc(100dvh - 80px), 1200px);
}
.chat {
  scroll-margin-top: 12px;
}
.composer textarea {
  min-height: 50px;
}
@media (max-width: 960px) {
  .inbox {
    height: auto;
  }
  .chat {
    height: clamp(620px, calc(100dvh - 80px), 900px);
    min-height: 0;
  }
}
@media (max-width: 760px) {
  .inbox-controls .quick-views,
  .inbox-controls .inbox-filter-bar {
    flex: 1 1 100%;
  }
  .inbox-controls .inbox-filter-bar {
    flex-wrap: nowrap;
    justify-content: flex-start;
  }
  .inbox-controls .inbox-filter-bar input {
    flex: 1 1 100px;
    min-width: 0;
    max-width: none;
  }
}

/* Bandeja: el hilo usa el alto visible y las opciones quedan bajo demanda. */
.inbox-body main {
  padding-bottom: 12px;
}
.inbox-body .inbox {
  height: max(460px, calc(100dvh - 88px));
}
.inbox-body .chat-header {
  position: relative;
  z-index: 3;
  flex-wrap: nowrap;
  min-height: 44px;
  padding: 6px 10px;
  gap: 7px;
}
.inbox-body .chat-header > .chat-identity {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.inbox-body .chat-header h2 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inbox-body .chat-channel {
  flex: none;
  min-width: 0;
  white-space: nowrap;
}
.inbox-body .chat-contact-link,
.inbox-body .chat-header select {
  flex: none;
  margin: 0;
}
.inbox-body .chat-header select {
  width: 112px;
  min-height: 30px;
}
.inbox-body .chat-details {
  position: relative;
  flex: none;
  margin: 0;
  border: 0;
}
.inbox-body .chat-details > summary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 4px 7px;
  border: 1px solid #cbd4df;
  border-radius: 6px;
  background: white;
  color: var(--brand-blue);
  white-space: nowrap;
  list-style: none;
  cursor: pointer;
}
.inbox-body .chat-details > summary::-webkit-details-marker {
  display: none;
}
.inbox-body .chat-details > summary::after {
  content: "▾";
  color: var(--muted);
}
.inbox-body .chat-details[open] > summary::after {
  content: "▴";
}
.inbox-body .chat-details[open] {
  max-height: none;
  overflow: visible;
}
.chat-priority-mark {
  display: inline-grid;
  place-items: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff0e9;
  color: #a5401c;
  font-size: 10px;
  font-weight: 700;
}
.inbox-body .chat-details-panel {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  z-index: 10;
  width: min(430px, calc(100vw - 40px));
  max-height: min(65dvh, 580px);
  overflow-y: auto;
  border: 1px solid #cbd4df;
  border-radius: 8px;
  background: white;
  box-shadow: 0 12px 30px #08162e2b;
}
.inbox-body .chat-details .conversation-context {
  padding: 10px 12px;
}
.inbox-body .chat-details .attention-hint {
  margin: 0;
}
.chat-contact-menu {
  display: none;
}
.chat-status-menu {
  display: none;
}
.inbox-body .messages > .message-pagination {
  position: sticky;
  top: 0;
  z-index: 1;
  align-self: center;
  width: fit-content;
  max-width: 100%;
  min-height: 0;
  padding: 3px 5px;
  border: 1px solid #d7dfe9;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 2px 8px #08162e12;
}
.inbox-body .messages > .message-pagination small {
  font-size: 10px;
  color: var(--muted);
}
.inbox-body .composer {
  display: flex;
  flex-wrap: wrap;
  column-gap: 8px;
  align-items: center;
}
.inbox-body .composer > textarea,
.inbox-body .composer > .presence-notice,
.inbox-body .composer > .note-mode-label,
.inbox-body .composer > .alert,
.inbox-body .composer > p[role="status"] {
  flex: 1 1 100%;
}
.inbox-body .composer-tools {
  flex: 1 1 310px;
  min-width: 0;
  margin: 0;
}
.inbox-body .composer > .actions {
  flex: 0 0 auto;
  flex-wrap: nowrap;
  gap: 6px;
}
.inbox-body .composer > .actions small {
  white-space: nowrap;
}
@media (max-width: 1180px) {
  .inbox-body .inbox {
    height: max(460px, calc(100dvh - 80px));
  }
}
@media (max-width: 960px) {
  .inbox-body .inbox {
    height: auto;
    min-height: 0;
  }
  .inbox-body .chat {
    height: max(420px, calc(100dvh - 20px));
  }
}
@media (max-width: 760px) {
  .inbox-body .composer {
    display: block;
  }
  .inbox-body .composer-tools {
    margin-bottom: 6px;
  }
}
@media (max-width: 600px) {
  .inbox-body .mobile-list-back {
    gap: 0;
    min-width: 28px;
    justify-content: center;
  }
  .inbox-body .mobile-back-label,
  .inbox-body .chat-channel-label,
  .inbox-body .chat-contact-link {
    display: none;
  }
  .inbox-body .chat-header > select {
    display: none;
  }
  .inbox-body .chat-status-menu {
    display: block;
    margin: 10px 12px 0;
    font-size: 11px;
  }
  .inbox-body .chat-status-menu select {
    display: block;
    width: 100%;
    min-height: 32px;
    margin-top: 3px;
  }
  .inbox-body .chat-contact-menu {
    display: inline-flex;
    min-height: 30px;
    margin: 8px 12px 0;
    padding: 4px 8px;
    font-size: 11px;
  }
  .inbox-body .chat-header select {
    width: 92px;
  }
  .inbox-body .chat-header > .chat-identity {
    flex-basis: 80px;
  }
}

@media (max-width: 600px) {
  .panel.agenda-panel,
  .panel.agenda-reminders {
    padding: 0;
  }
}

/* Dense list surfaces: the records start immediately under one control row. */
.catalog-toolbar,
.commercial-toolbar {
  position: relative;
  gap: 8px;
  margin-bottom: 10px;
}
.catalog-toolbar > input,
.commercial-toolbar > input,
.settings-toolbar > input {
  flex: 1 1 240px;
  max-width: 370px;
  min-height: 36px;
  padding: 7px 10px;
  border-left: 3px solid var(--brand-blue);
  background: #f7faff;
}
.catalog-toolbar > label,
.commercial-toolbar > label {
  color: #526276;
  font-size: 12px;
}
.catalog-toolbar .filter-builder-popover > summary,
.commercial-toolbar .filter-builder-popover > summary {
  min-height: 36px;
  background: #f3f6fa;
}
.pagination-bar {
  gap: 6px;
  margin: 6px 0 12px;
  color: #637084;
  font-size: 11px;
}
.pagination-bar button {
  min-height: 28px;
  padding: 4px 7px;
  font-size: 11px;
}
.table-panel th {
  padding: 9px 12px;
  border-bottom: 1px solid #d6e0eb;
  background: #eef3f8;
  color: #334d6c;
}
.table-panel td {
  padding: 8px 12px;
  line-height: 1.35;
}
.table-panel tbody tr:hover {
  background: #f7faff;
}
.table-panel td small {
  margin-top: 2px;
  font-size: 11px;
}
.settings-toolbar {
  margin-bottom: 12px;
}
.settings-toolbar > input {
  max-width: 300px;
}
.pipeline-cards {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.pipeline-card {
  padding: 12px;
  border-left: 3px solid var(--brand-blue);
  background: #fcfdff;
}
.pipeline-card:nth-child(even) {
  border-left-color: var(--brand-orange);
}
.pipeline-card .section-title {
  align-items: flex-start;
  margin-bottom: 0;
}
.pipeline-stage-summary {
  gap: 6px;
  margin-top: 10px;
}
.pipeline-stage-summary li {
  min-height: 24px;
  padding: 3px 7px;
  border: 1px solid #e1e7ee;
  border-radius: 5px;
  background: white;
  font-size: 11px;
}
.sessions-panel {
  padding: 0;
}
.sessions-panel > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  color: var(--brand-navy);
  font-size: 13px;
  font-weight: 600;
  list-style: none;
}
.sessions-panel > summary::-webkit-details-marker {
  display: none;
}
.sessions-panel > summary::after {
  content: "⌄";
  font-size: 16px;
}
.sessions-panel[open] > summary::after {
  content: "⌃";
}
.sessions-panel > summary small {
  margin-left: auto;
  font-size: 11px;
  font-weight: 400;
}
.sessions-content {
  padding: 0 14px 14px;
  border-top: 1px solid var(--border);
}
.sessions-content ul {
  margin: 9px 0;
  padding-left: 20px;
  font-size: 12px;
}
.sessions-content li {
  margin: 3px 0;
}
.sessions-content button {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 11px;
}
.bot-settings {
  padding: 0;
  background: #f7faff;
  border-left: 3px solid var(--brand-blue);
}
.bot-settings > summary,
.bot-preview-details > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  color: var(--brand-navy);
  font-size: 12px;
  font-weight: 600;
}
.bot-settings > summary small {
  margin-left: auto;
  font-size: 11px;
  font-weight: 400;
}
.bot-settings-content {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  padding: 0 12px 12px;
  border-top: 1px solid #dce5f0;
}
.bot-settings-content > label {
  margin: 7px 0 0;
}
.bot-settings-content > fieldset,
.bot-settings-content > .form-grid,
.bot-settings-content > label:last-child {
  grid-column: 1 / -1;
}
.bot-step {
  padding: 12px;
  margin: 10px 0;
  border-left: 3px solid var(--brand-orange);
  background: #fffdfa;
}
.bot-step > label:first-child {
  max-width: 260px;
  margin-top: 0;
}
.bot-step textarea {
  min-height: 70px;
}
.bot-library > h2 {
  margin-bottom: 12px;
}
.bot-preview-details {
  margin: 0 0 14px;
  border: 1px solid #dce5f0;
  border-radius: 6px;
  background: #f7faff;
}
.bot-preview-details > summary {
  margin: 0;
}
.bot-preview-details .bot-preview {
  margin: 0;
  padding: 12px;
  border-top: 1px solid #dce5f0;
  border-bottom: 0;
  background: white;
}
.bot-preview-details .bot-preview > h2 {
  display: none;
}
.bot-library > .mini-panel {
  padding: 12px;
  margin: 10px 0;
}
.record-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
}
.app-dialog .drawer .record-form > .record-field {
  min-width: 0;
  margin: 0;
}
.record-form > .record-field-wide,
.record-form > .advanced-toggle,
.record-form > .editor-stage-change,
.record-form > .form-actions {
  grid-column: 1 / -1;
}
.app-dialog .drawer .record-form > .record-field input,
.app-dialog .drawer .record-form > .record-field select {
  margin-top: 4px;
}
@media (max-width: 1000px) {
  .pipeline-cards {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 600px) {
  .record-form,
  .bot-settings-content {
    grid-template-columns: minmax(0, 1fr);
  }
  .catalog-toolbar > input,
  .commercial-toolbar > input {
    max-width: none;
  }
}

.bot-load {
  min-height: 30px;
  padding: 5px 8px;
  border-color: #b9cce1;
  background: #eef4fa;
  color: var(--brand-navy);
  font-size: 11px;
}
.bot-flow-actions {
  display: inline-block;
  margin: 0 0 0 6px;
  vertical-align: middle;
}
.bot-flow-actions > summary {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 8px;
  border: 1px solid #d7e0e9;
  border-radius: 5px;
  background: white;
  color: #4b6079;
  font-size: 11px;
  font-weight: 600;
  list-style: none;
}
.bot-flow-actions > summary::-webkit-details-marker {
  display: none;
}
.bot-flow-actions > summary::after {
  content: "⌄";
  margin-left: 5px;
}
.bot-flow-actions[open] {
  display: block;
  margin: 8px 0 0;
}
.bot-flow-actions[open] > summary {
  margin-bottom: 8px;
}
.bot-flow-actions .actions {
  gap: 5px;
  padding-top: 8px;
  border-top: 1px solid #e5eaf0;
}
.bot-flow-actions .actions button {
  min-height: 28px;
  padding: 4px 7px;
  font-size: 11px;
}
.metrics-controls .metric-filters {
  gap: 8px 12px;
  margin: 8px 0 10px;
}
.metrics-controls .metric-filters label {
  margin: 0;
  font-size: 12px;
}
.metrics-controls .metric-filters input,
.metrics-controls .metric-filters select {
  min-height: 34px;
  padding: 6px 8px;
}
.metric-extra {
  margin: 6px 0;
}
.metric-extra > summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 5px;
  color: var(--brand-blue);
  font-size: 12px;
  font-weight: 600;
}
.metric-extra > summary:hover {
  background: #edf3f9;
}
.metric-extra > summary small {
  padding: 2px 6px;
  border-radius: 9px;
  background: #e9eff6;
  color: var(--brand-navy);
  font-size: 10px;
}
.metrics-controls .actions {
  margin-top: 10px;
}
@media (max-width: 600px) {
  .bot-flow-actions {
    margin-top: 6px;
  }
}

.metric-extra > summary::after {
  content: "⌄";
  font-size: 13px;
}
.metric-extra[open] > summary::after {
  content: "⌃";
}
.metric-cards {
  gap: 9px;
  margin: 12px 0;
}
.metric-card {
  gap: 5px;
  min-height: 96px;
  padding: 12px 14px;
}
.metric-card strong {
  font-size: 20px;
}
.metric-card[aria-pressed="true"] {
  border-color: #ec8a5d;
  background: #fff7f1;
  box-shadow: inset 3px 0 var(--brand-orange);
}
.metric-card:hover:not(:disabled) {
  border-color: #9bb2cc;
  background: #f7faff;
}
.metric-card[aria-pressed="true"]:hover:not(:disabled) {
  background: #fff3e9;
}

/* Flujos locales: priorizar registros y resultados sobre formularios largos. */
.outreach-panel > p,
.csv-import-panel > p,
.marketing-lab > p {
  max-width: 78ch;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.outreach-panel .tabs {
  margin: 10px 0 12px;
}
.workflow-editor,
.csv-advanced,
.csv-help,
.lab-flow,
.import-alt,
.import-export {
  border: 1px solid #d9e2ec;
  border-radius: 7px;
  background: #f7f9fc;
}
.workflow-editor,
.csv-advanced,
.csv-help,
.lab-flow {
  margin: 10px 0;
}
.workflow-editor > summary,
.csv-advanced > summary,
.csv-help > summary,
.lab-flow > summary,
.import-alt > summary,
.import-export > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 12px;
  list-style: none;
  color: var(--brand-navy);
  font-size: 13px;
  font-weight: 600;
}
.workflow-editor > summary::-webkit-details-marker,
.csv-advanced > summary::-webkit-details-marker,
.csv-help > summary::-webkit-details-marker,
.lab-flow > summary::-webkit-details-marker,
.import-alt > summary::-webkit-details-marker,
.import-export > summary::-webkit-details-marker {
  display: none;
}
.workflow-editor > summary::after,
.csv-advanced > summary::after,
.csv-help > summary::after,
.lab-flow > summary::after,
.import-alt > summary::after,
.import-export > summary::after {
  content: "⌄";
  margin-left: auto;
  color: var(--brand-blue);
  font-size: 17px;
  line-height: 1;
}
.workflow-editor[open] > summary::after,
.csv-advanced[open] > summary::after,
.csv-help[open] > summary::after,
.lab-flow[open] > summary::after,
.import-alt[open] > summary::after,
.import-export[open] > summary::after {
  content: "⌃";
}
.workflow-editor > summary small,
.lab-flow > summary small {
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.workflow-editor > summary small + *,
.lab-flow > summary small + * {
  margin-left: 0;
}
.workflow-editor[open] > summary,
.csv-advanced[open] > summary,
.csv-help[open] > summary,
.lab-flow[open] > summary,
.import-alt[open] > summary,
.import-export[open] > summary {
  margin-bottom: 0;
  border-bottom: 1px solid #d9e2ec;
}
.workflow-editor[open],
.csv-advanced[open],
.csv-help[open],
.lab-flow[open] {
  padding-bottom: 12px;
}
.workflow-editor > :not(summary),
.csv-advanced > :not(summary),
.csv-help > :not(summary),
.lab-flow > :not(summary),
.import-alt > :not(summary),
.import-export > :not(summary) {
  margin-left: 12px;
  margin-right: 12px;
}
.workflow-editor .form-grid,
.csv-advanced .form-grid,
.lab-flow .form-grid {
  margin-bottom: 8px;
}
.workflow-editor .form-grid > label,
.csv-advanced .form-grid > label,
.lab-flow .form-grid > label {
  margin-top: 10px;
}
.outreach-panel > h3 {
  margin: 14px 0 8px;
}
.outreach-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px 12px;
  padding: 10px 12px;
  margin: 8px 0;
}
.outreach-item h3,
.outreach-item p {
  margin: 0;
}
.outreach-item h3 {
  font-size: 13px;
}
.outreach-item p {
  color: var(--muted);
  font-size: 12px;
}
.outreach-item .badge {
  grid-column: 2;
  grid-row: 1;
}
.outreach-item .actions {
  grid-column: 1 / -1;
  margin-top: 3px;
}
.outreach-item .actions button {
  min-height: 30px;
  padding: 5px 9px;
  margin: 0 5px 0 0;
  font-size: 12px;
}
.outreach-list {
  padding: 0;
  margin: 8px 0 0;
  list-style: none;
}
.outreach-list li {
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.outreach-list li button {
  min-height: 30px;
  padding: 5px 9px;
  margin: 0 0 0 6px;
  font-size: 12px;
}
.csv-primary-fields {
  gap: 0 12px;
  margin-bottom: 4px;
}
.csv-primary-fields > label {
  margin-top: 8px;
}
.csv-help {
  margin-bottom: 4px;
}
.csv-help p,
.import-alt p,
.import-export p {
  margin-top: 10px;
  font-size: 12px;
}
.csv-advanced .check-line {
  margin-top: 3px;
}
.imports-layout > .panel {
  margin-bottom: 12px;
}
.import-alt,
.import-export {
  padding: 0;
}
.import-alt[open],
.import-export[open] {
  padding-bottom: 12px;
}
.import-alt .toolbar {
  margin-top: 10px;
}
.import-review .section-title,
.import-history h2 {
  margin-bottom: 8px;
}
.import-history .activity-line {
  padding: 7px 0;
}
.marketing-lab .lab-primary h3 {
  margin: 10px 0 2px;
}
.marketing-lab .form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 12px;
  margin-bottom: 8px;
}
.marketing-lab .form-grid > label {
  margin-top: 10px;
}
.marketing-lab .lab-primary > label {
  margin-top: 8px;
}
.marketing-lab .lab-primary > p {
  max-width: 78ch;
  margin: 6px 0 10px;
  color: var(--muted);
  font-size: 12px;
}
.marketing-lab .lab-primary > button {
  margin: 0 6px 6px 0;
}
.marketing-lab .lab-flow {
  margin-top: 14px;
}
.marketing-lab .lab-flow p {
  margin-top: 8px;
  font-size: 12px;
}
.marketing-lab .lab-flow .toolbar {
  margin-top: 4px;
}
@media (max-width: 680px) {
  .marketing-lab .form-grid {
    grid-template-columns: 1fr;
  }
  .outreach-item {
    grid-template-columns: minmax(0, 1fr);
  }
  .outreach-item .badge {
    grid-column: 1;
    grid-row: auto;
    justify-self: start;
  }
  .workflow-editor > summary small,
  .lab-flow > summary small {
    display: none;
  }
}
