/* ============================================================
   Paneles demo — layout y componentes compartidos (ap-*)
   ============================================================ */
.ap-app { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.ap-side { background: var(--bg-alt); border-right: 1px solid var(--border); padding: 18px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.ap-side nav { display: grid; gap: 2px; margin-top: 18px; }
.ap-side nav button { display: flex; align-items: center; gap: 10px; background: none; border: 0; color: var(--muted); padding: 9px 11px; border-radius: 9px; font-size: 12.5px; font-weight: 500; cursor: pointer; text-align: left; width: 100%; transition: .15s; font-family: inherit; }
.ap-side nav button:hover { background: var(--surface-2); color: var(--text); }
.ap-side nav button.is-active { background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--text); box-shadow: inset 2px 0 0 var(--brand); }
.ap-side nav b { font-size: 13px; width: 16px; text-align: center; color: var(--brand-2); }
.ap-side__foot { margin-top: auto; font-size: 11px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 12px; display: grid; gap: 8px; }
.ap-main { padding: 20px 26px 60px; min-width: 0; }
.ap-topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.ap-topbar h1 { font-size: 20px; letter-spacing: -.02em; }
.ap-topbar p { font-size: 12px; color: var(--muted); margin-top: 2px; }
.ap-topbar__actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ap-search { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 0 12px; }
.ap-search input { background: none; border: 0; outline: none; color: var(--text); padding: 9px 0; width: 220px; font-size: 12.5px; font-family: inherit; }
.ap-view { display: none; }
.ap-view.is-on { display: block; }
.ap-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.ap-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; }
.ap-card span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 600; }
.ap-card strong { display: block; font-size: 21px; letter-spacing: -.02em; margin: 6px 0 2px; }
.ap-card em { font-style: normal; font-size: 11px; color: var(--muted); font-weight: 600; }
.ap-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.ap-panel h3 { font-size: 13px; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; }
.ap-panel h3 small { font-size: 10.5px; color: var(--muted); font-weight: 500; }
.ap-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ap-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.ap-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ap-table th { text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--border); font-weight: 600; }
.ap-table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.ap-table tbody tr:hover { background: var(--surface-2); }
.ap-table .row-actions { white-space: nowrap; text-align: right; }
.ap-table .row-actions button { background: none; border: 1px solid var(--border); border-radius: 7px; color: var(--muted); font: inherit; font-size: 11px; padding: 4px 9px; cursor: pointer; margin-left: 4px; }
.ap-table .row-actions button:hover { color: var(--text); border-color: var(--brand); }
.ap-table .tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 10px; font-weight: 600; border: 1px solid; }
.tag--ok { color: var(--ok); border-color: rgba(52,211,153,.3); background: rgba(52,211,153,.1); }
.tag--warn { color: var(--warn); border-color: rgba(251,191,36,.3); background: rgba(251,191,36,.1); }
.tag--d { color: var(--danger); border-color: rgba(251,113,133,.3); background: rgba(251,113,133,.1); }
.tag--n { color: var(--muted); border-color: var(--border); background: var(--surface-2); }
.ap-inp { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; color: var(--text); font-size: 12.5px; outline: none; font-family: inherit; }
.ap-inp:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent); }
select option { background: var(--bg-alt); color: var(--text); }
.ap-empty { padding: 26px; text-align: center; color: var(--muted); font-size: 12px; }
.ap-count { font-size: 10.5px; color: var(--muted); margin-top: 8px; }
.ap-chart { display: flex; align-items: flex-end; gap: 8px; height: 150px; padding: 8px 0 22px; }
.ap-chart div { flex: 1; border-radius: 5px 5px 0 0; background: linear-gradient(180deg, var(--brand), var(--brand-3)); min-width: 10px; position: relative; }
.ap-chart div span { position: absolute; bottom: -18px; left: 0; right: 0; text-align: center; font-size: 9.5px; color: var(--muted); }
.ap-chart div b { position: absolute; top: -18px; left: 0; right: 0; text-align: center; font-size: 9.5px; color: var(--muted); }
.mini-stat { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.mini-stat:last-child { border-bottom: 0; }
.mini-stat b { color: var(--text); }
.mini-stat span { color: var(--muted); }
.modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(3,6,5,.72); backdrop-filter: blur(4px); }
.modal__card { position: relative; width: min(680px, 100%); max-height: 92vh; display: flex; flex-direction: column; background: var(--bg-alt); border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 50px 100px -40px #000; overflow: hidden; }
.modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal__head h2 { font-size: 17px; letter-spacing: -.02em; }
.modal__eyebrow { font-size: 10px; text-transform: uppercase; letter-spacing: .12em; color: var(--brand-2); font-weight: 700; margin-bottom: 3px; }
.icon-x { background: transparent; border: 1px solid var(--border); color: var(--muted); width: 32px; height: 32px; border-radius: 9px; cursor: pointer; font-size: 14px; line-height: 1; }
.icon-x:hover { color: var(--text); border-color: var(--brand); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .field { display: grid; gap: 6px; }
.form-grid .field span { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: .04em; }
.form-grid .field input, .form-grid .field select, .form-grid .field textarea { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; color: var(--text); font-size: 12.5px; outline: none; width: 100%; font-family: inherit; }
.form-grid .field--full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.err { color: var(--danger); font-size: 12px; font-weight: 600; }
.modal__body { padding: 20px 22px; overflow: auto; display: grid; gap: 12px; }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: var(--surface); border: 1px solid var(--border); color: var(--text); padding: 10px 18px; border-radius: 12px; font-size: 12.5px; font-weight: 600; box-shadow: 0 20px 50px -20px #000; opacity: 0; transition: opacity .25s; z-index: 400; pointer-events: none; }
@media (max-width: 1024px) { .ap-cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px) {
  .ap-app { grid-template-columns: 1fr; }
  .ap-side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; }
  .ap-side nav { grid-auto-flow: column; overflow-x: auto; width: 100%; }
  .ap-grid2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .ap-topbar { flex-direction: column; align-items: flex-start; }
  .ap-topbar__actions { width: 100%; }
  .ap-search { flex: 1; }
  .ap-search input { width: 100%; }
  .modal { padding: 10px; }
  .modal__card { width: 100%; max-height: 94vh; }
}
@media (max-width: 560px) { .ap-cards { grid-template-columns: 1fr; } .ap-main { padding: 16px; } }
html[data-theme="light"] .ap-side { background: #ffffff; }
@media print {
  .ap-side, .ap-topbar__actions, .toast { display: none !important; }
  .ap-main { padding: 0; }
  .ap-view { display: none !important; }
  .ap-view.is-on { display: block !important; }
  body { background: #fff; }
}
