:root {
  font-family: Inter, "Noto Sans Lao", "Noto Sans SC", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172033;
  background: #edf0f4;
  font-synthesis: none;
  --hp-red: #d51f4d;
  --hp-red-dark: #a91339;
  --hp-ink: #131c31;
  --hp-ink-2: #1d2942;
  --hp-muted: #667085;
  --hp-line: #e4e8ef;
  --hp-surface: #ffffff;
  --hp-soft: #f6f8fb;
  --hp-text: #172033;
  --hp-text-strong: #101828;
  --hp-text-muted: #667085;
  --hp-border: #e4e7ec;
  --hp-focus: rgba(213, 31, 77, 0.16);
  --hp-success: #067647;
  --hp-success-bg: #ecfdf3;
  --hp-warning: #b54708;
  --hp-warning-bg: #fffaeb;
  --hp-danger: #b42318;
  --hp-danger-bg: #fef3f2;
  --hp-info: #175cd3;
  --hp-info-bg: #eff8ff;
  --hp-radius-sm: 9px;
  --hp-radius-md: 12px;
  --hp-radius-lg: 16px;
  --hp-font-xs: 11px;
  --hp-font-sm: 12px;
  --hp-font-md: 14px;
  --hp-font-lg: 17px;
  --hp-font-xl: 24px;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(circle at top left, rgba(217, 33, 80, 0.08), transparent 34rem),
    #edf0f4;
  font-size: 14px;
  line-height: 1.5;
}

.shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  padding-bottom: calc(32px + env(safe-area-inset-bottom));
}

.shell-wide { align-items: start; }

.portal-frame {
  width: min(620px, 100%);
  overflow: visible;
  border: 1px solid #dbe1e9;
  border-radius: 18px;
  background: var(--hp-surface);
  box-shadow: 0 22px 60px rgba(23, 32, 51, 0.10);
}

.shell-wide .portal-frame {
  width: min(1360px, 100%);
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  overflow: hidden;
}

.portal-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 92px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--hp-line);
  background: #fff;
  border-radius: 18px 18px 0 0;
}

.eyebrow {
  position: relative;
  display: flex;
  min-height: 54px;
  align-items: center;
  margin: 0;
  padding-left: 66px;
  color: var(--hp-ink);
  font-size: 14px;
  font-weight: 850;
  line-height: 1.3;
  letter-spacing: .035em;
  white-space: pre-line;
}
.eyebrow::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 54px;
  height: 54px;
  background: url('/happypay-logo-master.png') center / contain no-repeat;
  content: "";
}

.language-switcher,
.layout-switcher {
  display: grid;
  width: 100%;
  min-width: 0;
  gap: 6px;
}

