/* Presentation layer shared by Standard and Cloud. The marker is explicit:
   existing CORE forms, IDs, hidden states and permissions remain authoritative.
   !important below is limited to legacy theme/branding style overrides. */
html[data-customer-portal="true"][data-customer-appearance] { background: var(--cp-bg); }
html[data-customer-portal="true"][data-customer-appearance] body {
  margin: 0; padding-top: 0; min-height: 100vh;
  background: var(--cp-bg) !important; color: var(--cp-text) !important;
  font: 15px/1.6 var(--cp-font); -webkit-font-smoothing: antialiased;
}
html[data-customer-portal="true"] [hidden] { display: none !important; }
html[data-customer-portal="true"][data-customer-appearance] :is(body::before, .card::before, .hero-block::after) { content: none; }
html[data-customer-portal="true"] .shell {
  width: min(1160px, calc(100% - 64px)); max-width: 1160px;
  margin: 0 auto; padding: 38px 0 48px;
}
html[data-customer-portal="true"][data-customer-appearance] .card {
  padding: clamp(24px, 3.2vw, 42px); margin-bottom: 24px;
  border: 1px solid var(--cp-line) !important; border-radius: var(--cp-radius);
  background: var(--cp-surface) !important; box-shadow: var(--cp-shadow) !important;
  backdrop-filter: none; -webkit-backdrop-filter: none; transform: none;
}
html[data-customer-portal="true"][data-customer-appearance] :is(h1, h2, h3, strong) { color: var(--cp-text) !important; }
html[data-customer-portal="true"] :is(h1, h2, h3) {
  font-family: var(--cp-display); font-weight: 600; letter-spacing: -.035em;
  text-transform: none; line-height: 1.2;
}
html[data-customer-portal="true"] h1 { font-size: clamp(30px, 3.6vw, 44px); margin: 0 0 16px; }
html[data-customer-portal="true"] h2 { font-size: 25px; margin: 0; padding: 0; border: 0; }
html[data-customer-portal="true"] h3 { font-size: 21px; margin: 0 0 8px; }
html[data-customer-portal="true"][data-customer-appearance] :is(p, li, .subtitle, .page-subtitle, .note, .doc-meta, .doc-note, .doc-muted, .area-login-note, .grid span) {
  color: var(--cp-muted) !important; line-height: 1.65;
}
html[data-customer-portal="true"] .subtitle { margin: 0 0 22px; }
html[data-customer-portal="true"] :is(a, button, input, select, textarea):focus-visible { outline: 3px solid var(--cp-accent) !important; outline-offset: 3px; }
html[data-customer-portal="true"][data-customer-appearance] a { color: var(--cp-accent) !important; text-underline-offset: 4px; }

