/* DOMINO 360° premium operational UX — W3CRM-inspired, RTL-first. */

html body[data-dashboard-theme][data-portal-accent][data-portal-surface] {
  --premium-heading: var(--w3-heading, #101820);
  --premium-copy: var(--w3-copy, #7c8491);
  --premium-row: color-mix(in srgb, var(--w3-card-alt, #f8f9fa) 72%, var(--w3-card, #fff));
  --premium-row-alt: var(--w3-card-alt, #f8f9fa);
  --premium-success: #2bc155;
  --premium-warning: #ff9f43;
  --premium-planned: #7d8b99;
}

/* Right-side navigation and a deliberate desktop header hierarchy. */
@media (min-width: 921px) {
  html body[data-dashboard-theme] .portal {
    direction: rtl !important;
  }

  html body[data-dashboard-theme] .workspace {
    direction: rtl;
  }
  html body[data-dashboard-theme] .topbar > * { direction: rtl; }

  html body[data-dashboard-theme] .topbar {
    display: grid !important;
    grid-template-columns: minmax(17rem, 1fr) minmax(13rem, 20rem) minmax(15rem, .8fr) auto;
    grid-template-areas: "actions search brand toggle";
    direction: ltr;
    gap: .75rem !important;
    padding-inline: .75rem 1rem !important;
  }

  html body[data-dashboard-theme] #menu-button { display: none !important; }
  html body[data-dashboard-theme] #sidebar-collapse-button { grid-area: toggle; justify-self: start; }
  html body[data-dashboard-theme] .topbar-brand-home {
    grid-area: brand;
    justify-self: start;
    width: 100%;
    text-align: start;
  }
  html body[data-dashboard-theme] .w3-header-search {
    grid-area: search;
    justify-self: center;
    width: min(100%, 20rem) !important;
    margin: 0 !important;
  }
  html body[data-dashboard-theme] .topbar-actions {
    grid-area: actions;
    justify-self: end;
    min-width: 0;
  }
}

html body[data-dashboard-theme] .header-logout-button > span {
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1;
}

/* Calm typography: high information density without visual fatigue. */
html body[data-dashboard-theme] .content :is(h2, .page-heading h2, .section-heading h2) {
  font-size: clamp(1.18rem, 1.25vw, 1.42rem) !important;
  line-height: 1.4 !important;
}
html body[data-dashboard-theme] .content h3 { font-size: .98rem !important; line-height: 1.45 !important; }
html body[data-dashboard-theme] .content h4 { font-size: .875rem !important; line-height: 1.45 !important; }
html body[data-dashboard-theme] .content :is(
  .surface-title p, .section-heading p, .page-heading p, .accounting-heading p,
  .metric span, .metric small, form small, article small, .muted
) {
  color: var(--premium-copy) !important;
  font-size: .75rem !important;
  line-height: 1.7 !important;
}
html body[data-dashboard-theme] .content :is(label, legend) {
  color: var(--premium-heading) !important;
  font-size: .775rem !important;
  font-weight: 500 !important;
}

/* Form geometry contract: no overlap, identical width and baseline. */
html body[data-dashboard-theme] #portal-view .content :is(
  form, .accounting-form, .connect-form, .member-basic-grid, .target-editor-fields,
  [class*="-form"], [class*="-fields"]
) > * {
  min-width: 0;
  box-sizing: border-box;
}
html body[data-dashboard-theme] #portal-view .content :is(form, [class*="-form"], [class*="-fields"]) label {
  min-width: 0;
  align-content: start;
}
html body[data-dashboard-theme] #portal-view .content :is(input, select, textarea) {
  display: block;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100%;
  box-sizing: border-box !important;
}
html body[data-dashboard-theme] #portal-view .content :is(input:not([type="checkbox"]):not([type="radio"]), select) {
  height: 2.75rem !important;
  min-height: 2.75rem !important;
  padding-block: .5rem !important;
}
html body[data-dashboard-theme] #portal-view .content textarea {
  min-height: 5.5rem;
  resize: vertical;
}
html body[data-dashboard-theme] #portal-view .content .button {
  min-height: 2.75rem;
  box-sizing: border-box;
}

html body[data-dashboard-theme] #view-overview :is(.metric, .executive-brief-item, .management-insight-card) {
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease !important;
}
html body[data-dashboard-theme] #view-overview :is(.metric, .executive-brief-item, .management-insight-card):hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--portal-accent) 35%, var(--w3-border)) !important;
  box-shadow: 0 .65rem 1.6rem color-mix(in srgb, var(--portal-accent) 9%, transparent) !important;
}
html body[data-dashboard-theme] #portal-view .content :is(input[type="checkbox"], input[type="radio"]) {
  display: inline-block;
  width: 1rem !important;
  height: 1rem !important;
  min-height: 1rem !important;
}

