/* Compact My Work summaries. Quantity colors are shared across the cards. */

.mp-widget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 14px;
  margin-top: 18px;
}

html:not(.mp-ready) .mp-count-card[data-mp-feature],
html.mp-ready:not(.mp-feat-tasks) .mp-count-card[data-mp-feature="tasks"],
html.mp-ready:not(.mp-feat-osp) .mp-count-card[data-mp-feature="osp"],
html.mp-ready:not(.mp-feat-fleet) .mp-count-card[data-mp-feature="fleet"],
html.mp-ready:not(.mp-feat-warehouse) .mp-count-card[data-mp-feature="warehouse"],
.mp-count-card[hidden] {
  display: none !important;
}

.mp-count-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 222px;
  padding: 18px;
  border: 1px solid #e3e7ed;
  border-radius: 17px;
  background: linear-gradient(150deg, #fff 70%, #fcfcfd);
  color: #18212b;
  box-shadow: 0 3px 12px rgba(20, 32, 46, 0.045);
}

.mp-count-card--link {
  text-decoration: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.mp-count-card--link::after {
  position: absolute;
  top: 15px;
  right: 18px;
  color: #89939e;
  content: "↗";
  font-size: 1.1rem;
  line-height: 1;
}

.mp-count-card--link:hover {
  transform: translateY(-2px);
  border-color: #c9d2db;
  box-shadow: 0 9px 22px rgba(20, 32, 46, 0.095);
}

.mp-count-card--link:hover::after { color: #3f4b57; }

.mp-count-card--link:focus-visible,
.mp-count-card a:focus-visible {
  outline: 2px solid #ff763b;
  outline-offset: 3px;
}

#mp-fleet-activity-widget .mp-count-card__title {
  padding-right: 124px;
}

.mp-activity-tools {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mp-activity-age {
  color: #687581;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.mp-activity-age.is-error {
  color: #c93647;
}

.mp-activity-refresh {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid #e3e7ed;
  border-radius: 999px;
  background: #fff;
  color: #4d5b68;
  cursor: pointer;
}

.mp-activity-refresh:hover {
  color: #18212b;
  border-color: #c5ced6;
}

.mp-activity-refresh:focus-visible {
  outline: 2px solid #ff763b;
  outline-offset: 2px;
}

.mp-activity-refresh:disabled {
  cursor: wait;
  opacity: 0.7;
}

.mp-activity-refresh svg {
  width: 16px;
  height: 16px;
}

.mp-activity-refresh.is-busy svg {
  animation: mp-activity-spin 0.8s linear infinite;
}

@keyframes mp-activity-spin {
  to { transform: rotate(360deg); }
}

.mp-count-card__title {
  margin: 0;
  padding-right: 32px;
  color: #18212b;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.mp-count-card__viewall {
  position: absolute;
  top: 20px;
  right: 18px;
  color: #697684;
  font-size: 0.7rem;
  font-weight: 700;
  text-decoration: none;
}

.mp-count-card__viewall:hover {
  color: #273746;
  text-decoration: underline;
}

.mp-count-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: space-between;
  gap: 15px;
  padding-top: 17px;
}

.mp-count-card__body--solo { justify-content: center; }

.mp-count-card__primary,
.mp-count-card__stat {
  display: flex;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.mp-count-card__primary {
  flex: 1;
  flex-direction: row;
  align-items: center;
  gap: 13px;
}

.mp-count-card__primary-value {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  min-width: 76px;
  min-height: 74px;
  padding: 5px 10px;
  border-radius: 15px;
  background: var(--count-bg);
  color: var(--count-color);
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.06em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.mp-count-card__primary-label {
  color: #283541;
  font-size: 0.98rem;
  font-weight: 750;
  line-height: 1.25;
}

.mp-count-card__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  width: 100%;
}

.mp-count-card__stats--quad {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mp-count-card__stats--single {
  grid-template-columns: minmax(0, 150px);
}

.mp-count-card__stat {
  flex-direction: column;
  justify-content: center;
  min-height: 58px;
  padding: 8px 9px;
  border: 1px solid #f0f2f5;
  border-radius: 11px;
  background: #f8f9fb;
}

.mp-count-card__stat-value {
  color: var(--count-color);
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.mp-count-card__stat-label {
  margin-top: 3px;
  color: #687581;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.15;
}

.mp-count-card__primary[href]:hover .mp-count-card__primary-label,
.mp-count-card__stat[href]:hover .mp-count-card__stat-label {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.mp-tone-low { --count-color: #238454; --count-bg: #e8f5ec; }
.mp-tone-good { --count-color: #1b7a46; --count-bg: #e6f6ec; }
.mp-tone-medium { --count-color: #a3730b; --count-bg: #fff4d7; }
.mp-tone-high { --count-color: #c93647; --count-bg: #fff0ef; }
.mp-tone-critical { --count-color: #87233a; --count-bg: #fbe9ed; }
.mp-tone-neutral { --count-color: #6b7580; --count-bg: #f0f2f4; }

.mp-count-card__stat.mp-tone-good {
  background: var(--count-bg);
  border-color: #d4eedd;
}

.mp-count-card__unavailable,
.mp-activity-note {
  margin: auto 0;
  color: #687581;
  font-size: 0.83rem;
  font-weight: 600;
}

.mp-activity-note {
  margin: 0;
  font-size: 0.75rem;
}

#mp-fleet-deductions-widget .mp-count-card__title {
  padding-right: 48px;
}

.mp-deductions-new {
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
}

.mp-deduction-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.mp-deduction-modal[hidden] { display: none; }

.mp-deduction-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 24, 32, 0.45);
}

.mp-deduction-modal__panel {
  position: relative;
  width: min(440px, 100%);
  max-height: min(92vh, 720px);
  overflow: auto;
  padding: 18px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(16, 24, 32, 0.18);
}

.mp-deduction-modal__title {
  margin: 0 0 12px;
  font-size: 1.15rem;
}

.mp-deduction-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #3d4853;
}

.mp-deduction-field input,
.mp-deduction-field select,
.mp-deduction-field textarea {
  font: inherit;
  font-weight: 600;
  color: #18212b;
  padding: 8px 10px;
  border: 1px solid #d5dbe2;
  border-radius: 10px;
  background: #fff;
}

.mp-deduction-field select:disabled {
  background: #f3f5f7;
  color: #3d4853;
}

.mp-deduction-modal__error {
  margin: 0 0 10px;
  color: #c93647;
  font-size: 0.82rem;
  font-weight: 700;
}

.mp-deduction-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.mp-count-card--fleet .mp-count-card__body {
  gap: 12px;
}

.mp-count-card--warehouse .mp-count-card__title {
  padding-right: 78px;
}

.mp-fleet-widget__latest {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.mp-fleet-widget__latest-label {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6b7785;
}

.mp-fleet-widget__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mp-fleet-widget__item {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid #e8ecf1;
  border-radius: 10px;
  background: #fafbfc;
}

.mp-fleet-widget__truck {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: #18212b;
  line-height: 1.25;
}

.mp-warehouse-widget__link,
.mp-fleet-widget__truck a {
  color: inherit;
  text-decoration: none;
}

.mp-warehouse-widget__link {
  display: block;
}

.mp-warehouse-widget__link:hover .mp-fleet-widget__truck,
.mp-fleet-widget__truck a:hover {
  text-decoration: underline;
}

.mp-fleet-widget__notes {
  margin: 3px 0 0;
  font-size: 0.82rem;
  line-height: 1.35;
  color: #4b5563;
}

.mp-fleet-widget__notes--empty {
  color: #9aa3ad;
  font-style: italic;
}

.mp-fleet-widget__empty {
  margin: 0;
  font-size: 0.88rem;
  color: #6b7785;
}

.mp-count-card--email {
  min-height: 0;
}

.mp-count-card--email .mp-count-card__body {
  gap: 10px;
}

.mp-email-widget__summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.mp-email-widget__latest-label {
  margin: 2px 0 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6b7785;
}

.mp-email-widget__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mp-email-widget__item {
  min-width: 0;
}

.mp-email-widget__link {
  display: block;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid #e8ecf1;
  border-radius: 9px;
  background: #fafbfc;
  text-decoration: none;
  color: inherit;
}

.mp-email-widget__link:hover {
  border-color: #cfd8e3;
  background: #f3f6f9;
}

.mp-email-widget__meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.mp-email-widget__from {
  margin: 0;
  min-width: 0;
  font-size: 0.84rem;
  font-weight: 700;
  color: #18212b;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mp-email-widget__age {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 700;
  color: #8a95a1;
  letter-spacing: 0.01em;
}

.mp-email-widget__subject {
  margin: 2px 0 0;
  font-size: 0.78rem;
  line-height: 1.3;
  color: #4b5563;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mp-email-widget__more {
  align-self: flex-start;
  margin-top: 2px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 650;
  color: #3f4b57;
  cursor: pointer;
  text-decoration: none;
}

.mp-email-widget__more:hover {
  color: #18212b;
  text-decoration: underline;
}

.mp-email-widget__snippet {
  margin: 3px 0 0;
  font-size: 0.78rem;
  line-height: 1.35;
  color: #5b6775;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mp-email-widget__empty {
  margin: 0;
  font-size: 0.84rem;
  color: #6b7785;
}

.mp-email-action__badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.4;
}

.mp-email-action--urgent .mp-email-action__badge {
  color: #9a3412;
  background: #ffedd5;
}

.mp-email-action--deadline .mp-email-action__badge {
  color: #b45309;
  background: #fef3c7;
}

.mp-email-action--reply .mp-email-action__badge {
  color: #1d4ed8;
  background: #dbeafe;
}

.mp-email-action__verb {
  margin: 5px 0 0;
  font-size: 0.9rem;
  font-weight: 750;
  color: #18212b;
  line-height: 1.25;
}

.mp-email-action__from {
  margin: 2px 0 0;
  font-size: 0.74rem;
  font-weight: 650;
  color: #687581;
}

.mp-email-action-group + .mp-email-action-group {
  margin-top: 12px;
}

.mp-email-widget__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 2px;
}

.mp-email-widget__foot-link {
  font-size: 0.76rem;
  font-weight: 650;
  color: #687581;
  text-decoration: none;
}

.mp-email-widget__foot-link:hover {
  color: #18212b;
  text-decoration: underline;
}

.mp-email-modal__panel {
  width: min(560px, 100%);
}

.mp-email-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.mp-email-modal__head .mp-deduction-modal__title {
  margin-bottom: 4px;
}

.mp-email-modal__subtitle {
  margin: 0;
  font-size: 0.82rem;
  color: #687581;
  font-weight: 600;
}

.mp-email-modal__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.mp-email-modal__stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f5f7f9;
  border: 1px solid #e8ecf1;
}

.mp-email-modal__stat-value {
  font-size: 1.15rem;
  font-weight: 750;
  color: #18212b;
  line-height: 1.1;
}

.mp-email-modal__stat-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6b7785;
}

.mp-email-modal__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
  max-height: min(52vh, 420px);
  overflow: auto;
}

.mp-email-modal__body .mp-email-widget__link {
  padding: 9px 11px;
}

.mp-email-modal__body .mp-email-widget__from {
  white-space: normal;
}

.mp-email-modal__body .mp-email-widget__subject {
  white-space: normal;
}

.mp-count-card__kicker {
  margin: 4px 0 0;
  color: #687581;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.mp-dvir-rows {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}

.mp-dvir-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid #e8ecf1;
  border-radius: 12px;
  background: #f8f9fb;
}

.mp-dvir-row__label {
  color: #283541;
  font-size: 0.95rem;
  font-weight: 750;
}

.mp-dvir-row__value {
  color: #18212b;
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.mp-count-card__skeleton {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: space-between;
  gap: 15px;
}

.mp-count-card__skeleton span {
  display: block;
  border-radius: 9px;
  background: linear-gradient(90deg, #f3f5f7 25%, #e9edf1 37%, #f3f5f7 63%);
  background-size: 400% 100%;
  animation: mp-count-card-shimmer 1.4s ease infinite;
}

.mp-count-card__skeleton span:first-child { width: 75px; height: 74px; }
.mp-count-card__skeleton span:nth-child(2) { width: 45%; height: 12px; }
.mp-count-card__skeleton span:last-child { width: 100%; height: 58px; }

@keyframes mp-count-card-shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

@media (max-width: 520px) {
  .mp-widget-grid { grid-template-columns: minmax(0, 1fr); }
  .mp-count-card { min-height: 210px; }
}

/* Phone: stacked, readable metrics and 44px tap targets. */
@media (max-width: 560px) {
  .mp-main--mywork {
    padding-bottom: calc(88px + var(--safe-bottom, env(safe-area-inset-bottom, 0px)));
  }

  /* Brand header already identifies the portal; skip the repeated crumb/eyebrow. */
  .mp-main--mywork .mp-topbar,
  .mp-main--mywork .mp-eyebrow {
    display: none;
  }

  .mp-main--mywork .mp-page__head {
    margin-bottom: 10px;
  }

  .mp-main--mywork .mp-title {
    font-size: 1.7rem;
  }

  .mp-widget-grid {
    gap: 12px;
    margin-top: 12px;
  }

  .mp-count-card {
    min-height: 0;
    padding: 16px;
    border: 1px solid #e3e7ed;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 3px 12px rgba(20, 32, 46, 0.045);
  }

  .mp-count-card {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .mp-count-card__title {
    flex: 1 1 auto;
  }

  .mp-count-card__body {
    flex: 1 0 100%;
  }

  .mp-count-card__title {
    font-size: 1.12rem;
    padding-right: 0;
  }

  #mp-fleet-activity-widget .mp-count-card__title {
    padding-right: 0;
  }

  .mp-activity-tools {
    position: static;
    margin-left: auto;
  }

  .mp-activity-age {
    font-size: 0.85rem;
  }

  .mp-activity-refresh {
    width: 44px;
    height: 44px;
  }

  .mp-activity-refresh svg {
    width: 18px;
    height: 18px;
  }

  .mp-count-card__viewall {
    position: static;
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    font-size: 0.9rem;
    font-weight: 700;
    color: #3f4b57;
    text-decoration: none;
    white-space: nowrap;
  }

  .mp-count-card__body {
    padding-top: 12px;
    gap: 14px;
  }

  .mp-count-card__primary {
    gap: 14px;
  }

  .mp-count-card__primary-value {
    min-width: 64px;
    min-height: 64px;
    font-size: 2.35rem;
    border-radius: 14px;
  }

  .mp-count-card__primary-label {
    font-size: 1.05rem;
  }

  .mp-count-card__stats,
  .mp-count-card__stats--single {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .mp-count-card__stat {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    min-height: 48px;
    padding: 12px 14px;
    border-radius: 12px;
  }

  .mp-count-card__stat-value {
    flex: 0 0 auto;
    min-width: 1.75em;
    font-size: 1.75rem;
    text-align: center;
  }

  .mp-count-card__stat-label {
    margin-top: 0;
    color: #3d4853;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.25;
  }

  .mp-count-card--link:hover {
    transform: none;
  }

  /* Hide the leftover empty-state copy once a summary widget is on the page. */
  .mp-mywork:has(#mp-tasks-widget:not([hidden])) .mp-mywork__empty,
  .mp-mywork:has(#mp-bank-transactions-widget:not([hidden])) .mp-mywork__empty,
  .mp-mywork:has(#mp-osp-reports-widget:not([hidden])) .mp-mywork__empty {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mp-count-card--link { transition: none; }
  .mp-count-card__skeleton span { animation: none; }
  .mp-activity-refresh.is-busy svg { animation: none; }
}

/* -- My Tasks accent card ---------------------------------------------------
   The dashboard's single orange highlight, half a regular widget: a 2 x 1 cell
   in the fixed widget grid (see "Fixed-cell widget grid" below; auto height on
   phones). Three stacked rows: header, number + caption, status tiles.
   Colours are widget-scoped variables; Light values are the default, Dark
   overrides them. */

html:not(.mp-ready) .tasks-accent[data-mp-feature],
html.mp-ready:not(.mp-feat-tasks) .tasks-accent[data-mp-feature="tasks"],
.tasks-accent[hidden] {
  display: none !important;
}

.tasks-accent {
  --ta-bg:
    radial-gradient(90% 120% at 90% 0%, #f08a4e 0%, rgba(240, 138, 78, 0) 60%),
    linear-gradient(160deg, #d9622a 0%, #b4441a 100%);
  --ta-border: transparent;
  --ta-shadow: 0 6px 16px rgba(196, 82, 30, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  --ta-chip: rgba(255, 255, 255, 0.2);
  --ta-btn-bg: #fff;
  --ta-btn-icon: #b4441a;
  --ta-tile-bg: rgba(255, 255, 255, 0.16);
  --ta-tile-border: rgba(255, 255, 255, 0.22);
  --ta-tile-hover: rgba(255, 255, 255, 0.24);
  --ta-alert-bg: #fff;
  --ta-alert-shadow: 0 3px 8px rgba(120, 40, 10, 0.25);
  --ta-alert-shadow-hover: 0 5px 12px rgba(120, 40, 10, 0.32);
  --ta-skeleton: rgba(255, 255, 255, 0.18);

  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  box-sizing: border-box;
  min-width: 0;
  height: 100%;
  min-height: 0;
  padding: 14px 16px;
  overflow: hidden;
  border: 1px solid var(--ta-border);
  border-radius: 18px;
  background: var(--ta-bg);
  background-clip: padding-box;
  box-shadow: var(--ta-shadow);
  color: #fff;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

html[data-portal="manage"][data-theme="dark"] .tasks-accent {
  --ta-bg:
    radial-gradient(90% 120% at 90% 0%, rgba(240, 138, 78, 0.85) 0%, rgba(240, 138, 78, 0) 60%),
    linear-gradient(160deg, #d25b24 0%, #a23c14 100%);
  --ta-border: rgba(255, 255, 255, 0.14);
  --ta-shadow: 0 8px 20px rgba(0, 0, 0, 0.4), 0 0 28px rgba(217, 98, 42, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  --ta-chip: rgba(255, 255, 255, 0.18);
  --ta-btn-bg: #fff6ef;
  --ta-btn-icon: #a23c14;
  --ta-tile-bg: rgba(20, 10, 5, 0.22);
  --ta-tile-border: rgba(255, 255, 255, 0.16);
  --ta-tile-hover: rgba(20, 10, 5, 0.32);
  --ta-alert-bg: #fff6ef;
  --ta-alert-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
  --ta-alert-shadow-hover: 0 5px 12px rgba(0, 0, 0, 0.42);
}

/* Phones: height from the content. */
@media (max-width: 768px) {
  .tasks-accent {
    height: auto;
  }
}

/* Row 1: header. */
.tasks-accent__head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tasks-accent__chip {
  display: inline-flex;
  flex: 0 0 26px;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--ta-chip);
  color: #fff;
}

.tasks-accent__chip svg {
  width: 14px;
  height: 14px;
}

.tasks-accent__title {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tasks-accent__viewall {
  display: inline-flex;
  flex: 0 0 26px;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--ta-btn-bg);
  color: var(--ta-btn-icon);
  text-decoration: none;
  transition: transform 150ms ease;
}

.tasks-accent__viewall svg {
  width: 12px;
  height: 12px;
}

/* Rows 2 + 3 live in the body (the live region the counts are written into). */
.tasks-accent__body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  min-height: 0;
}

/* Row 2: number + caption. */
.tasks-accent__lead {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  border-radius: 8px;
  color: #fff;
  text-decoration: none;
}

.tasks-accent__big {
  flex: 0 0 auto;
  font-size: 36px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  white-space: nowrap;
}

.tasks-accent__caption {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Row 3: status tiles. */
.tasks-accent__tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  container: ta-tiles / inline-size;
}

.tasks-accent__tile {
  display: flex;
  flex-direction: column;
  gap: 1px;
  box-sizing: border-box;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--ta-tile-border);
  border-radius: 10px;
  background: var(--ta-tile-bg);
  color: #fff;
  text-decoration: none;
  transition: background-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.tasks-accent__tile-value {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.tasks-accent__tile-label {
  overflow: hidden;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Short labels instead of an ellipsis when a tile is too narrow (11px stays the
   minimum): tile text width = (row - 12) / 3 - 18. "In progress"/"Completed"
   need ~64px -> "Active"/"Done" below a 261px row; "Overdue" needs ~49px ->
   "Late" below 213px (one column of five). */
.tasks-accent__tile-label .is-short {
  display: none;
}

@container ta-tiles (max-width: 260px) {
  .tasks-accent__tile-label[data-short-below="md"] .is-full {
    display: none;
  }

  .tasks-accent__tile-label[data-short-below="md"] .is-short {
    display: inline;
  }
}

@container ta-tiles (max-width: 212px) {
  .tasks-accent__tile-label[data-short-below="sm"] .is-full {
    display: none;
  }

  .tasks-accent__tile-label[data-short-below="sm"] .is-short {
    display: inline;
  }
}

.tasks-accent__tile--alert {
  border-color: transparent;
  background: var(--ta-alert-bg);
  box-shadow: var(--ta-alert-shadow);
}

.tasks-accent__tile--alert .tasks-accent__tile-value {
  color: #c0392b;
}

.tasks-accent__tile--alert .tasks-accent__tile-label {
  color: #24211e;
}

@media (hover: hover) and (pointer: fine) {
  .tasks-accent__tile:not(.tasks-accent__tile--alert):hover {
    background: var(--ta-tile-hover);
  }

  .tasks-accent__tile--alert:hover {
    box-shadow: var(--ta-alert-shadow-hover);
    transform: translateY(-1px);
  }

  .tasks-accent__viewall:hover {
    transform: scale(1.05);
  }
}

.tasks-accent__viewall:focus-visible,
.tasks-accent__lead:focus-visible,
.tasks-accent__tile:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.7);
}

.tasks-accent__tile--alert:focus-visible {
  box-shadow: var(--ta-alert-shadow), 0 0 0 3px rgba(255, 255, 255, 0.7);
}

/* Loading (same skeleton-until-data behaviour as before) and failure. */
.tasks-accent__skeleton {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-content: space-between;
  gap: 6px;
}

.tasks-accent__skeleton span {
  display: block;
  height: 38px;
  border-radius: 10px;
  background: var(--ta-skeleton);
}

.tasks-accent__skeleton span:first-child {
  grid-column: 1 / -1;
  width: 60%;
  height: 32px;
  border-radius: 8px;
}

.tasks-accent .mp-count-card__unavailable {
  margin: 0;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

/* Phones: 44px touch targets. */
@media (max-width: 768px) {
  .tasks-accent__tile {
    justify-content: center;
    min-height: 44px;
  }

  .tasks-accent__viewall {
    flex-basis: 44px;
    width: 44px;
    height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tasks-accent__tile,
  .tasks-accent__viewall {
    transition: none;
  }

  .tasks-accent__tile--alert:hover,
  .tasks-accent__viewall:hover {
    transform: none;
  }
}

/* -- Bank Transactions "bank card" ------------------------------------------
   Same footprint as My Tasks: a 2 x 1 cell in the fixed widget grid (auto
   height on phones). Rows: header / EMV chip + In Progress
   count / three field links. One markup; Light values are the default
   (data-theme="light"), Dark overrides the widget-scoped --bc-* variables. */

html:not(.mp-ready) .bank-card[data-mp-feature],
html.mp-ready:not(.mp-feat-bank_transactions) .bank-card[data-mp-feature="bank_transactions"],
.bank-card[hidden] {
  display: none !important;
}

.bank-card {
  --bc-glow: radial-gradient(80% 110% at 100% 100%, rgba(238, 122, 59, 0.2) 0%, rgba(238, 122, 59, 0) 55%);
  --bc-sheen: linear-gradient(120deg, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, 0.75) 45%, rgba(255, 255, 255, 0) 60%);
  --bc-base: linear-gradient(140deg, #ffffff 0%, #efece8 55%, #e4dfd9 100%);
  --bc-base-color: #efece8;
  --bc-border: #dcd7d0;
  --bc-shadow: 0 1px 2px rgba(30, 25, 20, 0.05), 0 8px 20px rgba(30, 25, 20, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  --bc-shadow-hover: 0 2px 4px rgba(30, 25, 20, 0.06), 0 14px 30px rgba(30, 25, 20, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  --bc-ring: #d9d3cc;
  --bc-ring-opacity: 0.5;
  --bc-text: #24211e;
  --bc-text-2: #5c5752;
  --bc-icon: #8e8882;
  --bc-btn-bg: #24211e;
  --bc-btn-icon: #ffffff;
  --bc-chip-bg: linear-gradient(135deg, #f1d9a6 0%, #d6b06a 50%, #c29a52 100%);
  --bc-chip-edge: rgba(120, 85, 30, 0.35);
  --bc-chip-line: rgba(120, 85, 30, 0.45);
  --bc-chip-shadow: 0 0 0 transparent;
  --bc-alert-dot: #d2453b;
  --bc-alert-text: #b4372e;
  --bc-skeleton: rgba(36, 33, 30, 0.08);
  --bc-focus: 0 0 0 3px rgba(238, 122, 59, 0.35);

  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  box-sizing: border-box;
  min-width: 0;
  height: 100%;
  min-height: 0;
  padding: 16px 18px;
  overflow: hidden;
  border: 1px solid var(--bc-border);
  border-radius: 18px;
  /* glow / sheen band / base; the sheen is wider than the card so hover can
     slide it (background-position) */
  background-color: var(--bc-base-color);
  background-image: var(--bc-glow), var(--bc-sheen), var(--bc-base);
  background-position: 0 0, 30% 0, 0 0;
  background-repeat: no-repeat;
  background-size: 100% 100%, 250% 100%, 100% 100%;
  background-clip: padding-box;
  box-shadow: var(--bc-shadow);
  color: var(--bc-text);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  transition: transform 200ms ease, box-shadow 200ms ease, background-position 600ms ease;
}

html[data-portal="manage"][data-theme="dark"] .bank-card {
  --bc-glow: radial-gradient(90% 120% at 100% 0%, rgba(238, 122, 59, 0.3) 0%, rgba(238, 122, 59, 0) 55%);
  --bc-sheen: linear-gradient(120deg, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, 0.06) 45%, rgba(255, 255, 255, 0) 60%);
  --bc-base: linear-gradient(140deg, #34303a 0%, #221f26 55%, #17151a 100%);
  --bc-base-color: #221f26;
  --bc-border: rgba(255, 255, 255, 0.12);
  --bc-shadow: 0 10px 24px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  --bc-shadow-hover: 0 16px 34px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  --bc-ring: rgba(255, 255, 255, 0.07);
  --bc-ring-opacity: 0.6;
  --bc-text: #f3efea;
  --bc-text-2: #b3aca5;
  --bc-icon: #8a837d;
  --bc-btn-bg: #fff6ef;
  --bc-btn-icon: #24211e;
  --bc-chip-bg: linear-gradient(135deg, #f1d9a6 0%, #d6b06a 50%, #b88e48 100%);
  --bc-chip-edge: rgba(120, 85, 30, 0.45);
  --bc-chip-line: rgba(110, 75, 25, 0.5);
  --bc-chip-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  --bc-alert-dot: #f06a5e;
  --bc-alert-text: #ff8f84;
  --bc-skeleton: rgba(255, 255, 255, 0.08);
}

/* Decorative rings behind the content. */
.bank-card__rings {
  position: absolute;
  top: 0;
  right: -30px;
  width: 220px;
  height: 176px;
  stroke: var(--bc-ring);
  stroke-width: 1;
  opacity: var(--bc-ring-opacity);
  pointer-events: none;
}

.bank-card > :not(.bank-card__rings) {
  position: relative;
}

/* Row 1: header. */
.bank-card__head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.bank-card__title {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--bc-text);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bank-card__nfc {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  color: var(--bc-icon);
}

.bank-card__open {
  position: relative;
  display: inline-flex;
  flex: 0 0 26px;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bc-btn-bg);
  color: var(--bc-btn-icon);
  text-decoration: none;
  transition: transform 150ms ease;
}

.bank-card__open svg {
  width: 12px;
  height: 12px;
}

/* Rows 2 + 3 live in the body (the live region the counts are written into). */
.bank-card__body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  min-height: 0;
}

/* Row 2: EMV chip + In Progress count. */
.bank-card__lead {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.bank-card__chip {
  flex: 0 0 36px;
  width: 36px;
  height: 27px;
  border-radius: 6px;
  background:
    linear-gradient(var(--bc-chip-line), var(--bc-chip-line)) 0 9px / 100% 1px no-repeat,
    linear-gradient(var(--bc-chip-line), var(--bc-chip-line)) 0 17px / 100% 1px no-repeat,
    linear-gradient(var(--bc-chip-line), var(--bc-chip-line)) 12px 0 / 1px 100% no-repeat,
    linear-gradient(var(--bc-chip-line), var(--bc-chip-line)) 23px 0 / 1px 100% no-repeat,
    var(--bc-chip-bg);
  box-shadow: inset 0 0 0 1px var(--bc-chip-edge), var(--bc-chip-shadow);
}

.bank-card__amount {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  margin: 0;
}

.bank-card__big {
  flex: 0 0 auto;
  color: var(--bc-text);
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bank-card__caption {
  min-width: 0;
  overflow: hidden;
  color: var(--bc-text-2);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Row 3: All / No receipt / Complete. */
.bank-card__fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: 8px;
}

.bank-card__field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  border-radius: 6px;
  color: var(--bc-text);
  text-decoration: none;
}

.bank-card__label {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  color: var(--bc-text-2);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.15;
}

.bank-card__value {
  color: var(--bc-text);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* No receipt: red dot + red value only while the count is above 0. */
.bank-card__field--alert .bank-card__label::before {
  flex: 0 0 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--bc-alert-dot);
  content: "";
}

.bank-card__field--alert .bank-card__value {
  color: var(--bc-alert-text);
}

@media (hover: hover) and (pointer: fine) {
  .bank-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--bc-shadow-hover);
    background-position: 0 0, 70% 0, 0 0;
  }

  .bank-card__field:hover .bank-card__label,
  .bank-card__field:hover .bank-card__value {
    text-decoration: underline;
  }

  .bank-card__open:hover {
    transform: scale(1.06);
  }
}

.bank-card__open:focus-visible,
.bank-card__field:focus-visible {
  outline: none;
  box-shadow: var(--bc-focus);
}

/* Loading (same skeleton-until-data behaviour as before) and failure. */
.bank-card__skeleton {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-content: space-between;
  gap: 8px;
}

.bank-card__skeleton span {
  display: block;
  height: 32px;
  border-radius: 8px;
  background: var(--bc-skeleton);
}

.bank-card__skeleton span:first-child {
  grid-column: 1 / -1;
  width: 60%;
  height: 34px;
}

.bank-card .mp-count-card__unavailable {
  margin: 0;
  color: var(--bc-text-2);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
}

/* Phones: height from the content. */
@media (max-width: 768px) {
  .bank-card {
    height: auto;
    min-height: 176px;
  }
}

/* Phones: 44px touch targets (the open button keeps its 26px look). */
@media (max-width: 768px) {
  .bank-card__field {
    justify-content: center;
    min-height: 44px;
  }

  .bank-card__open::after {
    position: absolute;
    inset: -9px;
    content: "";
  }
}

@media (prefers-reduced-motion: reduce) {
  .bank-card,
  .bank-card__open {
    transition: none;
  }

  .bank-card:hover {
    transform: none;
    background-position: 0 0, 30% 0, 0 0;
  }

  .bank-card__open:hover {
    transform: none;
  }
}


/* -- Fixed-cell widget grid --------------------------------------------------
   Every widget has a fixed size from its footprint (regular 2 x 2 cells,
   My Tasks / Bank Transactions 2 x 1), never from its content or neighbours.
   Positions are CSS variables written by the server (my_work.html mw_item())
   and kept up to date by my_work_layout.js: --mw-x10/--mw-y10 for the
   10-column desktop grid (grid area >= 1100px), --mw-x6/--mw-y6 for the
   6-column grid below that; phones stack in saved order. One cell = 177px
   card + 12px gap; the gap is split as a 6px margin around each card (the
   gridstack variables, so Edit layout uses the same geometry). */

.mw-grid {
  --gs-cell-height: 189px;
  --gs-item-margin-top: 6px;
  --gs-item-margin-right: 6px;
  --gs-item-margin-bottom: 6px;
  --gs-item-margin-left: 6px;
  --gs-column-width: calc(100% / 6);
  --mw-rows: var(--mw-rows6, 0);

  position: relative;
  display: block;
  height: calc(var(--mw-rows) * var(--gs-cell-height));
}

/* The cards' 6px margins: pull the grid out so card edges sit where they did. */
.mp-main--mywork .mp-mywork__scroll > .mp-widget-grid.mw-grid,
.mp-widget-grid.mw-grid {
  margin: -6px;
}

.mw-grid > .mw-item {
  --mw-x: var(--mw-x6, 0);
  --mw-y: var(--mw-y6, 0);
}

@container mw-cards (min-width: 1100px) {
  .mw-grid {
    --gs-column-width: 10%;
    --mw-rows: var(--mw-rows10, 0);
  }

  .mw-grid > .mw-item {
    --mw-x: var(--mw-x10, 0);
    --mw-y: var(--mw-y10, 0);
  }
}

.mw-grid:not(.is-editing) > .mw-item {
  position: absolute;
  top: calc(var(--mw-y) * var(--gs-cell-height));
  left: calc(var(--mw-x) * var(--gs-column-width));
  width: calc(var(--mw-w, 2) * var(--gs-column-width));
  height: calc(var(--mw-h, 2) * var(--gs-cell-height));
}

.mw-grid > .mw-item[hidden] {
  display: none !important;
}

.mw-grid > .mw-item > .mw-item__content {
  position: absolute;
  top: var(--gs-item-margin-top);
  right: var(--gs-item-margin-right);
  bottom: var(--gs-item-margin-bottom);
  left: var(--gs-item-margin-left);
  overflow: hidden;
}

/* Custom cards own their complete visual surface. Neutralize both wrapper
   levels so no regular widget fill, edge, shadow or clipping can show behind
   their 18px corners. Regular widget wrappers keep the defaults above. */
.mw-grid > .mw-item.widget--custom,
.mw-grid > .mw-item.widget--custom > .mw-item__content {
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 18px;
  background: transparent;
  box-shadow: none;
}

/* The card fills its cell; content never resizes it. */
.mw-grid .mw-item__content > .mp-count-card,
.mw-grid .mw-item__content > .tasks-accent,
.mw-grid .mw-item__content > .bank-card {
  box-sizing: border-box;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.mw-grid .mw-item__content > .mp-count-card {
  display: flex;
  flex-direction: column;
}

.mw-grid .mp-count-card__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.mw-grid .mp-count-card__body > * {
  flex-shrink: 0;
}

/* Lists take the remaining height and scroll inside the card. */
.mw-grid .mp-count-card__body > .mp-email-widget__summary,
.mw-grid .mp-count-card__body > .mp-fleet-widget__latest {
  flex: 1 1 auto;
  min-height: 0;
}

.mw-grid :is(.mp-email-widget__list, .mp-fleet-widget__list, .mp-dvir-rows) {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong, #dcd7d0) transparent;
}

.mw-grid .mp-dvir-rows {
  justify-content: safe center;
}

.mw-grid :is(.mp-email-widget__list, .mp-fleet-widget__list, .mp-dvir-rows)::-webkit-scrollbar {
  width: 6px;
}

.mw-grid :is(.mp-email-widget__list, .mp-fleet-widget__list, .mp-dvir-rows)::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--border-strong, #dcd7d0);
}

/* Soft fade at the bottom edge while a list has more below (my_work_layout.js). */
.mw-grid .mw-fade {
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent);
}

/* Skeletons fill the same fixed box. */
.mw-grid .mp-count-card__skeleton {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

/* Phones: one column in saved order, heights from the content as before. */
@media (max-width: 768px) {
  .mp-main--mywork .mp-mywork__scroll > .mp-widget-grid.mw-grid,
  .mp-widget-grid.mw-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: auto;
    margin: 12px 0 0;
  }

  .mw-grid:not(.is-editing) > .mw-item {
    position: static;
    order: var(--mw-order, 0);
    width: auto;
    height: auto;
  }

  .mw-grid > .mw-item > .mw-item__content {
    position: static;
    overflow: visible;
  }

  .mw-grid .mw-item__content > .mp-count-card,
  .mw-grid .mw-item__content > .tasks-accent {
    height: auto;
    overflow: visible;
  }

  .mw-grid .mw-item__content > .bank-card {
    height: auto;
    min-height: 176px;
  }

  .mw-grid .mp-count-card__body,
  .mw-grid :is(.mp-email-widget__list, .mp-fleet-widget__list, .mp-dvir-rows) {
    overflow: visible;
  }

  .mw-grid .mw-fade {
    -webkit-mask-image: none;
    mask-image: none;
  }
}

/* -- Edit layout (desktop) ---------------------------------------------------- */

.mw-grid.is-editing {
  height: auto;
}

.mw-grid.is-editing > .mw-item--pinned {
  display: none !important;
}

.mw-grid.is-editing > .mw-item {
  cursor: grab;
}

.mw-grid.is-editing > .mw-item.ui-draggable-dragging {
  cursor: grabbing;
  z-index: 10;
}

.mw-grid.is-editing > .mw-item > .mw-item__content {
  border-radius: var(--mw-card-radius, 16px);
  outline: 1px dashed var(--accent, #ff5a00);
  outline-offset: 0;
  transform: scale(0.98);
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.mw-grid.is-editing > .mw-item.widget--custom > .mw-item__content {
  border-radius: 18px;
}

/* Nothing inside a widget reacts while arranging (the card is also inert). */
.mw-grid.is-editing > .mw-item > .mw-item__content > * {
  pointer-events: none;
  user-select: none;
}

.mw-grid.is-editing > .mw-item.ui-draggable-dragging > .mw-item__content {
  box-shadow: var(--shadow-lg, 0 12px 32px rgba(30, 25, 20, 0.1));
  transform: scale(1.02);
}

.mw-grid.is-editing > .mw-item.ui-draggable-dragging.widget--custom > .mw-item__content {
  box-shadow: none;
}

.mw-grid.is-editing > .grid-stack-placeholder > .placeholder-content {
  border: 1px dashed var(--accent, #ff5a00);
  border-radius: var(--mw-card-radius, 16px);
  background: var(--accent-soft, rgba(255, 90, 0, 0.12));
}

.mw-grid.is-editing.is-dragging-custom > .grid-stack-placeholder > .placeholder-content {
  border-radius: 18px;
}

/* Every cell outlined, so free spots are visible (widgets cover theirs). */
.mw-cells {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.mw-cell {
  position: absolute;
  width: var(--gs-column-width);
  height: var(--gs-cell-height);
}

.mw-cell::before {
  position: absolute;
  top: var(--gs-item-margin-top);
  right: var(--gs-item-margin-right);
  bottom: var(--gs-item-margin-bottom);
  left: var(--gs-item-margin-left);
  border: 1px dashed var(--mw-line, var(--border, #eae6e1));
  border-radius: var(--mw-card-radius, 16px);
  content: "";
}

@media (prefers-reduced-motion: reduce) {
  .mw-grid.is-editing > .mw-item > .mw-item__content,
  .mw-grid.is-editing > .mw-item.ui-draggable-dragging > .mw-item__content {
    transform: none;
    transition: none;
  }
}


/* -- JSA today --------------------------------------------------------------
   Safety card, 2 x 1 cell like My Tasks / Bank Transactions. Rendered only
   for people with JSA access (server-side; see my_work.html). Barlow and
   Barlow Condensed (self-hosted, latin subset, OFL) are used only here.
   One markup; widget-scoped --jt-* variables, Light by default, Dark below. */

@font-face {
  font-family: "Barlow";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/barlow/barlow-500.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Barlow";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/barlow/barlow-600.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Barlow";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/barlow/barlow-700.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Barlow Condensed";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/barlow/barlow-condensed-600.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Barlow Condensed";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/barlow/barlow-condensed-700.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Barlow Condensed";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("fonts/barlow/barlow-condensed-800.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

html:not(.mp-ready) .jsa-today[data-mp-feature],
html.mp-ready:not(.mp-feat-osp) .jsa-today[data-mp-feature="osp"],
.jsa-today[hidden] {
  display: none !important;
}

.jsa-today {
  --jt-glow: radial-gradient(90% 120% at 100% 0%, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0) 55%);
  --jt-sheen: linear-gradient(120deg, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, 0.6) 45%, rgba(255, 255, 255, 0) 60%);
  --jt-base: linear-gradient(160deg, #f5de96 0%, #eccb68 100%);
  --jt-base-color: #eccb68;
  --jt-border: transparent;
  --jt-shadow: 0 8px 20px rgba(140, 105, 20, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.55);
  --jt-stripe-dark: #2a261c;
  --jt-stripe-light: #eccb68;
  --jt-title: #17150f;
  --jt-total: #17150f;
  --jt-caption: #17150f;
  --jt-btn-bg: #2a261c;
  --jt-btn-icon: #f5de96;
  --jt-tag-bg: #2a261c;
  --jt-tag-border: transparent;
  --jt-tag-label: #e9e4d6;
  --jt-tag-num: #f5de96;
  --jt-tag-bar: #eccb68;
  --jt-focus: 0 0 0 3px rgba(23, 21, 15, 0.45);
  --jt-skeleton: rgba(23, 21, 15, 0.1);
  --jt-condensed: "Barlow Condensed", "Arial Narrow", sans-serif;
  --jt-text: "Barlow", system-ui, sans-serif;

  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  box-sizing: border-box;
  min-width: 0;
  height: 100%;
  min-height: 0;
  padding: 20px 16px 14px; /* top clears the hazard stripe */
  overflow: hidden;
  border: 1px solid var(--jt-border);
  border-radius: 18px;
  background-color: var(--jt-base-color);
  background-image: var(--jt-glow), var(--jt-sheen), var(--jt-base);
  background-position: 0 0, 85% 0, 0 0;
  background-repeat: no-repeat;
  background-size: 100% 100%, 250% 100%, 100% 100%;
  background-clip: padding-box;
  box-shadow: var(--jt-shadow);
  color: var(--jt-title);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  transition: background-position 600ms ease;
}

html[data-portal="manage"][data-theme="dark"] .jsa-today {
  --jt-glow: radial-gradient(90% 120% at 100% 0%, rgba(255, 194, 26, 0.16) 0%, rgba(255, 194, 26, 0) 55%);
  --jt-sheen: linear-gradient(120deg, rgba(255, 230, 160, 0) 28%, rgba(255, 230, 160, 0.16) 45%, rgba(255, 230, 160, 0) 62%);
  --jt-base: linear-gradient(140deg, #34302a 0%, #221f1b 55%, #161411 100%);
  --jt-base-color: #221f1b;
  --jt-border: rgba(255, 194, 26, 0.22);
  --jt-shadow: 0 10px 24px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  --jt-stripe-dark: #17150f;
  --jt-stripe-light: #ffc21a;
  --jt-title: #ffc21a;
  --jt-total: #ffffff;
  --jt-caption: #c9c2b8;
  --jt-btn-bg: #ffc21a;
  --jt-btn-icon: #17150f;
  --jt-tag-bg: rgba(255, 255, 255, 0.06);
  --jt-tag-border: rgba(255, 255, 255, 0.08);
  --jt-tag-label: #c9c2b8;
  --jt-tag-num: #ffc21a;
  --jt-tag-bar: #ffc21a;
  --jt-focus: 0 0 0 3px rgba(255, 194, 26, 0.45);
  --jt-skeleton: rgba(255, 255, 255, 0.08);
}

.mw-grid .mw-item__content > .jsa-today {
  height: 100%;
  min-height: 0;
}

.jsa-today__stripe {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 8px;
  background: repeating-linear-gradient(-45deg, var(--jt-stripe-dark) 0 10px, var(--jt-stripe-light) 10px 20px);
  pointer-events: none;
}

.jsa-today > :not(.jsa-today__stripe) {
  position: relative;
}

/* Row 1: title + open button. */
.jsa-today__head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.jsa-today__title {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--jt-title);
  font-family: var(--jt-condensed);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.jsa-today__open {
  display: inline-flex;
  flex: 0 0 26px;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--jt-btn-bg);
  color: var(--jt-btn-icon);
  text-decoration: none;
  transition: transform 150ms ease;
}

.jsa-today__open svg {
  width: 12px;
  height: 12px;
}

/* Rows 2 + 3 live in the body (the live region the counts are written into). */
.jsa-today__body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  min-height: 0;
}

/* Row 2: total + two-line caption. */
.jsa-today__lead {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin: 0;
}

.jsa-today__total {
  flex: 0 0 auto;
  color: var(--jt-total);
  font-family: var(--jt-condensed);
  font-size: 52px;
  font-weight: 800;
  line-height: 0.85;
  white-space: nowrap;
}

.jsa-today__caption {
  min-width: 0;
  color: var(--jt-caption);
  font-family: var(--jt-text);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.3;
  text-transform: uppercase;
}

/* Row 3: one tag per work type, with its share of the total as a bottom bar. */
.jsa-today__tags {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  container: jt-tags / inline-size;
}

.jsa-today__tag {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
  box-sizing: border-box;
  min-width: 0;
  padding: 6px 8px 8px;
  overflow: hidden;
  border: 1px solid var(--jt-tag-border);
  border-radius: 8px;
  background: var(--jt-tag-bg);
  text-decoration: none;
  transition: transform 150ms ease;
}

.jsa-today__label {
  min-width: 0;
  overflow: hidden;
  color: var(--jt-tag-label);
  font-family: var(--jt-text);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.jsa-today__num {
  flex: 0 0 auto;
  color: var(--jt-tag-num);
  font-family: var(--jt-condensed);
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.jsa-today__bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--jt-tag-bar);
}

.jsa-today__tags.is-empty .jsa-today__bar {
  display: none;
}

/* Narrow card (one of five columns): label over number, so 3-digit counts fit. */
@container jt-tags (max-width: 270px) {
  .jsa-today__tag {
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 2px;
  }
}

@media (hover: hover) and (pointer: fine) {
  .jsa-today:hover {
    background-position: 0 0, 15% 0, 0 0;
  }

  .jsa-today__tag:hover {
    transform: translateY(-1px);
  }

  .jsa-today__open:hover {
    transform: scale(1.06);
  }
}

.jsa-today__open:focus-visible,
.jsa-today__tag:focus-visible {
  outline: none;
  box-shadow: var(--jt-focus);
}

/* Loading (skeleton fills the same fixed box) and failure. */
.jsa-today__skeleton {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-content: space-between;
  gap: 6px;
}

.jsa-today__skeleton span {
  display: block;
  height: 32px;
  border-radius: 8px;
  background: var(--jt-skeleton);
}

.jsa-today__skeleton span:first-child {
  grid-column: 1 / -1;
  width: 60%;
  height: 44px;
}

.jsa-today .mp-count-card__unavailable {
  margin: 0;
  color: var(--jt-caption);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
}

/* Phones: height from the content, 44px touch targets. */
@media (max-width: 768px) {
  .mw-grid .mw-item__content > .jsa-today {
    height: auto;
    min-height: 176px;
  }

  .jsa-today__tag {
    align-items: center;
    min-height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .jsa-today,
  .jsa-today__tag,
  .jsa-today__open {
    transition: none;
  }

  .jsa-today:hover {
    background-position: 0 0, 85% 0, 0 0;
  }

  .jsa-today__tag:hover,
  .jsa-today__open:hover {
    transform: none;
  }
}
