/*
 * Role-Based Dashboard styles (Wave 1 module: role_based_dashboards).
 *
 * Targets the dynamically-rendered #role-dashboard-mount markup produced
 * by /js/role-dashboard.js. Reuses the kiln-* design tokens already
 * defined in portal-layout.css so the new widgets sit naturally in the
 * existing admin home grid.
 */

#role-dashboard-mount {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* When the role dashboard is rendering, suppress the legacy admin
 * dashboard-grid (Users/Pending Quotes/etc.) that sits as a sibling
 * underneath. The legacy tiles duplicate metrics the role pills already
 * show and create the bottom-heavy empty-card layout. Customer-only
 * cards keep their own visibility rules. */
#role-dashboard-mount.is-active ~ .dashboard-grid {
  display: none;
}

/* Inline notice banner shown when a dependency module is OFF */
.role-dashboard-notice {
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #fef3c7;
  border: 1px solid #fde68a;
  color: #92400e;
  font-size: 13px;
  line-height: 1.4;
}
.role-dashboard-notice strong {
  font-weight: 600;
}

/* Compact KPI pill row — replaces the old kiln-kpi-card-based metric
 * grid for the role dashboard. Tiles are intentionally smaller so the
 * top of the page doesn't dominate the page over the task widgets that
 * actually need attention. */
.role-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.role-kpi-pill {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  background: var(--surface, #fff);
  text-decoration: none;
  color: inherit;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
  min-height: 64px;
}
.role-kpi-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  border-color: var(--border-strong, #d1d5db);
}
.role-kpi-pill-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #6b7280);
}
.role-kpi-pill-value {
  font-size: 22px;
  font-weight: 600;
  color: var(--text, #111827);
  line-height: 1.1;
}

/* Category section — only emitted when there are >1 categories of
 * task widgets, otherwise widgets render directly in .role-dashboard-tasks
 * without a header. */
.role-task-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.role-task-section-header {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted, #6b7280);
  margin: 0;
}

/* Task widgets — default (single-category) is a flat grid. */
.role-dashboard-tasks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}
/* When grouped into category sections, the outer container becomes a
 * vertical stack of sections; each section runs its own internal grid. */
.role-dashboard-tasks.is-grouped {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.role-task-section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.role-task-widget {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.role-task-widget.is-empty {
  background: var(--canvas, #fafafa);
}
.role-task-widget.is-empty .role-task-empty {
  margin: 0;
  padding: 4px 0;
}

.role-task-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.role-task-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text, #111827);
  margin: 0;
  line-height: 1.3;
}

.role-task-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 8px;
  border-radius: 13px;
  background: var(--canvas, #f3f4f6);
  color: var(--text, #111827);
  font-size: 12px;
  font-weight: 600;
}
.role-task-count.is-pending { background: #fef3c7; color: #92400e; }
.role-task-count.is-approved { background: #d1fae5; color: #065f46; }
.role-task-count.is-bad { background: #fee2e2; color: #991b1b; }

.role-task-empty {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted, #6b7280);
  font-style: italic;
}

.role-task-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.role-task-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  background: var(--canvas, #fafafa);
  transition: background 100ms ease;
}
.role-task-row:hover {
  background: var(--surface, #fff);
}
.role-task-row.is-archived {
  opacity: 0.5;
}

.role-task-link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.role-task-primary {
  font-size: 14px;
  font-weight: 600;
  color: var(--text, #111827);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.role-task-secondary {
  font-size: 12px;
  color: var(--text-muted, #6b7280);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.role-task-total {
  font-size: 13px;
  font-weight: 600;
  color: var(--text, #111827);
  white-space: nowrap;
}

@media (max-width: 720px) {
  .role-dashboard-tasks {
    grid-template-columns: 1fr;
  }
  .role-task-widget {
    padding: 16px;
  }
}
