/* FinRestore Brandbook v1.0 — application visual system.
   Loaded after the legacy stylesheet while the templates migrate to shared
   primitives. It changes presentation only; page structure and behavior stay
   owned by the existing application. */

:root,
:root[data-theme="light"] {
  --bg: var(--fr-color-canvas);
  --bg-primary: var(--fr-color-canvas);
  --bg-secondary: var(--fr-color-surface);
  --bg-tertiary: var(--fr-color-surface-muted);
  --surface: var(--fr-color-surface);
  --surface-hover: var(--fr-color-surface-muted);
  --surface-strong: var(--fr-color-surface-muted);
  --border: var(--fr-color-border);
  --border-strong: var(--fr-color-border-strong);
  --border-hover: var(--fr-color-action);
  --text: var(--fr-color-text);
  --text-primary: var(--fr-color-text);
  --text-secondary: var(--fr-color-text-secondary);
  --text-muted: var(--fr-color-text-muted);
  --text-dim: var(--fr-color-text-muted);
  --primary: var(--fr-color-action);
  --primary-strong: var(--fr-color-action-hover);
  --primary-soft: var(--fr-color-action-soft);
  --primary-border: color-mix(in srgb, var(--fr-color-action) 34%, var(--fr-color-border));
  --primary-text: var(--fr-color-action);
  --primary-glow: transparent;
  --accent: var(--fr-color-info);
  --accent-soft: var(--fr-color-info-soft);
  --positive: var(--fr-color-success);
  --positive-bg: var(--fr-color-success-soft);
  --positive-border: color-mix(in srgb, var(--fr-color-success) 35%, var(--fr-color-border));
  --positive-text: var(--fr-color-success);
  --danger: var(--fr-color-danger);
  --danger-soft: var(--fr-color-danger-soft);
  --negative: var(--fr-color-danger);
  --negative-bg: var(--fr-color-danger-soft);
  --negative-border: color-mix(in srgb, var(--fr-color-danger) 35%, var(--fr-color-border));
  --negative-text: var(--fr-color-danger);
  --warning: var(--fr-color-warning);
  --warning-soft: var(--fr-color-warning-soft);
  --caution: var(--fr-color-warning);
  --caution-bg: var(--fr-color-warning-soft);
  --caution-border: color-mix(in srgb, var(--fr-color-warning) 38%, var(--fr-color-border));
  --caution-text: var(--fr-color-warning);
  --info: var(--fr-color-info);
  --info-soft: var(--fr-color-info-soft);
  --neutral: var(--fr-color-info);
  --neutral-bg: var(--fr-color-info-soft);
  --neutral-border: color-mix(in srgb, var(--fr-color-info) 32%, var(--fr-color-border));
  --radius: var(--fr-radius-surface);
  --radius-sm: var(--fr-radius-medium);
  --radius-xs: var(--fr-radius-small);
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: var(--fr-shadow-floating);
}

html {
  color-scheme: light;
  background: var(--fr-color-canvas);
}

html[data-theme="dark"] { color-scheme: dark; }

body,
button,
input,
select,
textarea {
  font-family: var(--fr-font-ui);
}

body {
  min-height: 100vh;
  color: var(--fr-color-text);
  background: var(--fr-color-canvas);
  font-size: var(--fr-text-body);
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body::before,
body::after { content: none; }

h1,
h2,
h3,
h4,
h5,
h6,
.panel h1,
.panel h2,
.panel h3 {
  font-family: var(--fr-font-display);
  color: var(--fr-color-text);
  letter-spacing: -.025em;
}

h1,
.panel h1 { font-size: var(--fr-text-page); line-height: 1.18; }
h2,
.panel h2 { font-size: var(--fr-text-section); line-height: 1.28; }
h3,
.panel h3 { font-size: var(--fr-text-block); line-height: 1.35; }

a { color: var(--fr-color-action); }
a:hover { color: var(--fr-color-action-hover); }

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--fr-color-focus);
  outline-offset: 2px;
}

