/* Department Overview — scrollable manager dashboard.
 * Namespaced under .do-* so nothing leaks into other pages. Self-contained:
 * uses the global styles.css custom props with hard fallbacks, no dependency on
 * the video page's --vd-* tokens. Mobile-first friendly: the card grid reflows
 * to a single column on narrow screens and the page scrolls vertically, never
 * horizontally cut off. */

.do-page {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  /* The app shell (.dashboard-content) is overflow:hidden, so this page must own
     its own scroll or long card lists get clipped (same pattern as .client-dashboard). */
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ── header ──────────────────────────────────────────────────────────────── */
.do-head { display: flex; flex-direction: column; gap: 4px; }
.do-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary, #1a1a1a);
}
.do-sub {
  font-size: 13px;
  color: var(--text-muted, #666);
  max-width: 60ch;
}

.do-body { display: flex; flex-direction: column; gap: 18px; }

.do-loading, .do-empty {
  padding: 24px 4px;
  font-size: 13px;
  color: var(--text-muted, #666);
}
.do-error {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 24px;
  font-size: 14px;
  color: var(--text-secondary, #444);
}
.do-btn {
  border: 1px solid var(--border-color, #e5e7eb);
  background: var(--card-bg, #fff);
  color: var(--text-primary, #1a1a1a);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.do-btn:hover { background: #f8fafc; }

/* ── KPI strip ───────────────────────────────────────────────────────────── */
.do-kpi-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
.do-kpi {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
  min-width: 0;
}
.do-kpi-accent {
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: #94a3b8;
}
.do-kpi-accent.critical { background: #991b1b; }
.do-kpi-accent.alert  { background: #dc2626; }
.do-kpi-accent.warm   { background: #d97706; }
.do-kpi-accent.active { background: #2563eb; }
.do-kpi-accent.cold   { background: #0d9488; }
.do-kpi-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted, #666);
  font-weight: 700;
}
.do-kpi-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-feature-settings: "tnum";
  color: var(--text-primary, #1a1a1a);
}
.do-kpi-delta {
  font-size: 12px;
  color: var(--text-muted, #666);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── section panels ──────────────────────────────────────────────────────── */
.do-panels { display: flex; flex-direction: column; gap: 20px; }
.do-panel {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 14px;
  overflow: hidden;
}
.do-panel-hdr {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-secondary, #444);
}
.do-panel-hdr::before {
  content: '';
  width: 8px; height: 8px; border-radius: 999px;
  background: #94a3b8; flex-shrink: 0;
}
.do-panel-hdr.critical::before { background: #991b1b; }
.do-panel-hdr.alert::before  { background: #dc2626; }
.do-panel-hdr.warm::before   { background: #d97706; }
.do-panel-hdr.active::before { background: #2563eb; }
.do-panel-title { }
.do-panel-count {
  margin-left: auto;
  background: #f1f5f9; color: #475569;
  border-radius: 999px; padding: 2px 10px; font-size: 11px;
  font-weight: 600; letter-spacing: 0; text-transform: none;
}

/* ── card grid ───────────────────────────────────────────────────────────── */
.do-card-grid {
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.do-card-grid .do-empty { grid-column: 1 / -1; padding: 8px 4px; }

.do-card {
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  background: #fff;
  transition: box-shadow .12s ease, border-color .12s ease, transform .12s ease;
  min-width: 0;
}
.do-card:hover, .do-card:focus {
  border-color: #cbd5e1;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
  outline: none;
  transform: translateY(-1px);
}
.do-card-head { display: flex; align-items: flex-start; gap: 8px; }
.do-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #1a1a1a);
  line-height: 1.3;
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.do-card-rating { flex-shrink: 0; }
.do-card-client {
  font-size: 12px;
  color: var(--text-muted, #666);
  overflow-wrap: anywhere;
}
.do-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.do-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary, #444);
}
.do-card-due { font-weight: 600; }

/* ── status chip ─────────────────────────────────────────────────────────── */
.do-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: var(--chip, #6b7280);
  background: color-mix(in srgb, var(--chip, #6b7280) 12%, transparent);
  max-width: 100%;
}
.do-status-dot {
  width: 7px; height: 7px; border-radius: 999px; flex-shrink: 0;
}
.do-status-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── dept badge ──────────────────────────────────────────────────────────── */
.do-dept-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--dept, #6b7280);
  background: color-mix(in srgb, var(--dept, #6b7280) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--dept, #6b7280) 30%, transparent);
}

/* ── responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .do-kpi-strip { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .do-page { padding: 14px; gap: 14px; }
  .do-kpi-strip { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .do-kpi { padding: 12px 12px; }
  .do-kpi-value { font-size: 22px; }
  .do-card-grid {
    grid-template-columns: 1fr;
    padding: 12px;
  }
  .do-title { font-size: 19px; }
}

/* ── #134 dark mode overrides ─────────────────────────────── */
html[data-theme="dark"] .do-btn:hover { background: #334155; }

/* Accent bars and header dots are 3px/8px marks on a slate card — the deeper
   reds and blues disappear, so each hue is lifted while keeping its meaning. */
html[data-theme="dark"] .do-kpi-accent { background: #94a3b8; }
html[data-theme="dark"] .do-kpi-accent.critical,
html[data-theme="dark"] .do-panel-hdr.critical::before { background: #f87171; }
html[data-theme="dark"] .do-kpi-accent.alert,
html[data-theme="dark"] .do-panel-hdr.alert::before { background: #fb7185; }
html[data-theme="dark"] .do-kpi-accent.warm,
html[data-theme="dark"] .do-panel-hdr.warm::before { background: #fbbf24; }
html[data-theme="dark"] .do-kpi-accent.active,
html[data-theme="dark"] .do-panel-hdr.active::before { background: #60a5fa; }
html[data-theme="dark"] .do-kpi-accent.cold { background: #2dd4bf; }

html[data-theme="dark"] .do-panel-count {
  background: rgba(148, 163, 184, 0.16);
  color: #cbd5e1;
}

/* Cards sit inside a --card-bg panel, so they need the raised tone to separate. */
html[data-theme="dark"] .do-card { background: #273449; }
html[data-theme="dark"] .do-card:hover,
html[data-theme="dark"] .do-card:focus {
  border-color: #475569;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}

/* --chip / --dept are set inline by the JS to mid-tone brand hues that read as
   foreground text. Those hues sit at ~2:1 on slate, so the hue is mixed toward
   white for the text and the tint alpha is raised to keep the pill visible. */
html[data-theme="dark"] .do-status-chip {
  color: color-mix(in srgb, var(--chip, #94a3b8) 55%, #ffffff);
  background: color-mix(in srgb, var(--chip, #94a3b8) 20%, transparent);
}
html[data-theme="dark"] .do-dept-badge {
  color: color-mix(in srgb, var(--dept, #94a3b8) 55%, #ffffff);
  background: color-mix(in srgb, var(--dept, #94a3b8) 16%, transparent);
  border-color: color-mix(in srgb, var(--dept, #94a3b8) 42%, transparent);
}
@supports not (color: color-mix(in srgb, red 50%, white)) {
  html[data-theme="dark"] .do-status-chip,
  html[data-theme="dark"] .do-dept-badge {
    color: #cbd5e1;
    background: rgba(148, 163, 184, 0.16);
  }
}