/* One identity, above the content. Header links are route-specific, not staff navigation. */
html[data-customer-portal="true"] .customer-portal-header {
  width: min(1160px, calc(100% - 64px)); margin: 0 auto; padding: 23px 0;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  border-bottom: 1px solid var(--cp-line);
}
html[data-customer-portal="true"] .customer-portal-identity { display: flex; align-items: center; gap: 12px; min-width: 0; text-decoration: none; }
html[data-customer-portal="true"] .customer-portal-mark {
  display: grid; place-items: center; flex: 0 0 42px; width: 42px; height: 42px;
  border: 1px solid var(--cp-line); border-radius: 13px;
  background: var(--cp-surface); color: var(--cp-accent); font-size: 21px; font-weight: 700;
}
html[data-customer-portal="true"] .customer-portal-mark img { width: 100%; height: 100%; object-fit: contain; border-radius: 12px; }
html[data-customer-portal="true"] .customer-portal-logo { width: 68px; height: 42px; object-fit: contain; }
html[data-customer-portal="true"] .customer-portal-brand-copy { min-width: 0; display: grid; }
html[data-customer-portal="true"] .customer-portal-name { font-size: 16px; font-weight: 650; line-height: 1.4; overflow-wrap: anywhere; }
html[data-customer-portal="true"] :is(.customer-portal-product, .customer-portal-label, .customer-portal-studio-code) { color: var(--cp-muted); font-size: 11px; line-height: 1.5; }
html[data-customer-portal="true"] .customer-portal-nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
html[data-customer-portal="true"][data-customer-appearance] .customer-portal-nav a {
  display: inline-flex; align-items: center; min-height: 42px; padding: 8px 13px;
  border: 1px solid transparent; border-radius: 12px;
  color: var(--cp-muted) !important; font-size: 13px; font-weight: 550; text-decoration: none;
}
html[data-customer-portal="true"][data-customer-appearance] .customer-portal-nav a:is(:hover, [aria-current="page"]) {
  color: var(--cp-accent) !important; background: var(--cp-accent-soft);
}
html[data-customer-portal="true"] .customer-portal-header:has(.customer-portal-legal-note) { flex-wrap: wrap; }
html[data-customer-portal="true"] .customer-portal-legal-note { flex-basis: 100%; margin: 0; font-size: 12px; line-height: 1.6; }
html[data-customer-portal="true"] .hero-block { padding: 0; margin: 0 0 14px; border: 0 !important; background: none !important; box-shadow: none !important; }
html[data-customer-portal="true"][data-customer-appearance] .hero-kicker {
  color: var(--cp-accent) !important; margin: 0 0 12px; padding: 0;
  border: 0; background: none; text-shadow: none !important;
  font: 650 11px/1.5 var(--cp-font); letter-spacing: .12em; text-transform: uppercase;
}
/* Hidden only once the replacement header exists; branding remains available without JS. */
html[data-customer-portal="true"] body:has(.customer-portal-header) :is(.hero-block .brand-logo, .area-login-copy > .brand-logo, .legal-public-nav) { display: none !important; }

/* Quiet editorial introduction and an immediately recognisable access form. */
html[data-customer-portal="true"][data-customer-appearance] .area-login-card {
  padding: 0; border: 0 !important; background: transparent !important; box-shadow: none !important;
}
html[data-customer-portal="true"] .area-login-layout { grid-template-columns: minmax(0, 1.2fr) minmax(320px, .85fr); gap: clamp(36px, 6vw, 88px); align-items: center; }
html[data-customer-portal="true"] .area-login-copy { display: block; padding: 26px 0; }
html[data-customer-portal="true"] .area-login-copy h1 { max-width: 13ch; font-size: clamp(38px, 4.5vw, 56px); line-height: 1.06; }
html[data-customer-portal="true"] .area-login-subtitle { max-width: 48ch; font-size: 16px; }
html[data-customer-portal="true"] .area-login-highlights { grid-template-columns: 1fr; gap: 0; margin-top: 28px; counter-reset: highlight; }
html[data-customer-portal="true"] .area-login-highlight {
  position: relative; padding: 17px 0 17px 43px; border: 0; border-top: 1px solid var(--cp-line);
  border-radius: 0; background: none; counter-increment: highlight;
}
html[data-customer-portal="true"] .area-login-highlight::before {
  content: "0" counter(highlight); position: absolute; top: 18px; left: 0;
  color: var(--cp-accent); font-size: 11px; font-weight: 650; letter-spacing: .06em;
}
html[data-customer-portal="true"] .area-login-highlight strong { font-size: 14px; font-weight: 650; margin-bottom: 3px; }
html[data-customer-portal="true"] .area-login-highlight p { font-size: 13px; line-height: 1.55; max-width: 48ch; }
html[data-customer-portal="true"] .area-login-panel {
  padding: clamp(26px, 3.2vw, 42px); gap: 20px; background: var(--cp-surface);
  border: 1px solid var(--cp-line); border-radius: var(--cp-radius); box-shadow: var(--cp-shadow);
}
html[data-customer-portal="true"] .area-login-panel-head { gap: 12px; }
html[data-customer-portal="true"] .area-login-panel-head h2 { font-size: 28px; }
html[data-customer-portal="true"] .area-login-panel-head .subtitle { font-size: 14px; margin: 0; }
html[data-customer-portal="true"] .area-login-badge { padding: 0; border: 0; background: none; color: var(--cp-accent); font-size: 11px; letter-spacing: .09em; text-transform: uppercase; }
html[data-customer-portal="true"] .area-login-note { padding-top: 16px; border-top: 1px solid var(--cp-line); font-size: 12px; }
html[data-customer-portal="true"][data-customer-page="delivery"] .shell,
html[data-customer-portal="true"][data-customer-page="practice"] .shell { max-width: 900px; }
html[data-customer-portal="true"][data-customer-page="delivery"] .shell > .card:first-child,
html[data-customer-portal="true"][data-customer-page="practice"] .shell > .card:first-child { max-width: 650px; margin: 0 auto 24px; }
/* CORE still controls authentication; omit the redundant sign-in panel only
   when its own authenticated practice card is visible. */
