/* ═══════════════════════════════════════════════════════════
   CRM360 · estilos
   ═══════════════════════════════════════════════════════════ */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #e2e5ea;
  --border-2: #cdd2da;
  --text: #171c26;
  --text-2: #4a5263;
  --text-3: #7c8492;
  --accent: #0e7490;          /* lo pisa el color de cada cliente */
  --accent-hover: #0b5f76;
  --accent-soft: #e6f3f6;
  --ok: #0f7a4a;      --ok-soft: #e7f5ee;
  --warn: #b25e09;    --warn-soft: #fdf3e5;
  --danger: #b42318;  --danger-soft: #fdecea;
  --info: #1d5fc2;    --info-soft: #eaf1fd;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .16);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 14px; line-height: 1.45; color: var(--text); background: var(--bg);
  font-feature-settings: 'cv11';
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 15px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
.num, .tabla td.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.oculto { display: none !important; }
.icon { width: 16px; height: 16px; flex-shrink: 0; vertical-align: -3px; }

/* ── Botones ───────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: var(--radius);
  border: 1px solid transparent; font-size: 13.5px; font-weight: 600;
  cursor: pointer; white-space: nowrap; text-decoration: none !important;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-sec { background: var(--surface); border-color: var(--border-2); color: var(--text); box-shadow: var(--shadow); }
.btn-sec:hover:not(:disabled) { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: #eceef2; color: var(--text); }
.btn-danger { background: var(--surface); border-color: #f1b8b1; color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); }
.btn-danger-solid { background: var(--danger); color: #fff; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-block { width: 100%; height: 40px; }
.btn-link { background: none; border: none; color: var(--accent); cursor: pointer; font-weight: 600; padding: 0; }
.btn-link:hover { text-decoration: underline; }
.acciones { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.acciones-fila { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: nowrap; }
form.inline { display: inline; }

/* ── Formularios ───────────────────────────────────────── */
.campo { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.campo > label, .campo > .label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.input, .select, .textarea,
.campo input:not([type=checkbox]):not([type=color]), .campo select, .campo textarea {
  width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--border-2);
  border-radius: var(--radius); background: var(--surface); font-size: 14px;
}
.campo textarea, .textarea { height: auto; min-height: 76px; padding: 8px 10px; resize: vertical; line-height: 1.45; }
.campo textarea.code { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 12px; min-height: 220px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
.campo .ayuda, .ayuda { font-size: 12px; color: var(--text-3); }
.grid-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.grid-form .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .grid-form { grid-template-columns: 1fr; } }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.con-boton { display: flex; gap: 6px; }
.con-boton input { flex: 1; }
input[type=color] { flex: none !important; width: 44px; height: 36px; padding: 2px; border: 1px solid var(--border-2); border-radius: var(--radius); background: #fff; }

/* ── Avisos ────────────────────────────────────────────── */
.aviso { display: flex; gap: 10px; padding: 11px 14px; border-radius: var(--radius); font-size: 13.5px; margin-bottom: 16px; border: 1px solid; }
.aviso-ok { background: var(--ok-soft); border-color: #b6e2c9; color: #0b4f31; }
.aviso-error { background: var(--danger-soft); border-color: #f5c2bc; color: #7a1a12; }
.aviso-info { background: var(--info-soft); border-color: #c3d6f7; color: #173d78; }
.aviso .ayuda { color: inherit; opacity: .8; margin-top: 4px; }
.copiar { display: flex; gap: 6px; margin-top: 8px; }
.copiar input { width: 260px; max-width: 100%; height: 30px; border: 1px solid #b7caf0; border-radius: 6px; padding: 0 8px; font-family: ui-monospace, Consolas, monospace; background: #fff; }

/* ── Tarjetas y tablas ─────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head p { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.card-body { padding: 18px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2); border-radius: 0 0 10px 10px; }

.tabla-wrap { overflow-x: auto; }
.tabla { width: 100%; border-collapse: collapse; font-size: 13px; }
.tabla th {
  text-align: left; font-weight: 600; font-size: 12px; color: var(--text-3);
  padding: 9px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap;
}
.tabla th.num { text-align: right; }
.tabla td { padding: 10px 12px; border-bottom: 1px solid #eef0f3; vertical-align: middle; }
.tabla tbody tr:last-child td { border-bottom: none; }
.tabla tr.clic { cursor: pointer; }
.tabla tr.clic:hover td { background: #f6f8fa; }
.tabla tr.activa td { background: var(--accent-soft); }
.tabla .corta { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabla .sub { font-size: 12px; color: var(--text-3); }
.tabla .vacio { text-align: center; color: var(--text-3); padding: 36px 12px; }
.tabla .guion { color: #b5bbc5; }
.pie-tabla { padding: 10px 14px; font-size: 12.5px; color: var(--text-3); border-top: 1px solid var(--border); }

/* estado: punto de color + texto */
.estado { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 12.5px; font-weight: 550; }
.estado::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--dot, #98a1ae); }
.c-gris { --dot: #98a1ae; } .c-amarillo { --dot: #e0a100; } .c-indigo { --dot: #5b5bd6; }
.c-azul { --dot: #2f6fdd; } .c-violeta { --dot: #8e4ec6; } .c-verde { --dot: #1a9a5b; }
.c-rojo { --dot: #d6453d; } .c-celeste { --dot: #1b9bb5; } .c-naranja { --dot: #e2701a; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 550; background: #eef0f3; color: var(--text-2); white-space: nowrap; }
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }
.tag-danger { background: var(--danger-soft); color: var(--danger); }
.tag-info { background: var(--info-soft); color: var(--info); }

/* ═══ CRM de cliente ═══════════════════════════════════ */
.strip { background: #fff8e6; border-bottom: 1px solid #f3dca4; color: #6b4a00; font-size: 13px; padding: 7px 24px; display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.strip a { color: #6b4a00; font-weight: 600; text-decoration: underline; }

.app-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 40; }
.app-header-in { max-width: 1320px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; gap: 28px; height: 60px; }
.marca { display: flex; align-items: center; gap: 10px; min-width: 0; }
.marca-logo { width: 34px; height: 34px; border-radius: 8px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; overflow: hidden; }
.marca-logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; padding: 3px; }
.marca-nombre { font-weight: 700; font-size: 15px; line-height: 1.15; white-space: nowrap; }
.marca-sub { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.tabs { display: flex; gap: 2px; height: 100%; }
.tabs a { display: flex; align-items: center; padding: 0 12px; color: var(--text-2); font-weight: 550; font-size: 13.5px; border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none; }
.tabs a:hover { color: var(--text); }
.tabs a.activo { color: var(--text); border-bottom-color: var(--accent); }
.tabs .cuenta { margin-left: 6px; background: #eef0f3; color: var(--text-2); font-size: 11.5px; padding: 0 6px; border-radius: 99px; }
.header-der { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.menu-usuario { position: relative; }
.menu-usuario > summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 5px 8px; border-radius: var(--radius); }
.menu-usuario > summary::-webkit-details-marker { display: none; }
.menu-usuario > summary:hover { background: #eef0f3; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: #e4e7ec; color: var(--text-2); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.menu-usuario .nombre { font-size: 13px; font-weight: 600; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-lista { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); min-width: 220px; padding: 6px; z-index: 50; }
.menu-lista .quien { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; font-size: 12.5px; color: var(--text-3); }
.menu-lista .quien b { display: block; color: var(--text); font-size: 13.5px; }
.menu-lista a, .menu-lista button { display: flex; width: 100%; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 6px; font-size: 13.5px; color: var(--text); background: none; border: none; cursor: pointer; text-align: left; text-decoration: none; }
.menu-lista a:hover, .menu-lista button:hover { background: #f1f3f5; }

.page { max-width: 1320px; margin: 0 auto; padding: 24px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { color: var(--text-3); font-size: 13.5px; margin-top: 3px; }
.periodo { display: flex; align-items: center; gap: 6px; }
.periodo label { font-size: 13px; color: var(--text-3); }
.periodo select { height: 36px; border: 1px solid var(--border-2); border-radius: var(--radius); padding: 0 30px 0 10px; background: var(--surface); font-weight: 600; font-size: 13.5px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
@media (max-width: 900px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; box-shadow: var(--shadow); }
.stat .l { font-size: 12.5px; color: var(--text-3); font-weight: 550; }
.stat .v { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .d { font-size: 12px; color: var(--text-3); margin-top: 2px; }

.filtros { display: flex; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; align-items: center; }
.buscador { position: relative; flex: 1; min-width: 220px; max-width: 360px; }
.buscador .icon { position: absolute; left: 10px; top: 10px; color: var(--text-3); }
.buscador input { width: 100%; height: 36px; border: 1px solid var(--border-2); border-radius: var(--radius); padding: 0 10px 0 32px; background: var(--surface); }
.filtros select { height: 36px; border: 1px solid var(--border-2); border-radius: var(--radius); padding: 0 8px; background: var(--surface); max-width: 190px; font-size: 13px; }
.filtros select.con-valor { border-color: var(--accent); background: var(--accent-soft); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-2 .card + .card { margin-top: 0; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
.seccion { margin-top: 24px; }
.seccion-titulo { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; gap: 12px; }
.seccion-titulo p { color: var(--text-3); font-size: 12.5px; }

/* barras horizontales */
.barras { display: flex; flex-direction: column; gap: 8px; }
.barra { display: grid; grid-template-columns: minmax(90px, 150px) 1fr 64px; gap: 10px; align-items: center; font-size: 12.5px; }
.barra .n { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barra .t { display: block; height: 10px; background: #eef0f3; border-radius: 99px; overflow: hidden; }
.barra .f { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.barra .f.resalto { background: var(--text); }
.barra .v { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); }
.barra .v b { color: var(--text); font-weight: 650; }

/* informe cargado por Web360 (HTML de los CRM viejos) */
.informe { margin-bottom: 20px; }
.informe .kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.informe .kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.informe .kpi .lbl { font-size: 12.5px; color: var(--text-3); font-weight: 550; }
.informe .kpi .val { font-size: 22px; font-weight: 700; margin-top: 4px; }
.informe .kpi .delta { font-size: 12px; font-weight: 600; margin-top: 2px; }
.informe .kpi .foot { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.informe .up { color: var(--ok); } .informe .down { color: var(--danger); } .informe .warn { color: var(--warn); }
.informe .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .informe .grid2 { grid-template-columns: 1fr; } }
.informe .box { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; }
.informe .box h3 { margin-bottom: 2px; }
.informe .box .sub { font-size: 12.5px; color: var(--text-3); margin-bottom: 12px; }
.informe .barrow { display: grid; grid-template-columns: 110px 1fr 70px; gap: 10px; align-items: center; margin-bottom: 8px; font-size: 12.5px; }
.informe .barrow .bl { text-align: right; color: var(--text-2); }
.informe .barrow .track { height: 10px; background: #eef0f3; border-radius: 99px; overflow: hidden; }
.informe .barrow .fill { height: 100%; border-radius: 99px; font-size: 0; }
.informe .barrow .bv { color: var(--text-3); font-size: 12px; }
.informe .plan-item { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid #eef0f3; font-size: 13px; }
.informe .plan-item:last-child { border-bottom: none; }
.informe .plan-pri { flex-shrink: 0; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 5px; height: fit-content; }
.informe .pri1 { background: var(--danger-soft); color: var(--danger); } .informe .pri2 { background: var(--warn-soft); color: var(--warn); } .informe .pri3 { background: var(--info-soft); color: var(--info); }

/* ── Panel lateral (ficha) ─────────────────────────────── */
.velo { position: fixed; inset: 0; background: rgba(16, 24, 40, .35); z-index: 90; opacity: 0; pointer-events: none; transition: opacity .15s; }
.velo.abierto { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--surface);
  z-index: 100; box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .18s ease;
}
.drawer.abierto { transform: none; }
.drawer-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; gap: 12px; align-items: flex-start; }
.drawer-head .t { font-size: 16px; font-weight: 700; }
.drawer-head .s { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.drawer-head .btn { margin-left: auto; }
.drawer-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.drawer-foot { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: center; background: var(--surface-2); }
.drawer-foot .msg { font-size: 13px; margin-right: auto; }
.msg.ok { color: var(--ok); } .msg.error { color: var(--danger); }
.bloque + .bloque { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.bloque-t { font-size: 12px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 12px; }
.notas { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.nota { border-left: 3px solid var(--border-2); padding: 2px 0 2px 12px; }
.nota .meta { font-size: 12px; color: var(--text-3); margin-bottom: 2px; }
.nota .txt { font-size: 13.5px; white-space: pre-wrap; word-break: break-word; }
.nota-form { display: flex; gap: 8px; align-items: flex-end; }
.nota-form textarea { flex: 1; min-height: 40px; height: 40px; }

/* ── Modales (dialog) ──────────────────────────────────── */
dialog.modal { border: none; border-radius: 12px; padding: 0; width: min(520px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); color: var(--text); margin: auto; }
dialog.modal.ancho { width: min(720px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(16, 24, 40, .4); }
.modal-head { padding: 16px 20px 0; display: flex; align-items: flex-start; gap: 12px; }
.modal-head h2 { font-size: 16px; }
.modal-head p { font-size: 13px; color: var(--text-3); margin-top: 3px; }
.modal-head .btn { margin-left: auto; margin-top: -4px; }
.modal-body { padding: 16px 20px; max-height: 70vh; overflow-y: auto; }
.modal-body.legal { font-size: 13.5px; line-height: 1.6; color: var(--text-2); }
.modal-body.legal h4 { color: var(--text); font-size: 13.5px; margin: 14px 0 4px; }
.modal-body.legal h4:first-child { margin-top: 0; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; align-items: center; background: var(--surface-2); border-radius: 0 0 12px 12px; }
.modal-foot .msg { margin-right: auto; font-size: 13px; }

/* tickets */
.tickets { display: flex; flex-direction: column; }
.ticket { padding: 14px 18px; border-bottom: 1px solid var(--border); }
.ticket:last-child { border-bottom: none; }
.ticket-top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.ticket-top .fecha { color: var(--text-3); margin-left: auto; font-size: 12.5px; }
.ticket-desc { margin-top: 6px; font-size: 13.5px; white-space: pre-wrap; word-break: break-word; }
.ticket-resp { margin-top: 8px; padding: 8px 12px; background: var(--surface-2); border-radius: var(--radius); font-size: 13px; border: 1px solid var(--border); }
.ticket-resp b { font-weight: 600; }
.ticket-admin { display: grid; grid-template-columns: 170px 1fr auto; gap: 8px; margin-top: 10px; align-items: end; }
@media (max-width: 700px) { .ticket-admin { grid-template-columns: 1fr; } }

footer.pie { max-width: 1320px; margin: 0 auto; padding: 20px 24px 36px; font-size: 12.5px; color: var(--text-3); display: flex; gap: 16px; flex-wrap: wrap; }
footer.pie a { color: var(--text-3); text-decoration: underline; }
footer.pie .der { margin-left: auto; }

/* ═══ Panel Web360 (superadmin) ════════════════════════ */
.admin-layout { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar .marca { padding: 16px 18px; border-bottom: 1px solid var(--border); }
.sidebar nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; color: var(--text-2); font-weight: 550; font-size: 13.5px; text-decoration: none; }
.sidebar nav a:hover { background: #f1f3f5; color: var(--text); }
.sidebar nav a.activo { background: var(--accent-soft); color: var(--accent); }
.sidebar nav .badge { margin-left: auto; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 0 6px; min-width: 18px; text-align: center; }
.sidebar .yo { padding: 12px 18px; border-top: 1px solid var(--border); font-size: 12.5px; }
.sidebar .yo b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.sidebar .yo .acciones { margin-top: 8px; }
.admin-main { min-width: 0; }
.admin-main .page { max-width: 1180px; }
@media (max-width: 860px) {
  .admin-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
}
.filtros-admin { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.filtros-admin input, .filtros-admin select { height: 34px; border: 1px solid var(--border-2); border-radius: var(--radius); padding: 0 10px; background: #fff; font-size: 13px; }
.subnav { display: flex; gap: 4px; flex-wrap: wrap; }
.subnav a { padding: 6px 10px; border-radius: 6px; font-size: 13px; color: var(--text-2); font-weight: 550; text-decoration: none; }
.subnav a.activo { background: #e9ecf0; color: var(--text); }
.colores { display: flex; gap: 16px; flex-wrap: wrap; }
.colores .campo { flex-direction: row; align-items: center; gap: 8px; }
details.avanzado > summary { cursor: pointer; font-weight: 600; font-size: 13.5px; padding: 14px 18px; list-style: none; display: flex; align-items: center; gap: 8px; }
details.avanzado > summary::-webkit-details-marker { display: none; }
details.avanzado > summary::before { content: '▸'; color: var(--text-3); }
details.avanzado[open] > summary::before { content: '▾'; }
details.avanzado[open] > summary { border-bottom: 1px solid var(--border); }

/* ═══ Login ═════════════════════════════════════════════ */
body.auth { background: var(--bg); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-box { width: 100%; max-width: 380px; }
.auth-marca { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; justify-content: center; }
.auth-marca .marca-logo { background: #171c26; }
.auth-marca .marca-nombre { font-size: 16px; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 26px 24px; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 18px; margin-bottom: 4px; }
.auth-card .intro { color: var(--text-3); font-size: 13.5px; margin-bottom: 18px; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; }
.auth-nota { text-align: center; font-size: 12.5px; color: var(--text-3); margin-top: 16px; }
pre.log { background: #171c26; color: #e4e7ec; border-radius: var(--radius); padding: 12px; font-size: 12px; white-space: pre-wrap; margin-bottom: 14px; max-height: 320px; overflow: auto; }

@media (max-width: 760px) {
  .app-header-in { height: auto; flex-wrap: wrap; padding: 10px 16px 0; gap: 8px 16px; }
  .tabs { order: 3; width: 100%; height: 42px; overflow-x: auto; }
  .page { padding: 16px; }
  .marca-sub { display: none; }
  .menu-usuario .nombre { display: none; }
  .stat .v { font-size: 19px; }
  .stat { padding: 12px; }
}

/* ═══ Editor de estructura (rubros) ═══════════════════════ */
.ed-sec { padding: 18px; border-bottom: 1px solid var(--border); }
.ed-sec:last-child { border-bottom: none; }
.ed-tit { margin-bottom: 12px; }
.ed-tit p { font-size: 12.5px; color: var(--text-3); margin-top: 2px; max-width: 760px; }
.ed-lista { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.ed-fila { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.ed-fila-est { align-items: center; padding: 6px 10px; }
.ed-fila-est .input { flex: 1; max-width: 340px; height: 32px; }
.ed-fila-est .select { width: 130px; height: 32px; padding: 0 6px; }
.ed-fila-est .estado { width: 10px; }
.ed-grid { flex: 1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.ed-grid .ed-ancho { grid-column: 1 / -1; }
.ed-grid input, .ed-grid select, .ed-grid textarea { height: 32px !important; font-size: 13px !important; }
.ed-grid textarea { height: auto !important; min-height: 70px; }
.orden { display: flex; flex-direction: column; gap: 2px; }
.orden .btn { height: 22px; padding: 0 6px; }
.ed-borrar { color: var(--danger); }
.ed-checks { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.ed-atendible { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; margin-top: 12px; }
.ed-at-fila { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; }
.ed-at-fila .select { width: 120px; height: 30px; padding: 0 6px; }
@media (max-width: 900px) { .ed-grid { grid-template-columns: 1fr 1fr; } }
.plantilla-preview { font-size: 12.5px; color: var(--text-3); }
.plantilla-preview .estado { margin-right: 10px; font-weight: 500; }