::selection {
  color: var(--fr-color-text);
  background: color-mix(in srgb, var(--fr-color-action) 18%, transparent);
}

/* Approved responsive logo lockups. */
.fr-brand-logo {
  position: relative;
  display: block;
  flex: 0 0 auto;
  width: 152px;
  min-width: 116px;
  aspect-ratio: 895 / 215;
}

.fr-brand-logo img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.fr-brand-logo img.fr-brand-logo__dark { display: none; }
html[data-theme="dark"] .fr-brand-logo img.fr-brand-logo__light { display: none; }
html[data-theme="dark"] .fr-brand-logo img.fr-brand-logo__dark {
  display: block;
  /* The approved dark-surface lockup keeps the exact mark geometry while
     presenting the complete signature as a high-contrast light mark. */
  filter: grayscale(1) brightness(0) invert(1);
}
.fr-brand-logo--app { width: 142px; }

/* Shared application shell. */
.page-header,
.pro-app-header {
  position: relative;
  top: auto;
  z-index: 100;
  margin: 0;
  padding: 0;
  border-bottom: 1px solid var(--fr-color-border);
  background: var(--fr-color-surface);
}

.page-header-inner,
.pro-app-header-inner {
  width: min(1360px, 100%);
  min-height: var(--fr-header-height);
  height: var(--fr-header-height);
  margin: 0 auto;
  padding: 0 var(--fr-space-5);
  border: 0;
  border-radius: 0;
  background: var(--fr-color-surface);
  box-shadow: none;
  backdrop-filter: none;
}

.brand,
.pro-app-brand {
  display: inline-flex;
  align-items: center;
  min-width: max-content;
  color: var(--fr-color-text);
}

.auth-nav,
.pro-app-account { gap: var(--fr-space-2); }

.user-chip {
  min-height: var(--fr-control-height-small);
  padding: 5px var(--fr-space-3);
  border-color: var(--fr-color-border);
  border-radius: var(--fr-radius-small);
  background: var(--fr-color-surface-muted);
  color: var(--fr-color-text-secondary);
  font-size: var(--fr-text-secondary);
}

.user-chip::before {
  width: 5px;
  height: 5px;
  background: var(--fr-color-success);
  box-shadow: none;
}

.pro-app-nav { gap: 2px; }
.pro-app-nav a {
  min-height: var(--fr-control-height-small);
  padding: 7px 9px;
  border-radius: var(--fr-radius-small);
  color: var(--fr-color-text-secondary);
  font-size: var(--fr-text-secondary);
  font-weight: 600;
}

.pro-app-nav a:hover,
.pro-app-nav a.is-active {
  color: var(--fr-color-action);
  background: var(--fr-color-action-soft);
}

.pro-app-header--compact .pro-app-header-inner {
  height: 44px;
  min-height: 44px;
  padding-inline: var(--fr-space-4);
}

.pro-app-header--compact .fr-brand-logo--app { width: 128px; }

