/**
 * Employee Dashboard home (#tab-dashboard) — modern overview layout.
 * Loads after portal-clean / portal-gpc; scoped so other tabs stay unchanged.
 */

#tab-dashboard.dash-home {
  --dash-space: 1.25rem;
  --dash-radius: 1rem;
  --dash-radius-sm: 0.75rem;
  --dash-gap: 1rem;
  --dash-accent: var(--accent, var(--bubble-out-mid, #2563eb));
  display: flex;
  flex-direction: column;
  gap: var(--dash-space);
  box-sizing: border-box;
  flex: 1 1 auto;
  align-self: stretch;
  width: 100%;
  max-width: none;
  min-width: 0;
  margin-inline: 0;
  padding-block: 0.15rem 1.75rem;
  font-family: "Inter", var(--portal-font-family, system-ui, sans-serif);
  font-feature-settings: "ss01" 1, "cv11" 1;
  letter-spacing: -0.011em;
}

html[lang="ar"] #tab-dashboard.dash-home,
html.is-rtl #tab-dashboard.dash-home {
  font-family: "IBM Plex Sans Arabic", var(--portal-font-family, system-ui, sans-serif);
  letter-spacing: 0;
}

#tab-dashboard.dash-home > .err:empty {
  display: none;
}

#appMain.main:has(> #tab-dashboard.dash-home:not(.hidden)) {
  padding-top: 0.65rem !important;
  align-items: stretch;
}

#tab-dashboard.dash-home > .card,
#tab-dashboard.dash-home > .dash-panel {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* —— Hero greeting —— */
#tab-dashboard.dash-home .dash-home__hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.65rem 1.25rem;
  padding: 0.15rem 0.15rem 0;
}

#tab-dashboard.dash-home .dash-home__kicker {
  margin: 0 0 0.28rem;
  font-size: 0.6875rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

#tab-dashboard.dash-home .dash-home__title {
  margin: 0;
  font-size: clamp(1.45rem, 2.2vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.15;
  color: var(--text);
}

#tab-dashboard.dash-home .dash-home__date {
  margin: 0.35rem 0 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.35;
}

#tab-dashboard.dash-home .dash-home__date:empty {
  display: none;
}

#tab-dashboard.dash-home .dash-banner {
  margin: 0;
  padding: 0.7rem 0.95rem;
  border-radius: var(--dash-radius-sm);
  font-size: 0.875rem;
}

#tab-dashboard.dash-home .dash-view-actions {
  margin: 0;
}

/* —— Shared cards —— */
#tab-dashboard.dash-home .dash-profile-card,
#tab-dashboard.dash-home .dash-active-work-card,
#tab-dashboard.dash-home .dash-done-trend-card,
#tab-dashboard.dash-home .dash-active-deployments-card {
  margin-top: 0 !important;
  border-radius: var(--dash-radius) !important;
  border: 1px solid var(--border) !important;
  background: var(--panel) !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 28px rgba(15, 23, 42, 0.045) !important;
}

[data-theme="dark"] #tab-dashboard.dash-home .dash-profile-card,
[data-theme="dark"] #tab-dashboard.dash-home .dash-active-work-card,
[data-theme="dark"] #tab-dashboard.dash-home .dash-done-trend-card,
[data-theme="dark"] #tab-dashboard.dash-home .dash-active-deployments-card {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.28), 0 12px 32px rgba(0, 0, 0, 0.22) !important;
}

#tab-dashboard.dash-home .card.dash-profile-card,
#appView #tab-dashboard.dash-home .card.dash-profile-card {
  padding: 1.35rem 1.4rem 1.25rem !important;
}

#tab-dashboard.dash-home .dash-active-work-card,
#tab-dashboard.dash-home .dash-done-trend-card,
#tab-dashboard.dash-home .dash-active-deployments-card,
#dashActiveWorkCard.dash-panel.dash-active-work-card,
#dashActiveDeploymentsCard.dash-panel.dash-active-deployments-card {
  padding: 1.25rem 1.35rem 1.3rem !important;
}

