/* Page styles for the dashboards area (admin redesign, DEC-181). Scoped to body.admin-shell.
   Pages: Dashboard (admin + department head), Alerts, Renewals, Audit log.
   Values ported from the boards AdminDashboard, HeadHome, Alerts, Renewals, AuditLog. */

/* ── Page stack and header ─────────────────────────────────────────────── */

.admin-shell .dash-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.admin-shell .dash-stack--tight {
  gap: 16px;
}

.admin-shell .dash-stack > .dashboard-hero,
.admin-shell .dash-stack > .ui-tabs,
.admin-shell .dash-stack > .dash-panel,
.admin-shell .dash-stack > .dash-card {
  margin: 0;
}

.admin-shell .dash-hero {
  align-items: center;
}

.admin-shell .dash-hero .dashboard-hero__text {
  margin-top: 4px;
  font-size: 14px;
}

.admin-shell .dash-hero__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* The security banner fragment renders nothing while all is well. */
.admin-shell .dash-security-slot:empty {
  display: none;
}

.admin-shell .dash-security-slot:not(:has(*)) {
  display: none;
}

.admin-shell .dash-security-slot > .admin-users-section {
  margin: 0;
}

/* ── KPI row ───────────────────────────────────────────────────────────── */

.admin-shell .dash-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.admin-shell .dash-kpis--4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-shell .dash-kpi {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--tdo-color-border);
  border-radius: 14px;
  background: #fff;
  color: var(--tdo-color-text) !important;
  text-decoration: none;
  min-width: 0;
}

.admin-shell a.dash-kpi:hover {
  border-color: var(--tdo-color-border-strong);
  background: #fff;
}

.admin-shell .dash-kpi__label,
.admin-shell .dash-kpi__meta {
  font-size: 12px;
  color: var(--tdo-color-muted);
}

.admin-shell .dash-kpi__value {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
}

.admin-shell .dash-kpi__value--alert {
  color: var(--tdo-tone-warning-fg);
}

/* ── Two-column body and cards ─────────────────────────────────────────── */

.admin-shell .dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 20px;
  align-items: start;
}

.admin-shell .dash-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.admin-shell .dash-card {
  background: #fff;
  border: 1px solid var(--tdo-color-border);
  border-radius: 16px;
  padding: 20px;
  min-width: 0;
}

.admin-shell .dash-card__head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-shell .dash-card__title {
  flex: 1;
  margin: 0 0 4px;
  font: 700 16px var(--tdo-font-body);
}

.admin-shell .dash-card__note {
  margin: 2px 0 10px;
  font-size: 12px;
  color: var(--tdo-color-muted);
}

.admin-shell .dash-card__text {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--tdo-color-muted);
}

.admin-shell .dash-card .admin-users-table-wrap,
.admin-shell .dash-card > table {
  margin-top: 8px;
}

/* Tables inside the area: board cell sizes. */
.admin-shell .dash-table {
  font-size: 14px;
}

.admin-shell .dash-table td {
  padding: 12px;
}

.admin-shell .dash-sub {
  font-size: 12px;
  color: var(--tdo-color-muted);
}

.admin-shell .dash-muted {
  color: var(--tdo-color-muted);
}

.admin-shell .dash-strong,
.admin-shell .dash-strong-link {
  font-weight: 600;
}

.admin-shell .dash-mono {
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.admin-shell .dash-wrap {
  overflow-wrap: anywhere;
}

.admin-shell .dash-num {
  text-align: right;
  white-space: nowrap;
}

.admin-shell .dash-col-action {
  width: 110px;
}

.admin-shell .dash-col-menu {
  width: 44px;
}

.admin-shell .dash-sr-only {
  position: absolute;
  left: -9999px;
}

.admin-shell .dash-row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.admin-shell .dash-icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: var(--tdo-tone-neutral-fg) !important;
  text-decoration: none;
}

.admin-shell .dash-icon-link:hover {
  background: var(--tdo-tone-neutral-bg);
  color: var(--tdo-color-text) !important;
}

.admin-shell .dash-attention__note {
  margin: 8px 0 0;
}

/* Recent activity: borderless three-column list */
.admin-shell .dash-activity {
  margin-top: 6px;
}

.admin-shell .dash-activity__when {
  width: 90px;
  white-space: nowrap;
}

.admin-shell .dash-activity__status {
  text-align: right;
}

/* Integrations badges */
.admin-shell .dash-int {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-shell .dash-int__slot {
  display: contents;
}

.admin-shell .dash-int__slot > .alert {
  margin: 0;
  padding: 2px 9px;
  font-size: 12px;
  border-radius: 999px;
}

.admin-shell .dash-int__loading {
  opacity: 0.6;
}

.admin-shell .dash-int__reason {
  flex-basis: 100%;
  font-size: 12px;
  color: var(--tdo-tone-danger-fg);
  overflow-wrap: anywhere;
}

.admin-shell .dash-int__reason--info {
  color: var(--tdo-color-muted);
}

/* Head home: Needs attention as a list */
.admin-shell .dash-attn-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
}

.admin-shell .dash-attn-list li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

/* ── Full-width list panels (Alerts, Renewals, Audit log) ──────────────── */

