/* Screen action controls shared by every role. No print or calendar geometry changes. */
@media screen {
  :root { --crm-action:#2166b7; --crm-action-hover:#18569e; }
  :is(main,dialog,header,.header-actions,.topbar,#account-entry,.account-ui)
  :is(button,a.primary,a.secondary,a.primary-link,a[role="button"]):not(:where(.kpi,.card,.nurse-card,.metric,.resident-metric,.calendar-day,.live-calendar-day,.calendar-event,.manager-event,.finance-event,.slot-plus,.icon-button,.close,.text-link,.card-link,[role="tab"],[role="gridcell"],[aria-pressed],[aria-selected],[data-live-day],[data-calendar-day],[aria-label^="Закрыть"],.calendar-grid *,.schedule-grid *,#contract-preview-dialog *,#service-act-preview *)) {
    box-sizing:border-box;
    min-height:44px !important;
    max-width:100%;
    padding:10px 14px !important;
    border-radius:8px !important;
    font-family:system-ui,-apple-system,"Segoe UI",sans-serif !important;
    font-size:14px !important;
    font-weight:600 !important;
    line-height:1.4 !important;
    white-space:normal;
    overflow-wrap:anywhere;
    vertical-align:middle;
  }
  :is(main,dialog,header,.header-actions,.topbar,#account-entry,.account-ui)
  :is(.primary,.primary-link,button[type="submit"]):not(.danger,.destructive) {
    background:var(--crm-action) !important;
    border:1px solid var(--crm-action) !important;
    color:#fff !important;
  }
  :is(main,dialog,header,.header-actions,.topbar,#account-entry,.account-ui)
  :is(.secondary,button[type="button"][data-close],button[data-account-close]:not([aria-label]),button[data-account-logout],#account-entry button) {
    background:#fff !important;
    border:1px solid #b7c8de !important;
    color:#23466f !important;
  }
  :is(button,a.primary,a.secondary,a.primary-link,a[role="button"]):focus-visible {
    outline:3px solid #80b8f1; outline-offset:2px;
  }
  :is(main,dialog,header) :is(.primary,.primary-link,button[type="submit"]):not(.danger,.destructive):enabled:hover {
    background:var(--crm-action-hover) !important;
  }
  button:disabled { cursor:not-allowed; }
  [data-account-close][aria-label] { min-width:40px; min-height:40px; padding:4px; font-size:22px; }
}
@media screen {
  #crm-workspace-header {
    grid-column:1 / -1; display:flex; flex-wrap:wrap; align-items:center;
    justify-content:space-between; gap:12px; padding:12px 24px;
    box-sizing:border-box; width:100%; min-width:0;
    background:#fff; border-bottom:1px solid #d8e3ef;
    font:400 14px/1.4 system-ui,-apple-system,"Segoe UI",sans-serif;
  }
  #crm-workspace-header [data-header-support] { flex:1 1 380px; min-width:0; }
  #crm-workspace-header [data-header-account] { flex:0 1 auto; min-width:0; margin-left:auto; }
  #crm-workspace-header .br-toolbar { padding:0; border:0; background:transparent; gap:8px; }
  #crm-workspace-header #account-entry { padding:0; }
  #crm-workspace-header :is(button,a) {
    display:inline-flex; align-items:center; justify-content:center; gap:8px;
    box-sizing:border-box; min-height:44px; max-width:100%; padding:10px 14px;
    border:1px solid #b7c8de; border-radius:8px; background:#fff;
    color:#23466f; font:600 14px/1.4 system-ui,-apple-system,"Segoe UI",sans-serif;
    text-decoration:none; white-space:normal; overflow-wrap:anywhere; cursor:pointer;
  }
  #crm-workspace-header :is(button,a):hover { background:#edf4fc; border-color:#2166b7; }
  #crm-workspace-header :is(button,a):focus-visible { outline:3px solid #80b8f1; outline-offset:2px; }
  #crm-workspace-header .br-toolbar p { flex-basis:100%; }
  #crm-workspace-header [hidden] { display:none; }
  @media (max-width:600px) {
    #crm-workspace-header { padding:12px 16px; gap:8px; }
    #crm-workspace-header [data-header-support] { flex-basis:100%; }
    #crm-workspace-header [data-header-account] { margin-left:0; }
  }
}
@media print { #crm-workspace-header { display:none !important; } }

@media screen {
  .crm-has-workspace-header :is(header,.header-actions,.topbar) :is(#profile,#nd-profile) { display:none; }
  .crm-has-workspace-header .header-actions { flex-wrap:wrap; gap:10px; }
  .crm-has-workspace-header .header-actions > :is(button,a) { flex-shrink:0; overflow-wrap:normal; }
}