/* Active Projects-inspired operational rows. */
html body[data-dashboard-theme] .rep-performance-list {
  gap: 0 !important;
  overflow: hidden;
  border: 1px solid var(--w3-border) !important;
  border-radius: .375rem;
  background: var(--w3-card) !important;
}
html body[data-dashboard-theme] .dashboard-grid.secondary-grid {
  grid-template-columns: 1fr !important;
}
html body[data-dashboard-theme] .rep-selection-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  min-height: 3rem;
  padding: .625rem .875rem;
  background: color-mix(in srgb, var(--portal-accent) 8%, var(--w3-card)) !important;
  border-bottom: 1px solid var(--w3-border) !important;
}
html body[data-dashboard-theme] .rep-selection-bar label,
html body[data-dashboard-theme] .rep-selection-summary {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 0;
}
html body[data-dashboard-theme] .rep-selection-summary { color: var(--premium-copy) !important; font-size: .75rem; }
html body[data-dashboard-theme] .rep-performance-entry {
  display: grid;
  grid-template-columns: 2.75rem minmax(0,1fr);
  align-items: stretch;
  background: var(--premium-row) !important;
  border-bottom: 1px solid var(--w3-border) !important;
}
html body[data-dashboard-theme] .rep-performance-entry:nth-child(odd) { background: var(--premium-row-alt) !important; }
html body[data-dashboard-theme] .rep-performance-entry:last-child { border-bottom: 0 !important; }
html body[data-dashboard-theme] .rep-performance-select {
  display: grid;
  place-items: center;
  border-inline-end: 1px solid var(--w3-border);
}
html body[data-dashboard-theme] .rep-performance-row {
  min-height: 4.25rem;
  padding: .75rem !important;
  border: 0 !important;
  background: transparent !important;
  color: var(--premium-heading) !important;
}
html body[data-dashboard-theme] .rep-performance-entry:hover,
html body[data-dashboard-theme] .rep-performance-entry:focus-within {
  background: color-mix(in srgb, var(--portal-accent) 7%, var(--w3-card)) !important;
}

/* All Projects-style goal distribution. */
html body[data-dashboard-theme] .rep-target-visual-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(15rem, .34fr);
  gap: 1rem;
  align-items: start;
  margin-top: 1rem;
}
html body[data-dashboard-theme] .rep-all-projects-card {
  display: grid;
  justify-items: center;
  gap: .75rem;
  padding: 1rem;
  border: 1px solid var(--w3-border) !important;
  border-radius: .375rem;
  background: var(--w3-card-alt) !important;
  text-align: center;
}
html body[data-dashboard-theme] .rep-all-projects-card :is(h4,p) { margin: 0; }
html body[data-dashboard-theme][data-portal-accent][data-portal-surface] #portal-view .rep-all-projects-chart {
  --done-angle: 0deg;
  --progress-angle: 0deg;
  position: relative;
  width: 9.5rem;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background-color: transparent !important;
  background-image: conic-gradient(
    var(--premium-success) 0 var(--done-angle),
    var(--portal-accent) var(--done-angle) var(--progress-angle),
    color-mix(in srgb, var(--premium-planned) 45%, var(--w3-card)) var(--progress-angle) 360deg
  ) !important;
  box-shadow: inset 0 0 0 1.4rem var(--w3-card) !important;
}
html body[data-dashboard-theme] .rep-all-projects-chart::after {
  content: attr(data-total) "\A هدف";
  white-space: pre;
  color: var(--premium-heading);
  font-size: .8rem;
  font-weight: 600;
  line-height: 1.45;
}
html body[data-dashboard-theme] .rep-all-projects-legend { display: grid; width: 100%; gap: .45rem; }
html body[data-dashboard-theme] .rep-all-projects-legend span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .65rem;
  color: var(--premium-copy) !important;
  font-size: .72rem;
}
html body[data-dashboard-theme] .rep-all-projects-legend i { width: .55rem; height: .55rem; border-radius: .15rem; }

/* Planned versus achieved route. */
html body[data-dashboard-theme] .rep-route-comparison {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: .625rem;
  margin: .875rem 0;
}
html body[data-dashboard-theme] .route-comparison-stat {
  display: grid;
  gap: .2rem;
  padding: .7rem .8rem;
  border: 1px solid var(--w3-border) !important;
  border-radius: .375rem;
  background: var(--w3-card-alt) !important;
}
html body[data-dashboard-theme] .route-comparison-stat span { color: var(--premium-copy) !important; font-size: .68rem; }
html body[data-dashboard-theme] .route-comparison-stat strong { color: var(--premium-heading) !important; font-size: .9rem; }
html body[data-dashboard-theme] .route-map-legend {
  grid-column: 1/-1;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  color: var(--premium-copy) !important;
  font-size: .7rem;
}
html body[data-dashboard-theme] .route-map-legend span { display: flex; align-items: center; gap: .4rem; }
html body[data-dashboard-theme] .route-map-legend i { width: 1.8rem; height: .18rem; border-radius: 1rem; }

