/* Difusión de voz — estilo gráfico Zennia (OMniLeads). Ver ui.md */
:root {
  /* Marca */
  --zn-primary: #1592BD;
  --zn-primary-light: #1EB7E4;
  --zn-logo-cyan: #1EB7E4;
  --zn-logo-gray: #798689;

  /* Shell */
  --zn-app-bg: #F4F6F8;
  --zn-nav-bg: #FFFFFF;
  --zn-nav-text: #6A716A;
  --zn-nav-icon: #3F4448;
  --zn-submenu-bg: rgba(0, 0, 0, .05);
  --zn-text: #333333;
  --zn-card-shadow: 0 2px 8px rgba(0, 0, 0, .06);

  /* CRUD / PrimeVue */
  --zn-crud-text: #495057;
  --zn-crud-text-2: #6C757D;
  --zn-th-bg: #F8F9FA;
  --zn-row-border: #E9ECEF;
  --zn-input-border: #CED4DA;
  --zn-input-bg: #FFFFFF;
  --zn-header-card-bg: #F8F9FA;
  --zn-header-card-border: #DEE2E6;
  --zn-surface: #FFFFFF;
  --zn-surface-2: #F8F9FA;
  --zn-success: #689F38;
  --zn-warning: #FBC02D;
  --zn-danger: #D32F2F;
  --zn-badge-new: #00E000;

  /* Dashboard */
  --dashboard-surface: rgba(255, 255, 255, .95);
  --dashboard-surface-strong: #FFFFFF;
  --dashboard-border: rgba(15, 23, 42, .08);
  --dashboard-outline: rgba(15, 23, 42, .04);
  --dashboard-text: #162033;
  --dashboard-muted: #6A778B;
  --dashboard-title-muted: #5F6C82;
  --dashboard-shadow: 0 24px 60px rgba(15, 23, 42, .10);
  --dashboard-shell-bg:
    radial-gradient(circle at top left, rgba(93, 163, 255, .16), transparent 30%),
    radial-gradient(circle at top right, rgba(143, 198, 65, .16), transparent 35%),
    linear-gradient(180deg, #F5F7FB, #EDF2F8);
  --grid-line: rgba(15, 23, 42, .06);

  /* Paleta de datos */
  --c-blue: #5DA3FF;   --c-blue-bg: rgba(93, 163, 255, .16);
  --c-amber: #FFB54D;  --c-amber-bg: rgba(255, 181, 77, .18);
  --c-lime: #8FC641;   --c-lime-bg: rgba(143, 198, 65, .16);
  --c-mint: #72D6B5;   --c-mint-bg: rgba(114, 214, 181, .16);
  --c-lav: #8F9CFF;    --c-lav-bg: rgba(143, 156, 255, .16);
  --c-coral: #FF7B72;  --c-coral-bg: rgba(255, 123, 114, .16);
  --c-neutral: #B4BFCF;

  /* Resultados de llamada */
  --r-marco_opcion: var(--c-lime);
  --r-escucho: var(--c-mint);
  --r-colgo: var(--c-amber);
  --r-buzon: var(--c-lav);
  --r-no_contesto: var(--c-neutral);
  --r-ocupado: var(--c-blue);
  --r-fallida: var(--c-coral);
  --r-sin_resultado: #D5DBE5;
  --r-en_curso: #A9C9F5;

  font-family: "Asap", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  color: var(--zn-text);
  background: var(--zn-app-bg);
  color-scheme: light;
}

html.dark-mode {
  --zn-app-bg: #2B2D31;
  --zn-nav-bg: #1E1F22;
  --zn-nav-text: #B5BAC1;
  --zn-nav-icon: #DBDEE1;
  --zn-text: #DBDEE1;
  --zn-crud-text: #DBDEE1;
  --zn-crud-text-2: #A5ABB3;
  --zn-th-bg: #313338;
  --zn-row-border: rgba(255, 255, 255, .08);
  --zn-input-border: rgba(255, 255, 255, .16);
  --zn-input-bg: #1E1F22;
  --zn-header-card-bg: #2B2D31;
  --zn-header-card-border: rgba(255, 255, 255, .14);
  --zn-surface: #1E1F22;
  --zn-surface-2: rgba(255, 255, 255, .03);
  --zn-card-shadow: 0 2px 8px rgba(0, 0, 0, .3);
  --dashboard-surface: rgba(18, 22, 33, .92);
  --dashboard-surface-strong: #171C28;
  --dashboard-border: rgba(255, 255, 255, .08);
  --dashboard-outline: rgba(255, 255, 255, .04);
  --dashboard-text: #F5F7FB;
  --dashboard-muted: #9AA8BF;
  --dashboard-title-muted: #9AA8BF;
  --dashboard-shadow: 0 24px 60px rgba(0, 0, 0, .35);
  --dashboard-shell-bg:
    radial-gradient(circle at top left, rgba(93, 163, 255, .18), transparent 30%),
    radial-gradient(circle at top right, rgba(255, 181, 77, .16), transparent 32%),
    linear-gradient(180deg, #0D1118, #121723);
  --grid-line: rgba(255, 255, 255, .06);
  --r-sin_resultado: #4A5263;
  --r-en_curso: #3D5E8C;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--zn-app-bg); color: var(--zn-text); }
a { color: var(--zn-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 500; }
p { margin: 0; }
.muted { color: var(--dashboard-muted); }
.hidden { display: none !important; }
.kicker { color: var(--dashboard-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; }
code { background: var(--zn-surface-2); border: 1px solid var(--zn-row-border); border-radius: 4px; padding: 0 4px; font-size: .85em; }

/* =========================================================
   Shell
   ========================================================= */
.app-shell { display: grid; grid-template-columns: 225px minmax(0, 1fr); gap: 15px; padding: 15px; min-height: 100vh; }
.sidebar { background: var(--zn-nav-bg); border-radius: 14px; box-shadow: var(--zn-card-shadow); display: flex; flex-direction: column; overflow: hidden; position: sticky; top: 15px; height: calc(100vh - 30px); }
.logo { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 22px 12px 18px; border-bottom: 1px solid var(--zn-row-border); }
.logo .wordmark { font-weight: 500; font-size: 1.55rem; color: var(--zn-logo-gray); letter-spacing: .01em; display: inline-flex; align-items: center; gap: 4px; }
.logo .wordmark i { width: 8px; height: 8px; border-radius: 50%; background: var(--zn-logo-cyan); display: inline-block; margin-left: 2px; }
.logo small { color: var(--dashboard-muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
.nav { padding: 12px 0; display: flex; flex-direction: column; }
.nav a { position: relative; display: block; padding: 10px 14px 10px 44px; color: var(--zn-nav-text); font-size: 16px; letter-spacing: .01em; }
.nav a svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--zn-nav-icon); }
.nav a:hover { background: var(--zn-submenu-bg); text-decoration: none; }
.nav a.active { background: var(--zn-primary); color: #fff; }
.nav a.active svg { color: #fff; }
.nav .chip-new { background: var(--zn-badge-new); color: #000; font-size: .66rem; font-weight: 700; padding: 1px 5px; border-radius: 3px; margin-left: 6px; vertical-align: 2px; }
.sidebar-foot { margin-top: auto; padding: 14px 16px 18px; border-top: 1px solid var(--zn-row-border); font-size: .85rem; color: var(--zn-crud-text-2); }
.sidebar-foot b { display: block; color: var(--zn-crud-text); font-weight: 500; }

.content-col { display: flex; flex-direction: column; gap: 15px; min-width: 0; }
.topbar { background: var(--zn-nav-bg); border-radius: 14px; box-shadow: var(--zn-card-shadow); height: 60px; padding: 0 20px; display: flex; align-items: center; gap: 10px; }
.topbar .lang { width: auto; min-height: 34px; border-radius: 4px; padding: 4px 8px; font-size: .9rem; }
.topbar .theme-btn { width: 36px; height: 34px; border-radius: 4px; background: #E9ECEF; border: 0; display: grid; place-items: center; color: #495057; cursor: pointer; padding: 0; min-height: 0; }
html.dark-mode .topbar .theme-btn { background: #313338; color: #DBDEE1; }
.topbar .theme-btn svg { width: 16px; height: 16px; }
.topbar .account { color: var(--zn-crud-text-2); font-size: .9rem; }
.topbar .logout { margin-left: 18px; font-weight: 500; color: var(--zn-nav-text); cursor: pointer; background: none; border: 0; font-size: 1rem; padding: 0; min-height: 0; }
.topbar .menu-btn { display: none; background: none; border: 0; color: var(--zn-nav-icon); padding: 4px; min-height: 0; }
.content { padding: 34px 20px 30px; min-width: 0; }

@media (max-width: 991px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); padding: 10px; }
  .sidebar { position: fixed; left: 10px; top: 10px; bottom: 10px; height: auto; width: 240px; z-index: 50; transform: translateX(-120%); transition: transform .2s; }
  .app-shell.nav-open .sidebar { transform: none; box-shadow: 0 24px 60px rgba(15, 23, 42, .25); }
  .topbar .menu-btn { display: inline-grid; }
  .topbar .account { display: none; }
  .content { padding: 20px 4px 30px; }
}

/* =========================================================
   Capa 1 — CRUD (PrimeVue / Bootstrap)
   ========================================================= */
.page-header { background: var(--zn-header-card-bg); border: 1px solid var(--zn-header-card-border); border-radius: 3px; padding: 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-header h1 { font-size: 32px; font-weight: 400; color: var(--zn-crud-text); }
.page-header p { color: var(--zn-crud-text-2); margin-top: 6px; font-size: .95rem; }

.card { background: var(--zn-surface); border-radius: 12px; box-shadow: var(--zn-card-shadow); border: 1px solid var(--zn-row-border); color: var(--zn-crud-text); }
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--zn-row-border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-head h2 { font-size: 1.15rem; font-weight: 500; color: var(--zn-crud-text); }
.card-head p { color: var(--zn-crud-text-2); font-size: .88rem; margin-top: 2px; }
.card-body { padding: 18px 20px; }
.stack { display: grid; gap: 16px; }
.split { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1100px) { .split, .grid-2 { grid-template-columns: minmax(0, 1fr); } }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.divider { height: 1px; background: var(--zn-row-border); margin: 16px 0; }

/* Formularios */
label.field { display: grid; gap: 6px; color: var(--zn-crud-text); font-size: .92rem; font-weight: 500; }
label.field .hint { color: var(--zn-crud-text-2); font-size: .8rem; font-weight: 400; }
input[type=text], input[type=password], input[type=tel], input[type=number], input[type=date], input[type=time],
input[type=datetime-local], input[type=search], select, textarea {
  font: inherit; font-size: .95rem; color: var(--zn-crud-text); background: var(--zn-input-bg);
  border: 1px solid var(--zn-input-border); border-radius: 8px; padding: 8px 11px; width: 100%; min-height: 40px;
  transition: box-shadow .15s, border-color .15s;
}
textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--zn-primary); box-shadow: 0 0 0 .2rem rgba(30, 183, 228, .35); }
input[type=checkbox], input[type=radio] { accent-color: var(--zn-primary); width: 17px; height: 17px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--zn-crud-text); font-size: .95rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 720px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.counter { font-size: .78rem; color: var(--zn-crud-text-2); text-align: right; }
.search { position: relative; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--zn-crud-text-2); }
.search input { padding-left: 32px; }

/* Botones */
button, .btn { font: inherit; font-size: .95rem; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 12px; padding: 8px 16px; min-height: 40px; border: 1px solid var(--zn-input-border); background: var(--zn-surface); color: var(--zn-crud-text); cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s; }
button:hover, .btn:hover { text-decoration: none; background: var(--zn-surface-2); }
button:disabled { opacity: .55; cursor: not-allowed; }
button svg, .btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--zn-primary); border-color: var(--zn-primary); color: #fff; }
.btn-primary:hover { background: #127fa4; border-color: #127fa4; }
.btn-outlined { background: transparent; border-color: var(--zn-primary); color: var(--zn-primary); }
.btn-outlined:hover { background: rgba(21, 146, 189, .08); }
.btn-text { background: transparent; border-color: transparent; color: var(--zn-primary); }
.btn-text:hover { background: rgba(21, 146, 189, .08); }
.btn-danger-outlined { background: transparent; border-color: var(--zn-danger); color: var(--zn-danger); }
.btn-danger-outlined:hover { background: rgba(211, 47, 47, .08); }
.btn-sm { min-height: 32px; padding: 4px 12px; font-size: .85rem; border-radius: 10px; }
.btn-icon { width: 38px; height: 38px; min-height: 38px; padding: 0; border-radius: 12px; border: 0; }
.btn-icon.success { background: var(--zn-success); color: #fff; }
.btn-icon.warning { background: var(--zn-warning); color: #212529; }
.btn-icon.danger { background: var(--zn-danger); color: #fff; }
.btn-icon.info { background: var(--zn-primary); color: #fff; }
html.dark-mode .btn-icon.success { background: transparent; border: 1px solid var(--zn-success); color: var(--zn-success); }
html.dark-mode .btn-icon.warning { background: transparent; border: 1px solid var(--zn-warning); color: var(--zn-warning); }
html.dark-mode .btn-icon.danger { background: transparent; border: 1px solid var(--zn-danger); color: #ff8a80; }
html.dark-mode .btn-icon.info { background: transparent; border: 1px solid var(--zn-primary-light); color: var(--zn-primary-light); }
.row-actions { display: flex; gap: 8px; }

/* Tabla */
.table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; flex-wrap: wrap; border-bottom: 1px solid var(--zn-row-border); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; color: var(--zn-crud-text); font-size: .92rem; }
th { background: var(--zn-th-bg); color: var(--zn-crud-text); font-weight: 600; text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--zn-row-border); border-right: 1px solid var(--zn-row-border); white-space: nowrap; }
th:last-child, td:last-child { border-right: 0; }
td { padding: 8px 10px; border-bottom: 1px solid var(--zn-row-border); border-right: 1px solid var(--zn-row-border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--zn-surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.truncate { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { text-align: center; color: var(--zn-crud-text-2); padding: 40px 16px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--zn-row-border); color: var(--zn-crud-text-2); font-size: .88rem; }

/* Badges de estado */
.badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 10px; font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; background: rgba(15, 23, 42, .05); color: #66758D; white-space: nowrap; }
html.dark-mode .badge { background: rgba(255, 255, 255, .06); color: #9AA8BF; }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.s-running { background: var(--c-blue-bg); color: #2F7BD9; }
.badge.s-paused { background: var(--c-amber-bg); color: #C77B12; }
.badge.s-completed { background: var(--c-lime-bg); color: #5E8F1E; }
.badge.s-cancelled { background: var(--c-coral-bg); color: #D2463D; }
.res { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.res i { width: 10px; height: 10px; border-radius: 999px; flex: none; }

/* Wizard */
.steps { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.step { display: inline-flex; align-items: center; gap: 10px; padding: 6px 16px 6px 6px; border-radius: 999px; background: var(--zn-surface); border: 1px solid var(--zn-row-border); color: var(--zn-crud-text-2); cursor: pointer; box-shadow: var(--zn-card-shadow); }
.step .n { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--zn-th-bg); font-size: .85rem; font-weight: 700; }
.step.active { color: var(--zn-primary); border-color: var(--zn-primary); }
.step.active .n { background: var(--zn-primary); color: #fff; }
.step.done .n { background: var(--zn-success); color: #fff; }
.wizard-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

.dropzone { border: 2px dashed var(--zn-input-border); border-radius: 16px; padding: 38px 20px; text-align: center; background: var(--zn-surface-2); cursor: pointer; transition: border-color .15s, background .15s; color: var(--zn-crud-text-2); }
.dropzone:hover, .dropzone.over { border-color: var(--zn-primary); background: rgba(21, 146, 189, .06); }
.dropzone svg { width: 40px; height: 40px; color: var(--zn-primary); }
.dropzone b { display: block; margin: 8px 0 4px; color: var(--zn-crud-text); font-weight: 500; font-size: 1.05rem; }

.var-row { display: grid; grid-template-columns: 1fr 130px 1.2fr 1fr 38px; gap: 8px; align-items: center; margin-bottom: 8px; }
.var-head { font-size: .78rem; color: var(--zn-crud-text-2); font-weight: 600; }
@media (max-width: 820px) { .var-row { grid-template-columns: 1fr 1fr; } .var-head { display: none; } }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid rgba(21, 146, 189, .35); background: rgba(21, 146, 189, .08); color: var(--zn-primary); border-radius: 999px; padding: 3px 11px; font-size: .82rem; font-weight: 500; cursor: pointer; min-height: 0; }
.chip:hover { background: rgba(21, 146, 189, .16); }
.preview-box { background: var(--zn-surface-2); border: 1px solid var(--zn-row-border); border-radius: 12px; padding: 12px 14px; white-space: pre-wrap; min-height: 64px; color: var(--zn-crud-text); font-size: .95rem; }
.preview-box mark { background: var(--c-lime-bg); color: inherit; border-radius: 4px; padding: 0 3px; }
.preview-box .missing { background: var(--c-coral-bg); color: #D2463D; border-radius: 4px; padding: 0 3px; }

.opt-row { display: grid; grid-template-columns: 96px 180px 1fr 38px; gap: 8px; align-items: center; margin-bottom: 8px; }
@media (max-width: 720px) { .opt-row { grid-template-columns: 80px 1fr 38px; } .opt-row .opt-text { grid-column: 1 / -1; } }
.day-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.day-chips label { border: 1px solid var(--zn-input-border); border-radius: 10px; padding: 6px 11px; cursor: pointer; user-select: none; color: var(--zn-crud-text); font-size: .9rem; }
.day-chips input { display: none; }
.day-chips label:has(input:checked) { background: var(--zn-primary); border-color: var(--zn-primary); color: #fff; }
.day-chips label:has(input:checked) .muted { color: rgba(255, 255, 255, .85); }
.day-chips label:has(input:disabled) { opacity: .45; cursor: not-allowed; }

/* Voces */
.voice-chosen { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--zn-input-border); border-radius: 12px; background: var(--zn-input-bg); }
.voice-chosen .grow { flex: 1; min-width: 0; }
.avatar { width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; font-weight: 700; flex: none; }
.voice-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.voice-card { border: 1px solid var(--dashboard-border); border-radius: 20px; padding: 14px; display: grid; gap: 12px; background: var(--dashboard-surface-strong); }
.voice-card.selected { border-color: var(--zn-primary); box-shadow: 0 0 0 .2rem rgba(30, 183, 228, .3); }
.voice-card .name { font-weight: 500; color: var(--dashboard-text); }
.voice-card .meta { font-size: .82rem; color: var(--dashboard-muted); margin-top: 2px; }
.tag { display: inline-block; font-size: .72rem; padding: 2px 8px; border-radius: 999px; background: rgba(15, 23, 42, .05); color: #66758D; margin-right: 4px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
html.dark-mode .tag { background: rgba(255, 255, 255, .06); color: #9AA8BF; }

/* Alertas, toasts, modal */
.alert { border-radius: 12px; padding: 11px 14px; font-size: .92rem; border: 1px solid; }
.alert.info { background: var(--c-blue-bg); border-color: rgba(93, 163, 255, .3); color: #2F6DB8; }
.alert.warn { background: var(--c-amber-bg); border-color: rgba(255, 181, 77, .35); color: #A2620A; }
.alert.error { background: var(--c-coral-bg); border-color: rgba(255, 123, 114, .35); color: #C2382F; }
.alert.ok { background: var(--c-lime-bg); border-color: rgba(143, 198, 65, .35); color: #4F7A18; }
html.dark-mode .alert.info { color: #9CC7FF; } html.dark-mode .alert.warn { color: #FFCF8A; }
html.dark-mode .alert.error { color: #FFA59E; } html.dark-mode .alert.ok { color: #B9E07F; }
#toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 100; }
.toast { background: var(--dashboard-surface-strong); color: var(--dashboard-text); border: 1px solid var(--dashboard-border); box-shadow: var(--dashboard-shadow); padding: 12px 16px; border-radius: 16px; max-width: 400px; font-size: .92rem; display: flex; gap: 10px; align-items: center; }
.toast::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--c-lime); flex: none; }
.toast.error::before { background: var(--c-coral); }
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: grid; place-items: center; z-index: 80; padding: 16px; backdrop-filter: blur(2px); }
.modal { background: var(--dashboard-surface-strong); color: var(--dashboard-text); border-radius: 24px; box-shadow: var(--dashboard-shadow); width: min(1000px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; border: 1px solid var(--dashboard-border); }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--dashboard-border); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.modal-head h2 { font-size: 1.4rem; }
.modal-body { padding: 18px 22px; overflow: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--dashboard-border); display: flex; justify-content: flex-end; gap: 10px; }

/* =========================================================
   Capa 2 — Dashboard
   ========================================================= */
.dashboard-shell { padding: 1rem; border-radius: 28px; background: var(--dashboard-shell-bg); display: grid; gap: 1rem; color: var(--dashboard-text); }
.status-bar { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
.status-bar .right { margin-left: auto; display: flex; gap: .75rem; flex-wrap: wrap; }
.status-item { display: inline-flex; align-items: center; gap: .65rem; padding: .9rem 1rem; border-radius: 999px; background: var(--dashboard-surface); border: 1px solid var(--dashboard-border); box-shadow: var(--dashboard-shadow); backdrop-filter: blur(14px); }
.status-dot { width: .65rem; height: .65rem; border-radius: 999px; box-shadow: 0 0 0 .3rem rgba(255, 255, 255, .08); }
.status-label { color: var(--dashboard-muted); font-size: .92rem; }
.status-value { color: var(--dashboard-text); font-weight: 700; }
.status-item.filters { padding: .45rem .6rem .45rem 1rem; gap: .5rem; }
.status-item.filters input, .status-item.filters select { min-height: 34px; border-radius: 999px; padding: 4px 12px; font-size: .88rem; width: auto; background: var(--dashboard-surface-strong); }
.status-item.filters button { min-height: 34px; border-radius: 999px; padding: 4px 14px; font-size: .88rem; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 1200px) { .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .kpi-grid { grid-template-columns: minmax(0, 1fr); } }
.kpi { padding: 1.3rem; border-radius: 24px; background: var(--dashboard-surface); border: 1px solid var(--dashboard-border); box-shadow: 0 22px 50px rgba(15, 23, 42, .08); overflow: hidden; }
.kpi__header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.15rem; }
.kpi__icon { width: 2.75rem; height: 2.75rem; border-radius: 16px; display: grid; place-items: center; }
.kpi__icon svg { width: 1.2rem; height: 1.2rem; }
.kpi__badge { height: 2rem; padding: 0 .85rem; border-radius: 999px; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: #66758D; background: rgba(15, 23, 42, .05); display: inline-flex; align-items: center; }
html.dark-mode .kpi__badge { color: #9AA8BF; background: rgba(255, 255, 255, .06); }
.kpi__title { margin: 0; color: var(--dashboard-title-muted); font-size: .92rem; line-height: 1.5; }
.kpi__value { display: inline-block; margin-top: .5rem; color: var(--dashboard-text); font-size: 2.4rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi__sub { color: var(--dashboard-muted); font-size: .85rem; margin-top: .45rem; }
.kpi__spark { height: 4.75rem; margin-top: 1.15rem; }
.kpi__spark svg { width: 100%; height: 100%; display: block; }

.panel-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1rem; }
.panel-grid.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 991px) { .panel-grid, .panel-grid.even { grid-template-columns: minmax(0, 1fr); } }
.panel { position: relative; padding: 1.15rem; border-radius: 26px; background: var(--dashboard-surface); border: 1px solid var(--dashboard-border); box-shadow: var(--dashboard-shadow); overflow: hidden; color: var(--dashboard-text); min-width: 0; }
.panel::before { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; background: linear-gradient(135deg, rgba(255, 255, 255, .24), transparent 40%); -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; }
.panel.tall { min-height: 24rem; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; }
.panel-kicker { margin-bottom: .4rem; color: var(--dashboard-muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; }
.panel-title { margin: 0; font-size: 1.4rem; line-height: 1.2; color: var(--dashboard-text); font-weight: 500; }
.panel-emphasis { min-width: 5.5rem; padding: .85rem 1rem; border-radius: 18px; text-align: right; background: rgba(93, 163, 255, .12); border: 1px solid rgba(93, 163, 255, .18); }
.panel-emphasis-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--dashboard-muted); }
.panel-emphasis strong { display: block; font-size: 1.5rem; }
.pill { min-width: 3rem; height: 3rem; padding: 0 .9rem; border-radius: 999px; font-weight: 700; display: inline-grid; place-items: center; background: rgba(143, 198, 65, .16); border: 1px solid rgba(143, 198, 65, .2); }
.highlight-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; }
.highlight-card { padding: 1rem; border-radius: 20px; background: var(--dashboard-surface-strong); border: 1px solid var(--dashboard-outline); }
.highlight-label { margin-bottom: .55rem; color: var(--dashboard-muted); font-size: .9rem; }
.highlight-card strong { font-size: 1.85rem; font-weight: 700; }
.breakdown-group { padding: 1rem; border-radius: 20px; background: var(--dashboard-surface-strong); border: 1px solid var(--dashboard-outline); margin-top: .9rem; }
.breakdown-group h4 { margin: 0 0 .85rem; font-size: .96rem; font-weight: 500; }
.breakdown-row { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .65rem 0; border-top: 1px solid var(--dashboard-border); font-size: .92rem; }
.breakdown-row:first-of-type { border-top: 0; padding-top: 0; }
.breakdown-row .lbl { display: inline-flex; align-items: center; gap: .6rem; color: var(--dashboard-text); }
.breakdown-row .val { font-weight: 700; font-variant-numeric: tabular-nums; }
.breakdown-row .pct { color: var(--dashboard-muted); font-weight: 400; margin-left: .4rem; font-size: .85rem; }
.breakdown-dot { width: .7rem; height: .7rem; border-radius: 999px; flex: none; }
.chart { height: 17rem; }
.chart.bars { height: 16rem; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart text { font-size: 11px; fill: var(--dashboard-muted); font-family: inherit; }
.chart-legend { display: flex; justify-content: center; flex-wrap: wrap; gap: .4rem 1rem; font-size: .82rem; color: var(--dashboard-muted); margin-bottom: .6rem; }
.chart-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.chart-legend i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid currentColor; display: inline-block; }
.progress { height: .6rem; border-radius: 999px; background: rgba(15, 23, 42, .06); overflow: hidden; display: flex; min-width: 120px; }
html.dark-mode .progress { background: rgba(255, 255, 255, .08); }
.progress > span { display: block; height: 100%; }
.dash-table { width: 100%; border-collapse: collapse; font-size: .92rem; color: var(--dashboard-text); }
.dash-table th { background: transparent; color: var(--dashboard-muted); font-weight: 400; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; border: 0; border-bottom: 1px solid var(--dashboard-border); padding: .6rem .4rem; }
.dash-table td { border: 0; border-bottom: 1px solid var(--dashboard-border); padding: .7rem .4rem; }
.dash-table tr:last-child td { border-bottom: 0; }

/* Loader */
.loader-card { display: grid; place-items: center; gap: .8rem; padding: 2.5rem; border-radius: 24px; background: var(--dashboard-surface); border: 1px solid var(--dashboard-border); box-shadow: var(--dashboard-shadow); color: var(--dashboard-muted); }
.spinner { width: 2rem; height: 2rem; border-radius: 50%; border: 3px solid; border-color: #5DA3FF #8FC641 rgba(93, 163, 255, .14) rgba(93, 163, 255, .14); animation: spin .85s linear infinite; display: inline-block; }
.spinner.sm { width: 1rem; height: 1rem; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.live { display: inline-flex; align-items: center; gap: .5rem; color: var(--dashboard-muted); font-size: .85rem; }
.live::before { content: ""; width: .6rem; height: .6rem; border-radius: 50%; background: var(--c-lime); box-shadow: 0 0 0 .3rem rgba(143, 198, 65, .2); }

@media (max-width: 991px) {
  .dashboard-shell { padding: .85rem; border-radius: 20px; }
  .panel.tall { min-height: 0; }
  .highlight-grid { grid-template-columns: minmax(0, 1fr); }
  .panel-head { flex-direction: column; }
  .panel-emphasis { width: 100%; text-align: left; }
}
@media (max-width: 960px) { .status-bar .right { margin-left: 0; } }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--dashboard-shell-bg); }
.login { width: min(420px, 100%); padding: 2rem; border-radius: 28px; background: var(--dashboard-surface); border: 1px solid var(--dashboard-border); box-shadow: var(--dashboard-shadow); }
.login .logo { border-bottom: 0; padding: 0 0 1.2rem; }
.login h1 { font-size: 1.4rem; color: var(--dashboard-text); margin-bottom: .3rem; text-align: center; }
.login p.muted { text-align: center; margin-bottom: 1.3rem; }

/* Administración */
.nav-section { margin: 14px 14px 4px; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--dashboard-muted); }
.imp-banner { display: inline-flex; align-items: center; gap: 10px; padding: 5px 6px 5px 12px; border-radius: 999px; background: var(--c-amber-bg); border: 1px solid rgba(255, 181, 77, .45); color: #8a5300; font-size: .88rem; }
html.dark-mode .imp-banner { color: #FFCF8A; }
.imp-banner svg { width: 16px; height: 16px; }
.imp-banner .btn-sm { min-height: 28px; border-radius: 999px; }
@media (max-width: 991px) { .imp-banner > span { display: none; } }

/* Editor JSON con resaltado: <pre> coloreado debajo de un <textarea> transparente (mismas métricas) */
.code-editor { position: relative; height: 260px; resize: vertical; overflow: hidden; border: 1px solid var(--zn-input-border); border-radius: 8px; background: var(--zn-input-bg); }
.code-editor:focus-within { border-color: var(--zn-primary); box-shadow: 0 0 0 3px rgba(21, 146, 189, .15); }
.code-editor .code-hl, .code-editor textarea {
  position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; padding: 10px 12px; box-sizing: border-box;
  border: 0; border-radius: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: .85rem; font-weight: 400; line-height: 1.55; letter-spacing: 0; white-space: pre; tab-size: 2; overflow: auto; word-wrap: normal;
}
.code-editor .code-hl { pointer-events: none; overflow: hidden; color: var(--zn-crud-text); background: transparent; }
.code-editor textarea { color: transparent; -webkit-text-fill-color: transparent; caret-color: var(--zn-crud-text); background: transparent; resize: none; outline: none; box-shadow: none; }
.code-editor textarea::selection { background: rgba(21, 146, 189, .28); }
pre.code-view { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; font-size: .8rem; line-height: 1.55; white-space: pre; overflow: auto; tab-size: 2; }
.hl-key { color: #0B6E99; }
.hl-str { color: #A0522D; }
.hl-num { color: #1A7F37; }
.hl-bool, .hl-null { color: #8250DF; }
.hl-punct { color: #6E7781; }
.hl-var { color: #0F6E8F; background: rgba(21, 146, 189, .14); border-radius: 3px; }
html.dark-mode .hl-key { color: #7CC7E8; }
html.dark-mode .hl-str { color: #E5A07B; }
html.dark-mode .hl-num { color: #7EE787; }
html.dark-mode .hl-bool, html.dark-mode .hl-null { color: #C8A2FF; }
html.dark-mode .hl-punct { color: #8B949E; }
html.dark-mode .hl-var { color: #9AD8F0; background: rgba(124, 199, 232, .18); }

/* Página de ayuda de la API */
.doc-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start; }
.doc-toc { position: sticky; top: 16px; padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.doc-toc a { padding: 7px 10px; border-radius: 8px; color: var(--zn-crud-text); font-size: .9rem; }
.doc-toc a:hover { background: var(--zn-surface-2); text-decoration: none; }
.doc .card { scroll-margin-top: 16px; }
.doc, .doc .stack { min-width: 0; grid-template-columns: minmax(0, 1fr); }
.doc .card, .doc .card-body { min-width: 0; }
.doc p, .doc li { overflow-wrap: anywhere; }
.doc p { margin: 0; line-height: 1.6; }
.code-block { position: relative; }
.code-block pre { margin: 0; max-height: 420px; padding-right: 76px; }
.code-copy { position: absolute; top: 6px; right: 6px; z-index: 1; }
.doc-table td, .doc-table th { vertical-align: top; }
.doc-table td:first-child { white-space: nowrap; }
.doc-table td { font-size: .9rem; line-height: 1.5; }
@media (max-width: 900px) {
  .doc-layout { grid-template-columns: 1fr; }
  .doc-toc { position: static; flex-direction: row; flex-wrap: wrap; }
}