html[data-customer-portal="true"] .shell:has(> #practiceCard:not([hidden])) > .card:first-child:not(#practiceCard) { display: none; }

/* Form controls. Native required/disabled, errors, consent and uploads are preserved. */
html[data-customer-portal="true"] form { margin-top: 24px; }
html[data-customer-portal="true"][data-customer-appearance] label { color: var(--cp-text); font-size: 13px; font-weight: 550; margin-bottom: 16px; }
html[data-customer-portal="true"][data-customer-appearance] :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  width: 100%; min-width: 0; min-height: 48px; padding: 11px 13px; margin-top: 7px;
  color: var(--cp-text) !important; background: var(--cp-surface) !important;
  border: 1px solid var(--cp-field-line) !important; border-radius: 10px;
  box-shadow: none !important; font: 400 16px/1.5 var(--cp-font);
}
html[data-customer-portal="true"] :is(input, textarea)::placeholder { color: var(--cp-muted); opacity: 1; }
html[data-customer-portal="true"] input[type="file"] { font-size: 13px; }
html[data-customer-portal="true"] input::file-selector-button { border: 0; background: var(--cp-subtle); color: var(--cp-text); border-radius: 6px; padding: 7px 10px; margin-right: 10px; }
html[data-customer-portal="true"] :is(input[type="checkbox"], input[type="radio"]) { accent-color: var(--cp-accent); width: 18px; height: 18px; min-height: 18px; }
html[data-customer-portal="true"] .consent { align-items: flex-start; gap: 10px; font-weight: 400; }
html[data-customer-portal="true"] .consent span { color: var(--cp-muted); font-size: 13px; }
html[data-customer-portal="true"][data-customer-appearance] :is(button, .portal-download-btn, .portal-link-btn, .action-link, [id="downloadAllDocsBtn"], [id="downloadBtn"], .back-link) {
  min-height: 44px; padding: 10px 16px; border-radius: 10px;
  border: 1px solid var(--cp-line) !important; background: var(--cp-surface) !important;
  color: var(--cp-accent) !important; box-shadow: none !important;
  font: 550 14px/1.5 var(--cp-font); text-decoration: none;
  backdrop-filter: none; -webkit-backdrop-filter: none; transition: background .15s ease;
}
html[data-customer-portal="true"][data-customer-appearance] :is(button, .portal-download-btn, .portal-link-btn, .action-link, [id="downloadAllDocsBtn"], [id="downloadBtn"], .back-link):hover { background: var(--cp-accent-soft) !important; transform: none; }
html[data-customer-portal="true"][data-customer-appearance] :is(form button[type="submit"], [id="downloadBtn"]) {
  background: var(--cp-accent) !important; color: var(--cp-on-accent) !important; border-color: var(--cp-accent) !important;
}
html[data-customer-portal="true"][data-customer-appearance] :is(form button[type="submit"], [id="downloadBtn"]):is(:hover, :focus-visible) {
  background: var(--cp-accent) !important; color: var(--cp-on-accent) !important;
}
html[data-customer-portal="true"] #downloadBtn { margin-top: 12px; }
html[data-customer-portal="true"] .back-link { margin-bottom: 22px; }
html[data-customer-portal="true"][data-customer-appearance] .feedback { background: var(--cp-subtle); color: var(--cp-text); border-color: var(--cp-line); border-radius: 12px; font-size: 14px; }
html[data-customer-portal="true"][data-customer-appearance] .feedback-info { color: var(--cp-accent) !important; background: var(--cp-accent-soft); }
html[data-customer-portal="true"][data-customer-appearance] .feedback-success { color: var(--cp-success) !important; background: var(--cp-success-bg); }
html[data-customer-portal="true"][data-customer-appearance] .feedback-error { color: var(--cp-error) !important; background: var(--cp-error-bg); }
html[data-customer-portal="true"] :is(button:disabled, input:disabled, select:disabled) { opacity: .6; cursor: not-allowed; }