.pro-app-account-label {
  max-width: 220px;
  overflow: hidden;
  color: var(--fr-color-text-muted);
  font-size: var(--fr-text-meta);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pro-app-theme-toggle,
.theme-toggle,
.pro-app-logout {
  color: var(--fr-color-text-secondary);
  border: 1px solid var(--fr-color-border);
  background: transparent;
  box-shadow: none;
}

.pro-app-theme-toggle,
.theme-toggle {
  width: var(--fr-control-height-small);
  min-width: var(--fr-control-height-small);
  height: var(--fr-control-height-small);
  min-height: var(--fr-control-height-small);
  padding: 0;
  border-radius: var(--fr-radius-small);
}

.pro-app-theme-toggle:hover,
.theme-toggle:hover,
.pro-app-logout:hover {
  color: var(--fr-color-action);
  border-color: var(--fr-color-border-strong);
  background: var(--fr-color-surface-muted);
  box-shadow: none;
  transform: none;
}

.pro-app-notifications {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.pro-app-notification-toggle,
.pro-app-notification-close {
  display: inline-grid;
  place-items: center;
  margin: 0;
  padding: 0;
  border: 1px solid var(--fr-color-border);
  border-radius: var(--fr-radius-small);
  background: transparent;
  color: var(--fr-color-text-secondary);
  box-shadow: none;
}

.pro-app-notification-toggle {
  position: relative;
  width: var(--fr-control-height-small);
  min-width: var(--fr-control-height-small);
  height: var(--fr-control-height-small);
  min-height: var(--fr-control-height-small);
}

.pro-app-notification-toggle svg { width: 18px; height: 18px; }
.pro-app-notification-close { width: 28px; min-width: 28px; height: 28px; min-height: 28px; }
.pro-app-notification-close svg { width: 16px; height: 16px; }

.pro-app-notification-count {
  position: absolute;
  top: -6px;
  right: -6px;
  display: inline-grid;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  place-items: center;
  border: 2px solid var(--fr-color-surface);
  border-radius: var(--fr-radius-small);
  background: var(--fr-color-danger);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.pro-app-notification-count[hidden],
.pro-app-notification-panel[hidden],
.pro-app-notification-new[hidden] { display: none; }

.pro-app-notification-panel {
  position: absolute;
  z-index: 300;
  top: calc(100% + var(--fr-space-2));
  right: 0;
  width: min(460px, calc(100vw - 24px));
  max-height: min(680px, calc(100vh - 80px));
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--fr-color-border-strong);
  border-radius: var(--fr-radius-surface);
  background: var(--fr-color-surface);
  color: var(--fr-color-text);
  box-shadow: var(--fr-shadow-floating);
}

.pro-app-notification-panel__header {
  position: sticky;
  z-index: 1;
  top: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--fr-space-3);
  padding: var(--fr-space-4);
  border-bottom: 1px solid var(--fr-color-border);
  background: var(--fr-color-surface);
}

.pro-app-notification-panel__header > div {
  display: grid;
  gap: 2px;
}

.pro-app-notification-panel__header strong { font-family: var(--fr-font-display); }
.pro-app-notification-panel__header span {
  color: var(--fr-color-text-muted);
  font-size: var(--fr-text-meta);
}

.pro-app-notification-list {
  display: grid;
  gap: var(--fr-space-3);
  padding: var(--fr-space-3);
}

.pro-app-notification-item {
  display: grid;
  gap: var(--fr-space-2);
  padding: var(--fr-space-3);
  border: 1px solid var(--fr-color-border);
  border-left: 3px solid var(--fr-color-warning);
  border-radius: var(--fr-radius-surface);
  background: var(--fr-color-surface-muted);
}

.pro-app-notification-item.is-read { border-left-color: var(--fr-color-border-strong); }
.pro-app-notification-item__heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--fr-space-3);
}
.pro-app-notification-item__heading > strong { font-family: var(--fr-font-display); }
.pro-app-notification-item p { margin: 0; color: var(--fr-color-text-secondary); line-height: 1.5; }
.pro-app-notification-item .pro-app-notification-summary { color: var(--fr-color-text); font-weight: 600; }
.pro-app-notification-action {
  padding-top: var(--fr-space-2);
  border-top: 1px solid var(--fr-color-border-subtle);
}
.pro-app-notification-action strong { color: var(--fr-color-text); }
.pro-app-notification-new {
  flex: 0 0 auto;
  padding: 3px 6px;
  border-radius: var(--fr-radius-small);
  background: var(--fr-color-warning-soft);
  color: var(--fr-color-warning);
  font-size: 10px;
  font-weight: 800;
}
.pro-app-notification-empty { margin: 0; padding: var(--fr-space-5); color: var(--fr-color-text-muted); }

.pro-app-notification-toggle:focus-visible,
.pro-app-notification-close:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--fr-color-action) 45%, transparent);
  outline-offset: 2px;
}

