/* Compression Connect portal design. Shared across roles; permissions and
   workflows remain in the existing controllers and forms. */
:root {
  --portal-ink: #12343b;
  --portal-muted: #64747a;
  --portal-accent: #a36849;
  --portal-accent-hover: #895437;
  --portal-cyan: #e1f7fb;
  --portal-border: #d5e0e4;
  --portal-surface: #f4f5f3;
  --portal-cream: #f8f1e8;
  --portal-radius: 18px;
  --portal-sidebar-width: 248px;
  --portal-header-height: 96px;
  --portal-gutter: 28px;
}
.portal-shell { margin: 0; background: white; color: var(--portal-ink); font-family: Inter, system-ui, sans-serif; font-size: 14px; line-height: 1.5; }
.portal-shell *, .portal-auth * { box-sizing: border-box; }
.portal-shell :is(button, a, input, select, textarea, summary):focus-visible { outline: 2px solid #1596ae; outline-offset: 3px; }
.portal-icon { width: 22px; height: 22px; flex: 0 0 22px; }
.portal-skip-link { position: fixed; top: -80px; left: 16px; padding: 12px 20px; z-index: 10000; background: var(--portal-ink); color: white; border-radius: 8px; }
.portal-skip-link:focus { top: 12px; }
.portal-sidebar { position: fixed; inset: 0 auto 0 0; width: var(--portal-sidebar-width); display: flex; flex-direction: column; background: white; border-right: 1px solid var(--portal-border); z-index: 40; transition: width .18s, transform .18s; }
.portal-brand { height: var(--portal-header-height); min-height: var(--portal-header-height); display: flex; align-items: center; padding: 12px 20px; }
.portal-brand img { width: 185px; height: auto; display: block; }
.portal-nav-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; padding-top: 20px; scrollbar-width: thin; }
.portal-nav { display: flex; flex-direction: column; gap: 8px; padding: 0 16px 24px; }
.portal-nav-link { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 12px; color: var(--portal-ink); font-size: 15px; font-weight: 500; border-radius: 10px; text-align: left; text-decoration: none; }
.portal-nav-link:hover { background: #f3f8f9; }
.portal-nav-link.is-active { background: var(--portal-cyan); font-weight: 650; }
.portal-nav-label { flex: 1; }
.portal-sidebar [id$="navigation_messages_badge"] [class~="bg-blue-600"] { background-color: var(--portal-accent); }
.portal-sidebar-footer { margin: 0 16px; padding: 12px 0; border-top: 1px solid var(--portal-border); flex-shrink: 0; }
.portal-sidebar-footer .portal-nav-link { min-height: 42px; font-size: 14px; }
.portal-logout { color: #d94d52; }
.portal-collapse { display: flex; align-items: center; gap: 12px; padding: 8px 12px; font-size: 11px; color: var(--portal-muted); width: 100%; }
.portal-collapse svg { width: 16px; height: 16px; transform: rotate(180deg); }
.portal-workspace { min-width: 0; margin-left: var(--portal-sidebar-width); transition: margin-left .18s; }
.portal-header { height: var(--portal-header-height); display: flex; align-items: center; gap: 16px; padding: 16px var(--portal-gutter); border-bottom: 1px solid var(--portal-border); background: white; position: sticky; top: 0; z-index: 35; }
.portal-title { margin: 0; font-size: clamp(24px, 2.5vw, 36px); font-weight: 650; line-height: 1.2; letter-spacing: -.035em; min-width: 0; overflow-wrap: anywhere; }
.portal-header-actions { display: flex; align-items: center; gap: 16px; margin-left: auto; flex-shrink: 0; }
.portal-icon-button { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 1px solid var(--portal-border); border-radius: 50%; color: var(--portal-ink); background: white; cursor: pointer; }
.portal-icon-button:hover { background: var(--portal-cyan); }
.portal-count { position: absolute; top: -3px; right: -5px; background: var(--portal-accent); color: white; border-radius: 20px; font-size: 10px; min-width: 17px; padding: 1px 4px; }
.portal-account { display: flex; align-items: center; gap: 10px; text-align: left; cursor: pointer; }
.portal-avatar { display: grid; place-items: center; height: 42px; width: 42px; border-radius: 50%; background: var(--portal-cream); border: 1px solid #ead9cb; color: var(--portal-accent-hover); font-weight: 650; }
.portal-account-text { display: flex; flex-direction: column; font-size: 14px; max-width: 180px; }
.portal-account-text strong { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.portal-account-text > span { font-size: 11px; color: var(--portal-muted); }
.portal-account-menu { position: absolute; top: calc(100% + 14px); right: 0; min-width: 220px; padding: 6px; border: 1px solid var(--portal-border); background: white; border-radius: 12px; box-shadow: 0 8px 24px #12343b18; z-index: 70; }
.portal-account-menu :is(a, button) { display: block; width: 100%; padding: 11px 12px; border-radius: 7px; text-align: left; font-size: 14px; }
.portal-account-menu :is(a, button):hover { background: var(--portal-surface); }
.portal-header-search { display: flex; align-items: center; gap: 10px; border: 1px solid var(--portal-border); border-radius: 10px; height: 44px; padding: 0 12px; width: clamp(180px, 22vw, 340px); color: var(--portal-muted); }
.portal-header-search input { min-width: 0; width: 100%; border: 0; background: none; outline: none; font: inherit; }
.portal-main { min-width: 0; padding: 26px var(--portal-gutter) 40px; min-height: calc(100dvh - var(--portal-header-height)); }
.portal-patient-footer { margin: 0 var(--portal-gutter); padding: 20px 0; border-top: 1px solid var(--portal-border); color: var(--portal-muted); font-size: 13px; }
/* The shell owns page gutters. Keep headings and page edges aligned; apply
   readable widths only to form bodies beneath their page headers. */
.portal-page { width: 100%; min-width: 0; max-width: none; margin-inline: 0; }
.portal-form-content { width: 100%; min-width: 0; max-width: 56rem; margin-inline: 0; }
.portal-form-content--wide { max-width: 67.5rem; }
.portal-page-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; }
.portal-page-header :is(h1,h2) { color: var(--portal-ink); font-size: clamp(22px, 2vw, 28px); font-weight: 550; letter-spacing: -.025em; line-height: 1.3; }
.portal-panel { min-width: 0; background: white; border: 1px solid var(--portal-border); border-radius: var(--portal-radius); }
.portal-panel-header { padding: 14px 18px; background: var(--portal-surface); border-bottom: 1px solid var(--portal-border); border-radius: 17px 17px 0 0; color: var(--portal-ink); font-weight: 550; }
.portal-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.portal-toolbar > * { min-width: 0; }
.portal-table-wrap { max-width: 100%; overflow-x: auto; scrollbar-width: thin; }
.portal-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 20px; }
.portal-muted { color: var(--portal-muted); }
.portal-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 16px; border: 1px solid var(--portal-border); border-radius: 9px; background: white; color: var(--portal-ink); font-weight: 500; text-align: center; cursor: pointer; }
.portal-btn:hover { background: #f3f8f9; }
.portal-btn-primary { background: var(--portal-accent); border-color: var(--portal-accent); color: white; }
.portal-btn-primary:hover { background: var(--portal-accent-hover); border-color: var(--portal-accent-hover); }
.portal-btn.justify-start { justify-content: flex-start; text-align: left; }
.portal-btn.text-red-600 { color: #dc2626; }
.portal-main :is(input, select, textarea) { max-width: 100%; }
.portal-main :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=file]):not([type=submit]), select, textarea):not([class*="border-red"]):not([aria-invalid=true]) { border-color: var(--portal-border); border-radius: 8px; }
.portal-main :is(input, select, textarea):disabled { opacity: .65; }
.portal-main :is(button, input[type=submit]):disabled { cursor: not-allowed; }
.portal-main table { border-collapse: collapse; }
.portal-main :is(th,td) { border-color: var(--portal-border); }
.portal-main th { font-weight: 500; color: var(--portal-muted); }
.portal-main td { vertical-align: middle; }
.portal-main img { max-width: 100%; }
.portal-main :is(p, dd) { overflow-wrap: break-word; }
.portal-mobile-close, .portal-menu-toggle { display: none; }
.portal-backdrop { position: fixed; inset: 0; z-index: 55; background: #12343b55; }

/* Existing nested staff navigation keeps its route checks and expanders. */
.portal-nav-scroll > nav { padding: 0 16px 24px; }
.portal-nav-scroll nav :is(a,button) { min-height: 42px; font-size: 14px; color: var(--portal-ink); border-radius: 9px; }
.portal-nav-scroll nav :is(a,button):hover { background-color: #f3f8f9; }
.portal-nav-scroll .sidebar-section-label { color: var(--portal-muted); font-size: 10px; letter-spacing: .1em; font-weight: 600; margin-top: 24px; margin-bottom: 8px; }
.portal-nav-scroll .sidebar-section-label:first-child { margin-top: 0; }
.portal-nav-scroll :is([class*="bg-[#f2eee8]"], [class*="bg-[#e8e4de]"]) { background: var(--portal-cyan); color: var(--portal-ink); }
.portal-nav-scroll [data-dropdown-target=menu] { margin-left: 14px; border-color: var(--portal-border); }

/* Compatibility for existing component and JS-rendered utility styles. This
   keeps shared dialogs, dynamically loaded forms and notifications on palette. */
:is(.portal-shell,.portal-auth) :is([class~="text-[#4d300e]"],[class~="text-[#4d2f0e]"],[class~="text-[#2c1d0c]"],[class~="text-[#23190d]"],[class~="text-[#121826]"],[class~="text-[#03101a]"]) { color: var(--portal-ink); }
:is(.portal-shell,.portal-auth) :is([class~="bg-[#4d300e]"],[class~="bg-[#4d2f0e]"],[class~="bg-[#80521e]"],[class~="bg-[#7B522F]"],[class~="bg-[#aa7050]"],[class~="bg-[#a96d4e]"]) { background-color: var(--portal-accent); }
:is(.portal-shell,.portal-auth) :is([class~="text-[#80521e]"],[class~="text-[#73491a]"],[class~="text-[#7B522F]"]) { color: #965c3f; }
:is(.portal-shell,.portal-auth) :is([class~="border-[#f0f1f2]"],[class~="border-[#f0f1f3]"],[class~="border-[#e5e7eb]"],[class~="border-gray-200"]) { border-color: var(--portal-border); }
:is(.portal-shell,.portal-auth) :is([class~="rounded-[40px]"],[class~="rounded-[50px]"]) { border-radius: 9px; }
:is(.portal-shell,.portal-auth) [class*="shadow-[0px_0px_11px"] { box-shadow: none; }
.portal-main > :is([class~="bg-gray-50"],[class~="bg-[#f9fafb]"],[class~="bg-[#f3f4f6]"]) { background: white; }
.portal-main > [class~="min-h-screen"] { min-height: 0; }
.portal-main [class~="lg:px-[135px]"], .portal-main [class~="md:px-[135px]"] { padding-left: 0; padding-right: 0; }
.portal-main :is([class~="lg:mx-[131px]"],[class~="md:mx-[131px]"]) { margin-left: 0; margin-right: 0; }
.portal-main [class~="lg:px-[131px]"] { padding-left: 0; padding-right: 0; }
.portal-main [class~="max-w-[1440px]"] { max-width: none; }

/* Order entry: same five steps, arranged as the reference's continuous bar. */
.portal-wizard { max-width: 100%; min-width: 0; }
.portal-wizard [class~="text-[#ca953b]"] { color: var(--portal-accent); }
.portal-wizard [class~="outline-[#ca953b]"] { outline-color: var(--portal-accent); box-shadow: 0 0 0 2px #a96d4e20; }
.portal-wizard [class~="outline-[#f0f1f2]"] { outline-color: var(--portal-border); }
.portal-wizard-progress { max-width: 760px; margin: 0 auto 30px; }
.portal-stepper { display: flex; list-style: none; padding: 0; margin: 0; gap: 0; }
.portal-stepper li { flex: 1; min-width: 0; text-align: center; }
.portal-stepper :is(a,span.portal-step-link) { display: flex; justify-content: center; align-items: center; min-height: 36px; padding: 8px 4px; background: var(--portal-surface); font-size: 12px; color: var(--portal-muted); }
.portal-stepper li:first-child :is(a,span.portal-step-link) { border-radius: 8px 0 0 8px; }
.portal-stepper li:last-child :is(a,span.portal-step-link) { border-radius: 0 8px 8px 0; }
.portal-stepper li.is-complete a, .portal-stepper li.is-current .portal-step-link { background: var(--portal-accent); color: white; }
.portal-stepper li.is-current .portal-step-link { font-weight: 650; }
.portal-step-marker { display: block; height: 22px; padding-top: 5px; font-size: 12px; color: #b7c4c8; }
.portal-stepper .is-complete .portal-step-marker, .portal-stepper .is-current .portal-step-marker { color: var(--portal-accent); }
.portal-wizard-content { width: 100%; min-width: 0; }
.portal-product-workspace { display: grid; grid-template-columns: minmax(0,1fr) 280px; gap: 22px; align-items: start; }
.portal-product-workspace > turbo-frame { min-width: 0; display: block; }
.portal-product-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%,190px),1fr)); gap: 14px; }
.portal-product-filters { width: 190px; top: calc(var(--portal-header-height) + 20px); max-height: calc(100dvh - var(--portal-header-height) - 40px); }
.portal-product-tile { border: 1px solid var(--portal-border); border-radius: 16px; overflow: hidden; background: white; display: flex; flex-direction: column; min-width: 0; }
.portal-product-tile:hover { border-color: var(--portal-accent); }
.portal-product-tile > :not(.portal-product-image) { margin-left: 10px; margin-right: 10px; }
.portal-product-tile > :last-child { padding-bottom: 10px; }
.portal-product-image { width: 100%; height: 210px; margin-bottom: 10px; background: #f2f3f2; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.portal-product-tile .portal-btn { width: 100%; }
.portal-selected-products .product-card .flex-shrink-0 { gap: 2px; }
.portal-selected-products .product-card .flex-shrink-0 button { min-height: 36px; min-width: 32px; padding: 6px; }
.portal-selected-products .product-card [class~="text-sm"] { font-size: 11px; }
.portal-selected-products { position: sticky; top: calc(var(--portal-header-height) + 20px); min-width: 0; }
.portal-selected-products { scroll-margin-top: calc(var(--portal-header-height) + 16px); }
.portal-selected-products-body { padding: 12px; max-height: min(65dvh,800px); overflow-y: auto; }
.portal-selected-products .product-card { padding: 12px 0; box-shadow: none; border: 0; border-bottom: 1px solid var(--portal-border); border-radius: 0; }
.portal-selected-products .product-card:last-child { border-bottom: 0; }
.portal-selected-products .product-card :is(h3,h4) { font-size: 13px; }
.portal-selected-products .product-card [class*="grid-cols-"] { grid-template-columns: 1fr; }
.portal-selected-products .product-card [class~="w-16"] { width: 40px; }
.portal-selected-products .product-card [class~="h-16"] { height: 40px; }
.portal-selected-products .product-card [class~="text-xs"] { font-size: 11px; }
.portal-order-actions { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding-top: 16px; }
.portal-status-progress { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); padding: 0; margin: 0; list-style: none; }
.portal-status-progress li { min-width: 0; text-align: center; }
.portal-status-progress .status-label { display: flex; align-items: center; justify-content: center; min-height: 32px; padding: 5px 2px; background: var(--portal-surface); font-size: 10px; color: var(--portal-muted); overflow-wrap: anywhere; }
.portal-status-progress li:first-child .status-label { border-radius: 8px 0 0 8px; }
.portal-status-progress li:last-child .status-label { border-radius: 0 8px 8px 0; }
.portal-status-progress .is-reached .status-label { background: var(--portal-accent); color: white; }
.portal-status-progress .status-marker { display: block; padding: 6px 0 0; font-size: 12px; color: var(--portal-accent); }
.portal-status-description { margin-top: 12px; font-size: 12px; color: var(--portal-muted); }
.portal-messages { height: calc(100dvh - var(--portal-header-height) - 66px); min-height: 360px; border: 1px solid var(--portal-border); border-radius: 12px; overflow: hidden; }
.portal-message-columns { display: flex; width: 100%; height: 100%; min-width: 0; }
.portal-inbox { flex-shrink: 0; }
.portal-message-filters { display: flex; gap: 6px; padding: 12px; overflow-x: auto; flex-shrink: 0; scrollbar-width: thin; }
.portal-filter-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--portal-border); border-radius: 24px; padding: 8px 12px; font-size: 12px; font-weight: 550; white-space: nowrap; }
.portal-filter-chip.is-active { color: white; background: var(--portal-accent); border-color: var(--portal-accent); }
.portal-filter-chip span { padding: 0 4px; border-radius: 10px; background: #12343b12; }
.portal-conversation { display: flex; width: 100%; min-width: 0; height: 100%; position: relative; }
.portal-conversation-body { min-width: 0; }
.portal-message-details { width: 275px; min-width: 275px; background: white; border-left: 1px solid var(--portal-border); height: 100%; overflow-y: auto; }
.portal-message-details-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--portal-border); }
.portal-message-details-header h3 { font-size: 14px; font-weight: 550; }
.portal-message-details-header button { width: 32px; height: 32px; border: 0; }
.portal-message-details-content { padding: 16px; }
.portal-message-product { padding: 16px 0; border-bottom: 1px solid var(--portal-border); }
.portal-message-product:first-child { padding-top: 0; }
.portal-message-product strong { font-weight: 550; }
.portal-message-product p { color: var(--portal-muted); font-size: 11px; padding-top: 3px; }
.portal-message-facts { display: grid; grid-template-columns: 80px minmax(0,1fr); gap: 16px 8px; font-size: 12px; margin-top: 22px; }
.portal-message-facts dt { color: var(--portal-muted); }
.portal-message-facts dd { overflow-wrap: anywhere; }
.portal-bubble-outgoing { background: var(--portal-cream); }
.portal-bubble-incoming { background: var(--portal-cyan); }
.portal-shell [data-order-pill] { background: transparent; padding: 0; color: var(--portal-ink); font-size: 14px; }
.portal-shell .mc-card-selected { background: var(--portal-cream) !important; border-left-color: var(--portal-accent) !important; }
.portal-shell .mc-pill-selected { background: transparent !important; color: var(--portal-ink) !important; }
.portal-auth { background: white; color: var(--portal-ink); font-family: Inter,system-ui,sans-serif; }
.portal-auth img[alt="Compression Connect"] { max-width: 220px; height: auto; }
.portal-auth input { min-width: 0; }

