:root{--navy:#071a34;--blue:#0b5cff;--ink:#172033;--muted:#6b7280;--line:#e7ebf2;--bg:#f4f7fb;--white:#fff;--danger:#d92d20;--warn:#b54708;--green:#067647;--shadow:0 16px 42px rgba(7,26,52,.09)}*{box-sizing:border-box}html{scroll-behavior:smooth}body{margin:0;background:var(--bg);color:var(--ink);font-family:Inter,ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}a{color:inherit;text-decoration:none}button,input,select,textarea{font:inherit}.app-shell{min-height:100vh;display:grid;grid-template-columns:270px 1fr}.sidebar{position:sticky;top:0;height:100vh;background:linear-gradient(180deg,#071a34,#0b2448);color:#fff;padding:24px 18px;display:flex;flex-direction:column;z-index:30}.brand{display:flex;gap:12px;align-items:center;padding:4px 8px 26px}.brand>b,.login-brand>b{width:46px;height:46px;border-radius:15px;background:linear-gradient(135deg,#68a5ff,#0b5cff);display:grid;place-items:center;color:#fff;box-shadow:0 10px 30px rgba(11,92,255,.35)}.brand span{display:flex;flex-direction:column}.brand small,.user-card small{color:#9fb2cd;font-size:12px;margin-top:3px}.sidebar nav{display:grid;gap:7px}.nav-link{display:flex;gap:12px;align-items:center;padding:12px 14px;border-radius:12px;color:#bfd0e7;transition:.2s}.nav-link:hover,.nav-link.active{background:rgba(255,255,255,.1);color:#fff;transform:translateX(3px)}.user-card{margin-top:auto;padding:14px 10px;border-top:1px solid rgba(255,255,255,.12);display:grid;grid-template-columns:38px 1fr auto;gap:10px;align-items:center}.user-card span:nth-child(2){display:flex;flex-direction:column;min-width:0}.user-card strong{font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.user-card>a{font-size:12px;color:#bdd0e9}.avatar{width:38px;height:38px;border-radius:50%;background:#fff;color:var(--navy);display:grid;place-items:center;font-weight:800}.workspace{min-width:0}.topbar{height:78px;background:rgba(255,255,255,.9);backdrop-filter:blur(12px);border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;padding:0 34px;position:sticky;top:0;z-index:20}.topbar>div{display:flex;flex-direction:column}.topbar small{color:var(--muted);font-size:12px;margin-top:3px}.menu{display:none;border:0;background:transparent;font-size:24px}.main{padding:32px;max-width:1500px;margin:auto;animation:enter .35s ease}.hero{background:radial-gradient(circle at 90% 10%,rgba(104,165,255,.38),transparent 35%),linear-gradient(135deg,#071a34,#0b5cff);border-radius:24px;padding:36px;color:#fff;display:flex;justify-content:space-between;align-items:end;box-shadow:var(--shadow);overflow:hidden}.hero span,.section-head>div>small{text-transform:uppercase;letter-spacing:.12em;font-weight:800;font-size:11px}.hero h1{font-size:34px;max-width:700px;margin:10px 0}.hero p{color:#d7e4f6;margin:0}.btn{display:inline-flex;align-items:center;justify-content:center;border:0;background:var(--blue);color:#fff;border-radius:11px;padding:11px 16px;font-weight:750;cursor:pointer;transition:.2s}.btn:hover{transform:translateY(-1px);box-shadow:0 8px 20px rgba(11,92,255,.22)}.btn.light{background:#fff;color:var(--navy)}.btn.sec{background:#edf3ff;color:#164da8}.btn.dan{background:#fff0ee;color:var(--danger)}.btn.sm{padding:8px 11px;font-size:12px}.btn.wide{width:100%}.btn.disabled{opacity:.45;pointer-events:none}.stats{display:grid;grid-template-columns:repeat(4,1fr);gap:18px;margin:22px 0}.stats article,.card,.form-card,.process-card,.brand-card{background:#fff;border:1px solid var(--line);border-radius:18px;box-shadow:0 8px 24px rgba(7,26,52,.05)}.stats article{padding:22px;display:flex;flex-direction:column}.stats b{font-size:31px;color:var(--navy)}.stats span{color:var(--muted);margin-top:5px}.card{margin:20px 0;padding:22px}.section-head,.page-head,.brand-card-head{display:flex;justify-content:space-between;gap:20px;align-items:flex-start}.section-head h2,.page-head h1,.brand-card h2{margin:5px 0}.section-head p,.page-head p,.brand-card p{margin:0;color:var(--muted)}.pill,.badge{display:inline-flex;border-radius:999px;padding:5px 9px;font-size:11px;font-weight:800}.pill.danger,.st-danger{background:#fee4e2;color:#b42318}.pill.warn,.st-warn,.st-grace{background:#fff3d6;color:#a15c00}.pill.info,.st-info{background:#eaf2ff;color:#175cd3}.st-15{background:#ffe6df;color:#c4320a}.st-ok{background:#dcfae6;color:#067647}.st-muted{background:#eef1f5;color:#667085}.alert-list{display:grid;gap:9px;margin-top:18px}.alert-row{display:grid;grid-template-columns:38px 1fr auto;align-items:center;gap:12px;padding:14px;border:1px solid var(--line);border-radius:14px;background:#fbfcfe}.alert-row>b{width:32px;height:32px;border-radius:10px;display:grid;place-items:center}.alert-row.critical>b{background:#fee4e2;color:#b42318}.alert-row.urgent>b{background:#fff3d6;color:#a15c00}.alert-row span,.alert-row em{display:flex;flex-direction:column}.alert-row small{color:var(--muted);margin-top:3px;font-style:normal}.alert-row em{text-align:right;font-style:normal}.table-wrap{overflow:auto;margin:0 -22px -22px}table{width:100%;border-collapse:collapse;min-width:720px}th,td{text-align:left;padding:14px 18px;border-bottom:1px solid var(--line);font-size:13px}th{color:#667085;background:#fafbfc;font-size:11px;text-transform:uppercase;letter-spacing:.05em}.empty{text-align:center;color:var(--muted);padding:28px}.warning,.error{padding:13px 15px;border-radius:12px;margin:16px 0;background:#fff3d6;color:#854a0e}.flash{background:#e7f8ee;color:#067647;padding:13px 15px;border-radius:12px;margin-bottom:18px;display:flex;justify-content:space-between}.flash button{border:0;background:none;color:inherit;font-size:18px}.form-card{margin:20px 0;padding:0 22px 22px}.form-card summary,.mini-form summary,.grant-box summary{cursor:pointer;font-weight:800;padding:20px 0}.form-card form{border-top:1px solid var(--line);padding-top:18px}.grid2,.grid3{display:grid;grid-template-columns:repeat(2,1fr);gap:14px}.grid3{grid-template-columns:repeat(3,1fr)}label{display:flex;flex-direction:column;gap:7px;font-size:12px;font-weight:750;color:#344054;margin-bottom:14px}input,select,textarea{width:100%;border:1px solid #d9e0ea;border-radius:10px;padding:11px 12px;background:#fff;color:var(--ink);outline:none}input:focus,select:focus,textarea:focus{border-color:#72a5ff;box-shadow:0 0 0 3px rgba(11,92,255,.1)}textarea{resize:vertical;min-height:88px}.actions,.card-actions,.modal-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.actions form{margin:0}.brand-card-tools{display:flex;gap:8px;align-items:center;flex-wrap:wrap;justify-content:flex-end}.brand-card-tools form{margin:0}.brand-grid,.template-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px;margin-top:20px}.brand-card{padding:22px}.brand-card dl{display:grid;grid-template-columns:repeat(2,1fr);gap:12px;margin:20px 0}.brand-card dl div{background:#f7f9fc;border-radius:12px;padding:12px}.brand-card dt,.process-meta small{font-size:10px;text-transform:uppercase;letter-spacing:.06em;color:var(--muted)}.brand-card dd{margin:5px 0 0;font-weight:700}.mini-form{width:100%}.mini-form form{display:grid;grid-template-columns:1fr 1fr;gap:8px;padding:12px;background:#f7f9fc;border-radius:12px}.mini-form textarea{grid-column:1/-1}.process-list{display:grid;gap:16px;margin-top:20px}.process-card{display:grid;grid-template-columns:1fr 280px;overflow:hidden}.process-main{padding:22px}.process-title h2{margin:8px 0 3px}.process-title p{margin:0;color:var(--muted)}.process-meta{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin:18px 0}.process-meta span{display:flex;flex-direction:column;gap:5px;padding:11px;background:#f7f9fc;border-radius:11px;font-weight:700}.notes{color:#475467}.grant-box{background:#f8faff;border-left:1px solid var(--line);padding:0 20px}.grant-box form{display:grid}.preview{background:#f7f9fc;border-radius:12px;padding:16px;color:#475467}.hint,.muted{color:var(--muted)}.modal{display:none;position:fixed;inset:0;background:rgba(7,26,52,.65);z-index:100;align-items:center;justify-content:center;padding:18px}.modal.show{display:flex}.modal-card{position:relative;background:#fff;border-radius:20px;width:min(620px,100%);padding:25px;box-shadow:var(--shadow);animation:enter .25s ease}.modal-close{position:absolute;right:15px;top:12px;border:0;background:none;font-size:26px}.auth-main{min-height:100vh;display:grid;place-items:center;padding:24px;background:radial-gradient(circle at 20% 10%,rgba(72,133,255,.25),transparent 30%),linear-gradient(145deg,#06152c,#0a2c59)}.login-card{width:min(430px,100%);background:#fff;border-radius:24px;padding:30px;box-shadow:0 30px 80px rgba(0,0,0,.28)}.login-brand{display:flex;gap:14px;align-items:center;margin-bottom:25px}.login-brand h1{margin:0}.login-brand p{margin:5px 0 0;color:var(--muted)}.switch{text-align:center;color:var(--muted);font-size:13px}.switch a{color:var(--blue);font-weight:800}.overlay{display:none}@keyframes enter{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}@media(max-width:1050px){.app-shell{grid-template-columns:1fr}.sidebar{position:fixed;left:-290px;width:270px;transition:.25s}.menu-open .sidebar{left:0}.overlay{position:fixed;inset:0;background:rgba(0,0,0,.45);z-index:25}.menu-open .overlay{display:block}.menu{display:block}.topbar{padding:0 20px}.main{padding:22px}.stats{grid-template-columns:repeat(2,1fr)}.grid3{grid-template-columns:repeat(2,1fr)}}@media(max-width:700px){.hero{padding:25px;display:block}.hero h1{font-size:27px}.hero .btn{margin-top:20px}.stats,.brand-grid,.template-grid,.grid2,.grid3{grid-template-columns:1fr}.process-card{grid-template-columns:1fr}.grant-box{border-left:0;border-top:1px solid var(--line)}.process-meta{grid-template-columns:1fr}.section-head,.page-head,.brand-card-head{flex-direction:column}.alert-row{grid-template-columns:34px 1fr}.alert-row em{grid-column:2;text-align:left}.topbar>.btn{display:none}.main{padding:16px}.brand-card dl{grid-template-columns:1fr}}

/* Refinamiento visual 2026 */
:root{--text-xs:11px;--text-sm:12px;--text-md:14px;--text-lg:18px;--text-xl:26px}
body{font-size:14px;line-height:1.45}.main{max-width:1500px;width:100%;margin:0 auto;padding:24px 28px}.topbar{height:66px}.topbar>div strong{font-size:14px}.topbar>div small{font-size:11px}.page-head h1{font-size:26px;line-height:1.18;letter-spacing:-.025em}.page-head p{font-size:13px}.section-head h2,.brand-card h2,.template-card h2{font-size:17px;line-height:1.25}.btn{padding:9px 14px;border-radius:10px;font-size:13px}.btn.sm{padding:7px 10px;font-size:11px}.card,.brand-card,.form-card,.process-card{border-radius:15px}.card,.brand-card{padding:18px}.form-card{padding:0 18px 18px}.form-card summary{padding:16px 0;font-size:14px}.grid2,.grid3{gap:12px}label{font-size:11px;gap:6px;margin-bottom:11px}input,select,textarea{padding:9px 11px;border-radius:9px;font-size:13px}textarea{min-height:78px}.form-actions{display:flex;align-items:center;gap:9px;margin-top:4px}.brand-grid,.template-grid{gap:14px;margin-top:16px}.brand-card dl{gap:9px;margin:15px 0}.brand-card dl div{padding:10px}.brand-card dt{font-size:9px}.brand-card dd{font-size:13px}.badge,.pill{font-size:10px;padding:4px 8px}.hint{font-size:11px;margin-top:-3px}.brand-form{max-width:1120px}
.editor-layout{display:grid;grid-template-columns:minmax(0,1.05fr) minmax(330px,.95fr);gap:24px;border-top:1px solid var(--line);padding-top:18px}.template-editor form{border-top:0;padding-top:0}.live-preview-panel{position:sticky;top:82px;align-self:start;background:#f5f7fb;border:1px solid var(--line);border-radius:16px;padding:14px}.preview-label{font-size:10px;text-transform:uppercase;letter-spacing:.08em;font-weight:800;color:var(--muted);margin-bottom:10px}.device-preview{overflow:hidden;border-radius:15px;box-shadow:0 15px 40px rgba(7,26,52,.16)}.whatsapp-preview{background:#efeae2}.wa-header{height:54px;background:#075e54;color:#fff;display:flex;align-items:center;gap:9px;padding:0 12px}.wa-header strong,.wa-header small{display:block}.wa-header strong{font-size:12px}.wa-header small{font-size:9px;opacity:.8}.wa-back{font-size:25px}.wa-avatar{width:32px;height:32px;border-radius:50%;background:#d9e3e1;color:#075e54;display:grid;place-items:center;font-weight:800}.wa-icons{margin-left:auto;letter-spacing:.4em}.wa-wall{min-height:330px;padding:18px 14px;background-color:#efeae2;background-image:radial-gradient(rgba(0,0,0,.035) 1px,transparent 1px);background-size:10px 10px}.wa-bubble{position:relative;margin-left:auto;max-width:82%;background:#d9fdd3;border-radius:9px 3px 9px 9px;padding:9px 9px 20px;font-size:12px;white-space:pre-wrap;box-shadow:0 1px 1px rgba(0,0,0,.12)}.wa-bubble:after{content:"";position:absolute;right:-7px;top:0;border-left:8px solid #d9fdd3;border-bottom:8px solid transparent}.wa-bubble img{width:100%;max-height:150px;object-fit:cover;border-radius:7px;margin-bottom:7px}.wa-bubble time,.mini-wa-bubble time{position:absolute;right:7px;bottom:4px;font-size:8px;color:#667781}.email-preview{background:#edf1f7}.mail-toolbar{height:48px;background:#fff;display:flex;align-items:center;justify-content:space-between;padding:0 15px;border-bottom:1px solid #e5e7eb;font-size:12px}.mail-sheet{margin:12px;background:#fff;border-radius:10px;padding:17px;min-height:322px;box-shadow:0 4px 16px rgba(0,0,0,.08)}.mail-meta{display:flex;align-items:center;gap:10px}.mail-avatar{width:34px;height:34px;border-radius:50%;background:#0b5cff;color:#fff;display:grid;place-items:center;font-size:10px;font-weight:800}.mail-meta strong,.mail-meta small{display:block}.mail-meta strong{font-size:12px}.mail-meta small{font-size:9px;color:#667085}.mail-sheet h3{font-size:17px;margin:17px 0 12px}.mail-sheet>img{width:100%;max-height:140px;object-fit:cover;border-radius:8px;margin-bottom:10px}.mail-accent{height:4px;border-radius:999px;background:#0b5cff;margin:8px 0 14px}.mail-sheet #emailPreviewBody{font-size:12px;white-space:pre-wrap;color:#344054}.email-preview{display:none}.template-card{margin:0}.mini-wa{border-radius:12px;overflow:hidden;background:#efeae2;border:1px solid #d8ddd9}.mini-wa-bar{background:#075e54;color:#fff;padding:9px 12px;font-size:10px;font-weight:800}.mini-wa-wall{min-height:180px;padding:13px}.mini-wa-bubble{position:relative;margin-left:auto;max-width:88%;background:#d9fdd3;border-radius:8px 3px 8px 8px;padding:8px 8px 19px;font-size:11px;white-space:normal}.mini-wa-bubble img{display:block;width:100%;max-height:105px;object-fit:cover;border-radius:6px;margin-bottom:6px}.mini-mail{border:1px solid #e2e6ec;border-radius:12px;overflow:hidden}.mini-mail-head{padding:12px;background:#f8fafc}.mini-mail-head b,.mini-mail-head small{display:block}.mini-mail-head b{font-size:12px}.mini-mail-head small{font-size:9px;color:#667085;margin-top:3px}.mini-mail>img{display:block;width:100%;max-height:120px;object-fit:cover}.mini-mail-accent{height:4px;background:var(--accent)}.mini-mail-body{padding:13px;font-size:11px;line-height:1.5;color:#344054}.template-card .section-head{margin-bottom:13px}
@media(max-width:980px){.editor-layout{grid-template-columns:1fr}.live-preview-panel{position:static}.main{padding:20px}.page-head h1{font-size:23px}}
@media(max-width:700px){.main{padding:14px}.card,.brand-card{padding:15px}.form-card{padding:0 15px 15px}.page-head h1{font-size:21px}.editor-layout{gap:16px}.wa-wall{min-height:280px}}

.field-help{font-size:10px;color:var(--muted);font-weight:500;margin-top:-2px}select option{color:#172033;background:#fff}

/* Filtros de marcas */
.filter-card{margin:18px 0 4px;background:#fff;border:1px solid var(--line);border-radius:15px;padding:16px 18px;box-shadow:0 8px 24px rgba(7,26,52,.045)}
.brand-filters{display:grid;grid-template-columns:minmax(250px,1.5fr) repeat(3,minmax(145px,.75fr)) auto;gap:11px;align-items:end}
.brand-filters label{margin:0}.brand-filters .filter-search input{min-width:0}.filter-actions{display:flex;gap:7px;align-items:center;padding-bottom:1px}.filter-summary{margin-top:11px;padding-top:10px;border-top:1px solid var(--line);font-size:12px;color:var(--muted)}.filter-summary strong{color:var(--navy);font-size:14px}
@media(max-width:1180px){.brand-filters{grid-template-columns:repeat(2,minmax(0,1fr))}.filter-actions{align-self:end}}
@media(max-width:700px){.filter-card{padding:14px}.brand-filters{grid-template-columns:1fr}.filter-actions .btn{flex:1}}

@media(max-width:700px){.brand-card-tools{width:100%;justify-content:flex-start}.brand-card-tools .btn{flex:1}}

/* Filtros horizontales y búsqueda instantánea de marcas */
.brand-filters{
  display:grid;
  grid-template-columns:minmax(260px,1.7fr) minmax(145px,.8fr) minmax(135px,.7fr) minmax(175px,.95fr) auto;
  max-width:none;
  width:100%;
  align-items:end;
  gap:10px;
}
.brand-filters label{width:100%;min-width:0;margin:0}
.brand-filters input,.brand-filters select{min-width:0;height:42px}
.brand-filters .filter-actions{padding-bottom:0;justify-content:flex-end;flex-wrap:nowrap}
.brand-filters .filter-actions .btn{min-width:112px;height:42px;white-space:nowrap;padding:9px 13px}
.brand-card[hidden]{display:none!important}
.brand-card.live-priority{outline:2px solid rgba(11,92,255,.16);outline-offset:1px}
#brandLiveEmpty{grid-column:1/-1;margin:0}
@media(max-width:1250px){
  .brand-filters{grid-template-columns:minmax(240px,1.5fr) repeat(3,minmax(135px,1fr))}
  .brand-filters .filter-actions{grid-column:1/-1;justify-content:flex-end}
}
@media(max-width:860px){
  .brand-filters{grid-template-columns:repeat(2,minmax(0,1fr))}
  .brand-filters .filter-search{grid-column:1/-1}
  .brand-filters .filter-actions{grid-column:1/-1}
}
@media(max-width:560px){
  .brand-filters{grid-template-columns:1fr}
  .brand-filters .filter-search,.brand-filters .filter-actions{grid-column:auto}
  .brand-filters .filter-actions{display:grid;grid-template-columns:1fr;justify-content:stretch}
  .brand-filters .filter-actions .btn{width:100%}
}

/* Historial de trámites por marca */
.brand-history{margin-top:18px;border-top:1px solid var(--line);padding-top:4px}
.brand-history>summary{list-style:none;cursor:pointer;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px 2px 10px;font-size:13px;font-weight:800;color:var(--navy)}
.brand-history>summary::-webkit-details-marker{display:none}
.brand-history>summary:after{content:'+';font-size:20px;font-weight:500;color:var(--muted);order:3}
.brand-history[open]>summary:after{content:'−'}
.brand-history>summary b{min-width:25px;height:25px;border-radius:999px;background:#edf3ff;color:#164da8;display:grid;place-items:center;font-size:11px;margin-left:auto}
.history-timeline{position:relative;display:grid;gap:0;padding:4px 0 2px 13px}
.history-timeline:before{content:'';position:absolute;left:18px;top:13px;bottom:18px;width:2px;background:#dfe7f2}
.history-item{position:relative;display:grid;grid-template-columns:22px 1fr;gap:10px;padding:8px 0 14px}
.history-dot{width:12px;height:12px;border-radius:50%;background:var(--blue);border:3px solid #eaf2ff;box-shadow:0 0 0 2px #fff;margin-top:4px;z-index:1}
.history-content{min-width:0;border:1px solid var(--line);border-radius:12px;background:#fbfcfe;padding:12px 13px}
.history-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
.history-head strong{font-size:12px;color:var(--navy)}
.history-head time{font-size:11px;color:var(--muted);white-space:nowrap}
.history-content p{font-size:12px;line-height:1.55;margin:8px 0;color:#475467;overflow-wrap:anywhere}
.history-content small{display:block;font-size:10px;color:#98a2b3;margin-top:7px}
.history-muted,.history-empty{color:var(--muted)!important}
.history-empty{font-size:12px;padding:12px 3px 15px}
.process-entry{position:relative}
.process-entry form{min-width:290px;max-width:390px;padding:14px;margin-top:8px;border:1px solid var(--line);border-radius:13px;background:#fbfcfe;box-shadow:0 12px 28px rgba(7,26,52,.08)}
.process-entry label{margin-bottom:10px}
.process-entry textarea{min-height:75px}
@media(max-width:700px){.history-head{flex-direction:column;gap:4px}.process-entry form{min-width:0;width:100%}.card-actions>.process-entry{width:100%}}

/* Botones desplegables para crear y editar registros */
.record-form{padding:0!important;overflow:hidden;border:0!important;background:transparent!important;box-shadow:none!important;margin-bottom:18px}
.record-form-toggle{list-style:none;display:flex!important;align-items:center;gap:12px;width:100%;max-width:560px;padding:13px 15px!important;border:1px solid #d7e3f4;border-radius:14px;background:linear-gradient(135deg,#0b5cff,#164da8);color:#fff!important;cursor:pointer;box-shadow:0 8px 20px rgba(11,92,255,.16);transition:transform .18s ease,box-shadow .18s ease,filter .18s ease}
.record-form-toggle::-webkit-details-marker{display:none}
.record-form-toggle:hover{transform:translateY(-1px);box-shadow:0 11px 25px rgba(11,92,255,.22);filter:saturate(1.05)}
.record-form-toggle .record-form-icon{width:30px;height:30px;flex:0 0 30px;border-radius:9px;background:rgba(255,255,255,.17);display:grid;place-items:center;font-size:21px;line-height:1;font-weight:500;transition:transform .2s ease}
.record-form-toggle>span:nth-child(2){display:flex;flex-direction:column;align-items:flex-start;min-width:0;line-height:1.2}
.record-form-toggle strong{font-size:13px;color:#fff;letter-spacing:.01em}
.record-form-toggle small{display:block;margin-top:4px;font-size:10.5px;font-weight:500;color:rgba(255,255,255,.78)}
.record-form-chevron{margin-left:auto;font-size:18px;transition:transform .2s ease}
.record-form[open] .record-form-icon{transform:rotate(45deg)}
.record-form[open] .record-form-chevron{transform:rotate(180deg)}
.record-form>form,.record-form>.editor-layout{margin-top:12px;padding:18px;border:1px solid var(--line);border-radius:16px;background:#fff;box-shadow:0 9px 25px rgba(7,26,52,.06)}
.record-form>form .form-actions{margin-top:16px}

/* Historial de trámites: lectura amplia y sin empalmes */
.brand-history{margin-top:20px;padding-top:12px;border-top:1px solid var(--line)}
.brand-history>summary{padding:12px 13px;border:1px solid #e0e8f3;border-radius:12px;background:#f8fafc;transition:background .18s ease,border-color .18s ease}
.brand-history>summary:hover{background:#f2f6fb;border-color:#ccd9e9}
.brand-history[open]>summary{background:#eef5ff;border-color:#cbdcff;margin-bottom:14px}
.history-timeline{padding:2px 0 4px 18px;gap:5px}
.history-timeline:before{left:24px;top:18px;bottom:23px;background:#d6e2f1}
.history-item{grid-template-columns:26px minmax(0,1fr);gap:13px;padding:7px 0 17px}
.history-dot{width:13px;height:13px;margin-top:18px;border:3px solid #e8f1ff;box-shadow:0 0 0 3px #fff}
.history-content{padding:16px;border-radius:15px;background:#fff;box-shadow:0 6px 18px rgba(15,35,65,.05)}
.history-head{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:16px;padding-bottom:13px;border-bottom:1px solid #edf1f6}
.history-title{display:flex;align-items:center;gap:10px;min-width:0}
.history-type-icon{width:30px;height:30px;flex:0 0 30px;border-radius:9px;background:#eaf2ff;color:#0b5cff;display:grid;place-items:center;font-weight:900;font-size:13px}
.history-title>div{display:flex;flex-direction:column;gap:3px;min-width:0}
.history-head strong{font-size:13px;line-height:1.3;color:var(--navy);overflow-wrap:anywhere}
.history-title small{font-size:10px;color:#8793a5}
.history-head time{min-width:126px;padding:8px 10px;border-radius:10px;background:#f5f7fa;text-align:right;font-size:11.5px;font-weight:800;color:#344054;line-height:1.3}
.history-head time span{display:block;margin-bottom:3px;font-size:9px;font-weight:600;text-transform:uppercase;letter-spacing:.04em;color:#98a2b3}
.history-notes{padding-top:13px}
.history-notes-label{display:block;margin-bottom:7px;font-size:9.5px;font-weight:800;text-transform:uppercase;letter-spacing:.05em;color:#667085}
.history-notes p{margin:0;padding:11px 12px;border-radius:10px;background:#f8fafc;font-size:11.5px;line-height:1.62;color:#475467;white-space:normal;overflow-wrap:anywhere}
.history-notes .history-muted{font-style:italic}
.history-captured{margin-top:10px;font-size:9.5px;color:#98a2b3;text-align:right}
.history-empty{padding:18px;border:1px dashed #d8e2ee;border-radius:12px;background:#fafcff;text-align:center}

@media(max-width:700px){
  .record-form-toggle{max-width:none;padding:12px 13px!important}
  .record-form-toggle small{display:none}
  .record-form>form,.record-form>.editor-layout{padding:14px}
  .history-head{grid-template-columns:1fr;gap:10px}
  .history-head time{width:100%;text-align:left;min-width:0}
  .history-captured{text-align:left}
  .history-timeline{padding-left:9px}
  .history-timeline:before{left:15px}
  .history-item{grid-template-columns:20px minmax(0,1fr);gap:9px}
  .history-content{padding:13px}
}


/* Historial continuo en marcas en proceso */
.process-card-history .process-main{min-width:0}
.process-card-history .brand-history{margin-top:20px}
.process-card-history .card-actions{align-items:flex-start}
.process-card-history .process-entry{width:auto}
.process-card-history .grant-box textarea{min-height:86px}
@media(max-width:1050px){
  .process-card-history{grid-template-columns:1fr}
  .process-card-history .grant-box{border-left:0;border-top:1px solid var(--line)}
}
@media(max-width:700px){
  .process-card-history .process-meta{grid-template-columns:1fr}
  .process-card-history .card-actions>.btn,.process-card-history .card-actions>a.btn{flex:1}
  .process-card-history .process-entry{width:100%}
}


/* Edición de antecedentes del historial */
.history-audit-row{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:7px 14px;margin-top:11px;font-size:9.5px;color:#98a2b3}
.history-audit-row span{display:inline-flex;align-items:center;gap:5px}
.history-audit-row .history-updated{color:#0b5cff;font-weight:700}
.history-edit{margin-top:12px;border-top:1px solid #edf1f6;padding-top:10px}
.history-edit>summary{display:inline-flex;align-items:center;gap:7px;padding:7px 10px;border:1px solid #d7e3f4;border-radius:9px;background:#f7faff;color:#164da8;font-size:10.5px;font-weight:800;cursor:pointer;list-style:none}
.history-edit>summary::-webkit-details-marker{display:none}
.history-edit>summary:before{content:'✎';font-size:12px}
.history-edit[open]>summary{background:#eaf2ff;border-color:#bfd3f3}
.history-edit form{display:grid;grid-template-columns:minmax(150px,.8fr) minmax(150px,.7fr) minmax(220px,1.5fr);gap:10px;margin-top:11px;padding:13px;border:1px solid #e2e8f0;border-radius:12px;background:#fbfcfe}
.history-edit form label{margin:0;font-size:10px}
.history-edit form textarea{min-height:68px}
.history-edit .form-actions{grid-column:1/-1;margin:0;justify-content:flex-end}
@media(max-width:850px){.history-edit form{grid-template-columns:1fr 1fr}.history-edit form label:last-of-type{grid-column:1/-1}}
@media(max-width:600px){.history-audit-row{justify-content:flex-start}.history-edit form{grid-template-columns:1fr}.history-edit form label:last-of-type,.history-edit .form-actions{grid-column:auto}.history-edit .form-actions .btn{width:100%}}

/* Identidad visual configurable IMAGENiOS */
:root{--blue:var(--primary,#08aeca);--navy:var(--primary-dark,#087f94);--ink:var(--text,#172033)}
body{font-family:var(--app-font,Inter,Arial,sans-serif);font-size:var(--base-font-size,14px);color:var(--text,#172033)}
h1{font-size:calc(2em * var(--heading-scale,1))}h2{font-size:calc(1.5em * var(--heading-scale,1))}h3{font-size:calc(1.17em * var(--heading-scale,1))}
.btn{background:var(--primary,#08aeca);color:var(--button-text,#fff)}
.btn:hover{box-shadow:0 8px 20px color-mix(in srgb,var(--primary,#08aeca) 25%,transparent)}
.btn.sec{background:color-mix(in srgb,var(--primary,#08aeca) 12%,white);color:var(--primary-dark,#087f94)}
.sidebar{background:linear-gradient(180deg,var(--primary-dark,#087f94),#063743)}
.hero{background:radial-gradient(circle at 90% 10%,rgba(255,255,255,.24),transparent 35%),linear-gradient(135deg,var(--primary-dark,#087f94),var(--primary,#08aeca))}
.record-form-toggle{background:linear-gradient(135deg,var(--primary,#08aeca),var(--primary-dark,#087f94));border-color:color-mix(in srgb,var(--primary,#08aeca) 40%,white)}
.brand img{width:116px;height:52px;object-fit:contain;object-position:left center;border-radius:0}.brand:has(img)>span{display:none}
.login-brand img{width:190px;max-height:80px;object-fit:contain;object-position:left center}.login-brand:has(img){display:block}.login-brand:has(img)>div{margin-top:12px}
.compact-filter{display:grid;grid-template-columns:minmax(260px,1.5fr) minmax(180px,.7fr) auto;gap:12px;align-items:end;padding:16px 18px;margin:18px 0}.compact-filter.process-filter{grid-template-columns:minmax(260px,1.4fr) minmax(180px,.8fr) minmax(130px,.45fr) auto}.compact-filter label{margin:0}.compact-filter .filter-actions{justify-content:flex-end}.compact-filter input,.compact-filter select,.compact-filter .btn{height:42px}
.settings-preview{display:flex;align-items:center;gap:18px}.settings-preview img{width:min(280px,100%);max-height:100px;object-fit:contain}.settings-preview span{color:var(--muted)}.settings-form h2{margin:24px 0 14px}.settings-form h2:first-of-type{margin-top:0}.color-grid{display:grid;grid-template-columns:repeat(5,minmax(130px,1fr));gap:12px}.color-control{display:flex;align-items:center;gap:9px;padding:8px;border:1px solid var(--line);border-radius:10px}.color-control input{width:42px;height:32px;padding:0;border:0}.color-control code{font-size:11px;color:var(--muted)}
@media(max-width:1050px){.compact-filter,.compact-filter.process-filter{grid-template-columns:repeat(2,minmax(0,1fr))}.compact-filter .filter-actions{grid-column:1/-1}.color-grid{grid-template-columns:repeat(3,1fr)}}
@media(max-width:650px){.compact-filter,.compact-filter.process-filter,.color-grid{grid-template-columns:1fr}.compact-filter .filter-actions{grid-column:auto;display:grid;grid-template-columns:1fr}.brand img{width:105px}.settings-preview{flex-direction:column;align-items:flex-start}}

/* Actualización de acceso, filtros instantáneos y editor enriquecido */
.login-brand-centered{display:flex!important;flex-direction:column;align-items:center;text-align:center;gap:12px;margin-bottom:24px}.login-brand-centered img{width:min(290px,92%);max-height:115px;object-fit:contain;object-position:center}.login-brand-centered p{margin:0;color:var(--muted)}
.rich-editor-wrap{margin:14px 0}.rich-toolbar{display:flex;flex-wrap:wrap;gap:6px;padding:9px;background:#f4f7fb;border:1px solid var(--line);border-bottom:0;border-radius:12px 12px 0 0}.rich-toolbar button,.rich-toolbar select{min-height:34px;border:1px solid #d9e1ec;border-radius:7px;background:#fff;padding:6px 9px;color:var(--text);cursor:pointer}.rich-toolbar button:hover{border-color:var(--primary);color:var(--primary-dark)}.rich-editor{min-height:235px;padding:15px;border:1px solid #d9e1ec;border-radius:0 0 12px 12px;background:#fff;line-height:1.6;overflow:auto}.rich-editor.plain-mode{white-space:pre-wrap;border-radius:12px}.email-social-footer{margin-top:24px;padding-top:17px;border-top:1px solid #e6ebf1;text-align:center}.email-social-icons{display:flex;justify-content:center;gap:9px;margin-bottom:14px}.email-social-icons a{width:32px;height:32px;border-radius:50%;display:inline-grid;place-items:center;background:var(--primary);color:#fff!important;text-decoration:none;font-weight:800;font-size:13px}.email-social-footer img{display:block!important;width:150px!important;max-height:58px!important;object-fit:contain!important;margin:0 auto!important}.mail-sheet #emailPreviewBody{white-space:normal}.mini-mail-body p:first-child{margin-top:0}.additional-filter{grid-template-columns:minmax(260px,1.5fr) minmax(170px,.6fr) auto}
[data-live-row][hidden],[data-client-card][hidden],[data-process-card][hidden]{display:none!important}
@media(max-width:700px){.rich-toolbar{gap:4px}.rich-toolbar button,.rich-toolbar select{font-size:12px;padding:5px 7px}.additional-filter{grid-template-columns:1fr}}

/* Correo HTML centrado y lienzo de 700 px */
.email-canvas{background:#eef1f4;padding:18px;overflow:auto}.email-canvas .mail-toolbar{margin:-18px -18px 18px}.email-canvas .mail-sheet.email-700{width:100%;max-width:700px;margin:0 auto;background:#fff;border-radius:12px;padding:28px 34px;box-sizing:border-box}.email-canvas .mail-sheet.email-700>img{width:calc(100% + 68px);max-width:none;max-height:none;height:auto;object-fit:contain;margin:-28px -34px 22px;border-radius:12px 12px 0 0}.email-mini-canvas{background:#eef1f4;padding:14px}.email-mini-canvas .mini-mail-head,.email-mini-canvas .mini-mail-accent,.email-mini-canvas .mini-mail-body{background:#fff}.email-mini-canvas .mini-mail-head{border-radius:9px 9px 0 0}.notification-filter{grid-template-columns:minmax(280px,1.6fr) minmax(150px,.45fr) auto}.table-sub{display:block;color:var(--muted);font-size:.8em;margin-top:4px}.message-detail summary{cursor:pointer;color:var(--primary-dark);font-weight:700;margin-top:5px}.message-detail>div{margin-top:8px;padding:10px;background:#f6f8fb;border-radius:8px;max-width:430px;white-space:normal;line-height:1.5}.pill.success{background:#e7f8ef;color:#147a45}
@media(max-width:760px){.email-canvas{padding:10px}.email-canvas .mail-toolbar{margin:-10px -10px 10px}.email-canvas .mail-sheet.email-700{padding:22px 18px}.email-canvas .mail-sheet.email-700>img{width:calc(100% + 36px);margin:-22px -18px 18px}.notification-filter{grid-template-columns:1fr}}

/* Personalización y exportación de notificaciones */
#notifyModal .modal-card{width:min(980px,94vw);max-height:92vh;overflow:auto}
.notify-customize{margin:14px 0;padding:16px;border:1px solid var(--line);border-radius:12px;background:#f8fafc}
.notify-customize h3{margin:0 0 4px}.notify-variable-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin-top:12px}.notify-variable-grid label{margin:0;text-transform:capitalize}.export-preview-wrap{margin:15px 0;border:1px solid var(--line);border-radius:12px;overflow:hidden;background:#eef1f4}.export-preview-head{display:flex;justify-content:space-between;padding:11px 14px;background:#fff;border-bottom:1px solid var(--line)}.export-preview-head small{color:var(--muted)}.export-email-stage{overflow:auto;padding:16px}.export-email-stage>.export-mail-bg{margin:0 auto;transform-origin:top center}@media(max-width:850px){.notify-variable-grid{grid-template-columns:1fr 1fr}.export-email-stage>.export-mail-bg{transform:scale(.75);margin-bottom:-25%}}@media(max-width:580px){.notify-variable-grid{grid-template-columns:1fr}.export-email-stage>.export-mail-bg{transform:scale(.48);margin-bottom:-52%}.modal-actions{display:grid;grid-template-columns:1fr}.modal-actions>*{width:100%}}

.smtp-status{border-left:5px solid var(--primary);margin-bottom:18px}.smtp-status.smtp-warn{border-left-color:#d78b00;background:#fff9ed}.smtp-status.smtp-ok{background:#f1fbf9}.smtp-status p{margin:.45rem 0 0}.smtp-test{margin-top:18px}.inline-test{display:flex;gap:12px;align-items:center}.inline-test input{flex:1}.check-line{display:flex!important;align-items:center;gap:10px;padding-top:28px}.check-line input{width:auto}.btn[disabled]{opacity:.5;cursor:not-allowed}
@media(max-width:680px){.inline-test{flex-direction:column;align-items:stretch}.check-line{padding-top:8px}}

/* Editor de correo: tamaño exacto y vista adaptable */
.font-size-exact{display:inline-flex!important;flex-direction:row!important;align-items:center;gap:5px!important;margin:0!important;padding:3px 5px;background:#fff;border:1px solid #d9e1ec;border-radius:7px;font-size:11px!important;font-weight:700!important;color:#475467!important}
.font-size-exact input{width:58px!important;min-height:28px!important;padding:4px 5px!important;border:1px solid #d9e1ec!important;border-radius:5px!important;text-align:center}
.font-size-exact button{min-height:28px!important;padding:4px 7px!important;border:0!important;background:var(--primary)!important;color:#fff!important}
.email-canvas{width:100%;min-width:0;background:#eef1f4;padding:22px;overflow:auto}
.email-canvas .mail-sheet.email-700{width:100%;max-width:700px;min-width:0;margin:0 auto;background:#fff}
.email-canvas .mail-sheet.email-700 img{max-width:100%;height:auto}
.email-canvas #emailPreviewBody,.email-canvas #emailPreviewBody *{max-width:100%;overflow-wrap:anywhere}
@media(max-width:760px){
  .email-canvas{padding:0;overflow:hidden;background:#eef1f4}
  .email-canvas .mail-toolbar{margin:0;border-radius:0}
  .email-canvas .mail-sheet.email-700{border-radius:0;padding:22px 18px!important;box-shadow:none}
  .email-canvas .mail-sheet.email-700>img{width:calc(100% + 36px)!important;margin:-22px -18px 18px!important;border-radius:0!important}
  .rich-toolbar{align-items:center}
  .font-size-exact{width:100%;justify-content:flex-start}
}


/* Plantillas ordenadas y administración de notificaciones */
.template-library{align-items:start}.template-library-card{padding:0;overflow:hidden;margin:0}.template-card-summary{list-style:none;cursor:pointer;display:flex;align-items:center;justify-content:space-between;gap:16px;padding:18px 20px;background:#fff}.template-card-summary::-webkit-details-marker{display:none}.template-card-title{display:flex;align-items:center;gap:12px;min-width:0}.template-card-title h2{margin:2px 0 3px;word-break:break-word}.template-card-title small{display:block;color:var(--muted);font-size:11px}.template-card-chevron{font-size:22px;color:var(--muted);transition:transform .2s ease}.template-library-card[open] .template-card-chevron{transform:rotate(180deg)}.template-library-card[open] .template-card-summary{border-bottom:1px solid var(--line);background:#fbfcfe}.template-card-expanded{padding:18px 20px 20px}.template-card-actions{display:flex;justify-content:flex-end;gap:8px;align-items:center;margin-bottom:14px}.template-card-actions form,.notification-head-actions form,td form{margin:0}.notification-head-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap;justify-content:flex-end}.email-social-footer img{margin-left:auto!important;margin-right:auto!important}.email-social-footer{text-align:center!important}
@media(max-width:700px){.template-card-summary{padding:15px}.template-card-title{align-items:flex-start}.template-card-title .pill{flex:0 0 auto}.template-card-expanded{padding:15px}.notification-head-actions{width:100%;justify-content:flex-start}}
/* Importación masiva */
.import-grid{align-items:start}.import-grid .card{height:100%}.import-result h2{margin-top:0}.stats-grid{display:grid;grid-template-columns:repeat(6,minmax(100px,1fr));gap:12px;margin:16px 0}.stats-grid>div{padding:16px;border:1px solid var(--line,#dce5e4);border-radius:14px;background:#f8fbfb;text-align:center}.stats-grid strong{display:block;font-size:1.65rem;color:var(--primary-dark)}.stats-grid span{display:block;font-size:.82rem;color:var(--muted);margin-top:4px}.import-errors{max-height:280px;overflow:auto;padding:10px 16px;background:#fff7f6;border-radius:12px}.import-errors p{margin:6px 0}.check-row{display:flex!important;align-items:center;gap:10px;margin:14px 0}.check-row input{width:auto!important}.notice{margin-top:18px;padding:14px;border-radius:12px;background:color-mix(in srgb,var(--primary) 9%,white);line-height:1.55}.muted{color:var(--muted)}@media(max-width:900px){.stats-grid{grid-template-columns:repeat(2,1fr)}}@media(max-width:620px){.stats-grid{grid-template-columns:1fr 1fr}.import-grid{grid-template-columns:1fr!important}}

.variable-chip-list{display:flex;flex-wrap:wrap;gap:7px;margin:10px 0 18px}.variable-chip{border:1px solid #cfd8df;background:#f7fafb;color:var(--primary-dark);border-radius:999px;padding:6px 10px;font-size:12px;cursor:pointer}.variable-chip:hover{border-color:var(--primary);background:#eefafa}.notify-link-fields{display:grid;gap:10px;margin-top:14px;padding-top:14px;border-top:1px solid #e6eaee}.notify-link-fields h4{margin:0}.notify-link-fields label{display:grid;gap:5px}.notify-link-fields input{width:100%}
.notification-row-actions{display:flex;flex-wrap:wrap;gap:7px;align-items:center}.notification-row-actions form{margin:0}
#notifyRecipientEmail:disabled{opacity:1;background:#f4f8f8;color:var(--text);cursor:default}

.brand-card-focus{outline:3px solid var(--primary);outline-offset:4px;box-shadow:0 0 0 8px color-mix(in srgb,var(--primary) 18%,transparent),0 18px 45px rgba(0,0,0,.14);transition:box-shadow .3s,outline-color .3s}
#sendWaImage[hidden]{display:none!important}

/* Editor: selector exacto de color de fuente */
.font-color-control{display:inline-flex;align-items:center;gap:6px;padding:4px 6px;border:1px solid var(--border,#dfe5ec);border-radius:8px;background:#fff;font-size:12px;white-space:nowrap}
.font-color-control input[type=color]{width:34px;height:28px;padding:1px;border:0;background:transparent;cursor:pointer}
.font-color-control button{height:28px;padding:0 9px}
@media(max-width:760px){.font-color-control{width:100%;justify-content:space-between}.font-color-control input[type=color]{flex:0 0 40px}}
.system-time-metrics article{min-width:0}.system-time-metrics strong{font-size:1rem;line-height:1.35;overflow-wrap:anywhere}.time-ok{color:#16794b}.time-warning{color:#b42318}
@media(max-width:760px){.system-time-metrics{grid-template-columns:1fr}.system-time-metrics article{padding:16px}}

/* Descripción de productos o servicios de la marca */
.brand-description-row{grid-column:1/-1}.brand-description-row dd{white-space:normal;line-height:1.55}.process-description{margin:14px 0;padding:14px 16px;border:1px solid rgba(8,174,202,.18);background:rgba(8,174,202,.05);border-radius:12px}.process-description small{display:block;font-weight:700;color:var(--primary,#08aeca);margin-bottom:6px}.process-description p{margin:0;line-height:1.55;white-space:normal}


/* Parche: fecha límite de gracia + contador visible en tarjetas */
.brand-card{position:relative;overflow:visible}
.brand-card-head{padding-right:70px}
.brand-days-notification{
  position:absolute;top:-13px;right:-13px;z-index:5;
  width:64px;height:64px;border-radius:50%;
  background:#d92d20;color:#fff;border:4px solid #fff;
  box-shadow:0 8px 22px rgba(217,45,32,.32);
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  line-height:1;text-align:center
}
.brand-days-notification strong{font-size:21px;font-weight:900;letter-spacing:-.04em}
.brand-days-notification span{font-size:9px;font-weight:800;text-transform:uppercase;margin-top:3px;letter-spacing:.04em}
.brand-card .grace-deadline-field{background:#fff4f2;border:1px solid #ffd5cf}
.brand-card .grace-deadline-field dt{color:#b42318}
.brand-card .grace-deadline-field dd{color:#8f1d14}
@media(max-width:700px){
  .brand-days-notification{top:-10px;right:-8px;width:58px;height:58px}
  .brand-days-notification strong{font-size:19px}
  .brand-card-head{padding-right:55px}
}
