/* Shared work-surface rhythm. Nested record/form layers keep their own geometry. */
:root {
  --workspace-inset: clamp(24px, 3.2vw, 54px);
  --workspace-top: 27px;
  --workspace-title-size: 24px;
  --workspace-heading-color: #42493f;
  --sidebar-brand-height: 40px;
  --sidebar-brand-gap: 28px;
  --sidebar-first-row-height: 49px;
  --workspace-heading-track: calc(var(--sidebar-brand-height) + var(--sidebar-brand-gap));
  --workspace-band-height: var(--sidebar-first-row-height);
  --workspace-label-size: var(--type-body, 14px);
}
#app > main > :is(#content, .entity-suspended-content) > .page {
  width: 100%; max-width: none; margin: 0;
  padding: var(--workspace-top) var(--workspace-inset) 32px !important;
}
#app > main > :is(#content, .entity-suspended-content) > .page > :is(.page-head, .pw-page-header) {
  box-sizing: border-box; min-height: var(--workspace-heading-track); margin: 0;
  padding: 0 54px 0 0; align-items: flex-start; gap: 16px;
}
#app > main > :is(#content, .entity-suspended-content) > .page > .page-head > div:first-child { min-width: 0; flex: 1; }
#app > main > :is(#content, .entity-suspended-content) > .page .page-title-line { min-height: 40px; align-items: center; flex-wrap: wrap; gap: 12px 20px; }
#app > main > :is(#content, .entity-suspended-content) > .page .page-title-line .button { min-height: 40px !important; height: 40px !important; }
#app > main > :is(#content, .entity-suspended-content) > .page > :is(.page-head, .pw-page-header) h1,
#app > main > :is(#content, .entity-suspended-content) > .page > h1 {
  margin: 0; font-size: var(--workspace-title-size) !important; font-weight: 700;
  line-height: 1.3; letter-spacing: -.02em; color: var(--workspace-heading-color);
}
#app > main > :is(#content, .entity-suspended-content) > .page > .page-head p { font-size: 13px; font-weight: 400; line-height: 1.5; margin: 2px 0 0; }
#app > main > :is(#content, .entity-suspended-content) > .page .page-view-actions { min-height: 40px; align-items: center; }
#app > main > :is(#content, .entity-suspended-content) > .page .page-view-actions:empty { display: none; }
#app > main > :is(#content, .entity-suspended-content) > .page > .pw-page-header { align-items: center; }
/* The first working band, not just the page title, shares one vertical rhythm.
   Keep these selectors at the root: record tabs and form layers are independent. */
