/* Staff shell only. Requires the explicit office-shell-v2 integration hook.
   Does not style client pages, module forms, buttons in general or dialogs. */
body[data-portal-audience="office"] .office-screen.office-shell-v2 {
  --office-shell-ink: #19394d;
  --office-shell-muted: #526571;
  --office-shell-line: #d5dfe5;
  --office-shell-soft: #f3f7fa;
}

/* The mobile drawer is narrower than the old two-column navigation grid. */
@media (max-width: 760px) {
  body[data-portal-audience="office"] #portal-sidebar nav,
  body[data-portal-audience="office"] #portal-sidebar .office-nav-group {
    grid-template-columns: minmax(0, 1fr);
  }
  body[data-portal-audience="office"] #portal-sidebar .nav-button {
    min-width: 0;
    overflow-wrap: anywhere;
  }
}

body[data-portal-audience="office"] #master-data-title {
  /* Keep the focused heading and its context label below the sticky topbar. */
  scroll-margin-top: 7rem;
  font-size: clamp(1.55rem, 2.4vw, 2rem);
  line-height: 1.2;
  letter-spacing: -.025em;
  overflow-wrap: anywhere;
}
body[data-portal-audience="office"] #master-data-description {
  overflow-wrap: anywhere;
}

body[data-portal-audience="office"] .office-screen.office-shell-v2 .office-home-head,
body[data-portal-audience="office"] .office-screen.office-shell-v2 .settings-workspace > .settings-head {
  align-items: center;
  gap: 1rem;
  margin: 0 0 1.25rem;
}
body[data-portal-audience="office"] .office-screen.office-shell-v2 .office-home-head h1,
body[data-portal-audience="office"] .office-screen.office-shell-v2 .settings-workspace > .settings-head h1 {
  margin: 0;
  font-size: clamp(1.55rem, 2.4vw, 2rem);
  line-height: 1.2;
  letter-spacing: -.025em;
  color: var(--office-shell-ink);
  overflow-wrap: anywhere;
}
body[data-portal-audience="office"] .office-screen.office-shell-v2 .office-home-head p:not(.eyebrow),
body[data-portal-audience="office"] .office-screen.office-shell-v2 .settings-workspace > .settings-head p:not(.eyebrow) {
  margin: .4rem 0 0;
  font-size: .9rem;
  line-height: 1.45;
  color: var(--office-shell-muted);
}
body[data-portal-audience="office"] .office-screen.office-shell-v2 .office-quick-work .office-area-heading {
  margin: 0 0 .75rem;
}
body[data-portal-audience="office"] .office-screen.office-shell-v2 #office-quick-work-title {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.3;
  letter-spacing: -.015em;
}
body[data-portal-audience="office"] .office-screen.office-shell-v2 .office-work-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .65rem;
}
body[data-portal-audience="office"] .office-screen.office-shell-v2 .office-work-card {
  display: grid;
  min-width: 0;
  min-height: 88px;
  align-content: center;
  gap: .3rem;
  padding: .95rem 1rem;
  border: 1px solid var(--office-shell-line);
  border-radius: .65rem;
  background: #fff;
  color: var(--office-shell-ink);
  box-shadow: none;
  text-align: left;
  overflow-wrap: anywhere;
}
body[data-portal-audience="office"] .office-screen.office-shell-v2 .office-work-card strong {
  font-size: 1rem;
  line-height: 1.3;
}
body[data-portal-audience="office"] .office-screen.office-shell-v2 .office-work-card small {
  color: var(--office-shell-muted);
  font-size: .83rem;
  line-height: 1.4;
}
body[data-portal-audience="office"] .office-screen.office-shell-v2 .office-work-card:hover {
  border-color: #7794a8;
  background: var(--office-shell-soft);
  color: var(--office-shell-ink);
  box-shadow: none;
  transform: none;
}