/* Personal details, sections and documents share the same information hierarchy. */
html[data-customer-portal="true"] .head { align-items: flex-start; gap: 20px; margin-bottom: 22px; }
html[data-customer-portal="true"] .head .subtitle { margin: 8px 0 0; }
html[data-customer-portal="true"] .head button { flex: 0 0 auto; margin: 0; }
html[data-customer-portal="true"] .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; background: var(--cp-subtle); border-radius: 14px; padding: 10px; }
html[data-customer-portal="true"] .grid > div { min-width: 0; padding: 13px 14px; border: 0; border-radius: 0; background: none; overflow-wrap: anywhere; }
html[data-customer-portal="true"] .grid span { font-size: 11px; margin-bottom: 4px; }
html[data-customer-portal="true"] .grid strong { display: block; font-size: 13px; font-weight: 550; }
html[data-customer-portal="true"] .portal-nav { display: flex; flex-wrap: wrap; gap: 4px; margin: 25px 0; padding-bottom: 13px; border-bottom: 1px solid var(--cp-line); }
html[data-customer-portal="true"][data-customer-appearance] .portal-nav-btn { width: auto; margin: 0; border-color: transparent !important; background: transparent !important; color: var(--cp-muted) !important; }
html[data-customer-portal="true"][data-customer-appearance] .portal-nav-btn.is-active { color: var(--cp-accent) !important; background: var(--cp-accent-soft) !important; }
html[data-customer-portal="true"] .portal-nav-btn[data-unread]::after { background: var(--cp-accent); color: var(--cp-on-accent); }
html[data-customer-portal="true"] .portal-summary-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 22px 0; }
html[data-customer-portal="true"][data-customer-appearance] :is(.summary-card, .doc-item, .upload-card, .empty-state) { border: 1px solid var(--cp-line) !important; border-radius: 14px; background: var(--cp-surface) !important; padding: 19px; box-shadow: none; }
html[data-customer-portal="true"] .summary-card { margin: 0; }
html[data-customer-portal="true"] .summary-card span { color: var(--cp-muted); font-size: 12px; opacity: 1; }
html[data-customer-portal="true"] .summary-card strong { font-size: 23px; font-weight: 600; }
html[data-customer-portal="true"] :is(.summary-card small, .selected-files, .doc-meta, .doc-note, .doc-muted, .communication-meta) { color: var(--cp-muted); font-size: 13px; }
html[data-customer-portal="true"] .docs-list { gap: 12px; }
html[data-customer-portal="true"] .doc-item { overflow-wrap: anywhere; }
html[data-customer-portal="true"] .doc-item > div { color: var(--cp-muted); }
html[data-customer-portal="true"] .doc-item strong { font-weight: 600; }
html[data-customer-portal="true"] .doc-badge { background: var(--cp-subtle); color: var(--cp-accent); font-size: 11px; font-weight: 600; }
html[data-customer-portal="true"] .doc-actions { flex-wrap: wrap; gap: 8px; }
html[data-customer-portal="true"] .docs-block { margin-top: 24px; padding-top: 24px; border-color: var(--cp-line); }
html[data-customer-portal="true"] .docs-block .head { align-items: center; }
html[data-customer-portal="true"] .note { font-size: 12px; margin: 16px 0; }
html[data-customer-portal="true"][data-customer-appearance] .communication-toggle { min-height: 44px; padding: 0; border: 0 !important; background: transparent !important; }
html[data-customer-portal="true"] .communication-toggle-label { font-size: 12px; opacity: 1; }
html[data-customer-portal="true"] :is(.communication-body, .document-request-upload-form, .f24-client-choice-panel) { border-color: var(--cp-line); }
html[data-customer-portal="true"][data-customer-appearance] .communication-item.is-unread { border-left: 3px solid var(--cp-accent) !important; }
html[data-customer-portal="true"][data-customer-appearance] .f24-client-choice-btn.is-selected { border-color: var(--cp-accent) !important; background: var(--cp-accent-soft) !important; }