/* Shared controls. */
button,
.actions a,
.artifact-links a,
.button-link,
input[type="submit"],
.primary-button {
  min-height: var(--fr-control-height);
  padding: 7px var(--fr-space-4);
  border: 1px solid var(--fr-color-action);
  border-radius: var(--fr-radius-control);
  background: var(--fr-color-action);
  color: #fff;
  box-shadow: none;
  font-family: var(--fr-font-ui);
  font-size: var(--fr-text-body);
  font-weight: 600;
  line-height: 1.25;
  transition: background-color .14s ease, border-color .14s ease, color .14s ease;
}

:root[data-theme] button,
:root[data-theme] input[type="submit"] {
  border-color: var(--fr-color-action);
  background: var(--fr-color-action);
  color: #fff;
  box-shadow: none;
}

:root[data-theme] button.theme-toggle,
:root[data-theme] button.pro-app-theme-toggle,
:root[data-theme] button.pro-app-notification-toggle,
:root[data-theme] button.pro-app-notification-close,
:root[data-theme] button.pro-app-logout {
  border-color: var(--fr-color-border);
  background: transparent;
  color: var(--fr-color-text-secondary);
  box-shadow: none;
}

:root[data-theme] button.theme-toggle:hover,
:root[data-theme] button.pro-app-theme-toggle:hover,
:root[data-theme] button.pro-app-notification-toggle:hover,
:root[data-theme] button.pro-app-notification-close:hover,
:root[data-theme] button.pro-app-logout:hover {
  border-color: var(--fr-color-border-strong);
  background: var(--fr-color-surface-muted);
  color: var(--fr-color-action);
}

button:hover,
.actions a:hover,
.artifact-links a:hover,
.button-link:hover,
input[type="submit"]:hover,
.primary-button:hover {
  border-color: var(--fr-color-action-hover);
  background: var(--fr-color-action-hover);
  color: #fff;
  box-shadow: none;
  transform: none;
}

button:active,
.button-link:active { background: var(--fr-color-action-active); }

button:disabled,
input[type="submit"]:disabled,
[aria-disabled="true"] {
  cursor: not-allowed;
  border-color: var(--fr-color-disabled);
  background: var(--fr-color-disabled);
  color: var(--fr-color-disabled-text);
  box-shadow: none;
  opacity: 1;
}

.secondary-button,
button.secondary-button,
a.secondary-button,
.pro-app-logout {
  border-color: var(--fr-color-border-strong);
  background: var(--fr-color-surface);
  color: var(--fr-color-text);
}

:root[data-theme] button.secondary-button,
:root[data-theme] .secondary-button.button-link,
:root[data-theme] button.pro-app-logout {
  border-color: var(--fr-color-border-strong);
  background: var(--fr-color-surface);
  color: var(--fr-color-text);
  box-shadow: none;
}

.secondary-button:hover,
button.secondary-button:hover,
a.secondary-button:hover {
  border-color: var(--fr-color-action);
  background: var(--fr-color-action-soft);
  color: var(--fr-color-action);
}

.danger-button,
.destructive-button {
  border-color: var(--fr-color-danger);
  background: var(--fr-color-danger);
}

/* Surfaces, hierarchy and compact content rhythm. */
.page-content {
  width: var(--fr-container);
  max-width: none;
  padding: var(--fr-space-6) 0 var(--fr-space-12);
  gap: var(--fr-space-4);
  align-items: start;
}

.panel,
.section-card {
  padding: var(--fr-space-5);
  border: 1px solid var(--fr-color-border);
  border-radius: var(--fr-radius-surface);
  background: var(--fr-color-surface);
  box-shadow: none;
  backdrop-filter: none;
  transition: border-color .14s ease;
}

.panel:hover { border-color: var(--fr-color-border); }
.panel h1 { margin: 0 0 var(--fr-space-2); }
.panel h2 { margin: var(--fr-space-6) 0 var(--fr-space-3); }
.panel h3 { margin: 0 0 var(--fr-space-2); }
.muted,
.muted-text { color: var(--fr-color-text-secondary); }
.empty-state { color: var(--fr-color-text-muted); }