:is(#content, .entity-suspended-content) > .page > .registry-tabs,
:is(#content, .entity-suspended-content) > .page > .registry-tabs-row,
:is(#content, .entity-suspended-content) > .page > .rw-scope > .registry-tabs,
:is(#content, .entity-suspended-content) > .page > .client-contracts-toolbar,
:is(#content, .entity-suspended-content) > .page > .deals-filters,
:is(#content, .entity-suspended-content) > .page .home-three-columns > .card > header,
:is(#content, .entity-suspended-content) > .chat-page .chat-sidebar > .registry-tabs,
:is(#content, .entity-suspended-content) > .mail-page :is(.mail-folders, .mail-inbox) > header,
:is(#content, .entity-suspended-content) > .calendar-page .mail-calendar-sources > header {
  box-sizing: border-box; height: var(--workspace-band-height); min-height: var(--workspace-band-height);
  flex-shrink: 0; display: flex; align-items: center; gap: 8px;
  margin-top: 0; padding-block: 0; font-size: var(--workspace-label-size); line-height: 20px;
}
:is(#content, .entity-suspended-content) > .page > :is(.registry-tabs, .registry-tabs-row, .client-contracts-toolbar, .deals-filters),
:is(#content, .entity-suspended-content) > .page > .rw-scope { margin-bottom: 16px; }
:is(#content, .entity-suspended-content) > .page > .rw-scope { margin-top: 0; }
:is(#content, .entity-suspended-content) > .page > .rw-scope > .registry-tabs,
:is(#content, .entity-suspended-content) > .page > .registry-tabs-row > .registry-tabs { margin: 0 !important; }
:is(#content, .entity-suspended-content) > .page > .registry-tabs,
:is(#content, .entity-suspended-content) > .page > .registry-tabs-row > .registry-tabs,
:is(#content, .entity-suspended-content) > .page > .rw-scope > .registry-tabs,
:is(#content, .entity-suspended-content) > .page > .client-contracts-toolbar > .client-contract-filter,
:is(#content, .entity-suspended-content) > .chat-page .chat-sidebar > .registry-tabs {
  align-items: stretch !important; flex-wrap: nowrap; overflow-x: auto; gap: 2px; padding: 0;
}
:is(#content, .entity-suspended-content) > .page > .registry-tabs > button,
:is(#content, .entity-suspended-content) > .page > .registry-tabs-row > .registry-tabs > button,
:is(#content, .entity-suspended-content) > .page > .rw-scope > .registry-tabs > button,
:is(#content, .entity-suspended-content) > .chat-page .chat-sidebar > .registry-tabs > button {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  /* Balance the 1px track rule plus the button's 3px underline. */
  align-self: stretch; min-height: 0; margin: 0; padding: 4px 14px 0 !important;
  font-size: var(--workspace-label-size) !important; line-height: 20px !important;
}
:is(#content, .entity-suspended-content) > .page > .registry-tabs-row > .registry-tabs { align-self: stretch; }
:is(#content, .entity-suspended-content) > .page > .client-contracts-toolbar { justify-content: flex-start; flex-direction: row; }
:is(#content, .entity-suspended-content) > .page > .client-contracts-toolbar > .client-contract-filter { display: flex; margin: 0; }
:is(#content, .entity-suspended-content) > .page > .client-contracts-toolbar .client-contract-filter > button {
  font-size: var(--workspace-label-size); line-height: 20px; white-space: nowrap;
}
:is(#content, .entity-suspended-content) > .page > .deals-filters { flex-wrap: nowrap; }
:is(#content, .entity-suspended-content) > .page > .deals-filters label {
  flex-direction: row; align-items: center; min-width: 0; font-size: var(--workspace-label-size);
}
:is(#content, .entity-suspended-content) > .page > .deals-filters input { height: 36px; padding: 6px 8px; width: 100%; }
:is(#content, .entity-suspended-content) > .page > .deals-filters .button { min-height: 36px; height: 36px; padding: 0 12px; }

/* Home headings/actions follow the outer filter/row surfaces, not their text. */
:is(#content, .entity-suspended-content) > .home-page {
  --home-list-inset: 17px;
  --home-item-inset: 11px;
  --home-label-size: var(--work-meta, 12px);
}
:is(#content, .entity-suspended-content) > .home-page .home-three-columns > .card > header {
  padding-inline: var(--home-list-inset);
}
:is(#content, .entity-suspended-content) > .home-page .home-three-columns :is(.card-tabs, .compact-list, .timeline-list) {
  padding-inline: var(--home-list-inset);
}
:is(#content, .entity-suspended-content) > .home-page .home-three-columns :is(.card-tabs > button, .task-line, .project-line, .timeline-row) {
  padding-inline: var(--home-item-inset);
}
:is(#content, .entity-suspended-content) > .page .home-three-columns > .card > header h2 {
  margin: 0; font-size: var(--home-label-size) !important; line-height: 20px !important;
  font-weight: 700 !important; white-space: nowrap;
}
:is(#content, .entity-suspended-content) > .page .home-three-columns .card-header-actions > button {
  font-size: var(--home-label-size) !important; font-weight: 400 !important;
  line-height: 20px; min-height: 32px; padding: 0; white-space: nowrap;
}
:is(#content, .entity-suspended-content) > .home-page .home-card-footer {
  display: flex; align-items: center; gap: 8px; margin-top: auto;
  padding: 0 var(--home-list-inset); border-top: 1px solid var(--line);
}
:is(#content, .entity-suspended-content) > .page .home-three-columns .home-more[data-home-destination] {
  display: flex; flex-direction: row; align-items: center; justify-content: center;
  flex: 1; width: auto; margin: 0; border: 0; gap: 6px; min-height: 44px; padding: 8px 0 !important;
  font-size: var(--home-label-size); line-height: 20px; font-weight: 400;
}
:is(#content, .entity-suspended-content) > .page .home-three-columns .home-more[data-home-destination] img {
  width: 12px; height: 12px; flex: 0 0 12px; opacity: .7;
}
:is(#content, .entity-suspended-content) > .home-page .home-list-toggle {
  display: grid; place-items: center; flex: 0 0 32px; width: 32px; height: 32px;
  border: 0; border-radius: 8px; background: transparent; padding: 0;
}
:is(#content, .entity-suspended-content) > .home-page .home-list-toggle:hover { background: var(--accent-soft); }
:is(#content, .entity-suspended-content) > .home-page .home-list-toggle img { width: 12px; height: 12px; opacity: .7; }
:is(#content, .entity-suspended-content) > .home-page .home-list-toggle[aria-expanded="true"] img { transform: rotate(180deg); }
:is(#content, .entity-suspended-content) > .home-page .home-card-footer button:focus-visible { outline: 2px solid var(--accent-dark); outline-offset: -2px; }

:is(#content, .entity-suspended-content) > .chat-page .chat-sidebar > .registry-tabs { padding-inline: 6px; }
:is(#content, .entity-suspended-content) > .chat-page .chat-sidebar > .registry-tabs > button { padding-inline: 6px !important; }
:is(#content, .entity-suspended-content) > .mail-page :is(.mail-folders, .mail-inbox),
:is(#content, .entity-suspended-content) > .calendar-page .mail-calendar-sources { padding-top: 0; }
:is(#content, .entity-suspended-content) > .mail-page :is(.mail-folders, .mail-inbox) > header,
:is(#content, .entity-suspended-content) > .calendar-page .mail-calendar-sources > header { font-weight: 700; color: var(--ink); }
:is(#content, .entity-suspended-content) > .mail-page .mail-inbox > header strong { font-size: inherit; font-weight: inherit; }
.mail-folder[hidden] { display: none !important; }

/* One footer for page size, selection actions and page navigation. */
.registry-pagination { gap: 10px 14px; align-items: center; }
.registry-pagination, .registry-pagination :is(.pagination-summary, .pagination-size, select, button) {
  font-size: var(--workspace-label-size); line-height: 20px; font-weight: 400;
}
.registry-pagination .registry-selection-actions {
  display: flex; flex: 1 1 auto; width: auto; min-width: 0;
  align-items: center; gap: 8px; padding: 0; border: 0;
}
.registry-pagination .registry-selection-actions :is(button, select) { min-height: 36px; padding: 6px 10px; }
.registry-pagination .registry-selection-actions select { min-width: 0; max-width: 220px; }
.registry-pagination .selection-count { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.registry-pagination .pagination-pages { flex: 0 1 auto; margin-left: auto; }
.registry-pagination .pagination-pages .active { font-weight: 700; }
[data-registry-schema] + .registry-pagination { margin-top: 14px; }
[data-registry-schema] :is(tr, .task-table-row)[hidden] { display: none !important; }
#app > main > :is(#content, .entity-suspended-content) > .page :is(.detail-hero h1, .knowledge-article > header h1) {
  font-size: var(--workspace-title-size) !important; font-weight: 700; line-height: 1.3; color: var(--workspace-heading-color);
}
.global-notification-button { position: fixed; top: var(--workspace-top); right: var(--workspace-inset); left: auto; bottom: auto; }
.chat-page .chat-workspace, .mail-page .mail-shell { height: calc(100dvh - var(--workspace-top) - var(--workspace-heading-track) - 32px); min-height: 420px; }
/* The first working labels share the Home navigation row, not the page H1.
   Use the same tracks as the sidebar; never offset each section independently. */
@media (min-width: 701px) {
  /* Home alone aligns card TOP edges to the Home navigation text center.
     Other sections continue to align the centers of their first labels. */
  :is(#content, .entity-suspended-content) > .home-page > .dashboard-grid.home-three-columns {
    margin-top: calc(var(--workspace-band-height) / 2);
  }
  body:not(.sidebar-collapsed) .sidebar { padding-top: var(--workspace-top) !important; }
  body:not(.sidebar-collapsed) .sidebar-brand {
    min-height: var(--sidebar-brand-height) !important;
    grid-template-rows: var(--sidebar-brand-height) !important;
    margin-bottom: var(--sidebar-brand-gap) !important;
  }
  #nav > .nav-item[data-page="home"] {
    height: var(--sidebar-first-row-height) !important;
    min-height: var(--sidebar-first-row-height) !important;
  }
  body.sidebar-collapsed {
    /* The collapsed rail has a stacked 82px brand and search area. */
    --workspace-heading-track: calc(18px + 82px + 14px - var(--workspace-top));
  }
  :is(#content, .entity-suspended-content) > .page .home-three-columns > .card > header,
  :is(#content, .entity-suspended-content) > .chat-page .chat-sidebar > .registry-tabs,
  :is(#content, .entity-suspended-content) > .mail-page :is(.mail-folders, .mail-inbox) > header,
  :is(#content, .entity-suspended-content) > .calendar-page .mail-calendar-sources > header {
    /* The parent panel contributes its own 1px top border to this track. */
    height: calc(var(--workspace-band-height) - 1px);
    min-height: calc(var(--workspace-band-height) - 1px);
  }
  :is(#content, .entity-suspended-content) > .chat-page .chat-sidebar > .registry-tabs > button { padding-top: 3px !important; }
  :is(#content, .entity-suspended-content) > .mail-page :is(.mail-folders, .mail-inbox) > header,
  :is(#content, .entity-suspended-content) > .calendar-page .mail-calendar-sources > header { border-bottom: 1px solid transparent; }
}
@media (min-width: 701px) and (max-height: 850px) {
  body:not(.sidebar-collapsed) {
    /* Expanded navigation compacts its text rows at 850px, before the
       brand spacing compacts at 820px. Inherited root aliases are already
       resolved, so bind the working band again in this same scope. */
    --sidebar-first-row-height: 40px;
    --workspace-band-height: var(--sidebar-first-row-height);
  }
}
@media (min-width: 701px) and (max-height: 820px) {
  :root { --workspace-top: 16px; --sidebar-brand-gap: 14px; --sidebar-first-row-height: 40px; }
  /* Fit the greeting and its date inside the compact 54px title track. */
  #app > main > :is(#content, .entity-suspended-content) > .home-page .page-title-line { min-height: 0; }
}
:is(#content, .entity-suspended-content) > .home-page { container: home-workspace / inline-size; }
@container home-workspace (max-width: 880px) {
  /* Never shrink the home typography or wrap just one of its three headings. */
  :is(#content, .entity-suspended-content) > .page .dashboard-grid.home-three-columns { grid-template-columns: minmax(0, 1fr); }
  :is(#content, .entity-suspended-content) > .page .home-three-columns > .card { grid-column: auto; }
}
@media (max-width: 950px) {
  :is(#content, .entity-suspended-content) > .calendar-page .mail-calendar-sources { gap: 0 12px; }
  :is(#content, .entity-suspended-content) > .calendar-page .mail-calendar-sources > header { width: 100%; }
}
@media (max-width: 700px) {
  :root { --workspace-inset: 15px; --workspace-top: 20px; --workspace-title-size: 22px; --workspace-band-height: 56px; }
  #app > main > :is(#content, .entity-suspended-content) > .page { padding-bottom: 90px !important; }
  #app > main > :is(#content, .entity-suspended-content) > .page > :is(.page-head, .pw-page-header) { padding-right: 48px; min-height: 104px; margin-bottom: 16px; }
  #app > main > :is(#content, .entity-suspended-content) > .page .page-title-line { align-items: flex-start; }
  .chat-page .chat-workspace, .mail-page .mail-shell { height: calc(100dvh - 200px); min-height: 380px; }
  :is(#content, .entity-suspended-content) > .page > .deals-filters { height: auto; flex-wrap: wrap; padding-block: 10px; }
  :is(#content, .entity-suspended-content) > .page > .deals-filters label { flex: 1 1 140px; }
}
/* One quiet, accessible creation control for section headers. */
.page-head .button.section-create {
  display:inline-flex;align-items:center;justify-content:center;
  width:38px;min-width:38px;height:38px;min-height:38px;padding:0;border:1px solid #729b18;
  border-radius:12px;background:#729b18;color:#fff;box-shadow:none;
  font-size:26px;font-weight:400;line-height:1;transition:transform .15s ease,background .15s ease;
}
.page-head .button.section-create:hover {background:#618514;transform:scale(1.06);}
.page-head .button.section-create:focus-visible {outline:2px solid #486410;outline-offset:3px;}
.page-head .button.section-create span {font:inherit;line-height:1;}
@media(prefers-reduced-motion:reduce){.page-head .button.section-create{transition:none}.page-head .button.section-create:hover{transform:none}}
.calendar-employees .mail-check {padding:7px 4px;margin:3px 0!important;align-items:center;cursor:pointer;}
.calendar-employees .mail-check span {overflow-wrap:anywhere;}
.calendar-employees .mail-check input {flex:0 0 16px;margin:0;}
.calendar-employees .mail-check:has(input:checked) {background:#eff5df;border-radius:8px;}
.calendar-employee-shortcuts {display:flex;gap:14px;margin-block:12px;}
.calendar-employee-shortcuts button {font:inherit;font-size:13px;color:#486410;background:transparent;border:0;border-radius:6px;padding:4px 0;cursor:pointer;}
.calendar-employee-shortcuts button:hover {text-decoration:underline;}

/* View controls belong to the working band, not the notification/title row. */
.registry-view-row {display:flex;align-items:center;gap:16px;min-width:0;}
.registry-view-row > .registry-tabs {flex:1 1 auto;min-width:0;align-self:stretch;}
.registry-view-row > .layout-toggle,.rw-scope > .layout-toggle {flex:0 0 auto;margin-left:auto;align-self:center;}
.client-contracts-toolbar.registry-view-row {border-bottom:1px solid var(--line);}
.client-contracts-toolbar.registry-view-row > .registry-tabs {border:0;}
.client-contracts-toolbar.registry-view-row .client-contract-filter > button {
  align-self:stretch;min-height:0;margin:0;padding:4px 14px 0;border:0;
  border-bottom:3px solid transparent;border-radius:0;background:transparent;
  color:var(--muted);font-size:var(--workspace-label-size);line-height:20px;font-weight:400;
}
.client-contracts-toolbar.registry-view-row .client-contract-filter > button.active {
  border-bottom-color:var(--accent);background:transparent;color:var(--ink);font-weight:700;
}
.deals-filters.registry-view-row > .layout-toggle button {white-space:nowrap;}
@media(max-width:1100px){
  :is(#content,.entity-suspended-content) > .page > .deals-filters.registry-view-row {height:auto;flex-wrap:wrap;}
}
@media(max-width:700px){
  :is(#content,.entity-suspended-content) > .page > .registry-view-row,
  :is(#content,.entity-suspended-content) > .page > .rw-scope {height:auto;flex-wrap:wrap;gap:8px;}
  .registry-view-row > .registry-tabs,.rw-scope > .registry-tabs {flex-basis:100%;min-height:49px;}
  .registry-view-row > .layout-toggle,.rw-scope > .layout-toggle {width:auto;margin-left:auto;margin-bottom:8px;}
}
