/* =====================================================================
   Mira · Data grid styles
   Restyles every table (agent registry on the dashboard, admin tables).
   Loaded after site.css. Uses CSS variables, so it also works with the
   optional dark theme (theme-dark.css overrides the --grid-* colours).
   ===================================================================== */

:root{
  --grid-head:#F1F5F9;
  --grid-head-text:#334155;
  --grid-stripe:#FAFBFD;
  --grid-row-line:#EDF1F6;
  --grid-hover:#EEF5FF;
  --grid-accent:#2563EB;
  --grid-alert:#FEF2F2;
  --grid-warn:#FFFBEB;
}

/* Frame */
.tbl-wrap{
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--panel);
  box-shadow:0 1px 2px rgba(15,23,42,.05),0 4px 14px rgba(15,23,42,.04);
  overflow:auto;
}
.tbl-wrap table{border-collapse:separate;border-spacing:0;width:100%;font-size:13px}

/* Header */
.tbl-wrap th{
  position:sticky;top:0;z-index:2;
  background:var(--grid-head);
  color:var(--grid-head-text);
  font-size:11px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;
  padding:12px 14px;
  border-bottom:2px solid var(--line);
  white-space:nowrap;
}
.tbl-wrap th[data-k]{cursor:pointer;padding-right:26px;position:sticky}
.tbl-wrap th[data-k]::after{
  content:"↕";position:absolute;right:10px;top:50%;transform:translateY(-50%);
  font-size:11px;color:#A0AEC0;opacity:.8
}
.tbl-wrap th.sort-asc::after{content:"▲";color:var(--grid-accent);opacity:1;font-size:9px}
.tbl-wrap th.sort-desc::after{content:"▼";color:var(--grid-accent);opacity:1;font-size:9px}
.tbl-wrap th.sort-asc,.tbl-wrap th.sort-desc{color:var(--grid-accent)}
.tbl-wrap th:hover{color:var(--grid-accent)}

/* Cells */
.tbl-wrap td{
  padding:10px 14px;
  border-bottom:1px solid var(--grid-row-line);
  vertical-align:middle;
  white-space:nowrap;
}
.tbl-wrap tbody tr:nth-child(even) td{background:var(--grid-stripe)}
.tbl-wrap tbody tr:last-child td{border-bottom:none}

/* Numbers right-aligned with equal-width digits */
.tbl-wrap .n{text-align:right;font-variant-numeric:tabular-nums}
.tbl-wrap th.n{padding-right:30px}
.tbl-wrap .c{text-align:center}

/* ID column */
.tbl-wrap td.id{
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  font-size:12px;font-weight:600;color:var(--grid-accent)
}

/* Row hover with an accent bar on the left */
.tbl-wrap tbody tr{transition:background-color .12s}
.tbl-wrap tbody tr:hover td{background:var(--grid-hover)}
.tbl-wrap tbody tr:hover td:first-child{box-shadow:inset 3px 0 0 var(--grid-accent)}

/* Rows that need attention */
.tbl-wrap tbody tr.row-quarantined td{background:var(--grid-alert)}
.tbl-wrap tbody tr.row-quarantined td:first-child{box-shadow:inset 3px 0 0 var(--crit)}
.tbl-wrap tbody tr.row-restricted td:first-child{box-shadow:inset 3px 0 0 var(--bad)}
.tbl-wrap tbody tr.row-degraded td:first-child{box-shadow:inset 3px 0 0 var(--warn)}

/* Score bar inside the grid */
.tbl-wrap .score{justify-content:flex-start;gap:10px;font-variant-numeric:tabular-nums}
.tbl-wrap .bar{width:80px;height:6px;border-radius:999px}

/* Compact controls inside admin grids */
.tbl-wrap td select,.tbl-wrap td input{padding:5px 8px;font-size:12px;min-width:0}
.tbl-wrap td .mini{padding:4px 10px;font-size:12px;border-radius:6px}

/* Empty state */
.tbl-wrap .empty td{text-align:center;color:var(--muted);padding:28px}

/* Row count next to the grid title */
#rowCount{
  display:inline-block;background:var(--grid-head);color:var(--grid-head-text);
  border-radius:999px;padding:2px 10px;font-size:11px;font-weight:600;margin-left:6px
}
