/* Gestión › Resumen — tablero compacto con panel de detalle. Identidad: negro, crema y dorado (tokens de crm.css). */
.gs { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
.gs-main { display: grid; gap: 12px; min-width: 0; }
.gs-aside { position: sticky; top: 12px; max-height: calc(100vh - 150px); min-height: 280px; display: flex; flex-direction: column; overflow: hidden; padding: 0; }

/* indicadores */
.gs-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.gs-kpi { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg, 12px); color: var(--text); text-decoration: none; min-width: 0; transition: border-color .15s, box-shadow .15s; }
.gs-kpi:hover { border-color: var(--accent); box-shadow: 0 2px 10px rgba(20, 17, 13, .08); }
.gs-kpi:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.gs-kpi-ic { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); }
.gs-kpi-ic svg { width: 18px; height: 18px; }
.gs-kpi-t { display: grid; min-width: 0; line-height: 1.15; }
.gs-kpi-l { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-kpi strong { font-size: 1.5rem; font-weight: 700; }
.gs-kpi small { font-size: .7rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-kpi.dark { background: var(--primary); border-color: var(--primary); color: #fff; }
.gs-kpi.dark .gs-kpi-l, .gs-kpi.dark small { color: rgba(255, 255, 255, .72); }
.gs-kpi.dark .gs-kpi-ic { background: rgba(222, 162, 2, .2); color: var(--accent); }
.gs-kpi.dark strong { color: var(--accent); }
.gs-kpi.bad .gs-kpi-ic { background: var(--err-soft); color: var(--err); }
.gs-kpi.bad strong { color: var(--err-ink); }

/* búsqueda + nuevo */
.gs-bar { display: flex; gap: 10px; align-items: center; }
.gs-search { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; }
.gs-search > svg { position: absolute; left: 12px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.gs-search input { width: 100%; min-height: 40px; padding-left: 36px; border-radius: var(--r-md, 10px); }
.gs-results { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; max-height: 360px; overflow: auto; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md, 10px); box-shadow: 0 10px 30px rgba(20, 17, 13, .18); padding: 4px; }
.gs-results[hidden], .gs-menu[hidden] { display: none; }
.gs-res-h { padding: 6px 8px 2px; font-size: var(--fs-xs); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.gs-res-note { padding: 10px; color: var(--muted); font-size: var(--fs-sm); }
.gs-res { display: flex; gap: 10px; align-items: center; width: 100%; padding: 7px 8px; border: 0; background: transparent; border-radius: var(--r-sm, 8px); font: inherit; color: var(--text); text-align: left; cursor: pointer; }
.gs-res:hover, .gs-res:focus-visible { background: var(--surface-3); outline: none; }
.gs-res > svg { width: 16px; height: 16px; color: var(--accent-ink); flex: none; }
.gs-res span { display: grid; min-width: 0; }
.gs-res strong { font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-res small { font-size: var(--fs-xs); color: var(--muted); }
.gs-newwrap { position: relative; flex: none; }
.gs-new { min-height: 40px; min-width: 110px; justify-content: center; }
.gs-caret { margin-left: 4px; font-size: .8em; }
.gs-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 210px; display: grid; padding: 4px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md, 10px); box-shadow: 0 10px 30px rgba(20, 17, 13, .2); }
.gs-menu.up { top: auto; bottom: calc(100% + 6px); }
.gs-menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 6px 10px; border: 0; background: transparent; border-radius: var(--r-sm, 8px); font: inherit; font-size: var(--fs-sm); color: var(--text); text-align: left; cursor: pointer; }
.gs-menu-item:hover, .gs-menu-item:focus-visible { background: var(--accent-soft); outline: none; }
.gs-menu-item.danger { color: var(--err-ink); }
.gs-menu-item svg { width: 16px; height: 16px; color: var(--accent-ink); }

/* zona central */
.gs-mid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 12px; align-items: stretch; }
.gs-card { padding: 0; margin: 0; display: flex; flex-direction: column; min-width: 0; }
.gs-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.gs-head h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: var(--fs-md); }
.gs-head h2 svg { width: 18px; height: 18px; color: var(--accent-ink); }
.gs-all { font-size: var(--fs-sm); font-weight: 600; color: var(--accent-ink); text-decoration: none; white-space: nowrap; }
.gs-all:hover { text-decoration: underline; }
.gs-scroll { overflow: auto; max-height: 320px; }
.gs-tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.gs-tbl th { padding: 6px 10px; text-align: left; font-size: var(--fs-xs); font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); white-space: nowrap; }
.gs-tbl td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.gs-tbl tbody tr:last-child td { border-bottom: 0; }
.gs-c { width: 34px; text-align: center; }
.gs-row { cursor: pointer; transition: background .12s; }
.gs-row:hover { background: var(--surface-2); }
.gs-row:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.gs-row.sel { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.gs-title { display: block; font-weight: 600; line-height: 1.25; }
.gs-date { white-space: nowrap; font-variant-numeric: tabular-nums; }
.gs-date.bad { color: var(--err-ink); font-weight: 600; }
.gs-chev { width: 22px; color: var(--muted); font-size: 1.2rem; text-align: right; }
.gs-act { display: flex; gap: 6px; align-items: center; justify-content: flex-end; white-space: nowrap; }
.gs-doc { display: flex; align-items: center; gap: 8px; min-width: 0; }
.gs-doc > svg { width: 18px; height: 18px; flex: none; color: var(--accent-ink); }
.gs-doc span { display: grid; min-width: 0; }
.gs-doc small { color: var(--muted); font-size: var(--fs-xs); }
.gs-pill { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 99px; font-size: var(--fs-xs); font-weight: 600; background: var(--surface-3); color: var(--text-2); white-space: nowrap; margin-top: 2px; }
.gs-pill.red { background: var(--err-soft); color: var(--err-ink); }
.gs-pill.amber { background: var(--warn-soft); color: var(--warn-ink); }
.gs-pill.green { background: var(--ok-soft); color: var(--ok-ink); }
.gs-tag { display: inline-block; max-width: 160px; padding: 1px 8px; border-radius: 99px; background: var(--surface-3); font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.gs-empty { display: grid; gap: 8px; justify-items: start; padding: 16px 14px; color: var(--muted); }
.gs-empty p { margin: 0; }

/* próximos eventos */
.gs-day { padding: 0 10px 6px; }
.gs-day-h { margin: 8px 0 4px; padding: 3px 8px; border-radius: var(--r-sm, 8px); background: var(--accent-soft); color: var(--accent-ink); font-size: var(--fs-xs); font-weight: 700; }
.gs-none { display: flex; align-items: center; gap: 8px; padding: 6px 8px; color: var(--muted); font-size: var(--fs-sm); }
.gs-none svg { width: 14px; height: 14px; }
.gs-ev { display: grid; grid-template-columns: 52px 3px minmax(0, 1fr); gap: 8px; align-items: stretch; width: 100%; padding: 6px 8px; border: 0; background: transparent; border-radius: var(--r-sm, 8px); font: inherit; text-align: left; cursor: pointer; color: var(--text); }
.gs-ev:hover { background: var(--surface-2); }
.gs-ev:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.gs-ev.sel { background: var(--accent-soft); }
.gs-ev-t { font-size: var(--fs-sm); font-variant-numeric: tabular-nums; color: var(--text-2); padding-top: 1px; }
.gs-ev-bar { border-radius: 2px; background: var(--info); }
.gs-ev-bar.event { background: var(--accent); }
.gs-ev-b { display: grid; min-width: 0; }
.gs-ev-b strong { font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-ev-b small { color: var(--muted); font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* panel lateral */
.gs-ah { padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.gs-ah-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.gs-kind { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent-ink); font-size: var(--fs-xs); font-weight: 700; }
.gs-kind svg { width: 14px; height: 14px; }
.gs-ah-title { margin: 0 0 8px; font-size: var(--fs-lg); line-height: 1.2; }
.gs-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.gs-pills .gs-pill { margin: 0; }
.gs-body { flex: 1; min-height: 0; overflow: auto; padding: 10px 16px; display: grid; gap: 12px; align-content: start; }
.gs-sec h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: var(--fs-sm); }
.gs-sec h3 svg { width: 15px; height: 15px; color: var(--accent-ink); }
.gs-desc { margin: 0; padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md, 10px); font-size: var(--fs-sm); white-space: pre-wrap; word-break: break-word; }
.gs-kvs { display: grid; gap: 2px; }
.gs-kv { display: grid; grid-template-columns: 124px minmax(0, 1fr); gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: var(--fs-sm); }
.gs-kv:last-child { border-bottom: 0; }
.gs-k { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.gs-k svg { width: 15px; height: 15px; }
.gs-v { min-width: 0; word-break: break-word; }
.gs-tl { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); display: grid; gap: 10px; }
.gs-tl li { position: relative; display: grid; }
.gs-tl li::before { content: ""; position: absolute; left: -20px; top: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.gs-tl strong { font-size: var(--fs-sm); }
.gs-tl small { color: var(--muted); font-size: var(--fs-xs); }
.gs-foot { display: flex; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--line); background: var(--surface); }
.gs-grow { flex: 1; justify-content: center; }
.gs-more { position: relative; }
.gs-aside-empty { display: grid; gap: 8px; justify-items: center; text-align: center; padding: 32px 20px; color: var(--muted); }
.gs-aside-empty svg { width: 22px; height: 22px; }
.gs-aside-empty p { margin: 0; font-size: var(--fs-sm); }

/* adaptable */
@media (max-width: 1280px) { .gs { grid-template-columns: minmax(0, 1fr) 310px; } .gs-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1060px) {
  .gs { grid-template-columns: minmax(0, 1fr); }
  .gs-aside { position: static; max-height: none; }
  .gs-body { overflow: visible; }
  .gs-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 860px) { .gs-mid { grid-template-columns: minmax(0, 1fr); } .gs-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) {
  .gs-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gs-bar { flex-wrap: wrap; }
  .gs-newwrap { width: 100%; }
  .gs-new { width: 100%; }
  .gs-menu { left: 0; right: 0; }
  .gs-kv { grid-template-columns: 100px minmax(0, 1fr); }
  .gs-tbl th:nth-child(5), .gs-tbl td:nth-child(5) { display: none; }
}

/* Diálogos centrados: nunca más altos que la pantalla (el contenido se desplaza dentro, cabecera y pie quedan visibles). */
.overlay.center .panel { max-height: calc(100dvh - 40px); }
.overlay.center .panel-body { min-height: 0; }
@media (max-width: 560px) { .overlay.center { padding: 8px; } .overlay.center .panel { max-height: calc(100dvh - 16px); } }

/* Comercial › Resumen: el panel de detalle solo aparece al seleccionar un registro */
.gs.noaside { grid-template-columns: minmax(0, 1fr); }
.gs-aside[hidden] { display: none; }
.gs-mid.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.cm-av { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--primary-soft); color: var(--primary-ink); font-size: var(--fs-xs); font-weight: 700; }
.gs-tbl td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 860px) { .gs-mid.even { grid-template-columns: minmax(0, 1fr); } }