body[data-portal-audience="office"] .office-screen.office-shell-v2 .settings-module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .7rem;
  align-items: stretch;
}
body[data-portal-audience="office"] .office-screen.office-shell-v2 .settings-module-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  min-height: 112px;
  gap: .35rem;
  padding: 1rem;
  border: 1px solid var(--office-shell-line);
  border-radius: .65rem;
  background: #fff;
  color: var(--office-shell-ink);
  text-align: left;
  box-shadow: none;
  overflow-wrap: anywhere;
}
body[data-portal-audience="office"] .office-screen.office-shell-v2 .settings-module-card > span {
  margin: 0;
  font-size: .7rem;
  line-height: 1.25;
  letter-spacing: .025em;
  text-transform: none;
  color: var(--office-shell-muted);
}
body[data-portal-audience="office"] .office-screen.office-shell-v2 .settings-module-card > strong {
  margin: 0;
  font-size: 1rem;
  line-height: 1.3;
  letter-spacing: -.01em;
}
body[data-portal-audience="office"] .office-screen.office-shell-v2 .settings-module-card > small {
  margin: 0;
  color: var(--office-shell-muted);
  font-size: .82rem;
  line-height: 1.4;
}
body[data-portal-audience="office"] .office-screen.office-shell-v2 .settings-module-card:hover {
  border-color: #7794a8;
  background: var(--office-shell-soft);
  box-shadow: none;
  transform: none;
}
body[data-portal-audience="office"] .office-screen.office-shell-v2 .settings-group-heading {
  grid-column: 1 / -1;
  margin: .65rem 0 .1rem;
  padding-top: .55rem;
  font-size: .95rem;
  line-height: 1.3;
  color: var(--office-shell-ink);
  letter-spacing: 0;
}
body[data-portal-audience="office"] .office-screen.office-shell-v2 .settings-group-heading:first-child {
  margin-top: 0;
  padding-top: 0;
}

body[data-portal-audience="office"] .office-screen.office-shell-v2 #matter-workspace-hub {
  padding: 0;
  margin-bottom: 1rem;
  border: 0;
  box-shadow: none;
}
body[data-portal-audience="office"] .office-screen.office-shell-v2 .matter-dashboard-facts {
  margin: .75rem 0;
  border-color: var(--office-shell-line);
  border-radius: .45rem;
}
body[data-portal-audience="office"] .office-screen.office-shell-v2 .matter-dashboard-facts > div {
  min-width: 0;
  gap: .15rem;
  padding: .6rem .75rem;
  background: var(--office-shell-soft);
}
body[data-portal-audience="office"] .office-screen.office-shell-v2 .matter-dashboard-facts dt {
  color: var(--office-shell-muted);
  font-size: .72rem;
  overflow-wrap: anywhere;
}
body[data-portal-audience="office"] .office-screen.office-shell-v2 .matter-dashboard-facts dd {
  color: var(--office-shell-ink);
  font-size: .9rem;
  overflow-wrap: anywhere;
}
body[data-portal-audience="office"] .office-screen.office-shell-v2 .office-work-card:focus-visible,
body[data-portal-audience="office"] .office-screen.office-shell-v2 .settings-module-card:focus-visible {
  outline: 3px solid #245d83;
  outline-offset: 3px;
}

@media (max-width: 1100px) {
  body[data-portal-audience="office"] .office-screen.office-shell-v2 .settings-module-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 620px) {
  body[data-portal-audience="office"] .office-screen.office-shell-v2 .office-home-head,
  body[data-portal-audience="office"] .office-screen.office-shell-v2 .settings-workspace > .settings-head {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: .95rem;
  }
  body[data-portal-audience="office"] .office-screen.office-shell-v2 .office-work-grid,
  body[data-portal-audience="office"] .office-screen.office-shell-v2 .settings-module-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: .5rem;
  }
  body[data-portal-audience="office"] .office-screen.office-shell-v2 .office-work-card,
  body[data-portal-audience="office"] .office-screen.office-shell-v2 .settings-module-card {
    min-height: 80px;
    padding: .8rem .9rem;
  }
}