#tab-dashboard.dash-home .page-title {
  font-size: 1.05rem !important;
  font-weight: 650 !important;
  letter-spacing: -0.02em !important;
  color: var(--text) !important;
}

/* —— Identity band —— */
#tab-dashboard.dash-home .dash-top-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(15.5rem, 28%);
  gap: 1.35rem 1.5rem;
  align-items: stretch;
  width: 100%;
}

#tab-dashboard.dash-home .dash-profile-head {
  align-items: flex-start;
  gap: 1.05rem;
  margin-bottom: 1.15rem;
}

#tab-dashboard.dash-home .dash-profile-head__photo {
  width: 4.5rem;
  height: 4.5rem;
  position: relative;
}

#tab-dashboard.dash-home .dash-profile-head__photo .avatar {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 1.15rem;
  border: none;
  box-shadow:
    0 0 0 3px var(--panel),
    0 0 0 5px color-mix(in srgb, var(--dash-accent) 38%, var(--border));
  background: var(--surface);
}

#tab-dashboard.dash-home .dash-profile-head__fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 1.15rem;
  background: color-mix(in srgb, var(--dash-accent) 14%, var(--surface));
  color: var(--dash-accent);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  box-shadow:
    0 0 0 3px var(--panel),
    0 0 0 5px color-mix(in srgb, var(--dash-accent) 38%, var(--border));
}

#tab-dashboard.dash-home .dash-profile-head__fallback.hidden {
  display: none;
}

#tab-dashboard.dash-home .dash-profile-name {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  white-space: normal;
}

#tab-dashboard.dash-home .dash-profile-head__topline {
  gap: 0.55rem 0.7rem;
}

#tab-dashboard.dash-home .wd-presence-pill--inline {
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  padding: 0.28rem 0.55rem 0.28rem 0.45rem;
  text-transform: uppercase;
}

#tab-dashboard.dash-home .dash-profile-sub {
  font-size: 0.875rem;
  margin-top: 0.15rem;
}

#tab-dashboard.dash-home .dash-profile-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem 0.65rem;
  margin-top: 0.85rem;
}

@media (min-width: 720px) {
  #tab-dashboard.dash-home .dash-profile-meta {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

#tab-dashboard.dash-home .dash-meta-item {
  padding: 0.6rem 0.75rem;
  border: 1px solid transparent;
  border-radius: var(--dash-radius-sm);
  background: var(--surface);
}

#tab-dashboard.dash-home .dash-meta-k {
  font-size: 0.625rem;
  letter-spacing: 0.07em;
  margin-bottom: 0.22rem;
}

#tab-dashboard.dash-home .dash-meta-v {
  font-size: 0.875rem;
  font-weight: 650;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  line-height: 1.3;
}

/* —— Presence tiles —— */
#tab-dashboard.dash-home .dash-presence-row {
  margin-top: 0;
  gap: 0.75rem;
}

#tab-dashboard.dash-home .dash-presence-card {
  padding: 0.9rem 1rem 0.95rem !important;
  border-radius: var(--dash-radius-sm) !important;
  border: 1px solid var(--border) !important;
  background: var(--surface) !important;
  box-shadow: none !important;
}

#tab-dashboard.dash-home .dash-presence-card__title {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.8125rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text);
}

#tab-dashboard.dash-home .dash-presence-k-icon {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 0.6rem;
  background: color-mix(in srgb, var(--dash-accent) 12%, var(--panel));
  color: var(--dash-accent);
}

#tab-dashboard.dash-home .dash-presence-row > .dash-presence-card:nth-child(2) .dash-presence-k-icon {
  background: color-mix(in srgb, #0d9488 14%, var(--panel));
  color: #0f766e;
}

[data-theme="dark"] #tab-dashboard.dash-home .dash-presence-row > .dash-presence-card:nth-child(2) .dash-presence-k-icon {
  color: #5eead4;
}

#tab-dashboard.dash-home .dash-presence-card .kv-v {
  margin-top: 0.55rem;
  font-size: 0.875rem !important;
}