/* Cursor-adjacent chart details. */
.domino-chart-tooltip {
  position: fixed;
  z-index: 1200;
  width: max-content;
  max-width: min(18rem, calc(100vw - 2rem));
  display: grid;
  gap: .25rem;
  padding: .7rem .8rem;
  pointer-events: none;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: .375rem;
  background: #101820;
  color: #fff;
  box-shadow: 0 .8rem 2rem rgba(16,24,32,.24);
  opacity: 0;
  transform: translateY(.25rem);
  transition: opacity .12s ease, transform .12s ease;
}
.domino-chart-tooltip.visible { opacity: 1; transform: translateY(0); }
.domino-chart-tooltip strong { color: #fff !important; font-size: .76rem; }
.domino-chart-tooltip span { color: #cfd5dc !important; font-size: .68rem; line-height: 1.55; }

/* Low-frequency workspaces share the same operational design language. */
html body[data-dashboard-theme] .operations-suite-view {
  --ops-accent: var(--portal-accent) !important;
  --ops-blue: var(--portal-accent) !important;
  --ops-good: var(--premium-success) !important;
}
html body[data-dashboard-theme] :is(
  .operations-suite-view, #view-accounting-purchasing, #view-makhzan-connect,
  #view-subscription, #view-audit, #view-companies
) :is(.surface, .operations-project-card, .operations-record, .planning-shift) {
  border-color: var(--w3-border) !important;
  background: var(--w3-card) !important;
  box-shadow: none !important;
}
html body[data-dashboard-theme] .operations-record-list {
  gap: 0 !important;
  overflow: hidden;
  border: 1px solid var(--w3-border);
  border-radius: .375rem;
}
html body[data-dashboard-theme] .operations-record {
  min-height: 4rem;
  border: 0 !important;
  border-bottom: 1px solid var(--w3-border) !important;
  border-radius: 0 !important;
  background: var(--premium-row) !important;
}
html body[data-dashboard-theme] .operations-record:nth-child(even) { background: var(--premium-row-alt) !important; }
html body[data-dashboard-theme] .operations-record:last-child { border-bottom: 0 !important; }
html body[data-dashboard-theme] .operations-record:is(:hover, :focus-within) {
  background: color-mix(in srgb, var(--portal-accent) 7%, var(--w3-card)) !important;
}
html body[data-dashboard-theme] :is(.operations-alert, .operations-upcoming, .industrial-control-surface) {
  border-inline-start-color: var(--portal-accent) !important;
}
html body[data-dashboard-theme] :is(.operations-progress, .capacity-bar) {
  background: color-mix(in srgb, var(--portal-accent) 13%, transparent) !important;
}
html body[data-dashboard-theme] :is(.operations-progress, .capacity-bar) > span {
  background: var(--portal-accent) !important;
}

/* One consistent loading, failure, and empty-data component. */
html body[data-dashboard-theme] .workspace-state,
html body[data-dashboard-theme] #portal-view .content :is(.empty, .empty-state, .accounting-empty, .pos-empty) {
  min-height: 5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .8rem;
  margin: .75rem 0;
  padding: 1rem;
  border: 1px dashed var(--w3-border) !important;
  border-radius: .375rem !important;
  background: var(--w3-card-alt) !important;
  color: var(--premium-copy) !important;
  text-align: center;
}
html body[data-dashboard-theme] .workspace-state[hidden] { display: none !important; }
html body[data-dashboard-theme] .workspace-state > div { display: grid; gap: .2rem; text-align: start; }
html body[data-dashboard-theme] .workspace-state :is(strong, p) { margin: 0; }
html body[data-dashboard-theme] .workspace-state p { color: var(--premium-copy) !important; font-size: .75rem; }
html body[data-dashboard-theme] .workspace-state-icon {
  width: 1.35rem;
  height: 1.35rem;
  flex: 0 0 auto;
  border: 2px solid color-mix(in srgb, var(--portal-accent) 22%, transparent);
  border-top-color: var(--portal-accent);
  border-radius: 50%;
}
html body[data-dashboard-theme] .workspace-state[data-state="loading"] .workspace-state-icon {
  animation: domino-state-spin .75s linear infinite;
}
html body[data-dashboard-theme] .workspace-state[data-state="error"] {
  border-style: solid !important;
  border-color: color-mix(in srgb, #d9363e 40%, var(--w3-border)) !important;
}
html body[data-dashboard-theme] .workspace-state[data-state="error"] .workspace-state-icon {
  border: 0;
  display: grid;
  place-items: center;
  color: #d9363e;
}
html body[data-dashboard-theme] .workspace-state[data-state="error"] .workspace-state-icon::before { content: "!"; font-weight: 700; }
html body[data-dashboard-theme] [data-state="loading"].status-pill { color: var(--premium-copy) !important; }
html body[data-dashboard-theme] [data-state="error"].status-pill { color: #d9363e !important; }
@keyframes domino-state-spin { to { transform: rotate(360deg); } }

/* Chart contract: neutral grid, accent series, and a readable hover target. */
html body[data-dashboard-theme] #portal-view :is(
  .sales-chart, .target-chart, .report-chart, .financial-chart,
  .analytics-chart, .chart-shell, [data-chart-title]
) {
  --chart-primary: var(--portal-accent);
  --chart-grid: var(--w3-border);
  --chart-label: var(--premium-copy);
}
html body[data-dashboard-theme] #portal-view :is(.chart-dot, .line-dot, .chart-column, .target-bar-fill) {
  transition: transform .14s ease, filter .14s ease, opacity .14s ease;
}
html body[data-dashboard-theme] #portal-view :is(.chart-dot, .line-dot, .chart-column, .target-bar-fill):hover {
  filter: brightness(1.04) saturate(1.08);
  opacity: 1;
  transform: translateY(-2px);
}

@media (prefers-reduced-motion: reduce) {
  html body[data-dashboard-theme] .workspace-state-icon,
  html body[data-dashboard-theme] #portal-view [data-chart-title] { animation: none !important; transition: none !important; }
}

@media (max-width: 1100px) {
  html body[data-dashboard-theme] .topbar-actions .account-chip { display: none; }
  html body[data-dashboard-theme] .rep-target-visual-grid { grid-template-columns: 1fr; }
  html body[data-dashboard-theme] .rep-all-projects-card { grid-template-columns: auto 9.5rem minmax(10rem,1fr); justify-items: start; text-align: start; }
}

