:root{
  color-scheme:light;
  --color-canvas:#f5f7fb;--color-surface:#ffffff;--color-surface-alt:#edf2f7;--color-surface-elevated:#ffffff;
  --color-text:#142033;--color-text-muted:#607087;--color-border:#d9e2ec;--color-border-strong:#bcc9d6;
  --color-primary:var(--primary,#11263d);--color-accent:var(--accent,#d9a441);--color-on-primary:#ffffff;
  --color-success:#176b47;--color-success-soft:#e7f6ee;--color-warning:#875d12;--color-warning-soft:#fff5d8;--color-danger:#9f2f35;--color-danger-soft:#fdecee;
  --shadow-soft:0 14px 38px rgba(17,38,61,.09);--focus-ring:0 0 0 3px color-mix(in srgb,var(--color-accent) 45%,transparent);
}
html[data-theme="dark"]{
  color-scheme:dark;
  --color-canvas:#0d1520;--color-surface:#151f2c;--color-surface-alt:#1d2937;--color-surface-elevated:#202d3c;
  --color-text:#edf4fb;--color-text-muted:#aab9c9;--color-border:#324255;--color-border-strong:#46596e;
  --color-on-primary:#ffffff;--color-success:#70d5a3;--color-success-soft:#153c2d;--color-warning:#f4c86f;--color-warning-soft:#3b2f16;--color-danger:#ff9aa0;--color-danger-soft:#452329;
  --shadow-soft:0 18px 46px rgba(0,0,0,.34);
}
html,body{background:var(--color-canvas);color:var(--color-text)}
body,.portal-main,.portal-content,.public-body{background:var(--color-canvas);color:var(--color-text)}
.card,.panel,.table-card,.filter-card,.hero-glass,.profile-dropdown,.modal-card,.action-menu-panel,.ai-widget,.ai-control-card{background:var(--color-surface)!important;color:var(--color-text);border-color:var(--color-border)!important;box-shadow:var(--shadow-soft)}
.card.soft,.notice,.empty,.empty-state,.section-tint,.field-help,.metric-subtitle{background:var(--color-surface-alt)!important;color:var(--color-text-muted);border-color:var(--color-border)!important}
h1,h2,h3,h4,h5,h6,strong,label,dt,th,.panel-head,.page-head{color:var(--color-text)}
p,small,.muted,dd,.help-text,.field-help{color:var(--color-text-muted)}
a{color:color-mix(in srgb,var(--color-primary) 72%,var(--color-text))}html[data-theme="dark"] a:not(.btn):not(.sidebar-link):not(.brand){color:#9fc8f2}
input,select,textarea,.mini-input{background:var(--color-surface-elevated)!important;color:var(--color-text)!important;border-color:var(--color-border-strong)!important}
input::placeholder,textarea::placeholder{color:var(--color-text-muted);opacity:.78}
input:focus,select:focus,textarea:focus,button:focus-visible,a:focus-visible,summary:focus-visible{outline:2px solid var(--color-accent);outline-offset:2px;box-shadow:var(--focus-ring)}
table{color:var(--color-text)}th{background:var(--color-surface-alt)!important}td,th{border-color:var(--color-border)!important}tbody tr:hover{background:color-mix(in srgb,var(--color-accent) 6%,var(--color-surface))}
.topbar,.public-header{background:color-mix(in srgb,var(--color-surface) 94%,transparent)!important;border-color:var(--color-border)!important;color:var(--color-text)}
.sidebar{background:#101d2b;color:#e9f0f6}.public-footer{background:#101d2b;color:#dce6ef}
.btn{background:var(--color-primary);color:var(--color-on-primary);border-color:transparent}.btn.btn-ghost{background:var(--color-surface-alt)!important;color:var(--color-text)!important;border-color:var(--color-border)!important}.btn.btn-success{background:var(--color-success);color:#07170f}.btn.btn-warning{background:var(--color-warning);color:#251b07}.btn.btn-danger{background:var(--color-danger);color:#fff}
.flash-success,.status-approved,.status-active,.status-sent{background:var(--color-success-soft)!important;color:var(--color-success)!important}.flash-warning,.status-pending,.status-expired{background:var(--color-warning-soft)!important;color:var(--color-warning)!important}.flash-danger,.status-declined,.status-failed,.status-voided{background:var(--color-danger-soft)!important;color:var(--color-danger)!important}
.document-preview-dialog::backdrop,.modal-backdrop{background:rgba(0,0,0,.66)}
.profile-dropdown a,.profile-dropdown button{color:var(--color-text)!important;background:transparent}.profile-dropdown a:hover,.profile-dropdown button:hover{background:var(--color-surface-alt)!important}
.theme-toggle{background:var(--color-surface-alt)!important;color:var(--color-text)!important;border-color:var(--color-border)!important}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important;animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}}

/* v6.1.1 dark-surface completeness for tables, forms and document review */
html[data-theme="dark"] .table-wrap,
html[data-theme="dark"] .table-responsive,
html[data-theme="dark"] .document-review-table tr,
html[data-theme="dark"] .form-card,
html[data-theme="dark"] .shift-card,
html[data-theme="dark"] .summary-box,
html[data-theme="dark"] .chat,
html[data-theme="dark"] .auth-card,
html[data-theme="dark"] .content-page .content,
body[data-theme="dark"] .table-wrap,
body[data-theme="dark"] .table-responsive,
body[data-theme="dark"] .document-review-table tr{
  background:var(--color-surface)!important;
  color:var(--color-text)!important;
  border-color:var(--color-border)!important;
}
html[data-theme="dark"] .table td,
html[data-theme="dark"] .document-review-table td,
body[data-theme="dark"] .table td,
body[data-theme="dark"] .document-review-table td{color:var(--color-text)!important;background:transparent!important}
html[data-theme="dark"] .card.soft,
html[data-theme="dark"] .notice,
html[data-theme="dark"] .document-review-bar,
body[data-theme="dark"] .card.soft,
body[data-theme="dark"] .notice,
body[data-theme="dark"] .document-review-bar{background:var(--color-surface-alt)!important;color:var(--color-text-muted)!important;border-color:var(--color-border)!important}
html[data-theme="dark"] .document-preview-state strong,
body[data-theme="dark"] .document-preview-state strong{color:var(--color-text)!important}
html[data-theme="dark"] .user-chip.profile-menu-toggle,
body[data-theme="dark"] .user-chip.profile-menu-toggle{background:var(--color-surface-elevated)!important;color:var(--color-text)!important;border-color:var(--color-border)!important}
html[data-theme="dark"] .user-avatar-fallback,
body[data-theme="dark"] .user-avatar-fallback{background:var(--color-surface-alt)!important;color:var(--color-text)!important}

/* v6.2.0 finance, live counters, chat and ticket polish */
.nav-badge{margin-left:auto;min-width:22px;height:22px;padding:0 7px;border-radius:999px;display:inline-flex;align-items:center;justify-content:center;background:#e8b447;color:#172333;font-size:.72rem;font-weight:900;line-height:1;box-shadow:0 5px 14px rgba(0,0,0,.18)}
.nav-badge[hidden]{display:none!important}.sidebar-subnav .nav-badge{min-width:20px;height:20px;font-size:.68rem}.notification-bell{position:relative;display:grid;place-items:center;width:42px;height:42px;border:1px solid var(--color-border);border-radius:13px;background:var(--color-surface-alt);text-decoration:none}.notification-bell [data-notification-count]{position:absolute;right:-4px;top:-5px;min-width:19px;height:19px;padding:0 5px;border-radius:999px;display:grid;place-items:center;background:var(--color-danger);color:#fff;font-size:.65rem;font-weight:900;border:2px solid var(--color-surface)}
.finance-summary{grid-template-columns:repeat(4,minmax(0,1fr));gap:14px}.finance-summary .summary-box{display:flex;min-height:116px;flex-direction:column;justify-content:center;border:1px solid var(--color-border);background:linear-gradient(145deg,var(--color-surface),color-mix(in srgb,var(--color-primary) 4%,var(--color-surface)))!important;box-shadow:0 12px 30px rgba(16,35,55,.07)}.finance-summary .summary-box span{color:var(--color-text-muted);font-size:.78rem;font-weight:800;text-transform:uppercase;letter-spacing:.06em}.finance-summary .summary-box strong{font-size:clamp(1.25rem,2.4vw,2rem);letter-spacing:-.04em}.finance-summary .summary-box small{margin-top:4px}.payment-state-card{text-align:center}.status-icon{width:58px;height:58px;margin:0 auto 14px;display:grid;place-items:center;border-radius:18px;background:var(--color-success-soft);color:var(--color-success);font-size:1.7rem;font-weight:900}.finance-due-banner{display:flex;align-items:center;justify-content:space-between;gap:18px;background:linear-gradient(135deg,color-mix(in srgb,var(--color-warning) 12%,var(--color-surface)),var(--color-surface))!important;border-color:color-mix(in srgb,var(--color-warning) 35%,var(--color-border))!important}.row-overdue{background:color-mix(in srgb,var(--color-danger) 7%,var(--color-surface))!important}.text-danger{color:var(--color-danger)!important;font-weight:800}.form-card,.summary-box,.table-wrap{background:var(--color-surface)!important;color:var(--color-text);border-color:var(--color-border)!important}.form-section{border-color:var(--color-border)!important}.quote-brand{background:linear-gradient(135deg,#10263c,#1c4365);color:#fff}.quote-brand strong{color:#fff}
.status-partially_paid,.status-partially-paid{background:var(--color-warning-soft)!important;color:var(--color-warning)!important}.status-pending_verification,.status-pending-verification{background:color-mix(in srgb,var(--color-warning) 16%,var(--color-surface))!important;color:var(--color-warning)!important}

/* Premium live site chat and ticket conversations */
[data-live-chat],.support-thread,.ticket-conversation{overflow:hidden;border-radius:22px!important}.chat-presence{display:flex;align-items:center;gap:8px;margin:-2px 0 12px;padding:9px 12px;border-radius:11px;background:var(--color-success-soft);color:var(--color-success);font-size:.8rem;font-weight:800}.chat-presence:before{content:"";width:8px;height:8px;border-radius:50%;background:currentColor;box-shadow:0 0 0 4px color-mix(in srgb,currentColor 16%,transparent)}.chat,.thread-list{display:flex;flex-direction:column;gap:10px;max-height:520px;overflow:auto;padding:18px;border:1px solid var(--color-border);border-radius:18px;background:linear-gradient(180deg,var(--color-surface-alt),var(--color-surface))!important;scrollbar-width:thin}.chat-message,.thread-message{align-self:flex-start;max-width:min(82%,720px);padding:12px 14px;border:1px solid var(--color-border);border-radius:16px 16px 16px 5px;background:var(--color-surface-elevated);color:var(--color-text);box-shadow:0 8px 22px rgba(13,28,44,.07);overflow-wrap:anywhere}.chat-message.mine,.thread-message.mine{align-self:flex-end;border-color:color-mix(in srgb,var(--color-primary) 35%,var(--color-border));border-radius:16px 16px 5px 16px;background:color-mix(in srgb,var(--color-primary) 88%,#fff);color:var(--color-on-primary)}.chat-message.mine .chat-meta,.thread-message.mine .chat-meta,.chat-message.mine a,.thread-message.mine a{color:color-mix(in srgb,var(--color-on-primary) 82%,transparent)!important}.chat-meta{margin-bottom:6px;color:var(--color-text-muted);font-size:.7rem;font-weight:750}.thread-message.internal-note{border-style:dashed;background:var(--color-warning-soft);color:var(--color-text)}[data-live-chat] form,.ticket-conversation form{padding-top:14px;border-top:1px solid var(--color-border)}[data-live-chat] form input[name="message"]{min-height:48px}.panel.highlight{border-color:var(--color-accent)!important;box-shadow:0 0 0 3px color-mix(in srgb,var(--color-accent) 18%,transparent),var(--shadow-soft)}

/* AI/chat launcher must remain visible in both themes */
.ai-assistant{--ai-primary:#17365d!important;--ai-surface:var(--color-surface)!important;--ai-text:var(--color-text)!important}.ai-assistant-toggle{background:linear-gradient(135deg,#10263c,#d09b36)!important;color:#fff!important;border:1px solid rgba(255,255,255,.2)}.ai-assistant-toggle>span:first-child{color:#fff!important;text-shadow:0 1px 5px rgba(0,0,0,.4)}.ai-assistant-panel,.ai-assistant-form,.ai-history{background:var(--color-surface)!important;color:var(--color-text)!important;border-color:var(--color-border)!important}.ai-assistant-messages{background:var(--color-surface-alt)!important}.ai-bubble:not(.user),.ai-suggestions button,.ai-work-card,.ai-secure-card,.ai-confirmation-card,.ai-assistant-form textarea{background:var(--color-surface-elevated)!important;color:var(--color-text)!important;border-color:var(--color-border)!important}

@media(max-width:980px){.finance-summary{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:620px){.finance-summary{grid-template-columns:1fr 1fr}.finance-summary .summary-box{min-height:96px;padding:14px}.finance-due-banner{align-items:stretch;flex-direction:column}.finance-due-banner .btn{width:100%}.chat-message,.thread-message{max-width:92%}.payment-shell,.quote-shell{margin-top:22px}.form-card{padding:18px}}
@media(max-width:430px){.finance-summary{grid-template-columns:1fr}.finance-summary .summary-box{min-height:auto}.nav-badge{min-width:20px;height:20px}}

/* v6.2.1 premium light/dark contrast patch
   Keeps every screen readable and gives action buttons a consistent semantic palette. */
html[data-theme="light"],body[data-theme="light"]{
  color-scheme:light;
  --bg:#f4f7fb;--surface:#ffffff;--surface-soft:#eef3f8;--surface-elevated:#ffffff;
  --text:#172337;--muted:#5f7085;--border:#d7e1eb;--primary:#173e63;--secondary:#285f86;--accent:#d7a541;
  --color-canvas:#f4f7fb;--color-surface:#ffffff;--color-surface-alt:#eef3f8;--color-surface-elevated:#ffffff;
  --color-text:#172337;--color-text-muted:#5f7085;--color-border:#d7e1eb;--color-border-strong:#bac8d7;
  --color-primary:#173e63;--color-accent:#d7a541;--color-on-primary:#ffffff;
  --color-success:#18784e;--color-success-soft:#e7f6ee;--color-warning:#86590d;--color-warning-soft:#fff4d7;--color-danger:#b63843;--color-danger-soft:#fdebed;
  --shadow-soft:0 15px 40px rgba(20,39,63,.09);
}
html[data-theme="dark"],body[data-theme="dark"]{
  color-scheme:dark;
  --bg:#0b1220;--surface:#111b2a;--surface-soft:#182538;--surface-elevated:#1d2c40;
  --text:#f2f6fb;--muted:#aab8c9;--border:#2d3e53;--primary:#2f72ad;--secondary:#3d83bc;--accent:#e0b34e;
  --color-canvas:#0b1220;--color-surface:#111b2a;--color-surface-alt:#182538;--color-surface-elevated:#1d2c40;
  --color-text:#f2f6fb;--color-text-muted:#aab8c9;--color-border:#2d3e53;--color-border-strong:#435873;
  --color-primary:#2f72ad;--color-accent:#e0b34e;--color-on-primary:#ffffff;
  --color-success:#7bd5a7;--color-success-soft:#153b2d;--color-warning:#f0c66e;--color-warning-soft:#3a2d14;--color-danger:#ff9da5;--color-danger-soft:#46232a;
  --success-surface:#153b2d;--warning-surface:#3a2d14;--danger-surface:#46232a;
  --shadow-soft:0 18px 48px rgba(0,0,0,.36);
}

html[data-theme] body,
body[data-theme]{background:var(--color-canvas)!important;color:var(--color-text)!important}
html[data-theme] .public-body{background:linear-gradient(180deg,var(--color-surface-alt) 0,var(--color-canvas) 30%,var(--color-canvas) 100%)!important}

/* Surfaces */
html[data-theme] :where(.card,.panel,.form-card,.auth-card,.table-wrap,.table-responsive,.metric-card,.dashboard-metric-card,.content-page .content,.health-item,.profile-dropdown,.modal-card,.document-modal-dialog,.action-menu-panel,.tree-node,.ai-widget,.ai-control-card,.html-editor,.nav-dropdown,.public-nav,.switch-card){
  background:var(--color-surface)!important;color:var(--color-text)!important;border-color:var(--color-border)!important;
}
html[data-theme] :where(.card.soft,.notice,.empty,.empty-state,.summary-box,.shift-card,.chat,.thread-list,.filter-card,.check-grid,.onboarding-check,.staff-renewal-box,.staff-warning-reason,.maintenance-package,.maintenance-manual-icon,.maintenance-code-list code){
  background:var(--color-surface-alt)!important;color:var(--color-text)!important;border-color:var(--color-border)!important;
}
html[data-theme] :where(.topbar,.public-header){background:color-mix(in srgb,var(--color-surface) 94%,transparent)!important;color:var(--color-text)!important;border-color:var(--color-border)!important}
html[data-theme] :where(.chat-message,.ai-bubble,.tab-btn,.checkbox-pill,.filter-chip,.editor-tool,.sidebar-toggle,.user-chip.profile-menu-toggle){
  background:var(--color-surface-elevated)!important;color:var(--color-text)!important;border-color:var(--color-border)!important;
}
html[data-theme] :where(.html-editor-toolbar,.document-review-bar,.filter-shortcuts){background:var(--color-surface-alt)!important;border-color:var(--color-border)!important}

/* Text hierarchy */
html[data-theme] :where(h1,h2,h3,h4,h5,h6,strong,label,legend,summary,dt,dd,th,td,.metric-value,.panel-head,.page-head,.topbar strong,.brand){color:var(--color-text)}
html[data-theme] :where(p,small,.muted,.help-text,.field-help,.metric-label,.metric-hint,.filter-shortcuts-label,.data-list dt,.table th,.document-review-table th){color:var(--color-text-muted)}
html[data-theme] a:not(.btn):not(.sidebar-link):not(.brand){color:color-mix(in srgb,var(--color-primary) 72%,var(--color-text))}
html[data-theme="dark"] a:not(.btn):not(.sidebar-link):not(.brand){color:#8fc8f4}

/* Forms */
html[data-theme] :where(input,select,textarea,.mini-input){background:var(--color-surface-elevated)!important;color:var(--color-text)!important;border-color:var(--color-border-strong)!important}
html[data-theme] :where(input[readonly],input:disabled,select:disabled,textarea:disabled){background:var(--color-surface-alt)!important;color:var(--color-text-muted)!important;opacity:1}
html[data-theme] input::placeholder,html[data-theme] textarea::placeholder{color:var(--color-text-muted)!important;opacity:.78}
html[data-theme] :where(input[type="file"]::file-selector-button){background:var(--color-surface-alt);color:var(--color-text);border:1px solid var(--color-border);border-radius:9px;padding:8px 11px;margin-right:10px;font-weight:750;cursor:pointer}

/* Premium action palette */
html[data-theme] :where(.btn,a.btn,button.btn){background:var(--color-primary)!important;color:var(--color-on-primary)!important;border:1px solid transparent!important;box-shadow:0 9px 22px color-mix(in srgb,var(--color-primary) 24%,transparent)}
html[data-theme] :where(.btn.btn-secondary,.btn-secondary){background:var(--color-accent)!important;color:#18202c!important}
html[data-theme] :where(.btn.btn-ghost,.btn-ghost){background:var(--color-surface-alt)!important;color:var(--color-text)!important;border-color:var(--color-border-strong)!important;box-shadow:none}
html[data-theme] :where(.btn.btn-success,.btn-success){background:#18784e!important;color:#ffffff!important}
html[data-theme="dark"] :where(.btn.btn-success,.btn-success){background:#247d55!important;color:#ffffff!important}
html[data-theme] :where(.btn.btn-warning,.btn-warning){background:#d7a541!important;color:#18202c!important}
html[data-theme="dark"] :where(.btn.btn-warning,.btn-warning){background:#e0b34e!important;color:#151b24!important}
html[data-theme] :where(.btn.btn-danger,.btn-danger){background:#b63843!important;color:#ffffff!important}
html[data-theme="dark"] :where(.btn.btn-danger,.btn-danger){background:#c2414d!important;color:#ffffff!important}
html[data-theme] :where(.btn:hover,a.btn:hover,button.btn:hover){filter:brightness(1.06);transform:translateY(-1px)}
html[data-theme] :where(.btn:disabled,button.btn:disabled,.btn[aria-disabled="true"]){opacity:.56;filter:none;cursor:not-allowed;transform:none}

/* Tables, cards and dashboard metrics */
html[data-theme] :where(table,.table,.document-review-table){color:var(--color-text)!important}
html[data-theme] :where(th,.table th,.document-review-table th){background:var(--color-surface-alt)!important;color:var(--color-text-muted)!important}
html[data-theme] :where(td,th,.table td,.table th,.document-review-table td,.document-review-table th){border-color:var(--color-border)!important}
html[data-theme] :where(tbody tr:hover){background:color-mix(in srgb,var(--color-accent) 7%,var(--color-surface))!important}
html[data-theme] .dashboard-metric-card{background:linear-gradient(145deg,var(--color-surface),color-mix(in srgb,var(--metric-accent) 5%,var(--color-surface)))!important}
html[data-theme] :where(.metric-icon,.metric-open-icon){background:color-mix(in srgb,var(--metric-accent) 12%,var(--color-surface-elevated))!important;border-color:color-mix(in srgb,var(--metric-accent) 22%,var(--color-border))!important}
html[data-theme] .dashboard-metric-card.is-restricted{background:var(--color-surface-alt)!important}
html[data-theme] .filter-shortcuts{border-color:var(--color-border)!important}
html[data-theme] .filter-chip.active{background:color-mix(in srgb,var(--color-accent) 18%,var(--color-surface))!important;color:color-mix(in srgb,var(--color-accent) 64%,var(--color-text))!important;border-color:color-mix(in srgb,var(--color-accent) 46%,var(--color-border))!important}

/* Navigation and menus */
html[data-theme] :where(.public-nav>a:hover,.nav-dropdown a:hover,.profile-dropdown a:hover,.profile-dropdown button:hover,.tab-btn:hover){background:var(--color-surface-alt)!important;color:var(--color-text)!important}
html[data-theme] :where(.tab-btn.active,.preview-device-switch button.active){background:var(--color-primary)!important;color:var(--color-on-primary)!important;border-color:var(--color-primary)!important}
html[data-theme] .sidebar-toggle:hover{background:var(--color-surface-alt)!important;border-color:var(--color-border-strong)!important}
html[data-theme] .notification-bell{background:var(--color-surface-alt)!important;color:var(--color-text)!important;border-color:var(--color-border)!important}

/* Keep intentionally branded dark areas readable in both modes */
html[data-theme] :where(.hero-panel,.hero-premium,.quote-brand,.maintenance-hero-main,.sidebar,.public-footer,.ai-assistant-head,.ai-assistant-toggle,.brand-mark){color:#ffffff!important}
html[data-theme] :where(.hero-panel,.hero-premium,.quote-brand,.maintenance-hero-main,.sidebar,.public-footer,.ai-assistant-head) :where(h1,h2,h3,h4,h5,h6,strong,label,summary){color:#ffffff!important}
html[data-theme] :where(.hero-panel,.hero-premium,.maintenance-hero-main) p{color:rgba(255,255,255,.84)!important}
html[data-theme] .quote-brand{background:linear-gradient(135deg,#12314e,#245b84)!important}

/* Semantic notices and statuses */
html[data-theme] :where(.flash-success,.status-approved,.status-active,.status-success,.status-paid,.onboarding-check.complete,.readiness-ready){background:var(--color-success-soft)!important;color:var(--color-success)!important;border-color:color-mix(in srgb,var(--color-success) 35%,var(--color-border))!important}
html[data-theme] :where(.flash-warning,.status-pending,.status-sent,.status-viewed,.status-partially_paid,.status-partially-paid,.status-pending_verification,.status-pending-verification,.readiness-pending){background:var(--color-warning-soft)!important;color:var(--color-warning)!important;border-color:color-mix(in srgb,var(--color-warning) 35%,var(--color-border))!important}
html[data-theme] :where(.flash-danger,.status-declined,.status-failed,.status-voided,.status-rejected,.status-overdue,.status-expired,.status-inactive,.status-revoked,.onboarding-check.invalid){background:var(--color-danger-soft)!important;color:var(--color-danger)!important;border-color:color-mix(in srgb,var(--color-danger) 35%,var(--color-border))!important}
html[data-theme] .flash-info{background:color-mix(in srgb,#3d8dcc 14%,var(--color-surface))!important;color:color-mix(in srgb,#3d8dcc 70%,var(--color-text))!important;border-color:color-mix(in srgb,#3d8dcc 36%,var(--color-border))!important}

/* AI widget inherits the active theme instead of retaining a light panel in dark mode */
html[data-theme] .ai-assistant{--ai-primary:var(--color-primary);--ai-surface:var(--color-surface);--ai-text:var(--color-text)}
html[data-theme] :where(.ai-assistant-panel,.ai-assistant-form,.ai-history,.ai-work-card,.ai-secure-card,.ai-confirmation-card){background:var(--color-surface)!important;color:var(--color-text)!important;border-color:var(--color-border)!important}
html[data-theme] .ai-assistant-messages{background:color-mix(in srgb,var(--color-surface-alt) 88%,var(--color-primary) 12%)!important}
html[data-theme] .ai-message-meta{color:var(--color-text-muted)!important}

@media(max-width:760px){
  html[data-theme] :where(.document-review-table tr,.staff-responsive-table tr){background:var(--color-surface)!important;color:var(--color-text)!important;border-color:var(--color-border)!important}
}

/* Contrast protection for dark branded shells and secondary hero actions */
html[data-theme] .public-footer :where(p,small,span,a){color:#b8c7d5!important}
html[data-theme] .sidebar :where(.sidebar-role,.sidebar-nav a,.sidebar-group-toggle,.sidebar-subnav a){color:#b9c9d7}
html[data-theme] :where(.hero-panel,.hero-premium) :where(.btn-ghost,.hero-ghost){background:rgba(255,255,255,.08)!important;color:#ffffff!important;border-color:rgba(255,255,255,.42)!important}
html[data-theme] :where(.hero-panel,.hero-premium) :where(.btn-ghost,.hero-ghost):hover{background:rgba(255,255,255,.16)!important}

/* v6.2.2 light-theme text visibility hardening
   Page-level styles are loaded after the shared stylesheets. These scoped
   important rules prevent accidental white text on light surfaces while
   preserving intentional inverse text on branded dark areas. */
html[data-theme="light"] :where(
  body,
  .portal-main,
  .portal-content,
  .topbar,
  .public-body,
  .public-body main,
  .form-shell,
  .quote-shell,
  .auth-wrap,
  .profile-dropdown,
  .document-modal-dialog,
  .ai-assistant-panel
){color:var(--color-text)!important}

html[data-theme="light"] :where(
  .portal-content,
  .topbar,
  .public-body main,
  .form-shell,
  .quote-shell,
  .auth-wrap,
  .profile-dropdown,
  .document-modal-dialog,
  .ai-assistant-panel
) :where(h1,h2,h3,h4,h5,h6,strong,b,label,legend,summary,dt,dd,th,td,li,caption,figcaption,output,address,time){
  color:var(--color-text)!important;
}

html[data-theme="light"] :where(
  .portal-content,
  .topbar,
  .public-body main,
  .form-shell,
  .quote-shell,
  .auth-wrap,
  .profile-dropdown,
  .document-modal-dialog,
  .ai-assistant-panel
) :where(p,small,.muted,.help-text,.field-help,.metric-label,.metric-hint,.data-list dt,.filter-shortcuts-label,.maintenance-submit-note,.ai-message-meta){
  color:var(--color-text-muted)!important;
}

html[data-theme="light"] :where(
  .portal-content,
  .topbar,
  .public-body main,
  .form-shell,
  .quote-shell,
  .auth-wrap,
  .profile-dropdown,
  .document-modal-dialog,
  .ai-assistant-panel
) a:not(.btn):not(.brand):not(.sidebar-link){
  color:#245b87!important;
}

/* Restore clean light surfaces that previously inherited inverse text. */
html[data-theme="light"] :where(
  .card,.panel,.form-card,.auth-card,.table-wrap,.table-responsive,
  .metric-card,.dashboard-metric-card,.content-page .content,.health-item,
  .profile-dropdown,.modal-card,.document-modal-dialog,.action-menu-panel,
  .tree-node,.ai-widget,.ai-control-card,.html-editor,.nav-dropdown,
  .public-nav,.switch-card,.summary-box,.filter-card,.check-grid,
  .onboarding-check,.staff-renewal-box,.staff-warning-reason
){
  color:var(--color-text)!important;
}

/* Legacy hero glass was accidentally converted to a white card by the base
   theme while retaining inverse text. Keep it as a true dark glass panel. */
html[data-theme="light"] .hero-glass{
  background:rgba(7,20,33,.76)!important;
  color:#ffffff!important;
  border-color:rgba(255,255,255,.2)!important;
  box-shadow:0 24px 75px rgba(0,0,0,.24)!important;
}

/* Intentional inverse surfaces. */
html[data-theme="light"] :where(
  .hero-premium,.hero-panel,.hero-glass,.quote-brand,.maintenance-hero-main,
  .sidebar,.public-footer,.code-box,.ai-assistant-head,.ai-assistant-toggle,
  .ai-preview-head
){color:#ffffff!important}

html[data-theme="light"] :where(
  .hero-premium,.hero-panel,.hero-glass,.quote-brand,.maintenance-hero-main,
  .sidebar,.public-footer,.code-box,.ai-assistant-head,.ai-assistant-toggle,
  .ai-preview-head
) :where(h1,h2,h3,h4,h5,h6,strong,b,label,legend,summary,dt,dd,th,td,li,caption,figcaption,output,address,time,a:not(.btn)){
  color:#ffffff!important;
}

html[data-theme="light"] :where(
  .hero-premium,.hero-panel,.hero-glass,.maintenance-hero-main,
  .sidebar,.public-footer,.ai-assistant-head,.ai-preview-head
) :where(p,small,.muted,.help-text){
  color:rgba(239,246,252,.82)!important;
}

html[data-theme="light"] :where(
  .brand-mark,.profile-photo-fallback,.gemini-brand>span,
  .ai-bubble.user,.ai-send,.editor-preview-toggle,
  .tab-btn.active,.preview-device-switch button.active,
  .notification-bell [data-notification-count]
){color:#ffffff!important}

/* Button text is always paired with its final background color. */
html[data-theme="light"] :where(.btn,a.btn,button.btn){color:#ffffff!important}
html[data-theme="light"] :where(.btn.btn-secondary,.btn-secondary,.btn.btn-warning,.btn-warning){color:#18202c!important}
html[data-theme="light"] :where(.btn.btn-ghost,.btn-ghost){color:var(--color-text)!important}
html[data-theme="light"] :where(.btn,.tab-btn.active,.preview-device-switch button.active,.editor-preview-toggle) :where(span,strong,small){color:inherit!important}
html[data-theme="light"] :where(.hero-premium,.hero-panel,.hero-glass) :where(.btn-ghost,.hero-ghost){
  background:rgba(255,255,255,.09)!important;
  color:#ffffff!important;
  border-color:rgba(255,255,255,.42)!important;
}

/* Semantic chips and labels must not be overridden by the generic text reset. */
html[data-theme="light"] .status{background:#e8eef5!important;color:#35516d!important}
html[data-theme="light"] :where(.status-paid,.status-approved,.status-active,.status-success){background:var(--color-success-soft)!important;color:var(--color-success)!important}
html[data-theme="light"] :where(.status-pending,.status-sent,.status-viewed,.status-returned,.status-revision_requested,.status-needs_information,.status-late,.status-partially_paid,.status-partially-paid,.status-pending_verification,.status-pending-verification){background:var(--color-warning-soft)!important;color:var(--color-warning)!important}
html[data-theme="light"] :where(.status-rejected,.status-declined,.status-failed,.status-overdue,.status-expired,.status-inactive,.status-revoked,.status-voided){background:var(--color-danger-soft)!important;color:var(--color-danger)!important}
html[data-theme="light"] :where(.status-submitted,.status-pending_review,.status-under_review){background:#e8efff!important;color:#274f9d!important}
html[data-theme="light"] :where(.status-archived,.status-cancelled,.status-withdrawn,.status-muted){background:#edf0f4!important;color:#536273!important}
html[data-theme="light"] :where(.flash-success,.flash-warning,.flash-danger,.flash-info,.status,.maintenance-status,.nav-badge) :where(span,strong,small){color:inherit!important}


html[data-theme="light"] :where(.chat-message.mine,.thread-message.mine,.ai-bubble.user){
  color:var(--color-on-primary)!important;
}
html[data-theme="light"] :where(.chat-message.mine,.thread-message.mine,.ai-bubble.user) :where(h1,h2,h3,h4,h5,h6,strong,b,label,small,p,a){
  color:inherit!important;
}

html[data-theme="light"] :where(.metric-icon,.metric-open-icon){color:var(--metric-accent)!important}
html[data-theme="light"] :where(.eyebrow){color:#8b6420!important}
html[data-theme="light"] :where(.hero-premium,.hero-panel,.hero-glass) .eyebrow{color:#f0c66e!important}

/* v6.2.3 — premium admin dashboard and professional table system */
.portal-role-super-admin,
.portal-role-sub-admin{
  --admin-navy:#102b45;
  --admin-navy-deep:#091a2b;
  --admin-blue:#236797;
  --admin-gold:#d9a441;
  --admin-radius:22px;
  --admin-shadow:0 18px 50px rgba(15,35,57,.10);
}

.portal-role-super-admin .portal-content,
.portal-role-sub-admin .portal-content{
  width:100%;
  max-width:1780px;
  padding:30px clamp(20px,2.4vw,38px) 42px;
}

.portal-role-super-admin .topbar,
.portal-role-sub-admin .topbar{
  min-height:82px;
  height:82px;
  padding-inline:clamp(18px,2.2vw,34px);
  border-bottom:1px solid color-mix(in srgb,var(--color-border) 78%,transparent)!important;
  box-shadow:0 8px 28px rgba(15,35,57,.045);
}
.portal-role-super-admin .topbar>div:nth-child(2) strong,
.portal-role-sub-admin .topbar>div:nth-child(2) strong{
  display:block;
  margin-top:2px;
  font-size:1.03rem;
  letter-spacing:-.012em;
}
.portal-role-super-admin .notification-bell,
.portal-role-super-admin .theme-toggle,
.portal-role-super-admin .user-chip.profile-menu-toggle,
.portal-role-sub-admin .notification-bell,
.portal-role-sub-admin .theme-toggle,
.portal-role-sub-admin .user-chip.profile-menu-toggle{
  min-height:42px;
  border-radius:13px!important;
  box-shadow:0 5px 16px rgba(15,35,57,.05);
}

.portal-role-super-admin .sidebar,
.portal-role-sub-admin .sidebar{
  background:
    radial-gradient(circle at 25% 5%,rgba(55,126,177,.22),transparent 29%),
    linear-gradient(180deg,#10283e 0%,#0b1c2c 56%,#081724 100%)!important;
  border-right:1px solid rgba(255,255,255,.055);
  box-shadow:12px 0 38px rgba(5,16,27,.12);
}
.portal-role-super-admin .sidebar-link,
.portal-role-super-admin .sidebar-group-toggle,
.portal-role-sub-admin .sidebar-link,
.portal-role-sub-admin .sidebar-group-toggle{
  min-height:48px;
  border:1px solid transparent;
  border-radius:14px;
}
.portal-role-super-admin .sidebar-link:hover,
.portal-role-super-admin .sidebar-group-toggle:hover,
.portal-role-sub-admin .sidebar-link:hover,
.portal-role-sub-admin .sidebar-group-toggle:hover{
  background:rgba(255,255,255,.065)!important;
  border-color:rgba(255,255,255,.065);
}
.portal-role-super-admin .sidebar-link.active,
.portal-role-sub-admin .sidebar-link.active{
  background:linear-gradient(135deg,rgba(217,164,65,.22),rgba(255,255,255,.07))!important;
  border-color:rgba(217,164,65,.34)!important;
  box-shadow:inset 3px 0 0 var(--admin-gold),0 8px 20px rgba(0,0,0,.12);
}
.portal-role-super-admin .sidebar-link.active .nav-icon,
.portal-role-sub-admin .sidebar-link.active .nav-icon{
  color:#f1c66c!important;
  background:rgba(217,164,65,.14)!important;
  border-color:rgba(217,164,65,.22)!important;
}

/* Shared professional page header for every admin list/form page. */
.portal-role-super-admin .portal-content>.page-head:not(.dashboard-hero),
.portal-role-sub-admin .portal-content>.page-head:not(.dashboard-hero){
  position:relative;
  overflow:hidden;
  padding:25px 28px;
  margin-bottom:20px;
  border:1px solid var(--color-border);
  border-radius:var(--admin-radius);
  background:
    linear-gradient(135deg,color-mix(in srgb,var(--color-primary) 7%,var(--color-surface)),var(--color-surface) 58%,color-mix(in srgb,var(--color-accent) 8%,var(--color-surface)))!important;
  box-shadow:var(--admin-shadow);
}
.portal-role-super-admin .portal-content>.page-head:not(.dashboard-hero)::after,
.portal-role-sub-admin .portal-content>.page-head:not(.dashboard-hero)::after{
  content:"";
  position:absolute;
  width:190px;
  height:190px;
  right:-72px;
  top:-115px;
  border-radius:50%;
  background:color-mix(in srgb,var(--color-accent) 12%,transparent);
  pointer-events:none;
}
.portal-role-super-admin .portal-content>.page-head:not(.dashboard-hero)>*,
.portal-role-sub-admin .portal-content>.page-head:not(.dashboard-hero)>*{position:relative;z-index:1}
.portal-role-super-admin .page-head h2,
.portal-role-sub-admin .page-head h2{
  margin-bottom:7px;
  font-size:clamp(1.65rem,2.2vw,2.35rem);
  letter-spacing:-.035em;
}
.portal-role-super-admin .page-head p,
.portal-role-sub-admin .page-head p{max-width:790px;line-height:1.65}

/* Dashboard command-center hero. */
.admin-dashboard{max-width:1480px;margin:0 auto}
.admin-dashboard .dashboard-hero{
  position:relative;
  isolation:isolate;
  overflow:hidden;
  min-height:184px;
  padding:31px 34px;
  margin-bottom:22px;
  border:1px solid rgba(255,255,255,.10)!important;
  border-radius:28px;
  background:
    radial-gradient(circle at 88% 15%,rgba(217,164,65,.30),transparent 26%),
    radial-gradient(circle at 12% 115%,rgba(57,137,191,.28),transparent 34%),
    linear-gradient(125deg,#0c2135 0%,#153a5a 58%,#102b45 100%)!important;
  color:#fff!important;
  box-shadow:0 28px 70px rgba(8,27,44,.24);
}
.admin-dashboard .dashboard-hero::before{
  content:"";
  position:absolute;
  inset:0;
  z-index:-1;
  opacity:.23;
  background-image:
    linear-gradient(rgba(255,255,255,.08) 1px,transparent 1px),
    linear-gradient(90deg,rgba(255,255,255,.08) 1px,transparent 1px);
  background-size:42px 42px;
  mask-image:linear-gradient(90deg,#000,transparent 78%);
}
.admin-dashboard .dashboard-hero::after{
  content:"";
  position:absolute;
  right:-80px;
  bottom:-112px;
  width:290px;
  height:290px;
  z-index:-1;
  border:52px solid rgba(255,255,255,.045);
  border-radius:50%;
}
.admin-dashboard .dashboard-hero :where(h1,h2,h3,h4,strong,label){color:#fff!important}
.admin-dashboard .dashboard-hero h2{
  margin:4px 0 9px;
  font-size:clamp(2rem,3.1vw,3rem);
  letter-spacing:-.05em;
}
.admin-dashboard .dashboard-hero p{
  max-width:760px;
  margin:0;
  color:rgba(235,244,251,.79)!important;
  font-size:1rem;
}
.admin-dashboard .dashboard-hero .eyebrow{color:#f1c66c!important}
.admin-dashboard .dashboard-hero .actions{
  position:relative;
  z-index:2;
  justify-content:flex-end;
  min-width:190px;
}
.admin-dashboard .dashboard-hero .actions .btn{
  min-width:150px;
  padding:12px 17px;
  border-radius:13px!important;
  background:#f6f9fc!important;
  color:#102b45!important;
  box-shadow:0 11px 28px rgba(4,16,27,.22)!important;
}
.admin-dashboard .dashboard-hero .actions .btn-secondary{
  background:linear-gradient(135deg,#e7b54d,#d39a31)!important;
  color:#172333!important;
}
.admin-dashboard .dashboard-hero .actions .btn:hover{filter:brightness(1.03);transform:translateY(-2px)}

/* Balanced 4 + 3 metric layout at desktop widths. */
.admin-dashboard .dashboard-metric-grid{
  display:grid!important;
  grid-template-columns:repeat(12,minmax(0,1fr))!important;
  gap:16px!important;
}
.admin-dashboard .dashboard-metric-card{
  grid-column:span 3;
  min-height:172px;
  padding:20px 21px 18px;
  border-radius:22px!important;
  border:1px solid color-mix(in srgb,var(--metric-accent) 17%,var(--color-border))!important;
  background:
    radial-gradient(circle at 100% 0%,color-mix(in srgb,var(--metric-accent) 10%,transparent),transparent 35%),
    linear-gradient(145deg,var(--color-surface),color-mix(in srgb,var(--metric-accent) 4%,var(--color-surface)))!important;
  box-shadow:0 14px 36px rgba(13,35,57,.085)!important;
}
.admin-dashboard .dashboard-metric-card:nth-child(n+5){grid-column:span 4}
.admin-dashboard .dashboard-metric-card::before{
  inset:0 auto 0 0;
  width:4px;
  height:auto;
  background:linear-gradient(180deg,var(--metric-accent),color-mix(in srgb,var(--metric-accent) 28%,transparent));
}
.admin-dashboard .dashboard-metric-card::after{width:122px;height:122px;right:-54px;top:-58px}
.admin-dashboard .dashboard-metric-card.is-clickable:hover{
  transform:translateY(-4px);
  border-color:color-mix(in srgb,var(--metric-accent) 42%,var(--color-border))!important;
  box-shadow:0 22px 48px rgba(13,35,57,.14)!important;
}
.admin-dashboard .metric-card-top{margin-bottom:15px}
.admin-dashboard .metric-icon{
  width:43px;
  height:43px;
  border-radius:13px;
  box-shadow:0 7px 18px color-mix(in srgb,var(--metric-accent) 13%,transparent);
}
.admin-dashboard .metric-open-icon{width:29px;height:29px;border-radius:9px}
.admin-dashboard .dashboard-metric-card .metric-label{margin-bottom:4px;font-size:.72rem;letter-spacing:.075em}
.admin-dashboard .dashboard-metric-card .metric-value{font-size:clamp(1.7rem,2vw,2.15rem)}
.admin-dashboard .dashboard-metric-card .metric-hint{padding-top:12px;font-size:.78rem}

/* Lower dashboard panels no longer stretch into empty white columns. */
.admin-dashboard .dashboard-activity-grid{
  display:grid;
  grid-template-columns:minmax(0,.92fr) minmax(0,1.08fr);
  gap:18px;
  align-items:start;
}
.admin-dashboard .dashboard-notifications-column{min-width:0}
.admin-dashboard .dashboard-notifications-column>.panel,
.admin-dashboard .dashboard-audit-panel{
  margin:0;
  padding:20px;
  border-radius:23px!important;
  border:1px solid var(--color-border)!important;
  background:var(--color-surface)!important;
  box-shadow:var(--admin-shadow)!important;
}
.admin-dashboard .dashboard-notifications-column>.panel .panel-head,
.admin-dashboard .dashboard-audit-panel>.panel-head{
  margin:-2px -2px 15px;
  padding:0 2px 14px;
  border-bottom:1px solid var(--color-border);
}
.admin-dashboard .panel-head h3{margin:0;font-size:1.05rem;letter-spacing:-.018em}
.admin-dashboard .panel-head p{margin:5px 0 0;font-size:.86rem}
.admin-dashboard .dashboard-audit-panel{
  max-height:620px;
  overflow:auto;
  scrollbar-width:thin;
  scrollbar-color:var(--color-border-strong) transparent;
}
.admin-dashboard .dashboard-audit-panel>.card.soft{
  position:relative;
  margin:0 0 10px;
  padding:14px 15px 13px 18px;
  border:1px solid var(--color-border)!important;
  border-radius:15px!important;
  background:color-mix(in srgb,var(--color-surface-alt) 72%,var(--color-surface))!important;
  box-shadow:none!important;
}
.admin-dashboard .dashboard-audit-panel>.card.soft::before{
  content:"";
  position:absolute;
  left:0;
  top:13px;
  bottom:13px;
  width:3px;
  border-radius:0 4px 4px 0;
  background:linear-gradient(180deg,var(--admin-blue),var(--admin-gold));
}
.admin-dashboard .dashboard-audit-panel>.card.soft strong{font-size:.88rem;word-break:break-word}
.admin-dashboard .dashboard-audit-panel>.card.soft p{margin:5px 0 0;font-size:.78rem}
.admin-dashboard .notification-preview{
  overflow:hidden;
  margin-bottom:9px;
  border:1px solid var(--color-border);
  border-radius:15px;
  background:color-mix(in srgb,var(--color-surface-alt) 66%,var(--color-surface));
}
.admin-dashboard .notification-preview a{display:grid;gap:3px;padding:13px 14px;text-decoration:none}
.admin-dashboard .notification-preview.unread{border-left:3px solid var(--admin-gold)}
.admin-dashboard .empty{
  min-height:100px;
  display:grid;
  place-items:center;
  border-radius:16px;
  background:color-mix(in srgb,var(--color-surface-alt) 80%,var(--color-surface))!important;
}

/* Professional admin tables — consistent, compact and readable. */
.portal-role-super-admin :where(.table-wrap,.panel.table-wrap),
.portal-role-sub-admin :where(.table-wrap,.panel.table-wrap){
  overflow:auto;
  padding:0!important;
  border:1px solid var(--color-border)!important;
  border-radius:20px!important;
  background:var(--color-surface)!important;
  box-shadow:0 16px 42px rgba(15,35,57,.075)!important;
}
.portal-role-super-admin :where(.table-wrap,.panel.table-wrap)>table,
.portal-role-sub-admin :where(.table-wrap,.panel.table-wrap)>table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  min-width:800px;
  margin:0;
}
.portal-role-super-admin :where(.table-wrap,.panel.table-wrap) thead th,
.portal-role-sub-admin :where(.table-wrap,.panel.table-wrap) thead th{
  position:sticky;
  top:0;
  z-index:2;
  padding:14px 16px!important;
  border:0!important;
  border-right:1px solid rgba(255,255,255,.075)!important;
  background:linear-gradient(180deg,#183b59,#102b45)!important;
  color:#edf5fb!important;
  font-size:.69rem!important;
  font-weight:850!important;
  line-height:1.3;
  letter-spacing:.09em!important;
  text-transform:uppercase;
  white-space:nowrap;
}
.portal-role-super-admin :where(.table-wrap,.panel.table-wrap) thead th:first-child,
.portal-role-sub-admin :where(.table-wrap,.panel.table-wrap) thead th:first-child{padding-left:20px!important}
.portal-role-super-admin :where(.table-wrap,.panel.table-wrap) thead th:last-child,
.portal-role-sub-admin :where(.table-wrap,.panel.table-wrap) thead th:last-child{border-right:0!important;padding-right:20px!important}
.portal-role-super-admin :where(.table-wrap,.panel.table-wrap) tbody td,
.portal-role-sub-admin :where(.table-wrap,.panel.table-wrap) tbody td{
  padding:14px 16px!important;
  border:0!important;
  border-bottom:1px solid var(--color-border)!important;
  background:transparent!important;
  color:var(--color-text)!important;
  font-size:.88rem;
  line-height:1.48;
  vertical-align:middle;
}
.portal-role-super-admin :where(.table-wrap,.panel.table-wrap) tbody td:first-child,
.portal-role-sub-admin :where(.table-wrap,.panel.table-wrap) tbody td:first-child{padding-left:20px!important}
.portal-role-super-admin :where(.table-wrap,.panel.table-wrap) tbody td:last-child,
.portal-role-sub-admin :where(.table-wrap,.panel.table-wrap) tbody td:last-child{padding-right:20px!important}
.portal-role-super-admin :where(.table-wrap,.panel.table-wrap) tbody tr:nth-child(even),
.portal-role-sub-admin :where(.table-wrap,.panel.table-wrap) tbody tr:nth-child(even){
  background:color-mix(in srgb,var(--color-surface-alt) 42%,var(--color-surface))!important;
}
.portal-role-super-admin :where(.table-wrap,.panel.table-wrap) tbody tr:hover,
.portal-role-sub-admin :where(.table-wrap,.panel.table-wrap) tbody tr:hover{
  background:color-mix(in srgb,var(--admin-blue) 7%,var(--color-surface))!important;
}
.portal-role-super-admin :where(.table-wrap,.panel.table-wrap) tbody tr:last-child td,
.portal-role-sub-admin :where(.table-wrap,.panel.table-wrap) tbody tr:last-child td{border-bottom:0!important}
.portal-role-super-admin :where(.table-wrap,.panel.table-wrap) td strong,
.portal-role-sub-admin :where(.table-wrap,.panel.table-wrap) td strong{font-weight:800;letter-spacing:-.01em}
.portal-role-super-admin :where(.table-wrap,.panel.table-wrap) td small,
.portal-role-sub-admin :where(.table-wrap,.panel.table-wrap) td small{display:inline-block;margin-top:3px;font-size:.76rem}
.portal-role-super-admin :where(.table-wrap,.panel.table-wrap) .btn-sm,
.portal-role-sub-admin :where(.table-wrap,.panel.table-wrap) .btn-sm{
  min-height:34px;
  padding:7px 12px;
  border-radius:10px!important;
  box-shadow:none!important;
}
.portal-role-super-admin :where(.table-wrap,.panel.table-wrap) .status,
.portal-role-sub-admin :where(.table-wrap,.panel.table-wrap) .status{
  min-height:27px;
  align-items:center;
  padding:5px 10px;
  border:1px solid color-mix(in srgb,currentColor 18%,transparent);
  border-radius:999px;
  font-size:.68rem;
  letter-spacing:.035em;
  text-transform:capitalize;
}

/* Filter and utility panels align with the table system. */
.portal-role-super-admin :where(.filter-bar,.portal-content>.panel:not(.table-wrap)),
.portal-role-sub-admin :where(.filter-bar,.portal-content>.panel:not(.table-wrap)){
  border-radius:18px!important;
  border-color:var(--color-border)!important;
  box-shadow:0 10px 30px rgba(15,35,57,.055)!important;
}
.portal-role-super-admin .filter-bar,
.portal-role-sub-admin .filter-bar{padding:18px 20px}
.portal-role-super-admin .filter-bar :where(input,select),
.portal-role-sub-admin .filter-bar :where(input,select){min-height:45px;border-radius:11px!important}

html[data-theme="dark"] :where(.portal-role-super-admin,.portal-role-sub-admin){
  --admin-shadow:0 18px 50px rgba(0,0,0,.28);
}
html[data-theme="dark"] .admin-dashboard .dashboard-metric-card{
  box-shadow:0 16px 38px rgba(0,0,0,.24)!important;
}
html[data-theme="dark"] :where(.portal-role-super-admin,.portal-role-sub-admin) :where(.table-wrap,.panel.table-wrap) thead th{
  background:linear-gradient(180deg,#1a3a56,#10273b)!important;
}
html[data-theme="dark"] :where(.portal-role-super-admin,.portal-role-sub-admin) :where(.table-wrap,.panel.table-wrap) tbody tr:nth-child(even){
  background:color-mix(in srgb,var(--color-surface-alt) 58%,var(--color-surface))!important;
}

@media(max-width:980px){
  .admin-dashboard .dashboard-metric-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .admin-dashboard .dashboard-metric-card,
  .admin-dashboard .dashboard-metric-card:nth-child(n+5){grid-column:auto}
  .admin-dashboard .dashboard-activity-grid{grid-template-columns:1fr}
  .admin-dashboard .dashboard-audit-panel{max-height:none}
}
@media(max-width:760px){
  .portal-role-super-admin .portal-content,
  .portal-role-sub-admin .portal-content{padding:18px 14px 30px}
  .admin-dashboard .dashboard-hero{min-height:0;padding:23px 20px;border-radius:22px;align-items:flex-start;flex-direction:column}
  .admin-dashboard .dashboard-hero .actions{width:100%;justify-content:flex-start}
  .admin-dashboard .dashboard-hero .actions .btn{flex:1;min-width:0}
  .portal-role-super-admin .portal-content>.page-head:not(.dashboard-hero),
  .portal-role-sub-admin .portal-content>.page-head:not(.dashboard-hero){padding:21px 19px;border-radius:19px;align-items:flex-start;flex-direction:column}
  .portal-role-super-admin .portal-content>.page-head>.actions,
  .portal-role-sub-admin .portal-content>.page-head>.actions{width:100%}
}
@media(max-width:580px){
  .admin-dashboard .dashboard-metric-grid{grid-template-columns:1fr!important}
  .admin-dashboard .dashboard-metric-card{min-height:158px}
  .admin-dashboard .dashboard-hero .actions{display:grid;grid-template-columns:1fr}
  .admin-dashboard .dashboard-hero .actions .btn{width:100%}
}

/* v6.2.4 - enterprise premium portal system
   Global polish for admin, client and staff pages. */
.portal-body{
  --premium-navy:#0b2136;
  --premium-navy-2:#123b5c;
  --premium-blue:#2d78a8;
  --premium-gold:#d8a33d;
  --premium-gold-soft:#f0c66e;
  --premium-card-radius:22px;
  --premium-control-radius:12px;
  --premium-card-shadow:0 18px 46px rgba(15,35,57,.085);
  --premium-card-shadow-hover:0 24px 58px rgba(15,35,57,.13);
  background:
    radial-gradient(circle at 92% -8%,rgba(45,120,168,.10),transparent 29%),
    radial-gradient(circle at 7% 104%,rgba(216,163,61,.08),transparent 27%),
    var(--color-canvas)!important;
}
html[data-theme="dark"] .portal-body{
  --premium-card-shadow:0 18px 48px rgba(0,0,0,.27);
  --premium-card-shadow-hover:0 24px 62px rgba(0,0,0,.36);
  background:
    radial-gradient(circle at 92% -8%,rgba(55,137,191,.12),transparent 29%),
    radial-gradient(circle at 7% 104%,rgba(216,163,61,.07),transparent 27%),
    var(--color-canvas)!important;
}

/* Main frame and top navigation */
.portal-body .portal-main{background:transparent!important}
.portal-body .portal-content{
  width:100%;
  max-width:1780px;
  padding:30px clamp(20px,2.35vw,40px) 48px;
}
.portal-body .topbar{
  min-height:82px;
  height:82px;
  padding-inline:clamp(18px,2.25vw,36px);
  background:color-mix(in srgb,var(--color-surface) 91%,transparent)!important;
  border-bottom:1px solid color-mix(in srgb,var(--color-border) 84%,transparent)!important;
  box-shadow:0 8px 30px rgba(15,35,57,.055);
  backdrop-filter:blur(22px) saturate(145%);
}
.portal-body .topbar .eyebrow{
  color:#8b6420!important;
  font-size:.66rem;
  letter-spacing:.14em;
}
html[data-theme="dark"] .portal-body .topbar .eyebrow{color:var(--premium-gold-soft)!important}
.portal-body .topbar>div:nth-child(2) strong{
  display:block;
  margin-top:2px;
  color:var(--color-text)!important;
  font-size:1.05rem;
  letter-spacing:-.018em;
}
.portal-body :where(.sidebar-toggle,.notification-bell,.theme-toggle,.user-chip.profile-menu-toggle){
  border-color:var(--color-border)!important;
  background:color-mix(in srgb,var(--color-surface-elevated) 95%,transparent)!important;
  color:var(--color-text)!important;
  box-shadow:0 6px 17px rgba(15,35,57,.055);
}
.portal-body :where(.sidebar-toggle,.notification-bell,.theme-toggle):hover{
  border-color:color-mix(in srgb,var(--premium-blue) 35%,var(--color-border))!important;
  background:var(--color-surface-alt)!important;
  transform:translateY(-1px);
}
.portal-body .user-chip.profile-menu-toggle:hover{border-color:color-mix(in srgb,var(--premium-blue) 35%,var(--color-border))!important}

/* Premium sidebar across every portal role */
.portal-body .sidebar{
  background:
    radial-gradient(circle at 24% 4%,rgba(56,139,195,.22),transparent 29%),
    radial-gradient(circle at 78% 96%,rgba(216,163,61,.10),transparent 28%),
    linear-gradient(180deg,#102a41 0%,#0a1c2c 56%,#071522 100%)!important;
  border-right:1px solid rgba(255,255,255,.06);
  box-shadow:13px 0 40px rgba(5,16,27,.14);
}
.portal-body .sidebar-brand .brand-mark{
  background:linear-gradient(145deg,#236797,#15456b)!important;
  color:#fff!important;
  border:1px solid rgba(255,255,255,.11);
  box-shadow:0 10px 24px rgba(0,0,0,.20),inset 0 1px 0 rgba(255,255,255,.12);
}
.portal-body :where(.sidebar-link,.sidebar-group-toggle){
  min-height:48px;
  border:1px solid transparent;
  border-radius:14px!important;
  transition:background .2s ease,border-color .2s ease,color .2s ease,transform .2s ease,box-shadow .2s ease;
}
.portal-body :where(.sidebar-link,.sidebar-group-toggle):hover{
  background:rgba(255,255,255,.065)!important;
  border-color:rgba(255,255,255,.07)!important;
  transform:translateX(1px);
}
.portal-body .sidebar-link.active,
.portal-body .sidebar-group.open>.sidebar-group-toggle{
  background:linear-gradient(135deg,rgba(216,163,61,.24),rgba(255,255,255,.07))!important;
  border-color:rgba(216,163,61,.34)!important;
  color:#fff!important;
  box-shadow:inset 3px 0 0 var(--premium-gold),0 9px 22px rgba(0,0,0,.14);
}
.portal-body :where(.sidebar-link.active,.sidebar-group.open>.sidebar-group-toggle) .nav-icon{
  color:#f1c66c!important;
  background:rgba(216,163,61,.14)!important;
  border-color:rgba(216,163,61,.23)!important;
}

/* Enterprise page heroes for all non-dashboard portal pages */
.portal-body .portal-content>.page-head:not(.dashboard-hero){
  position:relative;
  isolation:isolate;
  overflow:hidden;
  min-height:168px;
  padding:29px clamp(24px,2.5vw,36px);
  margin-bottom:22px;
  border:1px solid rgba(255,255,255,.10)!important;
  border-radius:28px!important;
  background:
    radial-gradient(circle at 89% 15%,rgba(216,163,61,.31),transparent 25%),
    radial-gradient(circle at 13% 118%,rgba(57,137,191,.29),transparent 35%),
    linear-gradient(124deg,#0b2136 0%,#153c5d 59%,#102c46 100%)!important;
  color:#fff!important;
  box-shadow:0 27px 68px rgba(8,27,44,.22)!important;
}
.portal-body .portal-content>.page-head:not(.dashboard-hero)::before{
  content:"";
  position:absolute;
  inset:0;
  z-index:-2;
  opacity:.24;
  background-image:
    linear-gradient(rgba(255,255,255,.075) 1px,transparent 1px),
    linear-gradient(90deg,rgba(255,255,255,.075) 1px,transparent 1px);
  background-size:42px 42px;
  mask-image:linear-gradient(90deg,#000,transparent 78%);
}
.portal-body .portal-content>.page-head:not(.dashboard-hero)::after{
  content:"";
  position:absolute;
  right:-76px;
  bottom:-118px;
  width:285px;
  height:285px;
  z-index:-1;
  border:50px solid rgba(255,255,255,.048);
  border-radius:50%;
  background:transparent!important;
}
.portal-body .portal-content>.page-head:not(.dashboard-hero)>*{position:relative;z-index:1}
.portal-body .portal-content>.page-head:not(.dashboard-hero) :where(h1,h2,h3,h4,strong,label){color:#fff!important}
.portal-body .portal-content>.page-head:not(.dashboard-hero) h2{
  margin:4px 0 9px;
  font-size:clamp(1.95rem,2.8vw,2.75rem);
  line-height:1.08;
  letter-spacing:-.052em;
}
.portal-body .portal-content>.page-head:not(.dashboard-hero) p{
  max-width:800px;
  margin:0;
  color:rgba(235,244,251,.79)!important;
  font-size:clamp(.94rem,1.1vw,1.03rem);
  line-height:1.65;
}
.portal-body .portal-content>.page-head:not(.dashboard-hero) .eyebrow{
  color:#f1c66c!important;
  font-size:.69rem;
  letter-spacing:.14em;
}
.portal-body .portal-content>.page-head:not(.dashboard-hero)>.actions{
  justify-content:flex-end;
  gap:11px;
}
.portal-body .portal-content>.page-head:not(.dashboard-hero)>.actions .btn{
  min-height:46px;
  padding:11px 18px;
  border-radius:13px!important;
  background:linear-gradient(135deg,#e4b451,#c9912c)!important;
  color:#172333!important;
  border:1px solid rgba(255,255,255,.24)!important;
  box-shadow:0 12px 26px rgba(0,0,0,.18)!important;
}
.portal-body .portal-content>.page-head:not(.dashboard-hero)>.actions .btn-ghost{
  background:rgba(255,255,255,.10)!important;
  color:#fff!important;
  border-color:rgba(255,255,255,.38)!important;
  box-shadow:none!important;
  backdrop-filter:blur(10px);
}
.portal-body .portal-content>.page-head:not(.dashboard-hero)>.actions .btn:hover{transform:translateY(-2px);filter:brightness(1.035)}

/* Universal premium cards and sections */
.portal-body :where(.panel,.card,.form-card,.table-card,.filter-card,.switch-card,.health-item,.auth-card,.content-page .content){
  border:1px solid var(--color-border)!important;
  border-radius:var(--premium-card-radius)!important;
  background:linear-gradient(145deg,var(--color-surface) 0%,color-mix(in srgb,var(--premium-blue) 2.5%,var(--color-surface)) 100%)!important;
  color:var(--color-text)!important;
  box-shadow:var(--premium-card-shadow)!important;
}
.portal-body .panel{
  position:relative;
  overflow:visible;
  padding:24px clamp(20px,2vw,28px);
  margin-bottom:20px;
}
.portal-body .panel::before{
  content:"";
  position:absolute;
  left:28px;
  right:28px;
  top:-1px;
  height:3px;
  border-radius:0 0 5px 5px;
  background:linear-gradient(90deg,var(--premium-gold),color-mix(in srgb,var(--premium-blue) 64%,var(--premium-gold)),transparent 92%);
  opacity:.82;
  pointer-events:none;
}
.portal-body .panel:hover{border-color:color-mix(in srgb,var(--premium-blue) 18%,var(--color-border))!important}
.portal-body .panel-head{
  align-items:flex-start;
  gap:18px;
  margin:-2px 0 18px;
  padding:0 0 17px;
  border-bottom:1px solid var(--color-border);
}
.portal-body .panel-head h3,
.portal-body .panel>h3:first-child{
  margin:0;
  color:var(--color-text)!important;
  font-size:1.08rem;
  line-height:1.3;
  letter-spacing:-.022em;
}
.portal-body .panel>h3:first-child{margin-bottom:17px;padding-bottom:15px;border-bottom:1px solid var(--color-border)}
.portal-body .panel-head p{margin:5px 0 0;max-width:850px;font-size:.88rem;line-height:1.58}
.portal-body .panel-head>a,
.portal-body .section-head>a,
.portal-body .heading-link{
  flex:0 0 auto;
  display:inline-flex;
  align-items:center;
  min-height:35px;
  padding:7px 11px;
  border:1px solid var(--color-border);
  border-radius:10px;
  background:var(--color-surface-alt);
  color:color-mix(in srgb,var(--premium-blue) 80%,var(--color-text))!important;
  font-size:.78rem;
  font-weight:780;
  text-decoration:none;
}
.portal-body .panel-head>a:hover,
.portal-body .section-head>a:hover,
.portal-body .heading-link:hover{
  border-color:color-mix(in srgb,var(--premium-blue) 35%,var(--color-border));
  background:color-mix(in srgb,var(--premium-blue) 8%,var(--color-surface));
}

/* Workflow operations center - purpose-built premium treatment */
.portal-body .workflow-tabs{
  display:grid;
  gap:20px;
}
.portal-body .workflow-tabs>.tabs{
  position:sticky;
  top:94px;
  z-index:25;
  display:flex;
  flex-wrap:nowrap;
  gap:8px;
  overflow-x:auto;
  margin:0;
  padding:10px;
  border:1px solid color-mix(in srgb,var(--color-border) 88%,transparent);
  border-radius:17px;
  background:color-mix(in srgb,var(--color-surface) 90%,transparent)!important;
  box-shadow:0 12px 32px rgba(15,35,57,.075);
  backdrop-filter:blur(20px) saturate(140%);
  scrollbar-width:thin;
  scrollbar-color:var(--color-border-strong) transparent;
}
.portal-body .workflow-tabs>.tabs .tab-btn{
  position:relative;
  flex:0 0 auto;
  min-height:40px;
  padding:9px 14px;
  border:1px solid var(--color-border)!important;
  border-radius:11px!important;
  background:var(--color-surface)!important;
  color:var(--color-text)!important;
  box-shadow:0 3px 10px rgba(15,35,57,.035);
  font-size:.8rem;
  font-weight:760;
  transition:transform .2s ease,background .2s ease,border-color .2s ease,box-shadow .2s ease;
}
.portal-body .workflow-tabs>.tabs .tab-btn:hover{
  transform:translateY(-1px);
  border-color:color-mix(in srgb,var(--premium-blue) 34%,var(--color-border))!important;
  background:color-mix(in srgb,var(--premium-blue) 6%,var(--color-surface))!important;
}
.portal-body .workflow-tabs>.tabs .tab-btn.active{
  border-color:#e1ad49!important;
  background:linear-gradient(135deg,#efc66f,#d49b32)!important;
  color:#172333!important;
  box-shadow:0 8px 19px rgba(201,145,44,.24)!important;
}
.portal-body .workflow-tabs>.tabs .tab-btn.active::after{
  content:"";
  position:absolute;
  left:50%;
  bottom:-11px;
  width:18px;
  height:3px;
  border-radius:999px;
  background:var(--premium-gold);
  transform:translateX(-50%);
}
.portal-body .workflow-tabs .tab-pane.active{display:grid;gap:20px;animation:premiumPaneIn .24s ease both}
@keyframes premiumPaneIn{from{opacity:.35;transform:translateY(5px)}to{opacity:1;transform:none}}
.portal-body .workflow-tabs .panel{margin:0}
.portal-body .workflow-tabs .grid-2{gap:20px}
.portal-body .workflow-tabs .panel>form{
  padding:19px;
  border:1px solid color-mix(in srgb,var(--premium-blue) 11%,var(--color-border));
  border-radius:17px;
  background:color-mix(in srgb,var(--color-surface-alt) 58%,var(--color-surface));
}
.portal-body .workflow-tabs .panel-head+form{margin-top:2px}

/* Forms and controls */
.portal-body :where(.field-grid,.field-grid-3){gap:18px}
.portal-body .field{min-width:0}
.portal-body .field label{
  display:block;
  margin-bottom:7px;
  color:var(--color-text)!important;
  font-size:.77rem;
  font-weight:820;
  letter-spacing:.025em;
}
.portal-body :where(input:not([type="checkbox"]):not([type="radio"]),select,textarea,.mini-input){
  min-height:47px;
  padding:10px 13px;
  border:1px solid var(--color-border-strong)!important;
  border-radius:var(--premium-control-radius)!important;
  background:var(--color-surface-elevated)!important;
  color:var(--color-text)!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.35),0 2px 7px rgba(15,35,57,.025);
  transition:border-color .18s ease,box-shadow .18s ease,background .18s ease;
}
.portal-body textarea{min-height:112px;resize:vertical}
.portal-body :where(input,select,textarea,.mini-input):focus{
  border-color:color-mix(in srgb,var(--premium-blue) 66%,var(--color-border))!important;
  box-shadow:0 0 0 4px color-mix(in srgb,var(--premium-blue) 13%,transparent),inset 0 1px 0 rgba(255,255,255,.25)!important;
  outline:0!important;
}
.portal-body input[type="file"]{padding:5px!important;overflow:hidden}
.portal-body input[type="file"]::file-selector-button{
  min-height:35px;
  margin-right:10px;
  padding:7px 12px;
  border:0;
  border-radius:9px;
  background:var(--color-surface-alt);
  color:var(--color-text);
  font-weight:760;
  cursor:pointer;
}
.portal-body .inline-actions{gap:8px}
.portal-body .inline-actions :where(input,select,.mini-input){min-height:38px;padding:7px 10px;border-radius:10px!important}
.portal-body .btn{
  min-height:42px;
  padding:10px 16px;
  border:1px solid transparent!important;
  border-radius:12px!important;
  background:linear-gradient(135deg,#18527d,#103b5e)!important;
  color:#fff!important;
  font-weight:780;
  box-shadow:0 9px 22px rgba(16,59,94,.18)!important;
  transition:transform .18s ease,filter .18s ease,box-shadow .18s ease;
}
.portal-body .btn:hover{transform:translateY(-1px);filter:brightness(1.045);box-shadow:0 13px 27px rgba(16,59,94,.22)!important}
.portal-body .btn-secondary{background:linear-gradient(135deg,#e5b653,#ca912d)!important;color:#172333!important;box-shadow:0 9px 22px rgba(201,145,45,.19)!important}
.portal-body .btn-ghost{
  background:var(--color-surface-alt)!important;
  color:var(--color-text)!important;
  border-color:var(--color-border)!important;
  box-shadow:none!important;
}
.portal-body .btn-danger{background:linear-gradient(135deg,#b94549,#942d33)!important;color:#fff!important}
.portal-body .btn-success{background:linear-gradient(135deg,#23815b,#176744)!important;color:#fff!important}
.portal-body .btn-warning{background:linear-gradient(135deg,#e0a63a,#bf7d17)!important;color:#211705!important}
.portal-body .btn-sm{min-height:35px;padding:7px 12px;border-radius:10px!important;font-size:.78rem;box-shadow:none!important}

/* Premium tables - covers table-wrap and table-responsive on every page */
.portal-body :where(.table-wrap,.table-responsive,.document-review-table-wrap,.staff-responsive-table-wrap){
  overflow:auto;
  max-width:100%;
  border:1px solid var(--color-border)!important;
  border-radius:17px!important;
  background:var(--color-surface)!important;
  box-shadow:0 10px 28px rgba(15,35,57,.055),inset 0 1px 0 rgba(255,255,255,.30)!important;
  scrollbar-width:thin;
  scrollbar-color:var(--color-border-strong) transparent;
}
.portal-body :where(.table-wrap,.table-responsive,.document-review-table-wrap,.staff-responsive-table-wrap)::-webkit-scrollbar{height:9px;width:9px}
.portal-body :where(.table-wrap,.table-responsive,.document-review-table-wrap,.staff-responsive-table-wrap)::-webkit-scrollbar-thumb{border:2px solid transparent;border-radius:999px;background:var(--color-border-strong);background-clip:padding-box}
.portal-body :where(.table-wrap,.table-responsive) table{
  width:100%;
  min-width:780px;
  margin:0;
  border-collapse:separate;
  border-spacing:0;
}
.portal-body .workflow-tabs .table-responsive table{min-width:820px}
.portal-body :where(.table-wrap,.table-responsive) thead th{
  position:sticky;
  top:0;
  z-index:2;
  padding:14px 16px!important;
  border:0!important;
  border-right:1px solid rgba(255,255,255,.075)!important;
  background:linear-gradient(180deg,#193f60,#102b45)!important;
  color:#eef6fc!important;
  font-size:.67rem!important;
  font-weight:850!important;
  line-height:1.3;
  letter-spacing:.095em!important;
  text-transform:uppercase;
  white-space:nowrap;
}
.portal-body :where(.table-wrap,.table-responsive) thead th:first-child{padding-left:20px!important}
.portal-body :where(.table-wrap,.table-responsive) thead th:last-child{padding-right:20px!important;border-right:0!important}
.portal-body :where(.table-wrap,.table-responsive) tbody td{
  padding:14px 16px!important;
  border:0!important;
  border-bottom:1px solid var(--color-border)!important;
  background:transparent!important;
  color:var(--color-text)!important;
  font-size:.86rem;
  line-height:1.48;
  vertical-align:middle;
}
.portal-body :where(.table-wrap,.table-responsive) tbody td:first-child{padding-left:20px!important}
.portal-body :where(.table-wrap,.table-responsive) tbody td:last-child{padding-right:20px!important}
.portal-body :where(.table-wrap,.table-responsive) tbody tr:nth-child(even){background:color-mix(in srgb,var(--color-surface-alt) 44%,var(--color-surface))!important}
.portal-body :where(.table-wrap,.table-responsive) tbody tr:hover{background:color-mix(in srgb,var(--premium-blue) 7%,var(--color-surface))!important}
.portal-body :where(.table-wrap,.table-responsive) tbody tr:last-child td{border-bottom:0!important}
.portal-body :where(.table-wrap,.table-responsive) td strong{color:var(--color-text)!important;font-weight:820;letter-spacing:-.012em}
.portal-body :where(.table-wrap,.table-responsive) td small{display:inline-block;margin-top:3px;color:var(--color-text-muted)!important;font-size:.74rem}
.portal-body :where(.table-wrap,.table-responsive) tbody:empty::after{
  content:"No records available";
  display:block;
  min-width:100%;
  padding:26px 20px;
  color:var(--color-text-muted);
  font-size:.84rem;
  text-align:center;
}

/* Supporting components */
.portal-body :where(.summary-box,.notice,.empty,.empty-state,.card.soft,.onboarding-check,.check-grid,.staff-renewal-box,.staff-warning-reason){
  border:1px solid var(--color-border)!important;
  border-radius:16px!important;
  background:color-mix(in srgb,var(--color-surface-alt) 70%,var(--color-surface))!important;
  color:var(--color-text-muted)!important;
}
.portal-body .summary-box{padding:19px}
.portal-body .notice{position:relative;padding:15px 17px 15px 20px;border-left:4px solid var(--premium-blue)!important}
.portal-body :where(.empty,.empty-state){min-height:105px;display:grid;place-items:center;padding:26px;border-style:dashed!important}
.portal-body .metric-card{
  position:relative;
  overflow:hidden;
  min-height:145px;
  padding:21px;
  border:1px solid var(--color-border)!important;
  border-radius:19px!important;
  background:linear-gradient(145deg,var(--color-surface),color-mix(in srgb,var(--premium-blue) 3%,var(--color-surface)))!important;
  box-shadow:0 14px 37px rgba(15,35,57,.07)!important;
}
.portal-body .metric-card::before{
  content:"";
  position:absolute;
  inset:0 0 auto;
  height:3px;
  background:linear-gradient(90deg,var(--premium-gold),var(--premium-blue));
}
.portal-body .data-list{gap:0;border:1px solid var(--color-border);border-radius:15px;overflow:hidden;background:var(--color-surface)}
.portal-body .data-list :where(dt,dd){margin:0;padding:11px 14px;border-bottom:1px solid var(--color-border)}
.portal-body .data-list :where(dt,dd):nth-last-child(-n+2){border-bottom:0}
.portal-body .data-list dt{background:color-mix(in srgb,var(--color-surface-alt) 72%,var(--color-surface));font-size:.76rem;font-weight:800}
.portal-body .status{
  min-height:27px;
  display:inline-flex;
  align-items:center;
  padding:5px 10px;
  border:1px solid color-mix(in srgb,currentColor 18%,transparent);
  border-radius:999px;
  font-size:.67rem;
  font-weight:820;
  letter-spacing:.035em;
  text-transform:capitalize;
}
.portal-body .pagination{display:flex;flex-wrap:wrap;gap:7px;align-items:center}
.portal-body .pagination a,
.portal-body .pagination span{
  min-width:38px;
  min-height:38px;
  display:grid;
  place-items:center;
  padding:7px 10px;
  border:1px solid var(--color-border);
  border-radius:10px;
  background:var(--color-surface);
  color:var(--color-text)!important;
  text-decoration:none;
  font-weight:750;
}

/* Dark-mode depth and contrast */
html[data-theme="dark"] .portal-body :where(.panel,.card,.form-card,.table-card,.filter-card,.switch-card,.health-item,.auth-card,.content-page .content){
  background:linear-gradient(145deg,var(--color-surface),color-mix(in srgb,var(--premium-blue) 4%,var(--color-surface)))!important;
  box-shadow:var(--premium-card-shadow)!important;
}
html[data-theme="dark"] .portal-body .workflow-tabs>.tabs{background:color-mix(in srgb,var(--color-surface) 91%,transparent)!important}
html[data-theme="dark"] .portal-body .workflow-tabs>.tabs .tab-btn{background:var(--color-surface-elevated)!important}
html[data-theme="dark"] .portal-body .workflow-tabs>.tabs .tab-btn.active{background:linear-gradient(135deg,#efc66f,#d49b32)!important;color:#172333!important}
html[data-theme="dark"] .portal-body .workflow-tabs .panel>form{background:color-mix(in srgb,var(--color-surface-alt) 66%,var(--color-surface))}
html[data-theme="dark"] .portal-body :where(input:not([type="checkbox"]):not([type="radio"]),select,textarea,.mini-input){box-shadow:inset 0 1px 0 rgba(255,255,255,.025)!important}
html[data-theme="dark"] .portal-body :where(.table-wrap,.table-responsive) tbody tr:nth-child(even){background:color-mix(in srgb,var(--color-surface-alt) 58%,var(--color-surface))!important}
html[data-theme="dark"] .portal-body :where(.table-wrap,.table-responsive) tbody tr:hover{background:color-mix(in srgb,var(--premium-blue) 12%,var(--color-surface))!important}

@media(max-width:980px){
  .portal-body .portal-content>.page-head:not(.dashboard-hero){min-height:0;align-items:flex-start;flex-direction:column}
  .portal-body .portal-content>.page-head:not(.dashboard-hero)>.actions{width:100%;justify-content:flex-start}
  .portal-body .workflow-tabs .field-grid-3{grid-template-columns:repeat(2,minmax(0,1fr))}
  .portal-body .panel-head{align-items:flex-start;flex-direction:column}
}
@media(max-width:760px){
  .portal-body .portal-content{padding:18px 14px 34px}
  .portal-body .portal-content>.page-head:not(.dashboard-hero){padding:23px 20px;border-radius:22px!important}
  .portal-body .portal-content>.page-head:not(.dashboard-hero) h2{font-size:1.75rem}
  .portal-body .portal-content>.page-head:not(.dashboard-hero)>.actions{display:grid;grid-template-columns:1fr 1fr}
  .portal-body .portal-content>.page-head:not(.dashboard-hero)>.actions .btn{width:100%}
  .portal-body .workflow-tabs>.tabs{top:86px;margin-inline:-2px}
  .portal-body .panel{padding:21px 18px;border-radius:19px!important}
  .portal-body .panel::before{left:20px;right:20px}
  .portal-body .workflow-tabs .panel>form{padding:16px}
  .portal-body .workflow-tabs .field-grid-3{grid-template-columns:1fr}
  .portal-body :where(.table-wrap,.table-responsive) table{min-width:720px}
}
@media(max-width:520px){
  .portal-body .portal-content>.page-head:not(.dashboard-hero)>.actions{grid-template-columns:1fr}
  .portal-body .panel-head>a,.portal-body .section-head>a,.portal-body .heading-link{width:100%;justify-content:center}
  .portal-body .inline-actions{flex-direction:column;align-items:stretch}
  .portal-body .inline-actions>*{width:100%!important}
  .portal-body .btn{width:100%}
}

/* v6.2.0-premiumreview.5 - light contrast + uninterrupted sequential staff review */
.document-review-bar [hidden],
.document-review-controls [hidden],
.document-review-feedback[hidden],
.document-review-queue[hidden]{display:none!important}

/* Final light-mode contrast protection for the dark employee hero. */
html[data-theme="light"] .staff-record-hero{
  color:#fff!important;
}
html[data-theme="light"] .staff-record-hero .staff-record-identity h1,
html[data-theme="light"] .staff-record-hero .staff-record-identity>p,
html[data-theme="light"] .staff-record-hero .staff-record-chip,
html[data-theme="light"] .staff-record-hero .staff-record-chip strong,
html[data-theme="light"] .staff-record-hero .staff-record-summary span,
html[data-theme="light"] .staff-record-hero .staff-record-summary strong,
html[data-theme="light"] .staff-record-hero .status{
  color:#fff!important;
}
html[data-theme="light"] .staff-record-hero .staff-record-identity>p,
html[data-theme="light"] .staff-record-hero .staff-record-summary span{color:rgba(245,250,255,.78)!important}
html[data-theme="light"] .staff-record-hero .staff-record-chip strong{color:#f3cb72!important}
html[data-theme="light"] .staff-record-hero .staff-record-chip,
html[data-theme="light"] .staff-record-hero .status{
  background:rgba(255,255,255,.10)!important;
  border-color:rgba(255,255,255,.17)!important;
}
html[data-theme="light"] .staff-record-hero .btn-ghost{
  background:rgba(255,255,255,.10)!important;
  color:#fff!important;
  border-color:rgba(255,255,255,.20)!important;
}
html[data-theme="light"] .staff-record-hero .btn-secondary{color:#172537!important}

/* Light surfaces always use dark readable typography. */
html[data-theme="light"] .premium-document-review-panel,
html[data-theme="light"] .premium-document-review-panel td,
html[data-theme="light"] .document-modal-dialog,
html[data-theme="light"] .document-review-bar,
html[data-theme="light"] .document-modal-actions{
  color:#142033!important;
}
html[data-theme="light"] .premium-document-review-panel :where(h2,h3,strong,label),
html[data-theme="light"] .document-modal-dialog :where(h2,h3,strong,label){color:#142033!important}
html[data-theme="light"] .premium-document-review-panel :where(p,small,.muted),
html[data-theme="light"] .document-modal-dialog :where(p,small,.muted){color:#607087!important}
html[data-theme="light"] .premium-document-review-panel thead th{color:#fff!important}
html[data-theme="light"] .document-review-panel-head .eyebrow,
html[data-theme="light"] .document-review-copy>.eyebrow{color:#8b6420!important}
html[data-theme="light"] .document-modal-footer-actions .btn-secondary{color:#18202c!important}

/* Compact, aligned premium decisions. */
.document-review-bar{
  grid-template-columns:minmax(205px,.55fr) minmax(0,1.45fr)!important;
  gap:18px!important;
  padding:15px 20px!important;
}
.document-review-copy{align-content:start!important;gap:4px!important}
.document-review-copy>strong{font-size:.96rem!important}
.document-review-copy>small{font-size:.72rem!important}
.document-review-queue{
  display:grid;
  gap:2px;
  margin-top:9px;
  padding:9px 11px;
  border:1px solid var(--color-border);
  border-radius:11px;
  background:var(--color-surface);
}
.document-review-queue>span{
  color:var(--color-text-muted);
  font-size:.62rem;
  font-weight:850;
  letter-spacing:.075em;
  text-transform:uppercase;
}
.document-review-queue>strong{color:var(--color-text)!important;font-size:.79rem!important}
.document-review-queue>small{color:var(--color-text-muted)!important;font-size:.68rem!important}

.document-review-controls{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) auto!important;
  grid-template-areas:"reason actions" "feedback feedback"!important;
  align-items:end!important;
  gap:9px 12px!important;
}
.document-decline-field{grid-area:reason!important;display:grid!important;gap:4px!important;min-width:0}
.document-decline-field textarea{
  min-height:42px!important;
  height:42px!important;
  max-height:76px!important;
  padding:8px 10px!important;
  border-radius:10px!important;
  resize:vertical!important;
  font-size:.78rem!important;
}
.document-decline-field>small{font-size:.62rem!important;line-height:1!important}
.document-decision-actions{
  grid-area:actions;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
  padding-bottom:16px;
}
.document-decision-actions form,
.document-approve-form,
.document-decline-form{
  display:block!important;
  width:auto!important;
  margin:0!important;
}
.document-decision-button{
  width:148px!important;
  min-width:148px!important;
  max-width:148px!important;
  min-height:40px!important;
  height:40px!important;
  padding:8px 12px!important;
  border-radius:10px!important;
  font-size:.76rem!important;
  white-space:nowrap;
  box-shadow:0 8px 18px rgba(15,35,57,.13)!important;
}
.document-decision-button svg{width:16px!important;height:16px!important;flex-basis:16px!important}
.document-review-controls button[aria-busy="true"]{cursor:wait!important;opacity:.72!important}
.document-modal.is-review-busy .document-modal-close,
.document-modal.is-review-busy [data-document-close]{pointer-events:none;opacity:.55}

.document-review-feedback{
  grid-area:feedback;
  display:grid;
  grid-template-columns:auto minmax(0,1fr) auto;
  align-items:center;
  gap:10px;
  min-height:48px;
  padding:9px 11px;
  border:1px solid #aad9c3;
  border-radius:12px;
  background:#eaf8f1;
  color:#155d40!important;
}
.document-review-feedback.is-error{border-color:#efb9bd;background:#fff0f1;color:#982f37!important}
.document-review-feedback-icon{
  display:grid;
  place-items:center;
  width:28px;
  height:28px;
  border-radius:9px;
  background:#1f8b60;
  color:#fff;
  font-weight:900;
}
.document-review-feedback.is-error .document-review-feedback-icon{background:#b63843}
.document-review-feedback>div{display:grid;gap:1px;min-width:0}
.document-review-feedback strong{color:inherit!important;font-size:.78rem!important}
.document-review-feedback small{color:inherit!important;font-size:.69rem!important;line-height:1.35}
.document-review-feedback .btn{min-height:34px!important;padding:6px 9px!important;font-size:.68rem!important}

/* Review results update in place without a page jump. */
.document-review-row{scroll-margin-top:135px}
.document-review-row.is-reviewed{position:relative}
.document-review-row.is-reviewed:after{
  content:"";
  position:absolute;
  inset:3px;
  pointer-events:none;
  border:1px solid transparent;
  border-radius:12px;
}
.document-review-row.review-result-approved:after{border-color:rgba(35,129,91,.25)}
.document-review-row.review-result-declined:after{border-color:rgba(185,69,73,.25)}
.document-review-row.is-review-focus{animation:documentReviewFocus 1.75s ease}
@keyframes documentReviewFocus{
  0%,100%{box-shadow:none}
  18%,72%{box-shadow:inset 4px 0 0 #d5a640,0 0 0 3px rgba(213,166,64,.14)}
}
.document-row-actions{min-width:145px!important}
.document-row-actions .document-review-button{min-width:132px!important}

/* Download exists only inside the protected preview. */
.document-modal-footer-actions .btn{min-width:138px!important}

html[data-theme="dark"] .document-review-queue{background:#142331;border-color:#34475a}
html[data-theme="dark"] .document-review-feedback{border-color:#285f4a;background:#123629;color:#8de0b8!important}
html[data-theme="dark"] .document-review-feedback.is-error{border-color:#6b343a;background:#3b2025;color:#ffabb0!important}

@media(max-width:900px){
  .document-review-bar{grid-template-columns:1fr!important}
  .document-review-copy{grid-template-columns:minmax(0,1fr) auto;align-items:center}
  .document-review-copy>.eyebrow,.document-review-copy>small{display:none}
  .document-review-queue{margin-top:0}
}
@media(max-width:700px){
  .document-review-controls{
    grid-template-columns:1fr!important;
    grid-template-areas:"reason" "actions" "feedback"!important;
  }
  .document-decision-actions{justify-content:stretch;padding-bottom:0}
  .document-decision-actions form{flex:1 1 50%;min-width:0}
  .document-decision-button{width:100%!important;min-width:0!important;max-width:none!important}
  .document-review-feedback{grid-template-columns:auto minmax(0,1fr)}
  .document-review-feedback .btn{grid-column:1/-1;width:100%!important}
}
@media(max-width:520px){
  .document-review-copy{display:block!important}
  .document-review-copy>strong{display:none}
  .document-review-queue{display:grid!important}
  .document-review-bar{max-height:45dvh!important;padding:10px 11px!important}
  .document-decline-field textarea{height:44px!important}
  .document-modal-footer-actions{grid-template-columns:1fr 1fr!important}
  .document-modal-footer-actions>a{display:inline-flex!important}
  .document-modal-footer-actions .btn{min-width:0!important}
}