#tab-dashboard.dash-home .dash-att-month {
  margin-top: 0.75rem;
  padding: 0.9rem 1rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--dash-radius-sm);
  background: var(--surface);
}

#tab-dashboard.dash-home .dash-att-month__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

#tab-dashboard.dash-home .dash-att-month__title {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text);
}

#tab-dashboard.dash-home .dash-att-month__table {
  display: flex;
  flex-direction: column;
}

#tab-dashboard.dash-home .dash-att-month__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0;
  border-top: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  font-size: 0.75rem;
}

#tab-dashboard.dash-home .dash-att-month__row:first-child {
  border-top: 0;
}

#tab-dashboard.dash-home .dash-att-month__k {
  color: var(--muted);
}

#tab-dashboard.dash-home .dash-att-month__v {
  font-weight: 650;
  color: var(--text);
  text-align: end;
  white-space: nowrap;
}

#tab-dashboard.dash-home .dash-top-split__aside.dash-job-panel {
  padding: 1.05rem 1.1rem;
  border: 1px solid var(--border);
  border-inline-start: 1px solid var(--border);
  border-radius: var(--dash-radius-sm);
  background: var(--surface) !important;
  box-shadow: none !important;
}

#tab-dashboard.dash-home .dash-job-panel__head {
  font-size: 0.6875rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

#tab-dashboard.dash-home .dash-job-panel__label {
  font-size: 0.625rem;
}

#tab-dashboard.dash-home .dash-job-panel__value {
  font-size: 0.875rem;
  font-weight: 650;
}

#tab-dashboard.dash-home .dash-job-panel__duties {
  font-size: 0.8125rem;
  color: var(--text);
}

@media (max-width: 900px) {
  #tab-dashboard.dash-home .dash-top-split {
    grid-template-columns: 1fr;
  }

  #tab-dashboard.dash-home .dash-top-split__aside.dash-job-panel {
    padding: 1.05rem 1.1rem;
    border-inline-start: 1px solid var(--border);
    border-top: 1px solid var(--border);
  }

  #tab-dashboard.dash-home .dash-presence-row {
    grid-template-columns: 1fr;
  }
}

/* —— Active work —— */
#tab-dashboard.dash-home .dash-active-work-card__head {
  margin-bottom: 0.95rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

#tab-dashboard.dash-home .dash-active-work-section + .dash-active-work-section {
  margin-top: 1.15rem;
  padding-top: 1.05rem;
  border-top: 1px solid var(--border);
}

#tab-dashboard.dash-home .dash-active-work-section__label {
  font-size: 0.8125rem !important;
  font-weight: 650 !important;
  letter-spacing: -0.01em;
}

#tab-dashboard.dash-home .dash-work-tag,
#tab-dashboard.dash-home .dash-active-work-section__head .dash-work-tag {
  display: inline-flex;
  align-items: baseline;
  gap: 0.28rem;
  padding: 0.22rem 0.55rem !important;
  border-radius: 999px !important;
  border: 1px solid var(--border);
  background: var(--panel) !important;
  font-size: 0.6875rem;
  letter-spacing: 0.01em;
  color: var(--muted) !important;
}

#tab-dashboard.dash-home .dash-work-tag + .dash-work-tag::before {
  content: none;
  margin: 0;
  display: none;
}

#tab-dashboard.dash-home .dash-work-tag__num {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--text) !important;
}

#tab-dashboard.dash-home #dashActiveWorkCard .tm-data-table--dashboard tbody tr:hover td {
  background: color-mix(in srgb, var(--surface) 80%, var(--panel)) !important;
}

/* —— Completed work —— */
#tab-dashboard.dash-home .dash-done-trend-card__head {
  margin-bottom: 0.95rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  align-items: center;
}

#tab-dashboard.dash-home .dash-done-trend-card__head .page-title {
  font-size: 1.05rem !important;
  font-weight: 650 !important;
}

#tab-dashboard.dash-home .dash-done-trend-card__subtitle {
  font-size: 0.8125rem;
  font-weight: 450;
}