.admin-shell .dash-panel {
  background: #fff;
  border: 1px solid var(--tdo-color-border);
  border-radius: 16px;
}

/* Rows that carry a ⋯ menu: the menu panel must not be clipped by the
   scroll box, so this panel lets the table wrap instead of scrolling. */
.admin-shell .dash-panel--menus .dash-panel__scroll {
  overflow: visible;
}

.admin-shell .dash-panel .dash-table tbody tr:last-child td:first-child {
  border-bottom-left-radius: 15px;
}

.admin-shell .dash-panel .dash-table tbody tr:last-child td:last-child {
  border-bottom-right-radius: 15px;
}

.admin-shell .dash-panel.vis-admin {
  box-shadow: none;
  border-color: var(--tdo-vis-admin-border);
}

.admin-shell .dash-panel__head {
  padding: 14px 14px 0;
}

.admin-shell .dash-panel__title {
  margin: 0;
  font: 700 16px var(--tdo-font-body);
}

.admin-shell .dash-panel__note {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--tdo-color-muted);
}

.admin-shell .dash-panel__head + .dash-panel__scroll {
  margin-top: 8px;
}

.admin-shell .dash-panel__scroll {
  overflow-x: auto;
}

.admin-shell .dash-panel__alert {
  margin: 14px;
}

.admin-shell .dash-panel__loading {
  margin: 0;
  padding: 18px 14px;
  font-size: 13px;
  color: var(--tdo-color-muted);
}

.admin-shell .dash-panel__foot {
  padding: 14px;
  border-top: 1px solid #eef2f5;
}

.admin-shell .dash-panel .ui-empty {
  border-top: 0;
}

.admin-shell .dash-panel .dash-table tbody tr:last-child td {
  border-bottom: 0;
}

/* Filter bar: text box + chips */
.admin-shell .dash-filterbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 14px;
  border-bottom: 1px solid var(--tdo-color-border);
}

.admin-shell .dash-panel__head + .dash-filterbar {
  margin-top: 8px;
  border-top: 1px solid var(--tdo-color-border);
}

.admin-shell .dash-filterbar__input {
  flex: 1 1 280px;
  min-width: 0;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--tdo-color-border-strong);
  border-radius: 10px;
  background: #fff;
  font: 400 13px var(--tdo-font-body);
  color: var(--tdo-color-text);
}

.admin-shell .dash-filterbar__input:focus {
  outline: none;
  border-color: var(--tdo-color-secondary);
  box-shadow: 0 0 0 3px rgba(131, 111, 255, 0.18);
}

.admin-shell .dash-chip,
.admin-shell .dash-filterbar .ui-menu > .button {
  height: 32px;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--tdo-color-border-strong);
  border-radius: 999px;
  background: #fff;
  font: 500 13px var(--tdo-font-body);
  color: var(--tdo-color-text);
  cursor: pointer;
}

.admin-shell .dash-chip {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 12px;
  max-width: 220px;
}

.admin-shell .dash-chip:hover,
.admin-shell .dash-filterbar .ui-menu > .button:hover {
  background: var(--tdo-color-hover);
}

/* Renewals: group heading rows */
.admin-shell .dash-table .dash-group-row td {
  padding: 8px 14px;
  font: 600 12px var(--tdo-font-body);
  background: #f8fafb;
  color: var(--tdo-color-muted);
}

.admin-shell .dash-table .dash-group-row:hover td {
  background: #f8fafb;
}

.admin-shell .dash-table .dash-group-row--danger td,
.admin-shell .dash-table .dash-group-row--danger:hover td {
  background: var(--tdo-tone-danger-bg);
  color: var(--tdo-tone-danger-fg);
}

.admin-shell .dash-table .dash-group-row--warning td,
.admin-shell .dash-table .dash-group-row--warning:hover td {
  background: var(--tdo-tone-warning-bg);
  color: var(--tdo-tone-warning-fg);
}

.admin-shell .dash-group-row__count {
  margin-left: 6px;
  opacity: 0.7;
}

/* Renewals: period switch (7 / 30 / 90 days) */
.admin-shell .dash-period .button {
  height: 32px;
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font: 600 12px var(--tdo-font-body);
  color: var(--tdo-tone-neutral-fg);
}

.admin-shell .dash-period .button[aria-pressed="true"] {
  background: var(--tdo-color-active-tint);
  box-shadow: inset 0 0 0 1px var(--tdo-color-primary);
  color: var(--tdo-color-text);
}

/* ── Responsive ────────────────────────────────────────────────────────── */

@media (max-width: 1200px) {
  .admin-shell .dash-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .admin-shell .dash-kpis--4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1023px) {
  .admin-shell .dash-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .admin-shell .dash-kpis,
  .admin-shell .dash-kpis--4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-shell .dash-card {
    padding: 16px;
  }

  .admin-shell .dash-hero__actions {
    width: 100%;
  }

  .admin-shell .dash-num {
    text-align: right;
  }

  .admin-shell .dash-col-action,
  .admin-shell .dash-col-menu {
    width: auto;
  }

  /* Card layout of the kit: group headings span the card. */
  .admin-shell .dash-table .dash-group-row td::before {
    content: none !important;
  }

  .admin-shell .dash-table .dash-group-row td {
    text-align: left !important;
  }
}
