/* Agentes · estilos propios. Todo va bajo .ag (contenido, drawer, modal) o .ag-side (bloque del menú)
   para no tocar nada de Dashboards. Portado de docs/agentes/prototipo.html. */

/* ---------- bloque del menú lateral ---------- */
.ag-side { margin: auto 8px 8px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfd; padding: 6px; }
.ag-side + .side-f { margin-top: 0; }
.ag-side .ag-h { font-size: 12px; color: var(--mut); font-weight: 600; padding: 8px 8px 4px; display: flex; align-items: center; }
.ag-side .ag-h .n { margin-left: auto; font-weight: 500; }
.ag-side .nav-i { padding: 7px 8px; }
.ag-side .nav-i svg { flex: none; }
.ag-side .sdot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.ag-side .add { color: var(--acc); }
.ag-side .add .plus-i { width: 26px; text-align: center; font-size: 18px; flex: none; }
.shell.mini .ag-side { margin: auto 4px 8px; padding: 4px 0; }
.shell.mini .ag-side .ag-h, .shell.mini .ag-side .sdot { display: none; }

/* ---------- contenido ---------- */
.ag { --line2: #d1d5db; --amber: #b45309; }
.ag .mono { font-family: 'IBM Plex Mono', ui-monospace, Consolas, monospace; }
.ag .num, .ag td { font-variant-numeric: tabular-nums; }
.ag-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 24px; background: #fff; border-bottom: 1px solid var(--line); }
.ag-top h1 { font-size: 15px; margin: 0; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ag-top h1 span { color: var(--mut); font-weight: 500; }
.ag .crumb { all: unset; cursor: pointer; color: var(--mut); font-weight: 500; }
.ag .crumb:hover { color: var(--ink); }
.ag .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ag .btn { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; color: var(--ink); }
.ag .btn.pri { color: #fff; }
.ag .btn.danger { color: var(--red); border-color: #fecaca; background: #fff; }
.ag .btn.ghost { padding-left: 12px; }
.ag .btn.sm { padding: 5px 9px; }
.ag .ag-wrap { padding: 20px 24px 48px; max-width: 1400px; width: 100%; margin: 0 auto; }
.ag .sheet { background: #fff; border-radius: 10px; padding: 24px 28px; box-shadow: 0 1px 3px rgba(15,23,42,.06); margin-bottom: 20px; }
.ag .shead { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 14px; }
.ag .sec { font-size: 16px; font-weight: 700; margin: 0 0 4px; }
.ag .secsub { color: var(--mut); margin: 0; }
.ag .test { display: flex; gap: 10px; align-items: center; background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; border-radius: 8px; padding: 9px 14px; margin-bottom: 16px; font-weight: 600; }
.ag .loading { padding: 40px; text-align: center; color: var(--mut); }

.ag .kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); border: 1px solid var(--line); border-radius: 8px; background: #fff; margin-bottom: 20px; }
.ag .kpi { padding: 14px 18px; border-right: 1px solid var(--line); }
.ag .kpi:last-child { border-right: 0; }
.ag .kpi > span { font-size: 12px; color: var(--mut); font-weight: 600; }
.ag .kpi b { display: block; font-size: 24px; font-weight: 800; margin-top: 2px; }
.ag .kpi b.sm { font-size: 15px; font-weight: 700; margin-top: 4px; }
.ag .kpi small { display: block; font-size: 11px; color: var(--mut); }
.ag .kpi.hi { background: #fef2f2; }
.ag .kpi.hi b { color: var(--red); }

.ag .agrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); gap: 16px; margin-bottom: 20px; }
.ag .acard { all: unset; box-sizing: border-box; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; gap: 14px; cursor: pointer; }
.ag .acard:hover { border-color: #bcd0f2; }
.ag .acard:focus-visible { outline: 2px solid var(--acc); }
.ag .ahead { display: flex; gap: 14px; align-items: center; }
.ag .ahead h3 { margin: 0; font-size: 16px; font-weight: 700; }
.ag .ahead p { margin: 2px 0 0; color: var(--mut); }
.ag .adesc { margin: 0; line-height: 1.5; }
.ag .ameta { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); padding-top: 12px; gap: 8px; }
.ag .ameta span { display: block; font-size: 11px; color: var(--mut); font-weight: 600; }
.ag .ameta b { font-size: 13px; }
.ag .acard.new { border: 1.5px dashed var(--line2); background: transparent; align-items: center; justify-content: center; text-align: center; color: var(--mut); min-height: 220px; }
.ag .acard.new:hover { border-color: var(--acc); color: var(--acc); }
.ag .plus { width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid currentColor; display: grid; place-items: center; font-size: 24px; line-height: 1; }

.ag .pill { white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #f1f5f9; color: #475569; }
.ag .p-on { background: #dcfce7; color: #166534; } .ag .p-off { background: #f1f5f9; color: #475569; }
.ag .p-alta { background: #fee2e2; color: #991b1b; } .ag .p-media { background: #ffedd5; color: #9a3412; } .ag .p-baja { background: #e0f2fe; color: #075985; }
.ag .p-ok { background: #dcfce7; color: #166534; } .ag .p-warn { background: #ffedd5; color: #9a3412; } .ag .p-err { background: #fee2e2; color: #991b1b; }
.ag .p-adj { background: #dbeafe; color: #1e40af; } .ag .p-pend { background: #fef3c7; color: #92400e; }

.ag .dhead { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.ag .dhead h2 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.3px; }
.ag .dhead p { margin: 4px 0 0; color: var(--mut); max-width: 75ch; line-height: 1.5; }
.ag .tabs { display: inline-flex; gap: 4px; background: #eef2f7; padding: 4px; border-radius: 8px; margin: 18px 0 0; flex-wrap: wrap; }
.ag .tab { border: 0; background: transparent; padding: 7px 16px; border-radius: 6px; font: 600 13px Inter, system-ui, sans-serif; color: var(--mut); cursor: pointer; }
.ag .tab.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(15,23,42,.12); }

.ag .tw { overflow-x: auto; }
.ag table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
.ag .t th { background: var(--navy); color: #fff; font-weight: 600; padding: 10px 12px; text-align: left; white-space: nowrap; }
.ag .t td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ag .t td.num { white-space: nowrap; }
.ag .t tr:nth-child(even) td { background: #fafbfc; }
.ag .t tr.click { cursor: pointer; }
.ag .t tr.click:hover td { background: #f1f6fe; }
.ag .t td.c, .ag .t th.c { text-align: center; }
.ag .tname { font-weight: 600; }
.ag .tsub { color: var(--mut); font-size: 12px; margin-top: 2px; max-width: 52ch; }
.ag .chips { display: flex; flex-wrap: wrap; gap: 4px; }
.ag .chip { display: inline-flex; align-items: center; gap: 4px; background: #eef2f7; border-radius: 6px; padding: 2px 8px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.ag .empty { padding: 28px; text-align: center; color: var(--mut); border: 1.5px dashed var(--line2); border-radius: 10px; background: transparent; }
.ag .empty b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

/* destinatarios */
.ag table.rt { width: 100%; border-collapse: collapse; }
.ag .rt th { font-size: 12px; color: var(--mut); font-weight: 600; text-align: left; padding: 0 8px 6px; border-bottom: 1px solid var(--line); }
.ag .rt td { padding: 6px 8px; border-bottom: 1px solid var(--line); }
.ag .rt select { width: auto; min-width: 5.5rem; }
.ag .rt input.bad { border-color: var(--red); background: #fef2f2; }
.ag .rt .dyn { color: var(--mut); font-style: italic; padding: 8px 0; display: block; }
.ag .rmv { all: unset; cursor: pointer; color: var(--mut); font-size: 18px; padding: 2px 8px; border-radius: 6px; }
.ag .rmv:hover { color: var(--red); background: #fef2f2; }

.ag .sw { position: relative; display: inline-block; width: 36px; height: 20px; flex: none; }
.ag .sw input { opacity: 0; width: 0; height: 0; position: absolute; }
.ag .sw i { position: absolute; inset: 0; background: #cbd5e1; border-radius: 999px; transition: .15s; cursor: pointer; }
.ag .sw i::after { content: ""; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.ag .sw input:checked + i { background: var(--green); }
.ag .sw input:checked + i::after { transform: translateX(16px); }
.ag .sw input:disabled + i { opacity: .45; cursor: not-allowed; }
.ag .sw input:focus-visible + i { outline: 2px solid var(--acc); outline-offset: 2px; }
.ag .swl { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }

.ag .form { display: grid; gap: 14px; }
.ag .f { display: flex; flex-direction: column; gap: 5px; }
.ag .f > label, .ag .f > span { font-size: 12px; color: var(--mut); font-weight: 600; }
.ag .f small { color: var(--mut); font-size: 11px; }
.ag .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 12px; }
.ag input[type=text], .ag input[type=email], .ag input[type=number], .ag input[type=time], .ag input[type=date], .ag select, .ag textarea { border: 1px solid var(--line2); border-radius: 6px; padding: 8px 10px; background: #fff; min-width: 0; width: 100%; }
.ag textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
.ag .opts { display: flex; flex-wrap: wrap; gap: 6px; }
.ag .opt { position: relative; }
.ag .opt input { position: absolute; opacity: 0; }
.ag .opt span { display: inline-block; border: 1px solid var(--line2); border-radius: 6px; padding: 6px 10px; cursor: pointer; font-weight: 500; background: #fff; }
.ag input[name=i-sev] + span { text-transform: capitalize; }
.ag .opt input:checked + span { background: var(--navy); border-color: var(--navy); color: #fff; }
.ag .opt input:focus-visible + span { outline: 2px solid var(--acc); outline-offset: 2px; }
.ag .kinds { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 8px; }
.ag .kind { position: relative; }
.ag .kind input { position: absolute; opacity: 0; }
.ag .kind span { display: block; border: 1px solid var(--line2); border-radius: 10px; padding: 12px; cursor: pointer; height: 100%; }
.ag .kind span b { display: block; margin-bottom: 2px; }
.ag .kind span small { color: var(--mut); }
.ag .kind input:checked + span { border-color: var(--acc); box-shadow: 0 0 0 1px var(--acc); background: #f5f9ff; }
.ag .swatches { display: flex; gap: 8px; }
.ag .swatch { position: relative; }
.ag .swatch input { position: absolute; opacity: 0; }
.ag .swatch span { display: block; width: 28px; height: 28px; border-radius: 50%; cursor: pointer; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line2); }
.ag .swatch input:checked + span { box-shadow: 0 0 0 2px var(--ink); }
.ag .grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr)); gap: 20px; }
.ag .note { font-size: 12px; color: var(--mut); margin-top: 10px; }
.ag .callout { font-size: 13px; line-height: 1.55; background: #f8fafc; border-left: 4px solid var(--navy); padding: 10px 14px; border-radius: 4px; margin: 0 0 16px; }

/* último envío */
.ag .file { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: #fbfcfd; flex-wrap: wrap; }
.ag .fico { width: 38px; height: 46px; border-radius: 5px; display: grid; place-items: center; color: #fff; font: 700 10px Inter, sans-serif; flex: none; background: var(--navy); }
.ag .fico.pptx { background: #c2410c; } .ag .fico.xlsx { background: #15803d; } .ag .fico.pdf { background: #b91c1c; }
.ag .file b { display: block; }
.ag .file small { color: var(--mut); }
.ag .files { display: flex; gap: 10px; flex-wrap: wrap; }
.ag .strip { display: flex; gap: 12px; overflow-x: auto; padding: 16px 2px 8px; scroll-snap-type: x proximity; }
.ag .thumb { all: unset; box-sizing: border-box; flex: none; width: 176px; cursor: pointer; scroll-snap-align: start; position: relative; }
.ag .thumb svg { display: block; width: 176px; height: 99px; border: 1px solid var(--line2); border-radius: 6px; background: #fff; }
.ag .thumb.on svg { border-color: var(--acc); box-shadow: 0 0 0 2px var(--acc); }
.ag .thumb.off svg { opacity: .35; }
.ag .thumb .tt { display: flex; gap: 6px; margin-top: 6px; font-size: 12px; font-weight: 600; align-items: flex-start; }
.ag .thumb .tt span:first-child { color: var(--mut); font-weight: 500; flex: none; }
.ag .thumb .badge { position: absolute; top: 6px; right: 6px; background: var(--acc); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; min-width: 20px; height: 20px; display: grid; place-items: center; padding: 0 6px; }
.ag .thumb.off .badge { background: var(--red); }
.ag .thumb:focus-visible svg { outline: 2px solid var(--acc); outline-offset: 2px; }
.ag .adjpanel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; border-top: 1px solid var(--line); padding-top: 18px; margin-top: 8px; }
.ag .adjlist { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.ag .adjlist li { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: #fff; }
.ag .adjlist li div { flex: 1; min-width: 0; }
.ag .adjlist li b { display: block; font-size: 12px; }
.ag .adjlist li small { color: var(--mut); font-size: 12px; }
.ag .adjlist li p { margin: 2px 0 0; }

/* casos del mes (desestimar / reactivar) */
.ag .cs-q { width: 18rem !important; max-width: 100%; }
.ag .cs-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.ag .cs-ley { color: var(--mut); font-size: 12px; font-weight: 600; }
.ag .cs th.r, .ag .cs td.r { text-align: right; }
.ag .cs th.ck, .ag .cs td.ck { width: 34px; padding-right: 0; }
.ag .cs input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--acc); cursor: pointer; vertical-align: middle; }
.ag .cs tr.on td { background: #eff6ff; }
.ag .cs td { white-space: nowrap; vertical-align: middle; }
.ag .cs td.cs-mo { white-space: normal; min-width: 20ch; max-width: 36ch; }
.ag .cs .cs-none { color: var(--mut); text-align: center; padding: 18px 12px; }
.ag .cs-des { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 12px; }
.ag .cs-tog { all: unset; cursor: pointer; font-weight: 700; font-size: 14px; display: inline-flex; gap: 6px; align-items: center; padding: 4px 0 10px; }
.ag .cs-tog:hover { color: var(--acc); }
.ag .cs-tog:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; border-radius: 4px; }
.ag .cs-tog .car { color: var(--mut); width: 12px; }
.ag .cs-list { margin: 0; padding-left: 18px; display: grid; gap: 2px; }
.ag .cs-mot { border: 1px solid var(--line2); background: #fff; cursor: pointer; font: 500 12px Inter, system-ui, sans-serif; color: var(--ink); max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.ag .cs-mot:hover { border-color: var(--acc); color: var(--acc); }

/* drawer y modal */
.ag-dw .scrim2 { position: fixed; inset: 0; background: rgba(15,23,42,.35); z-index: 40; display: none; }
.ag-dw .drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: #fff; z-index: 41; display: none; flex-direction: column; box-shadow: -10px 0 30px rgba(15,23,42,.15); }
.ag-dw.open .scrim2 { display: block; } .ag-dw.open .drawer { display: flex; }
.ag-dw .modal { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(820px, calc(100% - 24px)); max-height: calc(100% - 40px); background: #fff; z-index: 41; display: none; flex-direction: column; border-radius: 12px; box-shadow: 0 20px 50px rgba(15,23,42,.25); }
.ag-dw.mopen .scrim2 { display: block; } .ag-dw.mopen .modal { display: flex; }
.ag .dh { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.ag .dh h3 { margin: 0; font-size: 16px; }
.ag .db { flex: 1; overflow: auto; padding: 20px; }
.ag .df { display: flex; gap: 8px; justify-content: space-between; align-items: center; padding: 14px 20px; border-top: 1px solid var(--line); }
.ag pre.json { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 14px; font-size: 12px; overflow: auto; margin: 0; white-space: pre; }
.ag .vars { display: flex; flex-wrap: wrap; gap: 6px; }
.ag .var { font: 500 12px 'IBM Plex Mono', monospace; border: 1px dashed var(--line2); background: #f8fafc; border-radius: 6px; padding: 3px 8px; cursor: pointer; }
.ag .var:hover { border-color: var(--acc); color: var(--acc); }
.ag .mailprev { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.ag .mailprev .mh { background: #f8fafc; border-bottom: 1px solid var(--line); padding: 10px 14px; font-size: 12px; color: var(--mut); display: grid; gap: 3px; }
.ag .mailprev .mh b { color: var(--ink); }
.ag .mailprev .mb { padding: 14px; white-space: pre-wrap; line-height: 1.55; font-size: 13px; }
.ag .mailprev .att { border-top: 1px solid var(--line); padding: 10px 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.ag .mtable { border-collapse: collapse; font-size: 12px; margin: 6px 0; white-space: normal; }
.ag .mtable th { background: var(--navy); color: #fff; padding: 4px 8px; font-weight: 600; }
.ag .mtable td { border: 1px solid var(--line); padding: 4px 8px; color: var(--mut); }
.ag .mailsum { display: grid; gap: 4px; background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 14px; }
.ag .mailsum span { color: var(--mut); font-size: 12px; }
.ag .mailsum b { font-weight: 600; }
.ag-dw .ag-toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 8px; font-weight: 600; opacity: 0; transition: .2s; z-index: 60; pointer-events: none; max-width: calc(100vw - 32px); }
.ag-dw .ag-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 820px) {
  .ag-top { padding: 12px 16px; }
  .ag .ag-wrap { padding: 16px 14px 40px; }
  .ag .sheet { padding: 18px 16px; }
  .ag .ameta { grid-template-columns: 1fr 1fr; }
  .ag .adjpanel { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .ag *, .ag-dw * { transition: none !important; } }