/* Legal copy keeps its contents and links, with a readable measure and tables. */
html[data-customer-portal="true"][data-customer-page="legal"] .shell { max-width: 900px; }
html[data-customer-portal="true"][data-customer-page="legal"] h1 { max-width: 25ch; }
html[data-customer-portal="true"][data-customer-page="legal"] h2 { font-family: var(--cp-font); font-size: 20px; margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--cp-line); }
html[data-customer-portal="true"][data-customer-page="legal"] h3 { font-family: var(--cp-font); font-size: 17px; margin-top: 24px; }
html[data-customer-portal="true"][data-customer-page="legal"] :is(p, li) { font-size: 14px; line-height: 1.8; }
html[data-customer-portal="true"] .page-subtitle { font-size: 13px; margin: 0 0 28px; }
html[data-customer-portal="true"] .legal-grid { gap: 14px; }
html[data-customer-portal="true"] .legal-link-card { border-color: var(--cp-line); border-radius: 16px; background: var(--cp-subtle); min-height: 170px; padding: 24px; box-shadow: none; }
html[data-customer-portal="true"] .legal-link-card:hover { transform: none; border-color: var(--cp-accent); box-shadow: none; }
html[data-customer-portal="true"][data-customer-page="legal"] .legal-link-card h2 { margin: 0; padding: 0; border: 0; }
html[data-customer-portal="true"] table { border-color: var(--cp-line); background: var(--cp-surface); border-radius: 12px; }
html[data-customer-portal="true"] :is(th, td) { color: var(--cp-text); border-color: var(--cp-line); font-size: 13px; }