#tab-dashboard.dash-home .dash-done-trend-filter {
  gap: 0.15rem;
  padding: 0.18rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
}

#tab-dashboard.dash-home .dash-done-trend-filter__btn {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  padding: 0.38rem 0.7rem;
  border-radius: 999px;
}

#tab-dashboard.dash-home .dash-done-trend-filter__btn:focus-visible {
  outline: 2px solid var(--dash-accent);
  outline-offset: 1px;
}

#tab-dashboard.dash-home .dash-done-trend-filter__btn.is-active {
  background: var(--dash-accent);
  color: var(--btn-primary-fg, #fff);
  border-color: transparent;
}

#tab-dashboard.dash-home .dash-done-trend-legend {
  font-size: 0.75rem;
  font-weight: 550;
  gap: 1rem;
  color: var(--muted);
}

#tab-dashboard.dash-home .dash-done-trend-legend__swatch {
  height: 0.28rem;
  width: 1.15rem;
  border-radius: 999px;
}

#tab-dashboard.dash-home .dash-done-trend-chart-wrap {
  border-radius: var(--dash-radius-sm);
  background: color-mix(in srgb, var(--surface) 70%, var(--panel));
  padding: 0.65rem 0.35rem 0.2rem;
}

#tab-dashboard.dash-home .dash-active-work-metric {
  padding: 0.7rem 0.75rem !important;
  border-radius: var(--dash-radius-sm) !important;
  background: var(--surface) !important;
}

#tab-dashboard.dash-home .dash-active-work-metric__v {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

#tab-dashboard.dash-home .dash-active-work-metric__k {
  font-size: 0.6875rem;
  letter-spacing: 0.02em;
}

#tab-dashboard.dash-home .dash-done-trend-metrics .dash-active-work-metric__v {
  font-size: 1.35rem;
}

/* —— Deployments —— */
#tab-dashboard.dash-home .dash-active-deployments-card__head {
  margin-bottom: 0.75rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--border);
  align-items: center;
}

#tab-dashboard.dash-home .dash-active-deployments-card .active-dep-count {
  font-size: 0.8125rem;
  font-weight: 600;
}

@media (max-width: 640px) {
  #tab-dashboard.dash-home {
    --dash-space: 1rem;
    padding-block: 0 1.25rem;
  }

  #tab-dashboard.dash-home .card.dash-profile-card,
  #appView #tab-dashboard.dash-home .card.dash-profile-card,
  #tab-dashboard.dash-home .dash-active-work-card,
  #tab-dashboard.dash-home .dash-done-trend-card,
  #tab-dashboard.dash-home .dash-active-deployments-card,
  #dashActiveWorkCard.dash-panel.dash-active-work-card,
  #dashActiveDeploymentsCard.dash-panel.dash-active-deployments-card {
    padding: 1rem 0.95rem 1.05rem !important;
  }

  #tab-dashboard.dash-home .dash-profile-head__photo,
  #tab-dashboard.dash-home .dash-profile-head__photo .avatar {
    width: 3.65rem;
    height: 3.65rem;
  }

  #tab-dashboard.dash-home .dash-profile-head__fallback {
    font-size: 1.25rem;
    border-radius: 1rem;
  }

  #tab-dashboard.dash-home .dash-profile-name {
    font-size: 1.15rem;
  }

  #tab-dashboard.dash-home .dash-profile-meta {
    grid-template-columns: 1fr 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  #tab-dashboard.dash-home .dash-done-trend-filter__btn,
  #tab-dashboard.dash-home #dashActiveWorkCard .tm-data-table--dashboard tbody tr td {
    transition: none;
  }
}

/* Today's attendance card (dashboard timesheet tile) */
#tab-dashboard.dash-home .dash-att-today__status {
  margin: 0 0 0.55rem;
  font-size: 0.8125rem;
  font-weight: 650;
  color: var(--text);
}

#tab-dashboard.dash-home .dash-att-today__status--late {
  color: #b45309;
}