.language-switcher > span,
.layout-switcher > span {
  color: #7a8496;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.language-switcher select,
.layout-switcher select {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  border: 1px solid #dfe3ea;
  border-radius: 9px;
  padding: 0 34px 0 11px;
  color: #172033;
  background: #ffffff;
  font: inherit;
  font-size: 12px;
  font-weight: 750;
}

.language-switcher select:focus-visible,
.layout-switcher select:focus-visible {
  border-color: var(--hp-red);
  outline: 3px solid rgba(217, 33, 80, 0.18);
  outline-offset: 1px;
}

.card {
  background: var(--hp-surface);
}

.workspace {
  background: #f7f8fb;
}

.card { padding: 32px; }

.login-card { border-radius: 0 0 18px 18px; }
.login-card h1 { font-size: clamp(26px, 4vw, 30px); }

.login-description {
  margin-top: 0;
}

.workspace {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  padding: 34px;
}

h1,
h2,
h3 { color: var(--hp-ink); }

h1 {
  margin: 0;
  font-size: clamp(24px, 4vw, 32px);
  line-height: 1.16;
  letter-spacing: -0.02em;
}

.description {
  margin: 14px 0 0;
  color: #5d6677;
  font-size: 14px;
  line-height: 1.65;
}

.status,
.error {
  display: grid;
  gap: 6px;
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: 12px;
}

.status { border: 1px solid var(--hp-line); background: var(--hp-soft); }
.error { border: 1px solid #f4b7c6; color: #8c1735; background: #fff5f7; }

.status span,
.notice,
.request-id { color: #697386; line-height: 1.6; }

.login-form {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.login-form label {
  display: grid;
  gap: 7px;
  color: #273249;
  font-size: 14px;
  font-weight: 750;
}

input:not([type="checkbox"]):not([type="radio"]) {
  width: 100%;
  min-height: 50px;
  border: 1px solid #cdd3dd;
  border-radius: 10px;
  padding: 0 14px;
  color: var(--hp-ink);
  background: #fff;
  font: inherit;
  outline: none;
}

input:not([type="checkbox"]):not([type="radio"]):focus {
  border-color: var(--hp-red);
  box-shadow: 0 0 0 3px rgba(217, 33, 80, 0.12);
}

button,
.app-action {
  min-height: 44px;
  border-radius: 9px;
  padding: 0 16px;
  font: inherit;
  font-size: 13px;
  font-weight: 780;
}

button {
  border: 0;
  color: #fff;
  background: var(--hp-ink);
  cursor: pointer;
}

.login-form button {
  width: 100%;
  min-height: 50px;
  margin-top: 4px;
  background: var(--hp-red);
  box-shadow: 0 10px 24px rgba(217, 33, 80, 0.18);
}

.login-form button:hover:not(:disabled) { background: var(--hp-red-dark); }
button:hover:not(:disabled) { background: var(--hp-ink-2); }

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(217, 33, 80, 0.3);
  outline-offset: 2px;
}

button:disabled { color: #7e8795; background: #dfe3e8; box-shadow: none; cursor: not-allowed; }
button.secondary { border: 1px solid #cfd5de; color: #273249; background: #fff; }
button.secondary:hover { background: #f6f7f9; }

.notice {
  margin: 24px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--hp-line);
  font-size: 13px;
}

.portal-version {
  display: grid;
  grid-template-columns: minmax(0, 86px) minmax(90px, 1fr);
  min-width: 0;
  align-items: center;
  justify-content: end;
  gap: 9px;
  color: #ffffff;
  font-size: 10px;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
}

.portal-footer-logo {
  display: block;
  width: 86px;
  height: 40px;
  justify-self: end;
  object-fit: contain;
  object-position: right center;
  filter: brightness(0) invert(1);
}

.portal-version-copy {
  display: grid;
  min-width: 0;
  grid-template-rows: repeat(3, auto);
  gap: 1px;
  justify-items: end;
  color: #ffffff;
  line-height: 1.12;
  text-align: right;
}

.portal-version-number,
.portal-version-environment,
.portal-version-build {
  width: 100%;
  overflow: hidden;
  color: #ffffff;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-version-number {
  font-size: 11px;
  font-weight: 800;
}

.portal-version-environment,
.portal-version-build {
  font-size: 9px;
  font-weight: 650;
}

.workspace-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--hp-line);
}
.workspace-heading h1 { font-size: clamp(22px, 2.6vw, 30px); }
.logout-form { flex: 0 0 auto; }

.app-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-top: 24px;
}

.app-card {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 250px;
  flex-direction: column;
  padding: 20px;
  border: 1px solid #e3e7ee;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(19,28,49,0.055);
  grid-column: span 3;
}

.app-card-compact { grid-column: span 2; }
.personal-app-card,
.app-card-full-row { grid-column: 1 / -1; }

.app-card::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
  border-radius: 14px 0 0 14px;
  background: #c9d0da;
  content: "";
}
.app-card-active::before { background: var(--hp-red); }
.app-card-active {
  border-color: rgba(213,31,77,0.32);
  box-shadow: 0 12px 32px rgba(19,28,49,0.075);
}
.app-card-heading h2 { margin: 12px 0 0; font-size: 18px; line-height: 1.35; }
.app-card-heading p { margin: 8px 0 0; color: #657084; font-size: 13px; line-height: 1.6; }

.status-badge {
  display: inline-flex;
  width: fit-content;
  min-height: 24px;
  align-items: center;
  border-radius: 7px;
  padding: 0 8px;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.status-active { color: #17663b; background: #e7f6ed; }
.status-planned { color: #5d6677; background: #eef1f5; }
.status-maintenance,
.status-unconfigured { color: #83530e; background: #fff1d6; }

.submenu { flex: 1; margin-top: 16px; padding-top: 14px; border-top: 1px solid #edf0f3; }
.submenu h3 { margin: 0; color: #7a8496; font-size: 10px; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
.submenu ul { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px 12px; margin: 11px 0 16px; padding: 0; list-style: none; }
.submenu li { position: relative; padding-left: 11px; color: #596477; font-size: 12px; line-height: 1.45; }
.submenu li::before { position: absolute; top: .62em; left: 0; width: 4px; height: 4px; border-radius: 50%; background: #aeb7c5; content: ""; }
.submenu .submenu-group-label {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 6px;
  padding: 9px 0 4px;
  border-top: 1px solid #edf0f3;
  color: #273249;
  font-size: 11px;
  line-height: 1.35;
}
.submenu .submenu-group-label:first-child { margin-top: 0; border-top: 0; padding-top: 2px; }
.submenu .submenu-group-label::before { content: none; }
.submenu .submenu-group-label span { color: #8a94a6; font-size: 10px; font-weight: 800; font-variant-numeric: tabular-nums; }
.submenu .submenu-group-label strong { font-size: 11px; font-weight: 800; }
.app-card form { display: flex; }
.app-action {
  display: inline-flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  text-decoration: none;
}

.app-action:visited {
  color: #ffffff;
}

.app-card-active .app-action {
  background: var(--hp-red);
}

.app-card-active .app-action:hover {
  color: #ffffff;
  background: var(--hp-red-dark);
}

.app-action-disabled,
.app-action-disabled:visited,
.app-card-active .app-action-disabled {
  color: #7e8795;
  background: #eef1f4;
}

.system-access-workspace { min-width: 0; }
.system-access-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.system-access-grid.system-access-domains { grid-template-columns: 1fr; gap: 18px; }
.system-access-domain {
  min-width: 0;
  padding: 18px;
  border: 1px solid #e1e6ed;
  border-radius: 14px;
  background: #f9fafc;
}
.system-access-domain-heading {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 11px;
  border-bottom: 1px solid #e6eaf0;
}
.system-access-domain-heading span { color: #8a94a6; font-size: 11px; font-weight: 800; font-variant-numeric: tabular-nums; }
.system-access-domain-heading h2 { margin: 0; color: var(--hp-ink); font-size: 16px; font-weight: 800; }
.system-access-domain-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.system-access-panel { scroll-margin-top: 18px; min-width: 0; padding: 16px; border: 1px solid var(--hp-line); border-radius: 12px; background: #fff; }
.system-access-panel:target { border-color: var(--hp-red); box-shadow: 0 0 0 3px rgba(213,31,77,.10); }
.system-access-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.system-access-heading h2 { margin: 0; font-size: 15px; }
.system-access-heading > span { flex: none; border-radius: 999px; padding: 4px 8px; background: #f2f4f7; color: #475467; font-size: 10px; font-weight: 800; }
.system-access-panel p { color: #667085; font-size: 13px; }
.system-access-facts { display: grid; grid-template-columns: repeat(auto-fit,minmax(150px,1fr)); gap: 8px; margin: 12px 0 0; }
.system-access-facts div { min-width: 0; border: 1px solid #eaecf0; border-radius: 9px; padding: 9px; background: #f8fafc; }
.system-access-facts dt { color: #667085; font-size: 11px; font-weight: 700; }
.system-access-facts dd { overflow-wrap: anywhere; margin: 3px 0 0; color: #101828; font-size: 12px; font-weight: 700; }
.system-access-value-list { display: grid; gap: 6px; max-height: 310px; overflow: auto; margin: 12px 0 0; padding: 0; list-style: none; }
.system-access-value-list li { overflow-wrap: anywhere; border: 1px solid #eaecf0; border-radius: 9px; padding: 8px 10px; background: #f8fafc; color: #344054; font-size: 12px; }
.system-access-scopes { display: grid; gap: 10px; }
.system-access-audit, .system-access-unavailable, .system-access-notice { display: grid; gap: 7px; margin-top: 12px; border: 1px solid #e4e7ec; border-radius: 10px; padding: 11px; background: #f8fafc; color: #475467; }
.system-access-empty, .system-access-note, .system-access-actor { color: #667085; font-size: 12px; }

/* portal-shell-v3-single-authority */

body {
  background: #eef1f5;
}

.portal-footer,
.portal-login-main,
.portal-layout-slot {
  min-width: 0;
}

/* Login / unauthenticated shell: one continuous App-family background above,
 * one independent dark footer below. */
.shell:not(.shell-wide) .portal-frame {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  background: #ffffff;
}

.shell:not(.shell-wide) .portal-login-main {
  position: relative;
  isolation: isolate;
  display: grid;
  overflow: hidden;
  grid-template-columns: minmax(0, 1fr) 220px;
  grid-template-areas:
    "header layout"
    "content content";
  background: url('/happypay-background-default.svg') center / cover no-repeat;
}

.shell:not(.shell-wide) .portal-login-main::before,
.shell:not(.shell-wide) .portal-login-main::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: '';
}

.shell:not(.shell-wide) .portal-login-main::before {
  z-index: 0;
  background: rgba(42, 0, 16, 0.22);
}

.shell:not(.shell-wide) .portal-login-main::after {
  z-index: 0;
  background: linear-gradient(
    180deg,
    rgba(42, 0, 16, 0.04) 0%,
    rgba(42, 0, 16, 0.14) 58%,
    rgba(42, 0, 16, 0.24) 100%
  );
}

.shell:not(.shell-wide) .portal-login-main > * {
  position: relative;
  z-index: 1;
}

.shell:not(.shell-wide) .portal-header {
  grid-area: header;
  min-height: 132px;
  align-items: center;
  padding: 20px 28px;
  border: 0;
  border-radius: 18px 0 0 0;
  background: transparent;
}

.shell:not(.shell-wide) .eyebrow {
  min-height: 96px;
  padding-left: 112px;
  color: #ffffff;
  font-size: 19px;
  font-weight: 850;
  line-height: 1.24;
  letter-spacing: .025em;
  text-shadow: 0 1px 4px rgba(42, 0, 16, 0.72);
}

.shell:not(.shell-wide) .eyebrow::before {
  width: 96px;
  height: 96px;
}

.shell:not(.shell-wide) .portal-layout-slot {
  grid-area: layout;
  display: grid;
  align-content: center;
  padding: 18px 20px;
  background: transparent;
}

.shell:not(.shell-wide) .portal-layout-slot .layout-switcher {
  width: 100%;
  margin: 0;
}

.shell:not(.shell-wide) .portal-layout-slot .layout-switcher > span {
  color: #ffffff;
  text-shadow: 0 1px 4px rgba(42, 0, 16, 0.72);
}

.shell:not(.shell-wide) .portal-login-main > .card {
  grid-area: content;
  border-radius: 0;
  color: #ffffff;
  background: transparent;
  backdrop-filter: none;
}

.shell:not(.shell-wide) .login-card .login-form label,
.shell:not(.shell-wide) .login-card .notice {
  color: #ffffff;
  text-shadow: 0 1px 4px rgba(42, 0, 16, 0.72);
}

.shell:not(.shell-wide) .login-card .notice {
  border-top-color: rgba(255, 255, 255, 0.38);
}

.shell:not(.shell-wide) .portal-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  align-items: stretch;
  border-radius: 0 0 18px 18px;
  background: #2a0010;
}

.shell:not(.shell-wide) .portal-version {
  grid-column: 1;
  width: auto;
  grid-template-columns: 86px 96px;
  align-self: stretch;
  justify-self: stretch;
  justify-content: start;
  margin: 0;
  padding: 16px 12px 18px 20px;
  border-top: 1px solid rgba(255,255,255,0.14);
}

.shell:not(.shell-wide) .language-switcher {
  grid-column: 2;
  width: auto;
  min-width: 0;
  margin: 0;
  padding: 16px 20px 18px;
  border-top: 1px solid rgba(255,255,255,0.14);
}

.shell:not(.shell-wide) .language-switcher > span {
  color: #ffffff;
}

/* Authenticated / workspace shell. This is the only wide-shell authority. */
.shell-wide .portal-frame {
  width: min(1600px, 100%);
  min-height: calc(100vh - 48px);
  min-height: calc(100dvh - 48px);
  grid-template-columns: 1fr;
  grid-template-rows: auto minmax(0, 1fr);
}

.shell-wide .portal-wide-toolbar {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 22px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
  background:
    linear-gradient(105deg, rgba(213,31,77,0.30), rgba(19,28,49,0) 42%),
    var(--hp-ink);
}

.shell-wide .portal-header {
  min-height: 0;
  width: auto;
  flex: 0 1 360px;
  align-items: center;
  justify-content: flex-start;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: #ffffff;
  background: transparent;
}

.shell-wide .eyebrow {
  min-height: 88px;
  padding: 0 0 0 100px;
  border-bottom: 0;
  color: #ffffff;
  font-size: 13px;
}

.shell-wide .eyebrow::before {
  width: 88px;
  height: 88px;
}

.shell-wide .portal-wide-controls {
  display: grid;
  width: min(660px, 100%);
  min-width: 0;
  grid-template-columns: minmax(140px, 1fr) minmax(140px, 1fr) minmax(190px, 1.2fr);
  align-items: end;
  gap: 12px;
  margin-left: auto;
}

.shell-wide .language-switcher,
.shell-wide .layout-switcher {
  width: 100%;
  margin: 0;
}

.shell-wide .language-switcher > span,
.shell-wide .layout-switcher > span {
  color: #ffffff;
}

.shell-wide .language-switcher select,
.shell-wide .layout-switcher select {
  border-color: rgba(255,255,255,0.24);
  color: #ffffff;
  background: #25324a;
  -webkit-text-fill-color: #ffffff;
  color-scheme: dark;
}

.shell-wide .portal-version {
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  align-self: end;
}

.shell-wide .workspace {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
  padding: 34px;
}

.shell-wide .app-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

/* Explicit Mobile mode. User layout selection is authoritative. */
html[data-layout="mobile"] .shell:not(.shell-wide) .portal-frame {
  width: min(430px, 100%);
}

html[data-layout="mobile"] .shell:not(.shell-wide) .portal-login-main {
  grid-template-columns: 1fr;
  grid-template-areas:
    "header"
    "layout"
    "content";
}

html[data-layout="mobile"] .shell:not(.shell-wide) .portal-header {
  min-height: auto;
  padding: 18px 20px 8px;
  border-radius: 18px 18px 0 0;
}

html[data-layout="mobile"] .shell:not(.shell-wide) .eyebrow {
  min-height: 78px;
  padding-left: 90px;
  font-size: 17px;
  line-height: 1.24;
}

html[data-layout="mobile"] .shell:not(.shell-wide) .eyebrow::before {
  width: 78px;
  height: 78px;
}

html[data-layout="mobile"] .shell:not(.shell-wide) .portal-layout-slot {
  padding: 10px 20px 0;
}

html[data-layout="mobile"] .shell:not(.shell-wide) .portal-footer {
  grid-template-columns: 1fr;
}

html[data-layout="mobile"] .shell:not(.shell-wide) .language-switcher {
  grid-column: 1;
  grid-row: 1;
  padding: 14px 20px;
}

html[data-layout="mobile"] .shell:not(.shell-wide) .portal-version {
  grid-column: 1;
  grid-row: 2;
  padding: 14px 20px 18px;
}

html[data-layout="mobile"] .shell-wide .portal-frame {
  width: min(430px, 100%);
  grid-template-columns: 1fr;
  grid-template-rows: auto minmax(0, 1fr);
}

html[data-layout="mobile"] .shell-wide .portal-wide-toolbar {
  align-items: stretch;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
}

html[data-layout="mobile"] .shell-wide .portal-header {
  width: 100%;
  flex: 0 0 auto;
}

html[data-layout="mobile"] .shell-wide .portal-wide-controls {
  width: 100%;
  grid-template-columns: 1fr;
  margin-left: 0;
}

html[data-layout="mobile"] .shell-wide .portal-version {
  grid-column: 1;
  justify-self: stretch;
}

html[data-layout="mobile"] .shell-wide .workspace {
  grid-column: 1;
  grid-row: 2;
  padding: 22px 18px;
}

html[data-layout="mobile"] .shell-wide .app-grid {
  grid-template-columns: 1fr;
}

html[data-layout="mobile"] .shell-wide .app-card,
html[data-layout="mobile"] .shell-wide .app-card-compact {
  grid-column: 1;
}

/* Viewport rules are safety-only. They do not define a second layout system. */
@media (max-width: 980px) {
  .shell-wide .workspace {
    padding: 26px;
  }
}

@media (max-width: 760px) {
  .shell-wide .portal-wide-toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
    padding: 16px 18px;
  }
  .shell-wide .portal-header {
    width: 100%;
    flex: 0 0 auto;
  }
  .shell-wide .portal-wide-controls {
    width: 100%;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    margin-left: 0;
  }
  .shell-wide .portal-version {
    grid-column: 1 / -1;
    justify-self: stretch;
  }
  .shell {
    display: block;
    padding: 14px;
    padding-bottom: calc(32px + env(safe-area-inset-bottom));
  }
  .portal-frame {
    margin: 0 auto;
  }
  .card {
    padding: 24px 20px 28px;
  }
  .workspace {
    padding: 22px;
  }
  .workspace-heading {
    align-items: stretch;
    flex-direction: column;
  }
  .app-grid {
    grid-template-columns: 1fr;
  }
  .app-card {
    grid-column: 1;
    min-height: auto;
  }
  .logout-form button {
    width: 100%;
  }
  .system-access-domain-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .shell:not(.shell-wide) .portal-login-main {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "layout"
      "content";
  }
  .shell:not(.shell-wide) .portal-header {
    min-height: auto;
    padding: 18px 20px 8px;
    border-radius: 18px 18px 0 0;
  }
  .shell:not(.shell-wide) .eyebrow {
    min-height: 76px;
    padding-left: 88px;
    font-size: 16px;
    line-height: 1.24;
  }
  .shell:not(.shell-wide) .eyebrow::before {
    width: 76px;
    height: 76px;
  }
  .shell:not(.shell-wide) .portal-layout-slot {
    padding: 10px 20px 0;
  }
  .shell:not(.shell-wide) .portal-footer {
    grid-template-columns: 1fr;
  }
  .shell:not(.shell-wide) .language-switcher {
    grid-column: 1;
    grid-row: 1;
  }
  .shell:not(.shell-wide) .portal-version {
    grid-column: 1;
    grid-row: 2;
  }
  .shell-wide .portal-frame {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .shell-wide .portal-wide-controls {
    grid-template-columns: 1fr;
  }
  .shell-wide .portal-version {
    grid-column: 1;
  }
  .shell-wide .workspace {
    grid-column: 1;
    grid-row: 2;
  }
  .submenu ul {
    grid-template-columns: 1fr;
  }
  .system-access-domain {
    padding: 14px;
  }
}

/* security-email-settings */
.security-email-editor,
.security-email-test { margin-top: 20px; }
.security-email-parent-code,
.security-email-code {
  color: #8a94a6;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}
.security-email-parent-code { margin-right: 6px; font-size: 12px; }
.security-email-code { margin-right: 8px; font-size: 11px; }
.security-email-form { display: grid; gap: 14px; margin-top: 18px; }
.security-email-section {
  min-width: 0;
  margin: 0;
  padding: 16px 0 0;
  border: 0;
  border-top: 1px solid var(--hp-line);
}
.security-email-section legend {
  padding: 0 12px 0 0;
  color: #273249;
  font-size: 14px;
  font-weight: 800;
}
.security-email-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; margin-top: 12px; }
.security-email-form label,
.security-email-test-form label { display: grid; gap: 7px; color: #273249; font-size: 13px; font-weight: 750; }
.security-email-form label > span,
.security-email-test-form label > span { color: #273249; }
.security-email-form select { width: 100%; min-height: 50px; border: 1px solid #cdd3dd; border-radius: 10px; padding: 0 14px; color: var(--hp-ink); background: #fff; font: inherit; outline: none; }
.security-email-form select:focus { border-color: var(--hp-red); box-shadow: 0 0 0 3px rgba(217, 33, 80, 0.12); }
.security-email-form small { color: #697386; font-size: 11px; font-weight: 600; line-height: 1.5; }
.security-email-checkbox { align-content: end; grid-template-columns: 22px minmax(0, 1fr); align-items: center; min-height: 50px; }
.security-email-checkbox input[type="checkbox"] { width: 18px; min-height: 18px; height: 18px; margin: 0; accent-color: var(--hp-red); }
.security-email-form-actions { display: flex; justify-content: flex-end; padding-top: 2px; }
.security-email-form-actions button { min-width: 160px; background: var(--hp-red); }
.security-email-test h2,
.security-email-settings-workspace .management-panel > h2 { display: flex; align-items: baseline; gap: 2px; flex-wrap: wrap; }
.security-email-test-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 12px; margin-top: 18px; }
.security-email-test-form button { min-width: 160px; }
.security-email-feedback { margin-bottom: 20px; }
.security-email-settings-workspace input:disabled,
.security-email-settings-workspace select:disabled { color: #7e8795; background: #eef1f4; cursor: not-allowed; }
@media (max-width: 760px) {
  .security-email-form-grid,
  .security-email-test-form { grid-template-columns: 1fr; }
  .security-email-form-actions { justify-content: stretch; }
  .security-email-form-actions button,
  .security-email-test-form button { width: 100%; }
}

/* 08.12 release and feature alignment center */
.platform-panel[id="08.12"] { grid-column: 1 / -1; }
.release-alignment-center { display: grid; gap: 18px; min-width: 0; margin-top: 14px; }
.alignment-intro { margin: 0; }
.alignment-subnav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  border: 1px solid #e4e7ec;
  border-radius: 13px;
  padding: 10px;
  background: #f8fafc;
}
.alignment-subnav a {
  min-width: 0;
  border-radius: 9px;
  padding: 9px 10px;
  color: #344054;
  background: #fff;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}
.alignment-subnav a:hover,
.alignment-subnav a:focus-visible { color: var(--hp-red); box-shadow: 0 0 0 2px rgba(213,31,77,.12); }
.alignment-subsection {
  min-width: 0;
  scroll-margin-top: 18px;
  border-top: 1px solid #e4e7ec;
  padding-top: 18px;
}
.alignment-subsection:target { border-top-color: var(--hp-red); }
.alignment-subsection > header { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.alignment-subsection > header h3 { margin: 0; color: #101828; font-size: 15px; }
.alignment-subsection > header p { margin: 0; color: #667085; font-size: 12px; }
.alignment-table-wrap { width: 100%; overflow-x: auto; border: 1px solid #e4e7ec; border-radius: 12px; background: #fff; }
.alignment-table { width: 100%; min-width: 760px; border-collapse: collapse; }
.alignment-table th,
.alignment-table td { border-bottom: 1px solid #eaecf0; padding: 10px 12px; text-align: left; vertical-align: top; font-size: 12px; }
.alignment-table thead th { color: #475467; background: #f8fafc; font-size: 10px; font-weight: 850; letter-spacing: .035em; text-transform: uppercase; white-space: nowrap; }
.alignment-table tbody tr:last-child th,
.alignment-table tbody tr:last-child td { border-bottom: 0; }
.alignment-table tbody th { color: #273249; font-weight: 800; }
.alignment-table tbody th code,
.alignment-table tbody th span { display: block; }
.alignment-table tbody th span { margin-top: 3px; color: #667085; font-size: 11px; font-weight: 650; }
.alignment-table code { color: #344054; font-size: 11px; overflow-wrap: anywhere; }
.alignment-chip {
  display: inline-flex;
  width: fit-content;
  max-width: 180px;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  color: #344054;
  background: #f2f4f7;
  font-size: 10px;
  font-weight: 850;
  line-height: 1.25;
  text-align: center;
}
.alignment-chip-aligned,
.alignment-chip-banking-ready,
.alignment-chip-function-ready,
.alignment-chip-control-ready,
.alignment-chip-policy-ready,
.alignment-chip-dev-active,
.alignment-chip-runtime-verified,
.alignment-chip-release-verified,
.alignment-chip-source-verified,
.alignment-chip-owner-confirmed,
.alignment-chip-xcode-verified,
.alignment-chip-advanced,
.alignment-chip-pass { color: #067647; background: #ecfdf3; }
.alignment-chip-partial,
.alignment-chip-ui-ready,
.alignment-chip-development { color: #b54708; background: #fffaeb; }
.alignment-chip-missing,
.alignment-chip-regression,
.alignment-chip-not-started { color: #b42318; background: #fef3f2; }
.alignment-chip-expected-difference { color: #175cd3; background: #eff8ff; }
.alignment-chip-placeholder,
.alignment-chip-not-applicable,
.alignment-chip-no-code-change,
.alignment-chip-unchanged,
.alignment-chip-immutable { color: #475467; background: #f2f4f7; }
.alignment-boundary-note { margin-top: 10px; border-left: 3px solid #98a2b3; padding: 8px 10px; color: #475467; background: #f8fafc; font-size: 12px; }
.alignment-filters { display: grid; grid-template-columns: minmax(220px, 1.4fr) repeat(2, minmax(150px, .8fr)); gap: 10px; margin-bottom: 12px; }
.alignment-filters label { display: grid; min-width: 0; gap: 5px; color: #475467; font-size: 11px; font-weight: 800; }
.alignment-filters input,
.alignment-filters select { width: 100%; min-width: 0; min-height: 42px; border: 1px solid #d0d5dd; border-radius: 9px; padding: 8px 10px; color: #101828; background: #fff; font: inherit; }
.alignment-filters input:focus,
.alignment-filters select:focus { border-color: var(--hp-red); outline: 0; box-shadow: 0 0 0 3px rgba(213,31,77,.10); }
.alignment-filter-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.alignment-filter-actions button { width: auto; min-height: 36px; padding: 7px 11px; font-size: 11px; }
.alignment-filters output { grid-column: 1 / -1; color: #667085; font-size: 11px; font-weight: 750; }
.alignment-snapshots { display: grid; gap: 10px; }
.alignment-snapshot { min-width: 0; border: 1px solid #e4e7ec; border-radius: 12px; padding: 12px; background: #f8fafc; }
.alignment-snapshot > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #344054; cursor: pointer; }
.alignment-snapshot > summary > span:first-child { display: grid; gap: 2px; }
.alignment-snapshot > summary small { color: #667085; font-weight: 600; }
.alignment-snapshot[open] > summary { margin-bottom: 12px; }
.alignment-snapshot h4,
.alignment-subsection > h4 { margin: 16px 0 10px; color: #344054; font-size: 13px; }
.alignment-summary { display: flex; flex-wrap: wrap; gap: 8px 12px; margin: 0 0 12px; }
.alignment-summary > span { display: inline-flex; align-items: center; gap: 5px; color: #475467; font-size: 11px; }
.alignment-provenance-table { min-width: 1180px; }
@media (max-width: 860px) {
  .alignment-subnav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .alignment-filters { grid-template-columns: 1fr; }
  .alignment-filter-actions,
  .alignment-filters output { grid-column: 1; }
}
@media (max-width: 560px) {
  .alignment-subnav { grid-template-columns: 1fr; }
  .alignment-subsection > header { display: grid; }
  .alignment-filter-actions { display: grid; }
  .alignment-filter-actions button { width: 100%; }
}

/* Portal visual system v0.2.12: shared hierarchy, color and component rhythm. */
.workspace h1 { color: var(--hp-text-strong); font-size: var(--hp-font-xl); line-height: 1.25; }
.workspace h2 { color: var(--hp-text-strong); font-size: var(--hp-font-lg); line-height: 1.35; }
.workspace h3 { color: var(--hp-text-strong); font-size: 15px; line-height: 1.4; }
.workspace p,
.workspace li,
.workspace dd,
.workspace td { line-height: 1.55; }
.workspace .description,
.workspace small { color: var(--hp-text-muted); }
.workspace button,
.workspace .button-link,
.workspace input,
.workspace select { border-radius: var(--hp-radius-sm); font-size: var(--hp-font-sm); }
.workspace button:focus-visible,
.workspace .button-link:focus-visible,
.workspace input:focus-visible,
.workspace select:focus-visible,
.workspace a:focus-visible { outline: 3px solid var(--hp-focus); outline-offset: 2px; }

/* Long workspaces: one function panel at a time, with multi-row tabs. */
.platform-tabs,
.workspace-tabs {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  max-width: 100%;
  gap: 8px 10px;
  margin: 0 0 16px;
  border: 1px solid var(--hp-border);
  border-radius: var(--hp-radius-md);
  padding: 9px;
  overflow: visible;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.08);
}
.platform-tabs a,
.workspace-tabs a {
  flex: 0 1 auto;
  border: 1px solid transparent;
  border-radius: var(--hp-radius-sm);
  padding: 9px 12px;
  color: var(--hp-text-muted);
  background: var(--hp-soft);
  font-size: var(--hp-font-sm);
  font-weight: 800;
  line-height: 1.35;
  text-decoration: none;
  white-space: normal;
}
.platform-tabs a:hover,
.workspace-tabs a:hover { color: var(--hp-red); border-color: rgba(213, 31, 77, 0.22); }
.platform-tabs a[data-active="true"],
.workspace-tabs a[data-active="true"] {
  color: #fff;
  background: var(--hp-red);
  box-shadow: 0 5px 14px rgba(213, 31, 77, 0.22);
}
.platform-panel[data-platform-tab-panel],
[data-workspace-tab-panel] { width: 100%; }
[data-platform-tab-panel][hidden],
[data-workspace-tab-panel][hidden] { display: none; }
.platform-panel[data-active="true"],
[data-workspace-tab-panel][data-active="true"] { animation: platform-panel-enter 160ms ease-out; }
@keyframes platform-panel-enter {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 08.7 numbered client configuration and per-entry API security. */
.platform-system-configuration { display: grid; gap: 14px; margin-top: 14px; }
.system-config-block {
  min-width: 0;
  scroll-margin-top: 86px;
  border: 1px solid var(--hp-border);
  border-radius: var(--hp-radius-md);
  padding: 15px;
  background: var(--hp-surface);
}
.system-config-block > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.system-config-block > header h3 { margin: 0; }
.system-config-block > header > span {
  border-radius: 999px;
  padding: 4px 9px;
  color: var(--hp-text-muted);
  background: var(--hp-soft);
  font-size: var(--hp-font-xs);
  font-weight: 800;
}
.system-config-api { border-left: 4px solid rgba(213, 31, 77, 0.48); background: #fffafb; }
.api-security-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.api-security-actions button,
.api-security-actions .button-link,
.log-audit-action button {
  display: inline-flex;
  width: auto;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--hp-red);
  padding: 8px 12px;
  color: #fff;
  background: var(--hp-red);
  font: inherit;
  font-size: var(--hp-font-sm);
  font-weight: 800;
  text-decoration: none;
}
.api-security-actions button[disabled] { border-color: var(--hp-border); color: #98a2b3; background: #f2f4f7; cursor: not-allowed; }
.api-security-diagram {
  display: grid;
  gap: 14px;
  border: 1px solid var(--hp-border);
  border-radius: var(--hp-radius-md);
  padding: 14px;
  background: #fff;
}
.api-security-flow { display: flex; align-items: stretch; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.api-security-node {
  display: grid;
  flex: 1 0 150px;
  align-content: center;
  gap: 5px;
  min-height: 78px;
  border: 1px solid var(--hp-border);
  border-radius: var(--hp-radius-sm);
  padding: 10px;
  background: var(--hp-soft);
}
.api-security-node span,
.api-key-slot span { color: var(--hp-text-muted); font-size: var(--hp-font-xs); font-weight: 700; }
.api-security-node strong,
.api-key-slot strong { color: var(--hp-text-strong); font-size: var(--hp-font-sm); overflow-wrap: anywhere; }
.api-security-node-ready { border-color: #a6f4c5; background: var(--hp-success-bg); }
.api-security-node-off { border-color: #fedf89; background: var(--hp-warning-bg); }
.api-security-node-placeholder { border-style: dashed; }
.api-security-arrow { display: inline-grid; flex: 0 0 auto; place-items: center; color: #98a2b3; font-weight: 900; }
.api-key-ring { border: 1px dashed #98a2b3; border-radius: var(--hp-radius-md); padding: 12px; background: var(--hp-soft); }
.api-key-ring-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.api-key-ring-title span { font-weight: 850; }
.api-key-ring-title strong { color: var(--hp-warning); font-size: var(--hp-font-xs); }
.api-key-slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.api-key-slot { display: grid; gap: 4px; border: 1px solid var(--hp-border); border-radius: var(--hp-radius-sm); padding: 9px; background: #fff; }
.api-key-ring p { margin: 10px 0 0; font-size: var(--hp-font-xs); }

/* 08.10 real, sanitized runtime log center. */
.platform-log-center { display: grid; gap: 16px; margin-top: 12px; }
.log-center-section { min-width: 0; border-top: 1px solid var(--hp-border); padding-top: 14px; }
.log-center-section h3 { margin: 0 0 10px; }
.log-source-table { min-width: 680px; }
.log-event-table { min-width: 1120px; }
.log-state,
.log-level { display: inline-flex; border-radius: 999px; padding: 3px 8px; font-size: var(--hp-font-xs); font-weight: 850; }
.log-state-ready,
.log-level-info { color: var(--hp-success); background: var(--hp-success-bg); }
.log-state-unavailable,
.log-level-error { color: var(--hp-danger); background: var(--hp-danger-bg); }
.log-level-warn { color: var(--hp-warning); background: var(--hp-warning-bg); }
.log-audit-action { margin-top: 10px; }
.log-filters { display: grid; grid-template-columns: minmax(240px, 1.4fr) repeat(2, minmax(150px, .8fr)) auto; gap: 9px; align-items: end; }
.log-filters label { display: grid; gap: 5px; color: var(--hp-text-muted); font-size: var(--hp-font-xs); font-weight: 800; }
.log-filters input,
.log-filters select { width: 100%; min-height: 40px; border: 1px solid #d0d5dd; padding: 8px 10px; color: var(--hp-text); background: #fff; font: inherit; }
.log-filters button { width: auto; min-height: 40px; }
.log-empty,
.log-retention { color: var(--hp-text-muted); font-size: var(--hp-font-sm); }

/* 08.12 four-entry matrix switch. */
.alignment-platform-entry {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--hp-border);
  border-radius: var(--hp-radius-md);
  padding: 12px;
  background: #fff;
}
.alignment-platform-entry > div:first-child { display: grid; gap: 3px; }
.alignment-platform-entry > div:first-child span { color: var(--hp-text-muted); font-size: var(--hp-font-xs); }
.alignment-platform-buttons { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.alignment-platform-buttons button {
  width: auto;
  min-height: 36px;
  border: 1px solid var(--hp-border);
  padding: 7px 11px;
  color: var(--hp-text-muted);
  background: var(--hp-soft);
  font-weight: 800;
}
.alignment-platform-buttons button[data-active="true"] { border-color: var(--hp-red); color: #fff; background: var(--hp-red); }

@media (max-width: 860px) {
  .log-filters { grid-template-columns: 1fr 1fr; }
  .alignment-platform-entry { grid-template-columns: 1fr; }
  .alignment-platform-buttons { justify-content: flex-start; }
}
@media (max-width: 620px) {
  .workspace h1 { font-size: 21px; }
  .platform-tabs,
  .workspace-tabs { margin-inline: -8px; border-radius: 0; }
  .system-config-block > header,
  .api-key-ring-title { align-items: flex-start; flex-direction: column; }
  .api-key-slots,
  .log-filters { grid-template-columns: 1fr; }
  .api-security-actions { display: grid; }
  .api-security-actions button,
  .api-security-actions .button-link { width: 100%; }
}
