/* Shared cabinet rhythm. Public pages and printed documents keep their own layout. */
@media screen {
  #app-shell {
    --shadow: 0 4px 20px rgba(46, 26, 120, .035);
    --shadow-raised: 0 8px 26px rgba(46, 26, 120, .065);
  }
  #app-shell .page-heading { min-height: 0; margin-bottom: 24px; gap: 20px; }
  #app-shell .page-heading > div:first-child { min-width: 0; }
  #app-shell .page-heading h1 { font-size: clamp(26px, 2.4vw, 32px); letter-spacing: -.035em; line-height: 1.2; }
  #app-shell .page-heading p { max-width: 720px; font-size: 14px; line-height: 1.65; }
  #app-shell .heading-actions { gap: 10px; align-items: center; }
  #app-shell .heading-actions > [data-internal-finance] { display: flex; flex-wrap: wrap; gap: 10px; }
  #app-shell .panel { border-radius: 20px; }
  #app-shell .panel:hover { box-shadow: var(--shadow); }
  #app-shell .panel-header { min-height: 70px; padding-block: 16px; gap: 16px; }
  #app-shell .panel-header > div { min-width: 0; }
  #app-shell .panel-header h2 { font-size: 17px; line-height: 1.4; }
  #app-shell .panel-header p { margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
  #app-shell .collection-panel { min-height: 240px; }
  #app-shell .collection-panel + .collection-panel { margin-top: 24px; }
  #app-shell .portal-section-heading { padding-block: 18px; gap: 16px; }
  #app-shell .portal-section-heading > strong { font-size: 16px; }
  #app-shell .portal-section-heading span { line-height: 1.55; }
  #app-shell .empty-state { min-height: 144px; gap: 12px; align-content: center; line-height: 1.65; }
  #app-shell .collection-toolbar { padding: 18px; gap: 14px; align-items: end; }
  #app-shell .collection-toolbar label { gap: 8px; font-size: 12px; line-height: 1.45; }
  #app-shell .collection-toolbar :is(input, select) { min-width: 0; max-width: 100%; border-radius: 12px; }
  #app-shell .portal-row, #app-shell .inventory-row, #app-shell .staff-row { padding-block: 16px; }
  #app-shell .metric-card > div > strong { font-size: 30px; line-height: 1.2; letter-spacing: -.025em; }
  #app-shell .metric-card > div > span { color: var(--muted); font-size: 13px; line-height: 1.5; }
  #app-shell .metric-icon { position: absolute; right: 20px; bottom: 20px; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; color: var(--primary-mid); background: var(--primary-soft); }
  #app-shell .metric-icon svg { width: 20px; height: 20px; }
  #app-shell .finance-section-tabs { margin-inline: 0; border: 1px solid var(--line); border-radius: 16px; padding: 6px; gap: 6px; }
  #app-shell .status-pill { line-height: 1.35; }

  :is(#app-shell, dialog) :is(.primary-button, .secondary-button, .danger-button) {
    display: inline-flex; align-items: center; justify-content: center; gap: 9px;
    min-height: 46px; height: auto; max-width: 100%; padding: 11px 18px;
    border-radius: 13px; font-size: 14px; font-weight: 700; line-height: 1.45;
    white-space: normal; text-align: center; text-decoration: none;
  }
  :is(#app-shell, dialog) :is(.primary-button, .secondary-button, .danger-button).compact {
    min-height: 42px; padding: 9px 15px; border-radius: 12px; font-size: 13px;
  }
  :is(#app-shell, dialog) :is(.primary-button, .secondary-button, .danger-button) svg { flex: 0 0 18px; width: 18px; height: 18px; }
  :is(#app-shell, dialog) :is(.primary-button, .secondary-button, .danger-button) span { min-width: 0; overflow-wrap: anywhere; }
  :is(#app-shell, dialog) .primary-button:hover { transform: none; }
  :is(#app-shell, dialog) button:disabled { cursor: default; }
  :is(#app-shell, dialog) .icon-button { flex-shrink: 0; border-radius: 12px; }
  :is(#app-shell, dialog) :is(button, a, input, select, textarea):focus-visible { outline: 3px solid #8d82d8; outline-offset: 3px; }
  dialog .form-error:empty { margin: 0; }
  dialog :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):not([type="color"]), select, textarea) { border-radius: 12px; }
  dialog header h2 { line-height: 1.25; letter-spacing: -.025em; }
  dialog header p { line-height: 1.6; }
  dialog footer { gap: 12px; }
  dialog.create-dialog footer { padding-top: 18px; border-top: 1px solid var(--line); }
  dialog.create-dialog label { line-height: 1.5; }

  #app-shell .client-dashboard-heading { padding: 24px; border: 1px solid #e4def4; border-radius: 22px; background: linear-gradient(120deg, #f2edfc, #fff 80%); }
  #app-shell .client-dashboard-heading .eyebrow { margin-bottom: 8px; font-size: 11px; }
  #app-shell .client-dashboard-heading h1 { margin-top: 0; letter-spacing: -.035em; }
  #app-shell .parent-compact-summary { gap: 12px; }
  #app-shell .parent-compact-summary > span { min-width: 144px; padding: 14px 16px; box-shadow: none; }
  #app-shell .parent-cabinet-tabs { gap: 6px; padding: 6px; border-radius: 16px; }
  #app-shell .parent-cabinet-tabs button { font-size: 13px; font-weight: 700; }
  #app-shell .parent-cabinet-panel { gap: 20px; }
  #app-shell .parent-summary-grid, #app-shell .parent-dashboard-layout { gap: 20px; }
  #app-shell .parent-next-card h2, #app-shell .parent-subscription-overview h2 { font-size: 24px; margin: 10px 0; letter-spacing: -.025em; }
  #app-shell .parent-next-card p, #app-shell .parent-subscription-overview p { font-size: 14px; line-height: 1.65; }
  #app-shell .parent-document-actions { gap: 12px; margin-top: 18px; }
  #app-shell .parent-attendance-row { padding-block: 16px; }
  #app-shell .parent-subscription-details dl > div { padding: 14px; gap: 6px; }
  #app-shell .parent-profile-request { margin-top: 20px; }

  @media (max-width: 700px) {
    #app-shell .page-heading { gap: 16px; margin-bottom: 20px; }
    #app-shell .page-heading h1 { font-size: 26px; }
    #app-shell .heading-actions { display: flex; width: 100%; align-items: stretch; gap: 10px; }
    #app-shell .heading-actions > button, #app-shell .heading-actions > [data-internal-finance] { flex: 1 1 100%; width: 100%; }
    #app-shell .heading-actions > [data-internal-finance] > button { flex: 1 1 140px; }
    #app-shell .panel-header { padding: 16px 18px; flex-wrap: wrap; }
    #app-shell .panel-header h2 { font-size: 16px; }
    #app-shell .collection-panel { min-height: 180px; }
    #app-shell .collection-toolbar { padding: 16px; gap: 14px; }
    #app-shell .collection-panel + .collection-panel { margin-top: 20px; }
    #app-shell .client-dashboard-heading { padding: 20px; gap: 16px; }
    #app-shell .client-dashboard-heading > div:first-child { flex-basis: 100%; }
    #app-shell .parent-compact-summary { width: 100%; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
    #app-shell .parent-compact-summary > span { min-width: 0; padding: 12px; }
    #app-shell .parent-compact-summary strong { font-size: 16px; overflow-wrap: anywhere; }
    #app-shell .parent-cabinet-tabs { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
    #app-shell .parent-cabinet-tabs button { min-width: 0; min-height: 44px; padding: 10px; }
    #app-shell .parent-cabinet-panel, #app-shell .parent-summary-grid { gap: 16px; }
    #app-shell .parent-next-card h2, #app-shell .parent-subscription-overview h2 { font-size: 22px; }
    :is(#app-shell, dialog) :is(.primary-button, .secondary-button, .danger-button).compact { min-height: 44px; }
    dialog :is(input, select, textarea) { font-size: 16px; }
    dialog .group-settings-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    dialog .group-settings-tab { min-width: 0; min-height: 44px; white-space: normal; }
    #app-shell .staff-payroll-fields { grid-template-columns: minmax(0, 1fr); }
    #app-shell .staff-payroll-fields > * { grid-column: 1; }
    dialog.create-dialog footer { gap: 10px; }
    dialog.create-dialog footer > :is(button, a) { flex: 1 1 150px; }
  }
}