@media (min-width:1024px) {
  .portal-compact { --portal-sidebar-width: 80px; }
  .portal-compact .portal-brand { padding: 14px; overflow: hidden; }
  .portal-compact .portal-brand a { width: 44px; overflow: hidden; flex: 0 0 44px; }
  .portal-compact .portal-brand img { max-width: none; width: 185px; }
  .portal-compact :is(.portal-nav-label,.sidebar-nav-text,.sidebar-section-label) { display: none; }
  .portal-compact .portal-nav-scroll [data-dropdown-target=menu] { display: none; }
  .portal-compact .portal-nav-scroll :is(a,button) { justify-content: center; padding: 12px; }
  .portal-compact .portal-nav { padding: 0 12px; }
  .portal-compact .portal-nav-scroll > nav { padding: 0 12px 20px; }
  .portal-compact .portal-sidebar-footer { margin: 0 12px; }
  .portal-compact .portal-collapse svg { transform: none; }
  .portal-compact #navigation_messages_badge { position: absolute; right: 8px; }
}
@media (max-width:1279px) {
  :root { --portal-sidebar-width: 218px; --portal-gutter: 22px; }
  .portal-main { padding: 22px var(--portal-gutter); }
  .portal-header-search { display: none; }
  .portal-product-workspace { grid-template-columns: minmax(0,1fr) 250px; gap: 16px; }
}
@media (max-width:1499px) {
  .portal-message-details { position: absolute; right: 0; top: 0; bottom: 0; width: min(320px,100%); min-width: 0; z-index: 20; box-shadow: -8px 0 24px #12343b15; }
}
@media (max-width:767px) {
  .portal-messages { height: calc(100dvh - var(--portal-header-height) - 40px); min-height: 260px; }
  .portal-inbox { width: 100%; min-width: 0; }
  .portal-auth :is(input,select,textarea) { font-size: 16px; }
}
@media (max-width:1023px) {
  :root { --portal-header-height: 72px; --portal-gutter: 20px; }
  .portal-sidebar { z-index: 60; width: min(290px,85vw); transform: translateX(-100%); }
  .portal-menu-open { overflow: hidden; }
  .portal-menu-open .portal-sidebar { transform: translateX(0); }
  .portal-workspace { margin-left: 0; }
  .portal-header { gap: 12px; padding: 12px var(--portal-gutter); }
  .portal-title { font-size: 26px; }
  .portal-mobile-close,.portal-menu-toggle { display: inline-flex; flex-shrink: 0; }
  .portal-brand { justify-content: space-between; }
  .portal-brand img { width: 170px; }
  .portal-mobile-close { width: 36px; height: 36px; }
  .portal-collapse { display: none; }
  .portal-main { padding: 22px var(--portal-gutter) 32px; }
  .portal-product-workspace { display: flex; flex-direction: column; }
  .portal-product-workspace > *, .portal-selected-products { width: 100%; }
  .portal-selected-products { position: static; }
  .portal-selected-products-body { max-height: none; }
  .portal-product-filters { width: 100%; max-height: none; }
  .portal-main :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select, textarea) { font-size: 16px; }
  .portal-stepper :is(a,span.portal-step-link) { min-height: 44px; }
}
@media (max-width:639px) {
  :root { --portal-gutter: 16px; }
  .portal-header { gap: 10px; }
  .portal-title { font-size: 22px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
  .portal-header-actions { gap: 8px; }
  .portal-account-text { display: none; }
  .portal-avatar { width: 36px; height: 36px; font-size: 12px; }
  .portal-notification-button { width: 38px; height: 38px; }
  .portal-menu-toggle { width: 38px; height: 38px; border: 0; }
  .portal-main { padding: 20px var(--portal-gutter) 30px; }
  .portal-page-header { gap: 12px; margin-bottom: 20px; align-items: stretch; }
  .portal-form-grid { grid-template-columns: minmax(0,1fr); }
  .portal-main :is(.portal-toolbar, .portal-page-header) > form { width: 100%; }
  .portal-toolbar :is(input[type=search],input[type=text]) { width: 100%; }
  .portal-toolbar { align-items: stretch; }
  .portal-panel { border-radius: 14px; }
  .portal-panel-header { border-radius: 13px 13px 0 0; }
  .portal-wizard-progress { margin-bottom: 22px; }
  .portal-stepper :is(a,span.portal-step-link) { font-size: 10px; padding: 8px 2px; }
  .portal-main .fixed[role=dialog] > .flex { padding: 8px; }
  #product-modal-frame { padding: 16px; }
}
@media (prefers-reduced-motion:reduce) { .portal-shell *, .portal-shell *::before, .portal-shell *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; } }
@media print { .portal-sidebar,.portal-header,.portal-sidebar-footer,.help-guide-launcher { display: none !important; } .portal-workspace { margin: 0; } .portal-main { padding: 0; } }

.portal-menu-open .help-guide-launcher { visibility: hidden; }