/* One case context across overview, embedded workspaces and document tools. */
body[data-portal-audience="office"] .office-screen.office-shell-v2 > #active-matter-context {
  position: relative;
  top: auto;
  margin-bottom: .7rem;
  padding: .55rem .75rem;
  gap: .5rem;
  border: 0;
  border-radius: .4rem;
  box-shadow: none;
  background: var(--office-shell-soft);
}
body[data-portal-audience="office"] .office-screen.office-shell-v2 #active-matter-context .matter-context-heading {
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: .4rem .75rem;
}
body[data-portal-audience="office"] .office-screen.office-shell-v2 #active-matter-context [data-leave-matter-room] {
  min-height: 44px;
  flex: 0 0 auto;
}
body[data-portal-audience="office"] .office-screen.office-shell-v2 #active-matter-context-label {
  flex: 1 1 12rem;
  min-width: 0;
  white-space: normal;
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  font-size: .9rem;
  line-height: 1.4;
}
body[data-portal-audience="office"] .office-screen.office-shell-v2 #matter-context-menu {
  position: relative;
  min-width: 0;
  max-width: 100%;
  margin-left: auto;
}
body[data-portal-audience="office"] .office-screen.office-shell-v2 #matter-context-current {
  padding: .65rem .7rem;
  min-height: 44px;
  border: 1px solid var(--office-shell-line);
  border-radius: .35rem;
  background: #fff;
  font-size: .85rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
  cursor: pointer;
}
body[data-portal-audience="office"] .office-screen.office-shell-v2 #matter-context-menu .matter-context-tools {
  position: absolute;
  right: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: min(21rem, calc(100vw - 3rem));
  max-height: min(65vh, 32rem);
  overflow: auto;
  margin-top: .3rem;
  padding: .35rem;
  border: 1px solid var(--office-shell-line);
  border-radius: .4rem;
  background: #fff;
  box-shadow: 0 6px 18px rgb(25 47 72 / 12%);
}
body[data-portal-audience="office"] .office-screen.office-shell-v2 #matter-context-menu button {
  white-space: normal;
  text-align: left;
  overflow-wrap: anywhere;
}
body[data-portal-audience="office"] .office-screen.office-shell-v2 #matter-context-current:focus-visible {
  outline: 3px solid #245d83;
  outline-offset: 2px;
}
body.matter-room-open #master-data-description:empty,
body.matter-room-open #master-data-management:has(#master-pane-matters.matter-tasks-active) > .section-head,
body.matter-room-open #master-data-management:has(#master-pane-matters.matter-time-workspace-active) > .section-head {
  display: none;
}
@media (max-width: 620px) {
  body[data-portal-audience="office"] .office-screen.office-shell-v2 #active-matter-context-label {
    flex-basis: 100%;
    order: -1;
  }
  body[data-portal-audience="office"] .office-screen.office-shell-v2 #matter-context-menu {
    flex: 1 1 9rem;
  }
}

/* Document-specific spacing; the case bar above is shared by every case view. */
body[data-portal-audience="office"].matter-room-open .office-screen.office-shell-v2[data-office-active="office-documents"]:has(> #active-matter-context:not([hidden])) #document-request-management > .document-management-head .document-management-eyebrow,
body[data-portal-audience="office"].matter-room-open .office-screen.office-shell-v2[data-office-active="office-documents"]:has(> #active-matter-context:not([hidden])) #document-management-title + p:empty,
body[data-portal-audience="office"].matter-room-open .office-screen.office-shell-v2[data-office-active="office-documents"]:has(> #active-matter-context:not([hidden])) #document-request-management > .document-matter-picker,
body[data-portal-audience="office"].matter-room-open .office-screen.office-shell-v2[data-office-active="office-documents"]:has(> #active-matter-context:not([hidden])) #document-request-management.document-browser-ready #document-browser > .db-heading > div:first-child:has(> .db-eyebrow + h3) {
  display: none;
}
body[data-portal-audience="office"].matter-room-open .office-screen.office-shell-v2[data-office-active="office-documents"]:has(> #active-matter-context:not([hidden])) #document-request-management {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
body[data-portal-audience="office"].matter-room-open .office-screen.office-shell-v2[data-office-active="office-documents"]:has(> #active-matter-context:not([hidden])) #document-request-management > .document-management-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem .75rem;
  margin: 0 0 .7rem;
}
body[data-portal-audience="office"].matter-room-open .office-screen.office-shell-v2[data-office-active="office-documents"]:has(> #active-matter-context:not([hidden])) #document-management-title {
  margin: 0;
  font-size: clamp(1.25rem, 2vw, 1.55rem);
  line-height: 1.3;
}
body[data-portal-audience="office"].matter-room-open .office-screen.office-shell-v2[data-office-active="office-documents"]:has(> #active-matter-context:not([hidden])) .document-management-head-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .4rem .65rem;
  min-width: 0;
  max-width: 100%;
}
body[data-portal-audience="office"].matter-room-open .office-screen.office-shell-v2[data-office-active="office-documents"]:has(> #active-matter-context:not([hidden])) #document-management-status {
  white-space: normal;
  overflow-wrap: anywhere;
  max-width: 100%;
  font-size: .75rem;
}
body[data-portal-audience="office"].matter-room-open .office-screen.office-shell-v2[data-office-active="office-documents"]:has(> #active-matter-context:not([hidden])) #refresh-document-management {
  min-height: 44px;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}
body[data-portal-audience="office"].matter-room-open .office-screen.office-shell-v2[data-office-active="office-documents"]:has(> #active-matter-context:not([hidden])) #document-request-management.document-browser-ready #document-browser > .db-heading {
  padding: .7rem .85rem;
}