@media (min-width: 921px) and (max-width: 1199px) {
  html body[data-dashboard-theme] .topbar {
    grid-template-columns: minmax(11rem,1fr) minmax(12rem,1.25fr) minmax(10rem,.8fr) auto;
  }
  html body[data-dashboard-theme] #open-company-hub,
  html body[data-dashboard-theme] #refresh-button { display: none !important; }
}

@media (max-width: 920px) {
  html body[data-dashboard-theme] .portal { direction: rtl !important; }
  html body[data-dashboard-theme] .topbar { direction: rtl; }
  html body[data-dashboard-theme] .rep-route-comparison { grid-template-columns: 1fr 1fr; }
  html body[data-dashboard-theme] .route-map-legend { grid-column: 1/-1; }
}

@media (max-width: 620px) {
  html body[data-dashboard-theme] .rep-all-projects-card { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  html body[data-dashboard-theme] .rep-route-comparison { grid-template-columns: 1fr; }
  html body[data-dashboard-theme] .rep-performance-entry { grid-template-columns: 2.4rem minmax(0,1fr); }
  html body[data-dashboard-theme] .rep-selection-bar { align-items: flex-start; flex-direction: column; }
}

/* Homepage scheduling, communication pairing, and the branded command header. */
html body[data-dashboard-theme][data-portal-accent][data-portal-surface] .topbar {
  background: color-mix(in srgb, #101820 88%, var(--portal-accent)) !important;
  border-bottom: .1875rem solid var(--portal-accent) !important;
  color: #F4F1EA !important;
  box-shadow: 0 .35rem 1rem rgba(16,24,32,.16) !important;
}
html body[data-dashboard-theme][data-portal-accent][data-portal-surface] #portal-view > .workspace > .topbar {
  background-color: color-mix(in srgb, #101820 88%, var(--portal-accent)) !important;
  background-image: none !important;
  border-color: var(--portal-accent) !important;
}
html body[data-dashboard-theme][data-portal-accent][data-portal-surface] .topbar :is(h1,.eyebrow,.account-chip strong,.account-chip small) { color: #F4F1EA !important; }
html body[data-dashboard-theme][data-portal-accent][data-portal-surface] .topbar :is(.icon-button,.button.ghost,.w3-header-search) {
  background: rgba(244,241,234,.08) !important;
  border-color: rgba(244,241,234,.28) !important;
  color: #F4F1EA !important;
}
html body[data-dashboard-theme][data-portal-accent][data-portal-surface] .topbar .w3-header-search input {
  background: transparent !important;
  border: 0 !important;
  color: #F4F1EA !important;
}
html body[data-dashboard-theme][data-portal-accent][data-portal-surface] .topbar .w3-header-search input::placeholder { color: rgba(244,241,234,.7) !important; }
html body[data-dashboard-theme][data-portal-accent][data-portal-surface] .topbar :is(.icon-button,.button.ghost):hover,
html body[data-dashboard-theme][data-portal-accent][data-portal-surface] .topbar :is(.icon-button,.button.ghost):focus-visible {
  background: var(--portal-accent) !important;
  border-color: var(--portal-accent) !important;
  color: var(--portal-action-text) !important;
}

html body[data-dashboard-theme] .performance-only-grid { grid-template-columns: minmax(0,1fr) !important; }
html body[data-dashboard-theme] .upcoming-schedules { margin-block: 1rem; scroll-margin-top: 1rem; }
html body[data-dashboard-theme] .upcoming-schedules-heading { align-items: center; gap: 1rem; }
html body[data-dashboard-theme] .schedule-heading-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .45rem; }
html body[data-dashboard-theme] .schedule-heading-actions > strong { min-width: 8.25rem; text-align: center; font-size: .82rem; }
html body[data-dashboard-theme] .schedule-heading-actions .icon-button.compact { width: 2rem; height: 2rem; min-width: 2rem; padding: 0; }
html body[data-dashboard-theme] .upcoming-schedules-layout { display: grid; grid-template-columns: minmax(0,1.5fr) minmax(17rem,.65fr); gap: 1rem; align-items: stretch; }
html body[data-dashboard-theme] .schedule-calendar { min-width: 0; }
html body[data-dashboard-theme] .schedule-weekdays,
html body[data-dashboard-theme] .schedule-calendar-grid { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: .35rem; }
html body[data-dashboard-theme] .schedule-weekdays { margin-bottom: .45rem; }
html body[data-dashboard-theme] .schedule-weekdays span { color: var(--premium-copy) !important; font-size: .68rem; font-weight: 600; text-align: center; }
html body[data-dashboard-theme] .schedule-day {
  position: relative; display: grid; place-items: center; min-height: 3.15rem; padding: .35rem;
  border: 1px solid var(--w3-border) !important; border-radius: .55rem; background: var(--w3-card) !important; color: var(--premium-heading) !important;
  cursor: pointer; transition: transform .14s ease,border-color .14s ease,background .14s ease;
}
html body[data-dashboard-theme] .schedule-day:hover { transform: translateY(-1px); border-color: var(--portal-accent) !important; }
html body[data-dashboard-theme] .schedule-day.outside { opacity: .42; }
html body[data-dashboard-theme] .schedule-day.today { box-shadow: inset 0 0 0 1px var(--portal-accent); }
html body[data-dashboard-theme] .schedule-day.selected { background: var(--portal-accent) !important; border-color: var(--portal-accent) !important; color: var(--portal-action-text) !important; }
html body[data-dashboard-theme] .schedule-day-number { font-size: .82rem; font-weight: 600; color: inherit !important; }
html body[data-dashboard-theme] .schedule-day-count { position: absolute; inset-block-end: .25rem; inset-inline-end: .3rem; min-width: 1.05rem; height: 1.05rem; display: grid; place-items: center; border-radius: 999px; background: var(--portal-accent) !important; color: var(--portal-action-text) !important; font-size: .58rem; }
html body[data-dashboard-theme] .schedule-day.selected .schedule-day-count { background: var(--portal-action-text) !important; color: var(--portal-accent) !important; }
html body[data-dashboard-theme] .schedule-agenda { display: flex; flex-direction: column; min-height: 16rem; padding: .9rem; border: 1px solid var(--w3-border); border-radius: .75rem; background: var(--w3-card-alt); }
html body[data-dashboard-theme] .schedule-agenda-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding-bottom: .65rem; border-bottom: 1px solid var(--w3-border); }
html body[data-dashboard-theme] .schedule-agenda-head :is(h4,small) { margin: 0; }
html body[data-dashboard-theme] .schedule-agenda-head small { color: var(--premium-copy) !important; font-size: .68rem; }
html body[data-dashboard-theme] .schedule-count-badge { min-width: 1.8rem; height: 1.8rem; display: grid; place-items: center; border-radius: 999px; background: var(--portal-accent) !important; color: var(--portal-action-text) !important; font-size: .72rem; font-weight: 700; }
html body[data-dashboard-theme] .upcoming-schedule-list { display: grid; align-content: start; gap: .5rem; padding-top: .65rem; }
html body[data-dashboard-theme] .schedule-agenda-item { display: grid; grid-template-columns: auto minmax(0,1fr); gap: .65rem; align-items: center; width: 100%; padding: .65rem; text-align: start; border: 1px solid var(--w3-border) !important; border-radius: .6rem; background: var(--w3-card) !important; color: var(--premium-heading) !important; cursor: pointer; }
html body[data-dashboard-theme] .schedule-agenda-item:hover { border-color: var(--portal-accent) !important; }
html body[data-dashboard-theme] .schedule-agenda-time { padding: .3rem .45rem; border-radius: .4rem; background: var(--portal-accent) !important; color: var(--portal-action-text) !important; font-size: .68rem; font-weight: 700; }
html body[data-dashboard-theme] .schedule-agenda-copy { display: grid; gap: .12rem; min-width: 0; }
html body[data-dashboard-theme] .schedule-agenda-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; }
html body[data-dashboard-theme] .schedule-agenda-copy small { color: var(--premium-copy) !important; font-size: .65rem; }
html body[data-dashboard-theme] .schedule-empty { display: grid; place-items: center; min-height: 8rem; color: var(--premium-copy); text-align: center; font-size: .75rem; }
html body[data-dashboard-theme] .overview-communication-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1rem; align-items: stretch; }
html body[data-dashboard-theme] .overview-communication-grid > .surface { display: flex; flex-direction: column; margin: 0; min-width: 0; height: 510px; overflow: hidden; }
html body[data-dashboard-theme] .overview-communication-grid :is(.pulse-grid,.message-list) { flex: 1 1 auto; min-height: 0; overflow: auto; scrollbar-gutter: stable; }