.pro-portal-shell {
  width: min(1360px, 100%);
  padding: var(--fr-space-2) 0 var(--fr-space-8);
}

.pro-portal-shell--narrow { max-width: 840px; }
.pro-portal-heading { margin-bottom: var(--fr-space-4); }
.pro-portal-heading h1 { margin: 0 0 var(--fr-space-1); }
.pro-portal-heading p { font-size: var(--fr-text-body); }
.pro-portal-panel { padding: var(--fr-space-5); }

.pro-home-shell { gap: var(--fr-space-3); }
.pro-home-hero {
  padding: var(--fr-space-5);
  background: var(--fr-color-surface);
  border-left: 3px solid var(--fr-color-action);
}
.pro-home-hero h2 { margin: 0 0 var(--fr-space-2); font-size: var(--fr-text-section); }
.pro-home-grid,
.pro-home-quick-links { gap: var(--fr-space-3); }
.pro-home-card,
.pro-home-link-card { padding: var(--fr-space-4); }
.pro-home-card strong,
.billing-kpis strong,
.identity-balance-panel h2 strong {
  color: var(--fr-color-text);
  font-family: var(--fr-font-display);
  font-variant-numeric: tabular-nums;
}
.pro-home-card strong { font-size: var(--fr-text-kpi); }
.pro-home-recent { padding: var(--fr-space-4); }
.pro-home-case-list { gap: 0; }
.pro-home-case-row {
  padding: var(--fr-space-3) 0;
  border: 0;
  border-bottom: 1px solid var(--fr-color-border-subtle);
  border-radius: 0;
  background: transparent;
}
.pro-home-case-row:last-child { border-bottom: 0; }
.pro-home-link-card:hover { border-color: var(--fr-color-action); }

/* Forms. */
.auth-form,
.pro-portal-upload-form { gap: var(--fr-space-3); }
.auth-form label,
.pro-portal-upload-form label {
  gap: var(--fr-space-1);
  color: var(--fr-color-text);
  font-size: var(--fr-text-secondary);
  font-weight: 600;
}

.auth-form input,
.auth-form select,
.auth-form textarea,
.billing-key-activation-row input,
input[type="file"] {
  width: 100%;
  min-height: var(--fr-control-height-large);
  padding: 9px var(--fr-space-3);
  border: 1px solid var(--fr-color-border-strong);
  border-radius: var(--fr-radius-control);
  background: var(--fr-color-surface);
  color: var(--fr-color-text);
  box-shadow: none;
  font: inherit;
}

.auth-form textarea { min-height: 112px; resize: vertical; }
.auth-form input:hover,
.auth-form select:hover,
.auth-form textarea:hover,
input[type="file"]:hover { border-color: var(--fr-color-text-muted); }
.auth-form input:focus,
.auth-form select:focus,
.auth-form textarea:focus,
.billing-key-activation-row input:focus {
  outline: 2px solid color-mix(in srgb, var(--fr-color-focus) 38%, transparent);
  outline-offset: 1px;
  border-color: var(--fr-color-focus);
  background: var(--fr-color-surface);
  box-shadow: none;
}

input[type="checkbox"],
input[type="radio"] { accent-color: var(--fr-color-action); }

input[type="file"]::file-selector-button {
  min-height: 30px;
  margin-right: var(--fr-space-3);
  padding: 5px var(--fr-space-3);
  border: 1px solid var(--fr-color-border-strong);
  border-radius: var(--fr-radius-small);
  background: var(--fr-color-surface-muted);
  color: var(--fr-color-text);
  font: 600 var(--fr-text-secondary)/1.2 var(--fr-font-ui);
}

.upload-form {
  padding: var(--fr-space-4);
  border: 1px dashed var(--fr-color-border-strong);
  border-radius: var(--fr-radius-medium);
  background: var(--fr-color-surface-muted);
}