/* Shared footer and cookie choices remain functional and visibly secondary. */
html[data-customer-portal="true"] .site-footer { width: min(1160px, calc(100% - 64px)); margin: 0 auto; padding: 24px 0 28px; border-color: var(--cp-line); color: var(--cp-muted); font-size: 12px; }
html[data-customer-portal="true"] #siteFooter { display: grid; justify-items: center; gap: 7px; }
html[data-customer-portal="true"] .site-footer-brand { color: var(--cp-text); font-size: 13px; margin-bottom: 6px; }
html[data-customer-portal="true"] .legal-links { gap: 9px; }
html[data-customer-portal="true"] #siteFooter .policy-link-wrap { max-width: 100%; margin-top: 0; }
html[data-customer-portal="true"][data-customer-appearance] .policy-button { width: auto; min-height: 24px; margin: 0; padding: 0; border: 0 !important; border-radius: 2px; background: none !important; font: inherit; text-decoration: underline; }
html[data-customer-portal="true"][data-customer-appearance] .site-copyright { color: var(--cp-muted); font-size: 11px; margin-top: 13px; }
html[data-customer-portal="true"] #siteFooter .theme-switch { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 9px; }
html[data-customer-portal="true"][data-customer-appearance] .theme-switch button { width: auto; min-height: 36px; margin: 0; padding: 6px 12px; border-radius: 8px; font-size: 12px; background: transparent !important; }
html[data-customer-portal="true"][data-customer-appearance] .theme-switch button.active { background: var(--cp-accent-soft) !important; border-color: var(--cp-accent) !important; }
html[data-customer-portal="true"][data-customer-appearance] .cookie-banner-inner { width: min(850px, 100%); padding: 20px 24px; border: 1px solid var(--cp-line) !important; border-radius: 18px; background: var(--cp-surface) !important; box-shadow: 0 10px 40px #0000001a; }
html[data-customer-portal="true"] .cookie-title { font-size: 14px; color: var(--cp-text); }
html[data-customer-portal="true"][data-customer-appearance] .cookie-banner p { font-size: 12px; color: var(--cp-muted) !important; }
html[data-customer-portal="true"] .cookie-actions { gap: 8px; margin-top: 13px; }
html[data-customer-portal="true"] .cookie-actions .policy-link { margin-left: auto; font-size: 12px; }

@media (max-width: 900px) {
  html[data-customer-portal="true"] .customer-portal-header { align-items: flex-start; flex-wrap: wrap; }
  html[data-customer-portal="true"] .customer-portal-nav { justify-content: flex-start; }
  html[data-customer-portal="true"] .area-login-layout { grid-template-columns: minmax(0, 1fr) minmax(285px, .95fr); gap: 28px; align-items: start; }
  html[data-customer-portal="true"] .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  html[data-customer-portal="true"] .portal-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  html[data-customer-portal="true"] :is(.shell, .customer-portal-header, .site-footer) { width: calc(100% - 32px); }
  html[data-customer-portal="true"] .customer-portal-header { padding: 16px 0 12px; gap: 13px; }
  html[data-customer-portal="true"] .customer-portal-nav { width: 100%; gap: 3px; }
  html[data-customer-portal="true"] .customer-portal-nav a { padding: 7px 9px; font-size: 12px; }
  html[data-customer-portal="true"] .shell { padding: 24px 0 32px; }
  html[data-customer-portal="true"][data-customer-appearance] .card { padding: 23px 20px; border-radius: 18px; }
  html[data-customer-portal="true"][data-customer-appearance] .area-login-card { padding: 0; }
  html[data-customer-portal="true"] .area-login-layout { display: flex; flex-direction: column; gap: 24px; }
  html[data-customer-portal="true"] .area-login-copy { display: contents; }
  html[data-customer-portal="true"] .area-login-copy > .hero-kicker { margin: 0 0 -13px; }
  html[data-customer-portal="true"] .area-login-copy h1 { max-width: 100%; font-size: 39px; margin: 0 0 -10px; }
  html[data-customer-portal="true"] .area-login-subtitle { margin: 0; font-size: 15px; }
  html[data-customer-portal="true"] .area-login-panel { width: 100%; padding: 25px 22px; gap: 18px; }
  html[data-customer-portal="true"] .area-login-highlights { order: 5; width: 100%; margin-top: 0; }
  html[data-customer-portal="true"] .area-login-panel-head h2 { font-size: 26px; }
  html[data-customer-portal="true"] .head { gap: 12px; flex-wrap: wrap; }
  html[data-customer-portal="true"] .grid { padding: 4px; }
  html[data-customer-portal="true"] .grid > div { padding: 11px 9px; }
  html[data-customer-portal="true"] .portal-nav { margin: 20px 0; }
  html[data-customer-portal="true"] .portal-nav-btn { padding: 8px 11px; font-size: 12px; }
  html[data-customer-portal="true"] .doc-row { display: flex; flex-direction: column; gap: 12px; }
  html[data-customer-portal="true"] .doc-actions { justify-content: flex-start; }
  html[data-customer-portal="true"] .communication-toggle { gap: 12px; }
  html[data-customer-portal="true"] .legal-grid { grid-template-columns: 1fr; }
  html[data-customer-portal="true"] .cookie-banner-inner { padding: 16px; max-height: 65vh; overflow-y: auto; }
  html[data-customer-portal="true"] .cookie-actions .policy-link { margin: 4px 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  html[data-customer-portal="true"] :is(button, a) { transition: none; }
}