@media (max-width: 980px) {
  html body[data-dashboard-theme] .upcoming-schedules-layout,
  html body[data-dashboard-theme] .overview-communication-grid { grid-template-columns: 1fr; }
  html body[data-dashboard-theme] .overview-communication-grid > .surface { height: 510px; max-height: 510px; }
}
@media (max-width: 920px) {
  html, body { overflow-x: clip !important; overflow-y: visible !important; }
}
@media (max-width: 620px) {
  html body[data-dashboard-theme] .upcoming-schedules-heading { align-items: flex-start; }
  html body[data-dashboard-theme] .schedule-heading-actions { width: 100%; }
  html body[data-dashboard-theme] .schedule-heading-actions > strong { min-width: 7rem; }
  html body[data-dashboard-theme] .schedule-weekdays span { font-size: .55rem; }
  html body[data-dashboard-theme] .schedule-day { min-height: 2.55rem; padding: .2rem; }
  html body[data-dashboard-theme] .schedule-day-count { inset-inline-end: .15rem; }
}
@media (max-width: 520px) {
  html body[data-dashboard-theme] #schedule-notification-button { display: none !important; }
}

/* Personal workspace: permission-safe, compact and consistent with the DOMINO shell. */
.workspace-user-hidden { display: none !important; }
html body[data-dashboard-theme] :is(#portal-view, .workspace, .content, .page-view, .topbar, .topbar > *) { min-width: 0; max-width: 100%; }
html body[data-dashboard-theme] :is(#portal-view, .workspace, .content, .page-view) { overflow-x: clip; }
html body[data-dashboard-theme][data-portal-accent][data-portal-surface] .topbar {
  position: sticky !important;
  inset-block-start: 0 !important;
  z-index: 510 !important;
  background: #101820 !important;
  background-color: #101820 !important;
  background-image: none !important;
}
html body[data-dashboard-theme][data-portal-accent][data-portal-surface] #portal-view > .workspace > .topbar {
  background: #101820 !important;
  background-color: #101820 !important;
  background-image: none !important;
}

html body[data-dashboard-theme] .workspace-settings-view { display: grid; gap: 1rem; }
html body[data-dashboard-theme] .workspace-settings-view[hidden] { display: none !important; }
html body[data-dashboard-theme] .workspace-settings-hero {
  display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 1rem;
  padding: 1.15rem 1.25rem; border: 1px solid var(--w3-border); border-radius: .8rem;
  background: linear-gradient(135deg, color-mix(in srgb,var(--portal-accent) 9%,var(--w3-card)), var(--w3-card));
}
html body[data-dashboard-theme] .workspace-settings-hero :is(h2,p) { margin: 0; }
html body[data-dashboard-theme] .workspace-settings-hero h2 { color: var(--w3-heading); font-size: 1.35rem !important; }
html body[data-dashboard-theme] .workspace-settings-hero p:not(.eyebrow) { max-width: 48rem; margin-top: .35rem; color: var(--w3-copy) !important; font-size: .78rem; }
html body[data-dashboard-theme] .workspace-settings-summary { display: grid; grid-template-columns: repeat(3,minmax(6.4rem,1fr)); gap: .55rem; }
html body[data-dashboard-theme] .workspace-settings-summary article { display: grid; gap: .12rem; padding: .7rem .8rem; border: 1px solid var(--w3-border); border-radius: .6rem; background: var(--w3-card); text-align: center; }
html body[data-dashboard-theme] .workspace-settings-summary strong { color: var(--portal-accent) !important; font-size: 1.05rem; }
html body[data-dashboard-theme] .workspace-settings-summary small { color: var(--w3-copy) !important; font-size: .67rem; }
html body[data-dashboard-theme] .workspace-settings-layout { display: grid; grid-template-columns: minmax(0,1.7fr) minmax(18rem,.75fr); gap: 1rem; align-items: start; }
html body[data-dashboard-theme] .workspace-settings-side { display: grid; gap: 1rem; min-width: 0; }
html body[data-dashboard-theme] .workspace-settings-card { margin: 0; padding: 1rem; min-width: 0; }
html body[data-dashboard-theme] .workspace-settings-search { display: flex; align-items: center; gap: .4rem; width: min(15rem,100%); height: 2.2rem; padding-inline: .7rem; border: 1px solid var(--w3-border); border-radius: .45rem; background: var(--w3-card); color: var(--w3-copy); }
html body[data-dashboard-theme] .workspace-settings-search input { width: 100%; min-width: 0; height: 100%; padding: 0 !important; border: 0 !important; box-shadow: none !important; }
html body[data-dashboard-theme] .workspace-settings-table { overflow: hidden; margin-top: .9rem; border: 1px solid var(--w3-border); border-radius: .65rem; }
html body[data-dashboard-theme] :is(.workspace-settings-table-head,.workspace-module-row) { display: grid; grid-template-columns: minmax(15rem,1.6fr) minmax(6rem,.55fr) 6rem 4.5rem; align-items: center; gap: .75rem; padding: .7rem .85rem; }
html body[data-dashboard-theme] .workspace-settings-table-head { background: var(--w3-card-alt); color: var(--w3-copy); font-size: .68rem; font-weight: 700; }
html body[data-dashboard-theme] .workspace-module-row { min-height: 4rem; border-top: 1px solid var(--w3-border); background: var(--w3-card); }
html body[data-dashboard-theme] .workspace-module-row:hover { background: color-mix(in srgb,var(--portal-accent) 4%,var(--w3-card)); }
html body[data-dashboard-theme] .workspace-module-identity { display: grid; grid-template-columns: 2.1rem minmax(0,1fr); align-items: center; gap: .65rem; min-width: 0; }
html body[data-dashboard-theme] .workspace-module-identity > b { display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: .5rem; background: color-mix(in srgb,var(--portal-accent) 12%,var(--w3-card)); color: var(--portal-accent) !important; }
html body[data-dashboard-theme] .workspace-module-identity > span,
html body[data-dashboard-theme] .workspace-widget-row > span { display: grid; gap: .12rem; min-width: 0; }
html body[data-dashboard-theme] .workspace-module-identity strong,
html body[data-dashboard-theme] .workspace-widget-row strong { color: var(--w3-heading) !important; font-size: .76rem; }
html body[data-dashboard-theme] .workspace-module-identity small,
html body[data-dashboard-theme] .workspace-widget-row small,
html body[data-dashboard-theme] .workspace-module-category { color: var(--w3-copy) !important; font-size: .65rem; }
html body[data-dashboard-theme] .workspace-order-controls { display: flex; gap: .3rem; }
html body[data-dashboard-theme] .workspace-order-controls button { width: 1.8rem; height: 1.8rem; padding: 0; border: 1px solid var(--w3-border); border-radius: .35rem; background: var(--w3-card); color: var(--w3-heading); cursor: pointer; }
html body[data-dashboard-theme] .workspace-order-controls button:hover:not(:disabled) { border-color: var(--portal-accent); color: var(--portal-accent); }
html body[data-dashboard-theme] .workspace-order-controls button:disabled { opacity: .35; cursor: default; }
html body[data-dashboard-theme] .workspace-switch { position: relative; display: inline-flex; justify-self: start; }
html body[data-dashboard-theme] .workspace-switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
html body[data-dashboard-theme] .workspace-switch-track { position: relative; width: 2.25rem; height: 1.25rem; border-radius: 999px; background: var(--w3-border); transition: background .15s ease; cursor: pointer; }
html body[data-dashboard-theme] .workspace-switch-track::after { content: ''; position: absolute; inset-block-start: .175rem; inset-inline-start: .175rem; width: .9rem; height: .9rem; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(16,24,32,.22); transition: transform .15s ease; }
html body[data-dashboard-theme] .workspace-switch input:checked + .workspace-switch-track { background: var(--portal-accent); }
html body[data-dashboard-theme] .workspace-switch input:checked + .workspace-switch-track::after { transform: translateX(-1rem); }
html[dir="ltr"] body[data-dashboard-theme] .workspace-switch input:checked + .workspace-switch-track::after { transform: translateX(1rem); }
html body[data-dashboard-theme] .workspace-switch input:focus-visible + .workspace-switch-track { box-shadow: 0 0 0 .2rem color-mix(in srgb,var(--portal-accent) 28%,transparent); }
html body[data-dashboard-theme] .workspace-switch input:disabled + .workspace-switch-track { opacity: .55; cursor: not-allowed; }
html body[data-dashboard-theme] .workspace-start-label { display: grid; gap: .4rem; color: var(--w3-copy); font-size: .7rem; }
html body[data-dashboard-theme] .workspace-start-label select { width: 100%; }
html body[data-dashboard-theme] .workspace-settings-note { margin: .65rem 0 0; color: var(--w3-copy) !important; font-size: .66rem; }
html body[data-dashboard-theme] .workspace-widget-list { display: grid; gap: .1rem; }
html body[data-dashboard-theme] .workspace-widget-row { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: .75rem; padding: .65rem 0; border-bottom: 1px solid var(--w3-border); }
html body[data-dashboard-theme] .workspace-widget-row:last-child { border-bottom: 0; }
html body[data-dashboard-theme] .workspace-settings-actions { position: sticky; inset-block-end: .75rem; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 1rem; border: 1px solid var(--w3-border); border-radius: .7rem; background: color-mix(in srgb,var(--w3-card) 94%,transparent); box-shadow: 0 8px 24px rgba(16,24,32,.12); backdrop-filter: blur(10px); }
html body[data-dashboard-theme] .workspace-settings-actions > div { display: flex; align-items: center; gap: .55rem; }
html body[data-dashboard-theme] .workspace-settings-actions > div:first-child { display: grid; gap: .1rem; }
html body[data-dashboard-theme] .workspace-settings-actions small { color: var(--w3-copy) !important; font-size: .67rem; }
html body[data-dashboard-theme] .workspace-settings-actions small.success { color: #16803a !important; }

@media (max-width: 1080px) {
  html body[data-dashboard-theme] .workspace-settings-layout { grid-template-columns: 1fr; }
  html body[data-dashboard-theme] .workspace-settings-side { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 920px) {
  html body[data-dashboard-theme] .topbar { position: sticky !important; inset-block-start: 0 !important; width: 100%; }
  html body[data-dashboard-theme] .workspace-settings-hero { grid-template-columns: 1fr; }
  html body[data-dashboard-theme] .workspace-settings-summary { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 700px) {
  html body[data-dashboard-theme] .workspace-settings-side { grid-template-columns: 1fr; }
  html body[data-dashboard-theme] .workspace-settings-table { overflow: hidden; border: 0; }
  html body[data-dashboard-theme] .workspace-settings-table-head { display: none; }
  html body[data-dashboard-theme] .workspace-module-row { grid-template-columns: minmax(0,1fr) auto; gap: .55rem; margin-bottom: .55rem; padding: .75rem; border: 1px solid var(--w3-border); border-radius: .6rem; }
  html body[data-dashboard-theme] .workspace-module-row > .workspace-module-category { grid-column: 1; padding-inline-start: 2.75rem; }
  html body[data-dashboard-theme] .workspace-module-row > .workspace-order-controls { grid-column: 1; padding-inline-start: 2.75rem; }
  html body[data-dashboard-theme] .workspace-module-row > .workspace-switch { grid-column: 2; grid-row: 1 / span 3; align-self: center; }
  html body[data-dashboard-theme] .workspace-settings-actions { align-items: stretch; flex-direction: column; }
  html body[data-dashboard-theme] .workspace-settings-actions > div:last-child { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 460px) {
  html body[data-dashboard-theme] .workspace-settings-summary { grid-template-columns: 1fr; }
}

/* DOMINO 360° portal refinement: navy/milk default, compact header and durable navigation. */
html body[data-dashboard-theme] .sidebar-appearance-entry {
  display: grid; grid-template-columns: 2rem minmax(0,1fr); align-items: center; gap: .55rem;
  width: calc(100% - 1.2rem); min-height: 2.8rem; margin: .2rem .6rem .75rem; padding: .55rem .65rem;
  border: 1px solid color-mix(in srgb,var(--portal-accent) 45%,transparent); border-radius: .65rem;
  background: color-mix(in srgb,var(--portal-accent) 14%,transparent); color: inherit; font: inherit; text-align: start; cursor: pointer;
}
html body[data-dashboard-theme] .sidebar-appearance-entry > span { display:grid;place-items:center;width:2rem;height:2rem;border-radius:.45rem;background:var(--portal-accent);color:var(--portal-action-text);font-size:1rem; }
html body[data-dashboard-theme] .sidebar-appearance-entry > b { font-size:.72rem;line-height:1.45; }
html body[data-dashboard-theme] .sidebar-appearance-entry:hover,
html body[data-dashboard-theme] .sidebar-appearance-entry:focus-visible { outline:0;border-color:var(--portal-accent);background:color-mix(in srgb,var(--portal-accent) 24%,transparent); }
html body[data-dashboard-theme] .hamburger-lines { display:grid;gap:3px;width:1rem; }
html body[data-dashboard-theme] .hamburger-lines i { display:block;width:100%;height:2px;border-radius:9px;background:currentColor; }

@media (min-width: 921px) {
  html body[data-dashboard-theme] .topbar {
    grid-template-columns: minmax(18rem,1fr) minmax(8rem,10rem) minmax(17rem,.9fr) auto !important;
    min-height: 4.5rem !important;
  }
  html body[data-dashboard-theme] .w3-header-search { width:min(100%,10rem) !important; }
  html body[data-dashboard-theme] .sidebar-brand-lockup { width:min(12rem,100%) !important;max-height:4.6rem !important;object-fit:contain; }
}
html body[data-dashboard-theme][data-portal-accent][data-portal-surface="milk"] #portal-view > .workspace > .topbar {
  background:#F4F1EA !important;background-color:#F4F1EA !important;border-color:color-mix(in srgb,var(--portal-accent) 45%,#F4F1EA) !important;color:#101820 !important;
}
html body[data-dashboard-theme][data-portal-accent][data-portal-surface="milk"] .topbar :is(h1,.eyebrow,.account-chip strong,.account-chip small) { color:#101820 !important; }
html body[data-dashboard-theme][data-portal-accent][data-portal-surface="milk"] .topbar :is(.icon-button,.button.ghost,.w3-header-search) { background:#fffdf8 !important;border-color:#d3ccc0 !important;color:#101820 !important; }
html body[data-dashboard-theme][data-portal-accent][data-portal-surface="milk"] .topbar .w3-header-search input { color:#101820 !important;background:transparent !important; }
html body[data-dashboard-theme][data-portal-accent][data-portal-surface="milk"] .topbar .w3-header-search input::placeholder { color:#737b83 !important; }
html body[data-dashboard-theme] .account-chip > div { display:flex !important;align-items:center;gap:.4rem;white-space:nowrap; }
html body[data-dashboard-theme] .account-chip small::before { content:'·';margin-inline-end:.4rem; }

html body[data-dashboard-theme] #workspace-appearance-slot:empty { display:none; }
html body[data-dashboard-theme] #workspace-appearance-slot .dashboard-preferences {
  position:static !important;inset:auto !important;transform:none !important;display:grid !important;width:100% !important;max-width:none !important;
  margin:0 !important;padding:1rem !important;opacity:1 !important;visibility:visible !important;box-shadow:none !important;background:var(--w3-card) !important;
}
html body[data-dashboard-theme] #workspace-appearance-slot .w3-style-switcher-head { margin-bottom:.75rem; }
html body[data-dashboard-theme] #workspace-appearance-slot #close-portal-style { display:none !important; }
html body[data-dashboard-theme] .company-profile-form { display:grid;gap:.75rem; }
html body[data-dashboard-theme] .company-profile-form label { display:grid;gap:.35rem;color:var(--w3-copy);font-size:.7rem;font-weight:700; }
html body[data-dashboard-theme] .company-profile-logo-preview { width:100%;max-height:7rem;object-fit:contain;padding:.6rem;border:1px solid var(--w3-border);border-radius:.55rem;background:#fff; }

html body[data-dashboard-theme] #view-overview :is(.surface,.metric,.metric-card,.command-banner,.dashboard-motion-lab,.upcoming-schedules) {
  border-color:color-mix(in srgb,var(--w3-border) 80%,#101820) !important;
}
html body[data-dashboard-theme] .message-preview-actions { display:flex;align-items:center;gap:.45rem;flex-wrap:wrap; }
html body[data-dashboard-theme] .message-attachment-grid { display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.75rem; }
html body[data-dashboard-theme] .message-attachment-grid label { display:grid;gap:.35rem; }
html body[data-dashboard-theme] .message-attachment-preview { display:grid;gap:.6rem;padding:.75rem;border:1px solid var(--w3-border);border-radius:.6rem;background:var(--w3-card-alt); }
html body[data-dashboard-theme] .message-attachment-preview[hidden] { display:none !important; }
html body[data-dashboard-theme] .message-attachment-preview img,.message-image-attachment { display:block;max-width:min(100%,26rem);max-height:18rem;object-fit:contain;border:1px solid var(--w3-border);border-radius:.55rem;background:#fff; }
html body[data-dashboard-theme] .message-customer-link { display:inline-flex;align-items:center;width:max-content;max-width:100%;margin-top:.5rem;padding:.48rem .7rem;border:1px solid var(--portal-accent);border-radius:.45rem;background:color-mix(in srgb,var(--portal-accent) 10%,var(--w3-card));color:var(--portal-accent);font:inherit;font-size:.72rem;font-weight:800;cursor:pointer; }
@media(max-width:700px){html body[data-dashboard-theme] .message-attachment-grid{grid-template-columns:1fr}html body[data-dashboard-theme] .account-chip>div{display:grid!important;gap:0}html body[data-dashboard-theme] .account-chip small::before{content:none}}