/* Authentication and onboarding. */
.auth-panel {
  max-width: 480px;
  margin: var(--fr-space-8) auto;
  padding: var(--fr-space-6);
}
.auth-panel h1 { margin-bottom: var(--fr-space-1); font-size: var(--fr-text-page); }
.auth-panel .panel-desc { margin-bottom: var(--fr-space-5); font-size: var(--fr-text-body); }
.auth-switch { margin-top: var(--fr-space-4); padding-top: var(--fr-space-4); }
.identity-login-actions { margin-top: var(--fr-space-3); }
.identity-legal-panel { width: min(820px, 100%); }
.identity-account-workspace {
  width: min(1120px, calc(100% - 32px));
  margin: var(--fr-space-5) auto var(--fr-space-8);
  gap: var(--fr-space-3);
}
.identity-case-row,
.identity-batch-row {
  padding: var(--fr-space-3);
  border-color: var(--fr-color-border);
  border-radius: var(--fr-radius-small);
}
.legal-onboarding-panel { margin-top: var(--fr-space-5); }
.legal-onboarding-documents { gap: var(--fr-space-4); padding-top: var(--fr-space-5); }
.legal-onboarding-actions { padding: var(--fr-space-4); }

/* Feedback states. */
.auth-alert,
.alert {
  margin: 0;
  padding: 10px var(--fr-space-3);
  border-radius: var(--fr-radius-small);
  font-size: var(--fr-text-secondary);
  line-height: 1.45;
}
.auth-alert-error,
.alert.error { border: 1px solid var(--negative-border); background: var(--negative-bg); color: var(--negative-text); }
.auth-alert-success,
.alert.success { border: 1px solid var(--positive-border); background: var(--positive-bg); color: var(--positive-text); }
.auth-alert-warning,
.alert.warning { border: 1px solid var(--caution-border); background: var(--caution-bg); color: var(--caution-text); }

.status,
.status-badge,
.badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 3px var(--fr-space-2);
  border-radius: 999px;
  font-size: var(--fr-text-meta);
  font-weight: 600;
  line-height: 1.2;
}

/* Tables and machine-readable data. */
table { font-variant-numeric: tabular-nums; }
.cases-table,
.data-table,
.pro-v2-simple-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fr-text-secondary);
}
.cases-table th,
.data-table th,
.pro-v2-simple-table th {
  padding: 8px 10px;
  border-bottom: 1px solid var(--fr-color-border-strong);
  background: var(--fr-color-surface-muted);
  color: var(--fr-color-text-secondary);
  font-size: var(--fr-text-meta);
  font-weight: 600;
  text-align: left;
}
.cases-table td,
.data-table td,
.pro-v2-simple-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--fr-color-border-subtle);
  color: var(--fr-color-text);
  vertical-align: top;
}
.cases-table tbody tr:hover,
.data-table tbody tr:hover { background: var(--fr-color-surface-muted); }

code,
pre,
kbd,
.case-code,
.case-id,
[data-technical-value],
[data-uid] { font-family: var(--fr-font-mono); }

/* Billing and dialogs. */
.billing-panel { margin-bottom: var(--fr-space-5); }
.billing-kpis { gap: var(--fr-space-2); margin-bottom: var(--fr-space-4); }
.billing-kpis > div {
  padding: var(--fr-space-4);
  border-color: var(--fr-color-border);
  background: var(--fr-color-surface-muted);
}
.billing-columns { gap: var(--fr-space-4); }
.billing-product-option {
  transition: border-color .18s ease, background-color .18s ease;
}
.billing-product-option.is-selected {
  border-color: var(--fr-color-action);
  background: var(--fr-color-action-soft);
}
.billing-product-option.is-selected [data-selected-product-action] {
  box-shadow: 0 0 0 2px var(--fr-color-surface), 0 0 0 4px var(--fr-color-action);
}
.resource-document-dialog {
  border: 1px solid var(--fr-color-border-strong);
  border-radius: var(--fr-radius-large);
  background: var(--fr-color-surface);
  color: var(--fr-color-text);
  box-shadow: var(--fr-shadow-floating);
}
.resource-document-dialog::backdrop {
  background: rgb(15 23 34 / 62%);
  backdrop-filter: none;
}
.billing-key-activation { padding: var(--fr-space-3); background: var(--fr-color-surface-muted); }

