/* HMS operational presentation contract, 2026-09-10.
 * Loaded by the shared shell after compact_interactive.css.
 * Covers the real Admin, Doctor, Pharmacy, Reception, HR and stock components.
 * Depth belongs to controls and surface shadows; structural containers never
 * gain transforms/filters/perspective or new scrolling. Printed bills are unchanged.
 */
@media screen {
  body.hms-executive-ui.hms-ui-density-compact {
    --hms-control-face: linear-gradient(180deg, #ffffff 0%, #fffaf3 100%);
    --hms-control-edge: #d9c7aa;
    --hms-control-ink: #61451f;
    --hms-selected-face: linear-gradient(180deg, #f4dfb4 0%, #e6bf78 100%);
    --hms-selected-ink: #402b13;
    --hms-control-depth: inset 0 1px 0 rgba(255,255,255,.95), 0 2px 0 #cbb99c, 0 4px 9px rgba(72,51,22,.07);
    --hms-control-hover-depth: inset 0 1px 0 #fff, 0 3px 0 #c3ab84, 0 7px 14px rgba(72,51,22,.12);
    --hms-control-pressed-depth: inset 0 2px 4px rgba(85,55,18,.16), 0 1px 0 rgba(255,255,255,.9);
    --hms-surface-depth: inset 0 1px 0 #fff, 0 1px 2px rgba(72,51,22,.045), 0 6px 18px rgba(72,51,22,.055);
    --hms-table-head: linear-gradient(180deg, #f0fbf5 0%, #deefe5 100%);
    --hms-table-head-ink: #20543b;
    --hms-table-size: 12.25px;
    --hms-control-size: 12px;
  }

  /* Patient & Stock uses med-tabs; the daily report used a separate, larger
     navigation system. Both now share the same sizing, wrapping and states. */
  body.hms-executive-ui.hms-ui-density-compact .shell :is(.med-tabs, .ds-module-tabs) {
    display: flex;
    gap: 6px !important;
    flex-wrap: wrap !important;
    align-items: center;
    overflow: visible !important;
    margin: 0 !important;
    padding: 2px 0 5px !important;
  }
  body.hms-executive-ui.hms-ui-density-compact .shell .med-report-nav {
    gap: 8px !important;
    margin: 9px 0 7px !important;
    flex-wrap: wrap !important;
  }
  body.hms-executive-ui.hms-ui-density-compact .shell .ds-module-tabs { margin-bottom: 8px !important; }

  body.hms-executive-ui.hms-ui-density-compact .shell :is(.tab, .rx-tab, .rx-subtab, .phx-tab, .med-tabs a, .ds-module-tabs a, .mp-tab) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 32px !important;
    padding: 6px 10px !important;
    border: 1px solid var(--hms-control-edge) !important;
    border-radius: 9px !important;
    background: var(--hms-control-face) !important;
    color: var(--hms-control-ink) !important;
    font-size: var(--hms-control-size) !important;
    font-weight: 750 !important;
    line-height: 1.25 !important;
    text-decoration: none !important;
    box-shadow: var(--hms-control-depth) !important;
    transform: none !important;
    transition: box-shadow .15s ease, border-color .15s ease, color .15s ease !important;
  }
  body.hms-executive-ui.hms-ui-density-compact .shell :is(.tab.active, .rx-tab.active, .rx-subtab.active, .phx-tab.active, .med-tabs a.active, .ds-module-tabs a[aria-current="page"], .mp-tab[aria-current="page"], .tab[aria-current="page"]) {
    background: var(--hms-selected-face) !important;
    border-color: #bf8c39 !important;
    color: var(--hms-selected-ink) !important;
    box-shadow: inset 0 1px 0 #fff0d3, 0 2px 0 #ac7b30, 0 4px 9px rgba(130,86,20,.13) !important;
  }
  body.hms-executive-ui.hms-ui-density-compact .shell :is(.tab, .rx-tab, .rx-subtab, .phx-tab) > span {
    color: inherit !important;
  }

  /* Do not replace semantic success/danger backgrounds or status colors. */
  body.hms-executive-ui.hms-ui-density-compact :is(.btn, .phx-btn, .rx-btn, .ba-btn, .lx-btn, .audit-btn, .saveBtn, .icon-btn, .ds-btn, .mp-button, .med-export-btn, .hms-medicine-profile-link, .hms-medicine-order-link, .hms-medicine-order-button, .global-shell-action, .global-shell-notify-btn, .soft-approve, .soft-reject, .patient-view-bills, .bill-mini-btn, .med-order-btn) {
    border-radius: 9px !important;
    box-shadow: var(--hms-control-depth) !important;
    transform: none !important;
    transition: box-shadow .15s ease, border-color .15s ease, background-color .15s ease !important;
  }
  body.hms-executive-ui.hms-ui-density-compact .shell :is(.ds-btn, .mp-button) {
    min-height: 32px !important;
    height: auto !important;
    padding: 5px 10px !important;
    font-size: var(--hms-control-size) !important;
    line-height: 1.25 !important;
    color: var(--hms-control-ink) !important;
    border-color: var(--hms-control-edge) !important;
    background: var(--hms-control-face) !important;
    text-decoration: none !important;
  }
  body.hms-executive-ui.hms-ui-density-compact .shell :is(.btn.primary, .phx-btn.primary, .rx-btn.primary, .ds-btn.ds-selected, .mp-button:not(.mp-button-light)) {
    background: var(--hms-selected-face) !important;
    border-color: #bf8c39 !important;
    color: var(--hms-selected-ink) !important;
  }

  /* Shared surfaces have a crisp highlight and soft elevation. No card movement:
     several cards contain position:fixed dialogs, especially on Safari. */
  body.hms-executive-ui.hms-ui-density-compact .shell :is(.card, .phx-card, .panel, .section-box, .sec-panel, .tablePanel, .cm-card, .patient-panel, .dist-card, .analytics-panel, .attendance-card, .attendance-calendar-section, .mp-summary, .mp-workspace, .ds-toolbar, .hms-kpi-strip) {
    border-color: var(--hms-border) !important;
    box-shadow: var(--hms-surface-depth) !important;
  }
  body.hms-executive-ui.hms-ui-density-compact .shell :is(.topbar, .rx-topbar, .subbar, .rx-subbar) {
    box-shadow: inset 0 1px 0 #fff, 0 3px 10px rgba(72,51,22,.065) !important;
  }
  body.hms-executive-ui.hms-ui-density-compact .shell :is(.kpi, .kpiCard, .phx-kpi, .patient-kpi-box, .attendance-paid-total) {
    box-shadow: inset 0 1px 0 rgba(255,255,255,.95), 0 3px 9px rgba(72,51,22,.055) !important;
  }

  /* Filters use one compact surface/field rhythm across Patients and reports. */
  body.hms-executive-ui.hms-ui-density-compact .shell :is(.patient-toolbar, .med-filter, .ds-toolbar, .mp-toolbar, .filter-bar, .phx-filters, .rx-filters) {
    gap: 8px !important;
    padding: 8px 10px !important;
    border-radius: 10px !important;
    background: #fcfbf8 !important;
  }
  body.hms-executive-ui.hms-ui-density-compact .shell :is(.patient-field label, .med-filter label, .ds-toolbar label, .mp-field label) {
    font-size: 11px !important;
    font-weight: 700 !important;
    color: var(--hms-ink-soft) !important;
    line-height: 1.3 !important;
  }
  body.hms-executive-ui.hms-ui-density-compact .shell :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="hidden"]), select, textarea):focus-visible {
    outline: 2px solid #a87427 !important;
    outline-offset: 2px !important;
    box-shadow: inset 0 1px 2px rgba(72,51,22,.035), 0 0 0 4px #f6e7c8 !important;
  }

  /* Exact module-specific table classes are included: daily stock, medicine
     profile, HR approvals and Patient lists must not escape shared sizing. */
  body.hms-executive-ui.hms-ui-density-compact .shell :is(.table, .phx-table, .rx-table, .med-table, .patient-table, .intel-table, .cm-table, .ds-table, .ds-detail-table, .mp-table, .approval-table, .lifecycle-table, .hr-board-table) > thead > tr > th {
    background: var(--hms-table-head) !important;
    color: var(--hms-table-head-ink) !important;
    border-color: #ddc5a1 !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.7), inset 0 -1px 0 rgba(125,82,35,.07) !important;
    padding: 7px 8px !important;
    font-size: 11px !important;
    font-weight: 750 !important;
    text-transform: none !important;
    letter-spacing: .01em !important;
    line-height: 1.3 !important;
  }
  body.hms-executive-ui.hms-ui-density-compact .shell :is(.ds-table, .ds-detail-table, .mp-table) > tbody > tr:not(.ds-detail-row):not(.mp-day) > :is(th, td) {
    padding: 7px 8px !important;
    font-size: var(--hms-table-size) !important;
    line-height: 1.35 !important;
  }
  body.hms-executive-ui.hms-ui-density-compact .shell :is(.ds-page td > strong, .ds-expand strong) {
    font-size: var(--hms-table-size) !important;
    line-height: 1.35 !important;
  }
  body.hms-executive-ui.hms-ui-density-compact .shell :is(.ds-page td > span, .ds-medicine-pack) {
    font-size: 11px !important;
    line-height: 1.35 !important;
    margin-top: 3px !important;
  }
  body.hms-executive-ui.hms-ui-density-compact .shell .ds-page {
    --ds-ink: var(--hms-ink);
    --ds-brown: var(--hms-primary-dark);
    --ds-line: var(--hms-border);
    --ds-muted: var(--hms-muted);
  }
  body.hms-executive-ui.hms-ui-density-compact .shell .ds-report-meta {
    padding: 8px 0 !important;
    font-size: 11px !important;
  }
  body.hms-executive-ui.hms-ui-density-compact .shell .ds-report-meta strong { font-size: 12.5px !important; }
  body.hms-executive-ui.hms-ui-density-compact .shell .ds-detail-host { padding: 8px !important; }
  body.hms-executive-ui.hms-ui-density-compact .shell .ds-detail-heading { padding: 8px 10px !important; }
  body.hms-executive-ui.hms-ui-density-compact .shell .ds-pagination { padding: 9px 0 !important; }
  body.hms-executive-ui.hms-ui-density-compact .shell .ds-table-scroll,
  body.hms-executive-ui.hms-ui-density-compact .shell .ds-detail-scroll { height: auto !important; max-height: none !important; }

  /* Dialog appearance is shared, but position/z-index/overflow/display are
     owned by each working dialog. A visual refresh must never break a modal. */
  body.hms-executive-ui.hms-ui-density-compact :is(.sbe-dialog, .ba-dialog, .modal-box, .modal-content, .billing-kpi-dialog, .bill-manage-dialog, .patient-manage-dialog, .global-bills-dialog) {
    border-color: var(--hms-border-strong) !important;
    box-shadow: inset 0 1px 0 #fff, 0 24px 70px rgba(29,24,18,.24) !important;
  }

  body.hms-executive-ui.hms-ui-density-compact :is(.btn, .phx-btn, .rx-btn, .ba-btn, .lx-btn, .audit-btn, .saveBtn, .icon-btn, .ds-btn, .mp-button, .med-export-btn, .hms-medicine-profile-link, .hms-medicine-order-link, .hms-medicine-order-button, .global-shell-action, .global-shell-notify-btn, .soft-approve, .soft-reject, .patient-view-bills, .bill-mini-btn, .tab, .rx-tab, .rx-subtab, .phx-tab, .med-tabs a, .ds-module-tabs a, .mp-tab):focus-visible {
    outline: 2px solid #946017 !important;
    outline-offset: 3px !important;
  }
  body.hms-executive-ui.hms-ui-density-compact :is(button:disabled, [aria-disabled="true"], .btn.is-disabled, .phx-btn.is-disabled) {
    box-shadow: inset 0 1px 0 rgba(255,255,255,.65) !important;
    transform: none !important;
  }
}