#tab-dashboard.dash-home .dash-att-today__status--done {
  color: #047857;
}

#tab-dashboard.dash-home .dash-att-today__roster {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
}

#tab-dashboard.dash-home .dash-att-today__roster-k,
#tab-dashboard.dash-home .dash-att-today__hours-k,
#tab-dashboard.dash-home .dash-att-today__punch-k {
  color: var(--muted);
}

#tab-dashboard.dash-home .dash-att-today__roster-v {
  font-weight: 600;
  text-align: end;
}

#tab-dashboard.dash-home .dash-att-today__punches {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.55rem;
}

#tab-dashboard.dash-home .dash-att-today__punch {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.75rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}

#tab-dashboard.dash-home .dash-att-today__punch--active .dash-att-today__punch-v {
  color: var(--primary, #2563eb);
  font-weight: 650;
}

#tab-dashboard.dash-home .dash-att-today__hours {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.8125rem;
  margin-bottom: 0.35rem;
}

#tab-dashboard.dash-home .dash-att-today__hours-v strong {
  font-weight: 700;
}

#tab-dashboard.dash-home .dash-att-today__advice {
  margin-top: 0.45rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

#tab-dashboard.dash-home .dash-att-today__advice-line {
  margin: 0;
  padding: 0.45rem 0.55rem;
  border-radius: 0.45rem;
  font-size: 0.72rem;
  line-height: 1.4;
}

#tab-dashboard.dash-home .dash-att-today__advice-line--info {
  background: color-mix(in srgb, #2563eb 12%, var(--surface));
  color: var(--text);
}

#tab-dashboard.dash-home .dash-att-today__advice-line--warn {
  background: color-mix(in srgb, #d97706 14%, var(--surface));
  color: #92400e;
}

#tab-dashboard.dash-home .dash-att-today__advice-line--danger {
  background: color-mix(in srgb, #dc2626 12%, var(--surface));
  color: #991b1b;
}

#tab-dashboard.dash-home .dash-att-today__advice-line--ok {
  background: color-mix(in srgb, #059669 12%, var(--surface));
  color: #065f46;
}

[data-theme="dark"] #tab-dashboard.dash-home .dash-att-today__advice-line--warn {
  color: #fbbf24;
}

[data-theme="dark"] #tab-dashboard.dash-home .dash-att-today__advice-line--danger {
  color: #fca5a5;
}

[data-theme="dark"] #tab-dashboard.dash-home .dash-att-today__advice-line--ok {
  color: #6ee7b7;
}

/* Monthly attendance timesheet modal */
.dash-att-modal__panel {
  max-width: min(920px, 96vw);
  max-height: min(90vh, 900px);
  display: flex;
  flex-direction: column;
}

.dash-att-modal__body {
  padding: 0 1.1rem 1.1rem;
  overflow: auto;
  flex: 1;
  min-height: 0;
}

.dash-att-modal__desc {
  margin: 0 0 0.85rem;
  font-size: 0.8125rem;
}

.dash-att-modal__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  margin-bottom: 0.65rem;
}

.dash-att-modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.dash-att-modal__status {
  margin: 0.35rem 0;
  font-size: 0.8125rem;
}

.dash-att-modal__summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.75rem;
}

.dash-att-modal__preview-wrap {
  margin-top: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--dash-radius-sm, 0.5rem);
  padding: 0.65rem;
  max-height: min(52vh, 480px);
  overflow: auto;
  background: var(--surface);
}

.dash-att-modal__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
}

.dash-att-modal__table th,
.dash-att-modal__table td {
  padding: 0.4rem 0.45rem;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  text-align: start;
  white-space: nowrap;
}

.dash-att-modal__table th {
  font-weight: 650;
  color: var(--muted);
  position: sticky;
  top: 0;
  background: var(--surface);
}

@media (max-width: 640px) {
  #tab-dashboard.dash-home .dash-att-today__punches {
    grid-template-columns: 1fr;
  }

  .dash-att-modal__controls {
    flex-direction: column;
    align-items: stretch;
  }
}
