/* Shared staff-workspace rhythm. Public portals and printed invoices are isolated. */
@media screen {
  :is(.shell, body:has(.shell) > .modal-shell) {
    --admin-body: 15px;
    --admin-caption: 13px;
    --admin-label: 12px;
    --admin-heading: 20px;
    --admin-gap: 24px;
    --admin-padding: 24px;
    font-size: var(--admin-body);
    line-height: 1.5;
  }

  .shell .page-head { gap: var(--admin-gap); margin-bottom: 28px; flex-wrap: wrap; }
  .shell .page-head h1 { font-size: 32px; line-height: 1.2; }
  .shell .page-head p:not(.eyebrow) { font-size: var(--admin-body); line-height: 1.5; margin-top: 10px; }
  :is(.shell, body:has(.shell) > .modal-shell) .eyebrow {
    font-size: var(--admin-label); line-height: 1.5; letter-spacing: .1em; margin-bottom: 8px;
  }
  .shell .panel-head { padding: var(--admin-padding); gap: 16px; flex-wrap: wrap; }
  .shell :is(.panel-head h3, .setting-card h3, .user-admin-head h2, .side-card h3, .reset-card h3) {
    font-size: var(--admin-heading); line-height: 1.3; font-weight: 700; letter-spacing: -.02em; margin: 0 0 8px;
  }
  .shell :is(.panel-head p:not(.eyebrow), .setting-card > p, .user-admin-head p:not(.eyebrow), .reset-card p:not(.eyebrow)) {
    font-size: var(--admin-body); line-height: 1.55; color: var(--muted); margin: 0;
  }
  :is(.shell, body:has(.shell) > .modal-shell) .button {
    font-size: 14px; line-height: 1.4; min-height: 44px; padding: 11px 16px;
  }
  :is(.shell, body:has(.shell) > .modal-shell) .button.small { min-height: 36px; padding: 8px 12px; font-size: var(--admin-caption); }
  .shell :is(.status, .role-pill) { font-size: var(--admin-label); line-height: 1.4; padding: 5px 10px; }
  .shell .metric-label { font-size: var(--admin-label); line-height: 1.5; }
  .shell .metric-detail { font-size: var(--admin-caption); line-height: 1.5; }
  .shell .table-wrap :is(td, .cell-main) { font-size: var(--admin-body); line-height: 1.5; }
  .shell .table-wrap td { padding-block: 16px; }
  .shell .table-wrap :is(th, .cell-sub) { font-size: var(--admin-caption); line-height: 1.5; }
  .shell .table-wrap th { padding-block: 14px; }
  .shell .invoice-list-table { min-width: 1200px; }
  .shell .invoice-list-table td:is(:nth-last-child(6), :nth-last-child(5)) { white-space: nowrap; }
  .shell .invoice-list-table .status { white-space: nowrap; }
  .shell :is(.project-toolbar, .project-summary-grid, .project-intelligence-grid) { gap: 16px; }
  .shell .project-toolbar { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); padding: var(--admin-padding); }
  .shell .project-toolbar label > span { font-size: var(--admin-label); line-height: 1.5; }
  .shell .project-toolbar select { font-size: 14px; min-height: 44px; }
  .shell .project-command-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
  .shell .project-summary-card { padding: 20px; gap: 10px; }
  .shell :is(.project-summary-card > span, .vendor-statement-balance span) { font-size: var(--admin-label); line-height: 1.5; }
  .shell :is(.project-summary-card small, .vendor-statement-balance small, .project-chart-legend, .project-updates-panel > button span) { font-size: var(--admin-caption); line-height: 1.5; }
  .shell :is(.project-stage-list span, .project-chart-rows button > strong) { font-size: 14px; line-height: 1.5; }
  .shell .project-stage-list { gap: 12px; }
  .shell :is(.project-source-metrics, .project-intelligence-grid > .panel, .project-gantt) > .panel-head { padding: 0 0 20px; margin-bottom: 20px; }

  /* Administration: keep identities, security status and actions independently readable. */
  .shell .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--admin-gap); }
  .shell .setting-card { padding: var(--admin-padding); min-width: 0; }
  .shell .settings-grid .setting-card > p { margin-bottom: 20px; }
  .shell .security-state { padding: 16px 0; gap: 16px; font-size: var(--admin-body); flex-wrap: wrap; }
  .shell .security-state strong { overflow-wrap: anywhere; }
  .shell .user-admin { margin-bottom: var(--admin-gap); }
  .shell .user-admin-head { padding: var(--admin-padding); gap: var(--admin-gap); flex-wrap: wrap; }
  .shell .user-admin-head > div:first-child { flex: 1 1 300px; }
  .shell .user-counts { gap: 12px; }
  .shell .user-counts > div { min-width: 88px; padding: 12px 16px; }
  .shell .user-counts strong { font-size: 24px; line-height: 1.2; }
  .shell .user-counts span { font-size: var(--admin-label); line-height: 1.5; }
  .shell .user-directory { padding: 0 var(--admin-padding); }
  .shell .user-profile-row {
    grid-template-columns: 44px minmax(150px, 1fr) minmax(210px, 1.25fr) minmax(145px, .9fr) minmax(220px, 1.2fr) 64px;
    gap: 20px; padding: 24px 0; align-items: center;
  }
  .shell .user-profile-row > * { min-width: 0; }
  .shell .profile-avatar { width: 44px; height: 44px; font-size: var(--admin-caption); }
  .shell :is(.profile-main, .profile-contact, .profile-location) strong {
    font-size: var(--admin-body); line-height: 1.5; white-space: normal; overflow: visible; overflow-wrap: anywhere;
  }
  .shell :is(.profile-main, .profile-contact, .profile-location) span {
    font-size: var(--admin-caption); line-height: 1.5; margin-top: 4px; white-space: normal; overflow: visible; overflow-wrap: anywhere;
  }
  .shell .profile-main > div { flex-wrap: wrap; gap: 8px; }
  .shell .profile-main .you-badge { font-size: 11px !important; }
  .shell .profile-location { display: block; }
  .shell .profile-access { flex-wrap: wrap; gap: 8px; }
  .shell .profile-access small { flex-basis: 100%; font-size: var(--admin-caption); color: var(--muted); line-height: 1.5; }
  .shell .profile-edit { font-size: 14px; min-height: 44px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
  .shell .profile-edit:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
  .shell .integration-row { gap: 16px; padding: 16px 0; min-height: 76px; }
  .shell .integration-row > span:first-child { min-width: 0; overflow-wrap: anywhere; }
  .shell .integration-row strong { font-size: var(--admin-body); line-height: 1.5; }
  .shell .integration-row small { font-size: var(--admin-caption); line-height: 1.5; margin-top: 4px; }
  .shell .reset-card { margin-top: var(--admin-gap); padding: var(--admin-padding); gap: var(--admin-gap); flex-wrap: wrap; }

  /* The same form scale applies in admin drawers, not vendor/customer portals. */
  body:has(.shell) > .modal-shell :is(.drawer-head, .drawer-foot) { padding: var(--admin-padding); gap: 16px; }
  body:has(.shell) > .modal-shell .drawer-head h2 { font-size: 24px; line-height: 1.3; }
  body:has(.shell) > .modal-shell .drawer-head p:not(.eyebrow) { font-size: var(--admin-body); line-height: 1.5; }
  body:has(.shell) > .modal-shell .drawer-body { padding: var(--admin-padding); }
  :is(.shell, body:has(.shell) > .modal-shell) .form-grid { gap: 24px; }
  :is(.shell, body:has(.shell) > .modal-shell) .field label {
    font-size: var(--admin-caption); line-height: 1.5; letter-spacing: .02em; color: var(--muted); margin-bottom: 8px;
  }
  :is(.shell, body:has(.shell) > .modal-shell) .field :is(input, select, textarea) { font-size: var(--admin-body); line-height: 1.5; min-height: 44px; }
  :is(.shell, body:has(.shell) > .modal-shell) :is(.field-help, .field small) { font-size: var(--admin-caption); line-height: 1.5; }
  body:has(.shell) > .modal-shell .form-section { margin-bottom: 28px; padding-bottom: 28px; }
  body:has(.shell) > .modal-shell .form-section h3 { font-size: 18px; line-height: 1.4; margin-bottom: 16px; }
  body:has(.shell) > .modal-shell :is(.profile-form-intro strong, .credential-security strong) { font-size: var(--admin-body); }
  body:has(.shell) > .modal-shell :is(.profile-form-intro p, .credential-security p) { font-size: var(--admin-caption); line-height: 1.55; }

  @media (max-width: 1450px) {
    .shell .user-profile-row { grid-template-columns: 44px minmax(0, 1fr) minmax(0, 1fr) 64px; gap: 16px 20px; }
    .shell .profile-avatar { grid-column: 1; grid-row: 1; }
    .shell .profile-main { grid-column: 2; grid-row: 1; }
    .shell .profile-contact { grid-column: 3; grid-row: 1; }
    .shell .profile-location { grid-column: 2; grid-row: 2; }
    .shell .profile-access { grid-column: 3; grid-row: 2; }
    .shell .profile-edit { grid-column: 4; grid-row: 1; }
  }
  @media (max-width: 1000px) {
    .shell .settings-grid { grid-template-columns: minmax(0, 1fr); }
  }
  @media (max-width: 760px) {
    :is(.shell, body:has(.shell) > .modal-shell) { --admin-padding: 20px; --admin-gap: 20px; }
    .shell .user-profile-row { grid-template-columns: 44px minmax(0, 1fr) 64px; gap: 16px 12px; }
    .shell .profile-main { grid-column: 2 / -1; padding-right: 0; }
    .shell .profile-contact { grid-column: 1 / -1; grid-row: 2; }
    .shell .profile-location { grid-column: 1 / -1; grid-row: 3; }
    .shell .profile-access { grid-column: 1 / 3; grid-row: 4; }
    .shell .profile-edit { grid-column: 3; grid-row: 4; align-self: start; }
    .shell .integration-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
    .shell .integration-row .status { grid-column: 1; justify-self: start; }
    .shell .integration-row b { grid-column: 2; grid-row: 1 / 3; }
    :is(.shell, body:has(.shell) > .modal-shell) .field :is(input, select, textarea) { font-size: 16px; }
  }
}