@media screen and (hover: hover) and (pointer: fine) {
  body.hms-executive-ui.hms-ui-density-compact .shell :is(.tab, .rx-tab, .rx-subtab, .phx-tab, .med-tabs a, .ds-module-tabs a, .mp-tab):hover,
  body.hms-executive-ui.hms-ui-density-compact :is(.btn, .phx-btn, .rx-btn, .ba-btn, .lx-btn, .audit-btn, .saveBtn, .icon-btn, .ds-btn, .mp-button, .med-export-btn, .hms-medicine-profile-link, .hms-medicine-order-link, .hms-medicine-order-button, .global-shell-action, .global-shell-notify-btn, .soft-approve, .soft-reject, .patient-view-bills, .bill-mini-btn):not(:disabled):not([aria-disabled="true"]):hover {
    box-shadow: var(--hms-control-hover-depth) !important;
    transform: translateY(-1px) !important;
  }
}
@media screen {
  body.hms-executive-ui.hms-ui-density-compact .shell :is(.tab, .rx-tab, .rx-subtab, .phx-tab, .med-tabs a, .ds-module-tabs a, .mp-tab):active,
  body.hms-executive-ui.hms-ui-density-compact :is(.btn, .phx-btn, .rx-btn, .ba-btn, .lx-btn, .audit-btn, .saveBtn, .icon-btn, .ds-btn, .mp-button, .med-export-btn, .hms-medicine-profile-link, .hms-medicine-order-link, .hms-medicine-order-button, .global-shell-action, .global-shell-notify-btn, .soft-approve, .soft-reject, .patient-view-bills, .bill-mini-btn):not(:disabled):not([aria-disabled="true"]):active {
    box-shadow: var(--hms-control-pressed-depth) !important;
    transform: translateY(1px) !important;
  }
}
@media screen and (max-width: 700px) {
  body.hms-executive-ui.hms-ui-density-compact .shell :is(.med-tabs a, .ds-module-tabs a) { white-space: normal !important; text-align: center; }
  body.hms-executive-ui.hms-ui-density-compact .shell .ds-toolbar .ds-search { min-width: min(220px, 100%); }
}
@media screen and (pointer: coarse) {
  body.hms-executive-ui.hms-ui-density-compact .shell :is(.tab, .rx-tab, .rx-subtab, .phx-tab, .med-tabs a, .ds-module-tabs a, .mp-tab, .btn, .phx-btn, .rx-btn, .ds-btn, .mp-button),
  body.hms-executive-ui.hms-ui-density-compact :is(.hms-medicine-profile-link, .hms-medicine-order-link, .hms-medicine-order-button, .med-export-btn) {
    min-height: 40px !important;
    min-width: 40px !important;
  }
}
@media screen and (prefers-reduced-motion: reduce) {
  body.hms-executive-ui.hms-ui-density-compact .shell :is(.tab, .rx-tab, .rx-subtab, .phx-tab, .med-tabs a, .ds-module-tabs a, .mp-tab),
  body.hms-executive-ui.hms-ui-density-compact .shell :is(.tab, .rx-tab, .rx-subtab, .phx-tab, .med-tabs a, .ds-module-tabs a, .mp-tab):is(:hover, :active),
  body.hms-executive-ui.hms-ui-density-compact :is(.btn, .phx-btn, .rx-btn, .ba-btn, .lx-btn, .audit-btn, .saveBtn, .icon-btn, .ds-btn, .mp-button, .med-export-btn, .hms-medicine-profile-link, .hms-medicine-order-link, .hms-medicine-order-button, .global-shell-action, .global-shell-notify-btn, .soft-approve, .soft-reject, .patient-view-bills, .bill-mini-btn),
  body.hms-executive-ui.hms-ui-density-compact :is(.btn, .phx-btn, .rx-btn, .ba-btn, .lx-btn, .audit-btn, .saveBtn, .icon-btn, .ds-btn, .mp-button, .med-export-btn, .hms-medicine-profile-link, .hms-medicine-order-link, .hms-medicine-order-button, .global-shell-action, .global-shell-notify-btn, .soft-approve, .soft-reject, .patient-view-bills, .bill-mini-btn):not(:disabled):not([aria-disabled="true"]):is(:hover, :active) {
    transition: none !important;
    transform: none !important;
  }
}

/* One typography and table surface for every operational role. */
@media screen {
  body.hms-executive-ui { --hms-font-family: "DM Sans", "Avenir Next", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
  body.hms-executive-ui, body.hms-executive-ui :is(.phx-wrap,.tablePanel,.rx-wrap,.phx-card,dialog,table,th,td,label,input,select,textarea,button,h1,h2,h3,h4,h5,h6,p,a,small,strong,li,dt,dd) { font-family: var(--hms-font-family) !important; }
  body.hms-executive-ui.hms-ui-density-compact table thead :is(th,td) { background: linear-gradient(180deg,#f0fbf5,#deefe5) !important; color:#20543b !important; border-color:#bad9c7 !important; }
  body.hms-executive-ui.hms-ui-density-compact table thead input { background:#fff !important; color:var(--hms-ink) !important; }
  body.hms-executive-ui .tablePanel td strong, body.hms-executive-ui .tablePanel td [data-medicine-profile-name] { font-weight:700; }
}