.resource-document-dialog__header {
  min-height: 50px;
  padding: 8px var(--fr-space-3);
  border-color: var(--fr-color-border);
}
.resource-document-dialog__body {
  height: calc(100% - 50px);
  padding: var(--fr-space-6) clamp(20px, 5vw, 56px) var(--fr-space-8);
  background: var(--fr-color-surface-muted);
}
.resource-document-content {
  padding: var(--fr-space-6);
  border: 1px solid var(--fr-color-border-subtle);
  border-radius: var(--fr-radius-medium);
  background: var(--fr-color-surface);
  font-size: var(--fr-text-body);
}
.resource-document-content .resource-document-title { font-size: var(--fr-text-section); }
.resource-document-dialog__actions > a { border-radius: var(--fr-radius-small); }

/* Legal/resource footer remains intentionally subdued outside case workspace. */
.resource-footer {
  border-color: var(--fr-color-border);
  background: var(--fr-color-surface);
  color: var(--fr-color-text-muted);
}
.resource-footer__inner { padding: var(--fr-space-5); }
.resource-footer a { color: var(--fr-color-action); }
.workspace-page-body .resource-footer { display: none; }

/* Global loader: a single restrained elevated state, no decorative glow. */
.global-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--fr-space-3);
  padding: var(--fr-space-6);
  color: #fff;
  background: rgb(15 23 34 / 86%);
}
.global-loading-mark { width: 44px; height: 44px; object-fit: contain; }
.global-loading-spinner {
  width: 30px;
  height: 30px;
  border: 2px solid rgb(255 255 255 / 26%);
  border-top-color: #fff;
  border-radius: 50%;
  animation: fr-spin .8s linear infinite;
}
.global-loading-overlay p { margin: 0; font-weight: 500; }
@keyframes fr-spin { to { transform: rotate(360deg); } }

@media (max-width: 980px) {
  .pro-app-header-inner { gap: var(--fr-space-3); }
  .fr-brand-logo--app { width: 128px; }
  .pro-app-nav { overflow-x: auto; scrollbar-width: thin; }
  .pro-app-account-label { display: none; }
}

@media (max-width: 760px) {
  .page-header-inner,
  .pro-app-header-inner,
  .pro-app-header--compact .pro-app-header-inner {
    height: auto;
    min-height: 52px;
    padding: 8px var(--fr-space-3);
    gap: 8px var(--fr-space-3);
  }
  .fr-brand-logo,
  .fr-brand-logo--app,
  .pro-app-header--compact .fr-brand-logo--app { width: 124px; }
  .pro-app-nav { order: 3; width: 100%; }
  .pro-app-nav a { flex: 0 0 auto; }
  .pro-app-notification-panel {
    position: fixed;
    top: 64px;
    right: 12px;
    left: 12px;
    width: auto;
    max-height: calc(100vh - 76px);
  }
  .page-content { width: calc(100% - 24px); padding: var(--fr-space-4) 0 calc(88px + env(safe-area-inset-bottom)); }
  .panel,
  .section-card,
  .pro-portal-panel { padding: var(--fr-space-4); }
  .auth-panel { margin: var(--fr-space-3) auto; }
  .pro-portal-heading { align-items: flex-start; flex-direction: column; }
  .pro-home-hero,
  .pro-home-section-heading { align-items: stretch; flex-direction: column; }
  .pro-home-hero-actions { justify-content: flex-start; }
  .pro-home-grid,
  .pro-home-quick-links,
  .pro-home-case-row,
  .identity-account-workspace { grid-template-columns: 1fr; }
  .resource-footer__inner { padding-inline: var(--fr-space-4); }
  .resource-document-content { padding: var(--fr-space-4); }
}

@media (prefers-reduced-motion: reduce) {
  .global-loading-spinner { animation-duration: 1.5s; }
}
