:root {
  --ink: #151515;
  --muted: #6f685b;
  --line: #ded5c4;
  --panel: #ffffff;
  --page: #f6f2e9;
  --soft: #fbf8ef;
  --brand: #c6a15b;
  --brand-dark: #080808;
  --teal: #b9924e;
  --cyan: #8a6b32;
  --amber: #d2ad63;
  --rose: #b84a3a;
  --shadow: 0 10px 30px rgba(8, 8, 8, 0.10);
}

* { box-sizing: border-box; }

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.shell {
  min-height: 100vh;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at top left, rgba(198, 161, 91, .20), transparent 34%), linear-gradient(135deg, #fbf8ef, #eee6d6);
}

.auth-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
}

.auth-card h1 {
  margin: 0;
  font-size: 26px;
}

.auth-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.auth-remember-device {
  justify-self: start;
  white-space: normal;
}

.auth-remember-device input {
  accent-color: var(--brand);
}

.loading-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 8, 8, .38);
  backdrop-filter: blur(5px);
}

.loading-showcase {
  width: min(440px, 100%);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
  padding: 20px;
  border: 1px solid rgba(198, 161, 91, .45);
  border-radius: 14px;
  background: #fffdf8;
  box-shadow: 0 22px 60px rgba(8, 8, 8, .26);
}

.loading-showcase.embedded {
  box-shadow: var(--shadow);
}

.loading-showcase strong {
  display: block;
  margin-bottom: 4px;
  font-size: 18px;
}

.loading-showcase p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.loading-spinner {
  width: 42px;
  height: 42px;
  border: 4px solid #eee3cf;
  border-top-color: var(--brand);
  border-radius: 999px;
  animation: loading-spin .85s linear infinite;
}

.loading-dots {
  display: flex;
  gap: 5px;
  margin-top: 12px;
}

.loading-dots span {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--brand);
  opacity: .35;
  animation: loading-pulse 1.1s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: .15s; }
.loading-dots span:nth-child(3) { animation-delay: .3s; }

@keyframes loading-spin {
  to { transform: rotate(360deg); }
}

@keyframes loading-pulse {
  0%, 100% { opacity: .25; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-3px); }
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(220px, .7fr) minmax(0, auto) minmax(0, auto);
  align-items: center;
  gap: 12px 20px;
  padding: 14px 28px 16px;
  background: rgba(8, 8, 8, 0.97);
  border-bottom: 1px solid rgba(198, 161, 91, .38);
  backdrop-filter: blur(12px);
}

.topbar .brand {
  grid-column: 1;
  grid-row: 1;
  align-self: start;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-button {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.brand-button:hover strong,
.brand-button:focus-visible strong {
  color: #fff8df;
}

.brand-button:focus-visible {
  outline: 2px solid rgba(198, 161, 91, .85);
  outline-offset: 4px;
  border-radius: 8px;
}

.brand-logo,
.brand-mark {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
}

.brand-logo {
  display: block;
  border-radius: 50%;
  object-fit: cover;
  background: #080808;
  box-shadow: 0 0 0 1px rgba(247, 231, 189, .2);
}

.brand-mark {
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #1b1b1b, #080808);
  color: #f4d37b;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .08em;
}

.brand > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.brand strong { font-size: 17px; color: #f7e7bd; }
.brand div span { color: #cdbb93; font-size: 12px; }
.brand strong,
.brand div span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main-nav {
  grid-column: 1 / 3;
  grid-row: 2;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
  width: min(860px, 100%);
  max-width: 100%;
  justify-self: start;
  padding: 6px;
  border: 1px solid rgba(198, 161, 91, .38);
  border-radius: 10px;
  background: rgba(255, 255, 255, .06);
}

.main-nav button {
  display: grid;
  gap: 3px;
  min-width: 0;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #ddd2b9;
  text-align: left;
  align-content: center;
}

.main-nav button span {
  color: #f7e7bd;
  font-size: clamp(13px, 1.1vw, 15px);
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main-nav button small {
  color: #cdbb93;
  font-size: clamp(9px, .85vw, 11px);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main-nav button:hover,
.main-nav button.active {
  border-color: var(--brand);
  background: rgba(198, 161, 91, .16);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

.main-nav button.active span {
  color: var(--brand);
}

.sub-nav {
  grid-column: 1 / -1;
  grid-row: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  padding: 0 2px;
}

.sub-nav > span {
  flex: 0 0 auto;
  color: #cdbb93;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.sub-nav > div {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  flex-wrap: wrap;
}

.sub-nav button {
  flex: 0 1 auto;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid rgba(198, 161, 91, .36);
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  color: #f0e2bf;
  font-weight: 700;
}

.sub-nav button:hover {
  border-color: var(--brand);
  color: #fff7df;
}

.sub-nav button.active {
  border-color: var(--brand);
  background: var(--brand);
  color: #080808;
}

.workspace-layout {
  width: min(1320px, calc(100vw - 34px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.workspace-layout.has-section-nav {
  grid-template-columns: minmax(0, 1fr);
}

.section-nav-open {
  justify-self: start;
  display: inline-grid;
  grid-template-columns: auto auto auto;
  align-items: center;
  gap: 10px;
  max-width: min(100%, 520px);
  margin-top: 14px;
  padding: 10px 14px;
  border: 1px solid rgba(198, 161, 91, .42);
  border-radius: 999px;
  background: #11100e;
  color: #fff7df;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .14);
  text-align: left;
}

.section-nav-open span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--brand);
  color: #080808;
  font-weight: 900;
}

.section-nav-open strong {
  font-size: 13px;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.section-nav-open small {
  min-width: 0;
  overflow: hidden;
  color: #d6c8a7;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-rail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(0, 0, 0, .56);
  backdrop-filter: blur(2px);
}

.section-rail {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 75;
  width: min(360px, 88vw);
  height: 100dvh;
  max-height: none;
  min-width: 0;
  padding: 20px 16px;
  border: 0;
  border-right: 1px solid rgba(198, 161, 91, .42);
  border-radius: 0 16px 16px 0;
  background:
    linear-gradient(180deg, rgba(198, 161, 91, .14), transparent 170px),
    #10100f;
  box-shadow: 20px 0 50px rgba(0, 0, 0, .34);
  overflow-y: auto;
}

.section-rail-head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 12px;
  padding: 6px 0 16px;
  border-bottom: 1px solid rgba(198, 161, 91, .26);
  margin-bottom: 12px;
}

.section-rail-head div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.section-rail-head span {
  color: var(--brand);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.section-rail-head strong {
  overflow: hidden;
  color: #fff7df;
  font-size: 20px;
  line-height: 1.15;
  text-overflow: ellipsis;
}

.section-rail-close {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(198, 161, 91, .44);
  border-radius: 10px;
  background: rgba(255, 255, 255, .04);
  color: #fff7df;
  font-size: 22px;
  line-height: 1;
}

.section-rail-list {
  display: grid;
  gap: 8px;
}

.section-rail-list button {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 10px;
  border: 1px solid rgba(198, 161, 91, .24);
  border-radius: 8px;
  background: rgba(255, 255, 255, .05);
  color: #f2e6ca;
  text-align: left;
}

.section-rail-list button span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: rgba(198, 161, 91, .16);
  color: #d8bd78;
  font-size: 11px;
  font-weight: 900;
}

.section-rail-list button strong {
  overflow: hidden;
  color: inherit;
  font-size: 14px;
  line-height: 1.2;
}

.section-rail-list button:hover,
.section-rail-list button.active {
  border-color: var(--brand);
  background: rgba(198, 161, 91, .18);
  color: #fff7df;
}

.section-rail-list button.active span {
  background: var(--brand);
  color: #090909;
}

.workspace-layout .main {
  width: 100%;
  min-width: 0;
  margin: 0;
}

@media (max-width: 980px) {
  .workspace-layout,
  .workspace-layout.has-section-nav {
    width: min(100% - 18px, 1320px);
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .workspace-layout .main {
    width: 100%;
    min-width: 0;
    margin: 0;
    padding-top: 8px;
  }

  .section-nav-open {
    grid-template-columns: auto minmax(0, auto);
    max-width: 100%;
  }

  .section-nav-open small {
    display: none;
  }
}

@media (max-width: 520px) {
  .workspace-layout,
  .workspace-layout.has-section-nav {
    width: min(100% - 22px, 1320px);
    padding: 0;
  }

  .section-rail {
    width: min(340px, 92vw);
    padding: 18px 14px;
  }

  .section-rail-list button {
    min-height: 54px;
  }

  .section-nav-open {
    width: 100%;
    justify-content: start;
  }
}

.nav-category {
  position: relative;
  min-width: 0;
}

.nav-category-trigger {
  display: grid;
  gap: 3px;
  min-width: 122px;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255, 255, 255, .07);
  color: #ddd2b9;
  text-align: left;
}

.nav-category-trigger span {
  color: #f7e7bd;
  font-size: 14px;
  font-weight: 800;
}

.nav-category-trigger small {
  color: #cdbb93;
  font-size: 11px;
  font-weight: 700;
}

.nav-category:hover .nav-category-trigger,
.nav-category:focus-within .nav-category-trigger,
.nav-category.active .nav-category-trigger {
  border-color: var(--brand);
  background: rgba(198, 161, 91, .16);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

.nav-category.active .nav-category-trigger span {
  color: var(--brand);
}

.nav-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 40;
  display: grid;
  gap: 4px;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  width: max-content;
  min-width: 220px;
  max-width: min(320px, calc(100vw - 28px));
  padding: 8px;
  border: 1px solid rgba(198, 161, 91, .42);
  border-radius: 8px;
  background: #111;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .28);
  transition: opacity .12s ease;
}

.nav-dropdown-right {
  right: 0;
  left: auto;
}

.nav-category:hover .nav-dropdown,
.nav-category:focus-within .nav-dropdown {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transition-delay: 0s;
}

.nav-dropdown button {
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #f0e2bf;
  text-align: left;
  font-weight: 750;
}

.nav-dropdown button:hover,
.nav-dropdown button.active {
  border-color: rgba(198, 161, 91, .54);
  background: var(--brand);
  color: #080808;
}

.dropdown-user {
  display: block;
  padding: 8px 10px 10px;
  color: #cdbb93;
  font-size: 12px;
  font-weight: 800;
  border-bottom: 1px solid rgba(198, 161, 91, .28);
}

.actions {
  grid-column: 3;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: nowrap;
  justify-content: flex-end;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(198, 161, 91, .26);
}

.save-controls {
  grid-column: 3;
  grid-row: 2;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  padding: 6px 0;
}

.top-save-button {
  min-height: 44px;
  min-width: 148px;
  border-color: rgba(244, 211, 123, .55);
  background: #2d2618;
  color: #f7e7bd;
  font-weight: 900;
}

.top-save-button.needs-save {
  background: var(--brand);
  color: #080808;
  box-shadow: 0 0 0 3px rgba(198, 161, 91, .18);
}

.top-cancel-button {
  min-height: 44px;
  min-width: 86px;
  border-color: rgba(198, 161, 91, .42);
  background: rgba(255, 255, 255, .08);
  color: #f0e2bf;
  font-weight: 900;
}

.top-cancel-button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.autosave-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid rgba(198, 161, 91, .42);
  border-radius: 8px;
  background: rgba(255, 255, 255, .07);
  color: #f0e2bf;
}

.autosave-toggle strong {
  font-size: 12px;
}

.save-controls small {
  max-width: 110px;
  color: #cdbb93;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
}

.action-category .nav-category-trigger {
  border-color: rgba(198, 161, 91, .42);
}

.action-category .nav-dropdown {
  right: 0;
  left: auto;
}

.utility-menu {
  position: relative;
  flex: 0 0 auto;
}

.utility-menu-toggle {
  display: inline-flex;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  border: 1px solid rgba(198, 161, 91, .58);
  border-radius: 10px;
  background: rgba(198, 161, 91, .14);
  color: #f7e7bd;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .18);
  cursor: pointer;
  list-style: none;
}

.utility-menu-toggle::-webkit-details-marker {
  display: none;
}

.utility-menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.utility-menu[open] .utility-menu-toggle,
.utility-menu-toggle:hover,
.utility-menu-toggle:focus-visible {
  background: var(--brand);
  color: #080808;
}

.utility-menu-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 90;
  display: grid;
  gap: 8px;
  min-width: 236px;
  max-width: min(320px, calc(100vw - 24px));
  padding: 10px;
  border: 1px solid rgba(198, 161, 91, .52);
  border-radius: 12px;
  background: #111;
  box-shadow: 0 22px 52px rgba(0, 0, 0, .34);
}

.utility-menu-panel .nav-category,
.utility-menu-panel .nav-category-trigger {
  width: 100%;
}

.utility-menu-panel .nav-category-trigger {
  min-width: 0;
  min-height: 48px;
}

.utility-menu-panel .nav-dropdown,
.utility-menu-panel .nav-dropdown-right {
  right: 0;
  left: auto;
}

.utility-menu-panel .nav-category > .nav-dropdown {
  top: 0;
  right: 100%;
  left: auto;
}

.icon-btn, .button, .segment button {
  border: 1px solid transparent;
  background: transparent;
  color: #30333d;
  border-radius: 6px;
  padding: 9px 12px;
  white-space: normal;
  flex: 0 1 auto;
}

.button.primary, .segment button.active {
  background: var(--brand-dark);
  color: #fff;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  border-color: var(--line);
  background: #fff;
}

.button:hover,
.icon-btn:hover {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(198, 161, 91, .16);
}

.button.primary { border-color: var(--brand-dark); }
.button.accent { background: var(--brand); border-color: var(--brand); color: #080808; font-weight: 800; }
.button.danger { color: var(--rose); }
.button.small { min-height: 30px; padding: 6px 9px; font-size: 12px; }
.button.large { min-height: 44px; padding: 10px 18px; font-weight: 700; }

.app-update-button {
  border-color: rgba(198, 161, 91, .72);
  background: #c6a15b;
  color: #0f0d0a;
  font-weight: 900;
  box-shadow: 0 0 0 1px rgba(247, 231, 189, .14), 0 8px 20px rgba(0, 0, 0, .22);
  white-space: nowrap;
}

.app-update-button:hover,
.app-update-button:focus-visible {
  background: #f0cf7c;
  color: #050505;
}

.icon-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border-color: var(--line);
  background: #fff;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid rgba(198, 161, 91, .42);
  border-radius: 999px;
  background: rgba(198, 161, 91, .16);
  color: #f7e7bd;
  font-size: 12px;
  font-weight: 800;
  white-space: normal;
}

.main {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 28px 0 52px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 18px;
}

.page-title h1 {
  margin: 0 0 6px;
  font-size: 28px;
  line-height: 1.15;
}

.client-title-badge {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin-left: 8px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffaf0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.page-title p {
  margin: 0;
  color: var(--muted);
  max-width: 820px;
}

.page-head > .actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  max-width: 100%;
}

.toolbar-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 38px;
  padding: 9px 14px;
  border: 1px solid rgba(198, 161, 91, .55);
  border-radius: 999px;
  background: linear-gradient(135deg, #11100d, #262018);
  color: #f7e7bd;
  font-weight: 850;
  box-shadow: 0 10px 22px rgba(8, 8, 8, .12);
  white-space: nowrap;
}

.toolbar-action span {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(247, 231, 189, .48);
  border-radius: 999px;
  background: rgba(198, 161, 91, .18);
  color: #fffaf0;
  font-size: 15px;
  line-height: 1;
}

.toolbar-action:hover {
  border-color: var(--brand);
  background: linear-gradient(135deg, #080808, #352914);
  box-shadow: 0 0 0 3px rgba(198, 161, 91, .18), 0 12px 24px rgba(8, 8, 8, .16);
}

.toolbar-secondary {
  border-radius: 999px;
  min-height: 38px;
  padding-inline: 14px;
  white-space: nowrap;
}

.factfind-calculator-menu {
  position: relative;
  display: inline-flex;
  max-width: 100%;
}

.factfind-calculator-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  display: none;
  min-width: 230px;
  padding: 8px;
  border: 1px solid rgba(198, 161, 91, .45);
  border-radius: 14px;
  background: #11100d;
  box-shadow: 0 18px 42px rgba(8, 8, 8, .24);
}

.factfind-calculator-menu:hover .factfind-calculator-dropdown,
.factfind-calculator-menu:focus-within .factfind-calculator-dropdown {
  display: grid;
  gap: 6px;
}

.factfind-calculator-dropdown button {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #f7e7bd;
  font-weight: 800;
  text-align: left;
}

.factfind-calculator-dropdown button:hover,
.factfind-calculator-dropdown button:focus-visible {
  border-color: rgba(198, 161, 91, .45);
  background: rgba(198, 161, 91, .14);
  outline: none;
}

.access-denied-panel .empty-state {
  max-width: 760px;
  margin: 0 auto;
  padding: 34px;
  text-align: center;
  border: 1px solid rgba(198, 161, 91, .42);
  border-radius: 12px;
  background: #fffdf8;
}

.access-denied-panel .empty-state strong {
  display: block;
  font-size: 24px;
  margin-bottom: 8px;
}

.access-denied-panel .empty-state p {
  color: var(--muted);
}

.phase-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 7px;
}

.phase-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #f6ead1;
  color: var(--brand);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.source-line {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.page-subheading {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 20px;
}

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal);
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 1px 1px rgba(16, 24, 40, 0.03);
}

.kpi-card {
  appearance: none;
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.kpi-card:hover,
.kpi-card:focus-visible {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(199, 154, 43, .16);
  outline: none;
}

.metric:nth-child(2) { border-left-color: var(--cyan); }
.metric:nth-child(3) { border-left-color: var(--brand); }
.metric:nth-child(4) { border-left-color: var(--amber); }
.metric:nth-child(5) { border-left-color: var(--rose); }
.metric span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.metric strong { font-size: 22px; }
.metric small { display: block; color: var(--muted); margin-top: 6px; }

.notice {
  background: #fff8db;
  border: 1px solid #f1dfa4;
  color: #57430c;
  border-radius: 8px;
  padding: 14px 16px;
  line-height: 1.5;
  margin: 12px 0 18px;
}

.landing-page {
  display: grid;
  gap: 18px;
}

.landing-hero,
.landing-next {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(135deg, #fffdf8, #f7f1e6);
  padding: 26px;
  box-shadow: var(--shadow);
}

.landing-hero h1 {
  margin: 10px 0 8px;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.03;
  color: var(--ink);
}

.landing-hero p,
.landing-next p {
  margin: 0;
  max-width: 760px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.landing-status {
  min-width: 260px;
  display: grid;
  align-content: center;
  gap: 8px;
  border: 1px solid rgba(198, 161, 91, .45);
  border-radius: 10px;
  background: #11100d;
  color: #fffaf0;
  padding: 18px;
}

.landing-status span,
.landing-status small {
  color: #d8caa9;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.landing-status strong {
  font-size: 18px;
  line-height: 1.25;
}

.landing-section {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 253, 248, .76);
  padding: 22px;
  box-shadow: var(--shadow);
}

.landing-section-head {
  display: grid;
  gap: 6px;
}

.landing-section-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(24px, 2.4vw, 34px);
  line-height: 1.05;
}

.landing-section-head p {
  margin: 0;
  max-width: 760px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.landing-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.landing-actions.compact {
  grid-template-columns: minmax(220px, 420px);
}

.impersonation-banner {
  position: sticky;
  top: 0;
  z-index: 24;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 10px 24px;
  color: #241b08;
  background: #f4d66d;
  border-bottom: 1px solid #b88920;
  box-shadow: 0 4px 14px rgba(54, 38, 8, .16);
}

.impersonation-banner > div {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.impersonation-banner strong {
  font-size: 15px;
}

.impersonation-banner span {
  font-size: 13px;
}

.impersonation-banner .button {
  flex: 0 0 auto;
  color: #fff;
  background: #17130b;
  border-color: #17130b;
}

.landing-empty {
  display: grid;
  gap: 5px;
  min-height: 112px;
  align-content: center;
  padding: 20px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.54);
  color: var(--muted);
}

.landing-empty strong { color: var(--ink); }
.quick-links-manager-list { margin-top: 14px; }
.quick-links-manager-list .detail-row > span { display: grid; gap: 3px; }
.quick-links-manager-list small { color: var(--muted); font-weight: 500; }

.account-settings-modal { width: min(1180px,calc(100vw - 28px)); }
.calculation-variables-section { overflow: hidden; }
.variables-intro { display: grid; gap: 5px; margin-bottom: 14px; padding: 14px 16px; border: 1px solid rgba(198,161,91,.34); border-radius: 12px; background: #faf6ec; }
.variables-intro span,.variables-intro small { color: var(--muted); line-height: 1.45; }
.variables-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.variables-toolbar label { display: grid; gap: 5px; flex: 1; color: var(--muted); font-size: .78rem; font-weight: 800; text-transform: uppercase; }
.variables-toolbar input { width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); font: inherit; text-transform: none; }
.variables-toolbar > span { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.variables-groups { display: grid; gap: 10px; }
.variables-group { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.variables-group > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 15px; background: #f5f0e6; cursor: pointer; }
.variables-group > summary span { color: var(--muted); font-size: .78rem; }
.variables-table { display: grid; }
.variable-row { display: grid; grid-template-columns: minmax(0,1fr) minmax(190px,250px); gap: 18px; align-items: center; padding: 14px 15px; border-top: 1px solid var(--line); }
.variable-identity { display: grid; gap: 5px; min-width: 0; }
.variable-identity code { width: fit-content; padding: 2px 6px; border-radius: 5px; background: #eee9df; color: #6a5b3b; font-size: .72rem; overflow-wrap: anywhere; }
.variable-identity p { margin: 0; color: var(--muted); font-size: .84rem; line-height: 1.4; }
.variable-uses { display: flex; flex-wrap: wrap; gap: 5px; }
.variable-uses span { padding: 3px 7px; border-radius: 999px; background: #f3e6bd; color: #6f5419; font-size: .69rem; font-weight: 800; }
.variable-value { display: grid; gap: 5px; }
.variable-value > span,.variable-value small { color: var(--muted); font-size: .72rem; font-weight: 750; }
.variable-value > div { display: grid; grid-template-columns: minmax(0,1fr) auto; }
.variable-value input { width: 100%; min-height: 42px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px 0 0 9px; color: var(--ink); font: inherit; font-weight: 800; }
.variable-value input:disabled { background: #f5f3ee; color: #4e4a42; opacity: 1; }
.variable-value b { display: flex; align-items: center; min-width: 48px; justify-content: center; padding: 0 9px; border: 1px solid var(--line); border-left: 0; border-radius: 0 9px 9px 0; background: #eee9df; color: var(--muted); font-size: .75rem; }
.variables-actions { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,253,248,.96); box-shadow: 0 -8px 22px rgba(0,0,0,.06); }
@media (max-width: 700px) { .variable-row { grid-template-columns: 1fr; gap: 10px; } .variables-toolbar { align-items: stretch; flex-direction: column; } .variables-toolbar > span { white-space: normal; } .variables-actions { display: grid; } }

.landing-card {
  appearance: none;
  min-height: 172px;
  display: grid;
  align-content: start;
  gap: 12px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
  padding: 22px;
  box-shadow: var(--shadow);
  cursor: pointer;
  text-decoration: none;
}

.landing-card:hover,
.landing-card:focus-visible {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(198, 161, 91, .18), var(--shadow);
  outline: none;
}

.landing-card.primary-card {
  background: linear-gradient(135deg, #11100d, #2d2315);
  color: #fffaf0;
  border-color: rgba(198, 161, 91, .7);
}

.landing-card strong {
  font-size: 22px;
  line-height: 1.16;
}

.landing-card small {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.landing-card.primary-card small {
  color: #dfd1af;
}

.landing-icon {
  width: 46px;
  min-width: 46px;
  height: 46px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(198, 161, 91, .58);
  border-radius: 999px;
  background: #fff7e7;
  color: var(--brand);
  font-size: 15px;
  font-weight: 900;
}

.landing-card.primary-card .landing-icon {
  background: rgba(198, 161, 91, .18);
  color: #f7e7bd;
}

.landing-next {
  align-items: center;
}

.landing-next h2 {
  margin: 0 0 4px;
  font-size: 22px;
}

.tool-page-actions {
  max-width: 1160px;
  margin: 0 auto 14px;
  padding: 0 4px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.risk-submission-detail {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px dashed var(--line);
  display: grid;
  gap: 18px;
}

.risk-submission-detail h3 {
  margin: 0;
  font-size: 18px;
}

.section-header.compact {
  padding-bottom: 0;
  border-bottom: 0;
}

.landing-link-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 16px;
  box-shadow: 0 1px 1px rgba(16, 24, 40, 0.03);
}

.section-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.section-header h2 {
  margin: 0;
  font-size: 18px;
}

.section-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.section-body { padding: 18px; }

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfe;
}

.form-card h3 {
  margin: 0 0 12px;
  font-size: 15px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

input, select, textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: #fff;
  color: var(--ink);
}

textarea { resize: vertical; min-height: 70px; }

input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(91, 61, 245, 0.16);
  border-color: var(--brand);
}

.people-page {
  display: grid;
  gap: 28px;
}

.people-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 18px;
}

.risk-submission-person {
  display: grid;
  gap: 4px;
}

.risk-submission-person strong {
  font-size: 18px;
}

.risk-submission-person span {
  color: var(--muted);
}

.modal-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.client-risk-match-list,
.client-risk-create-list {
  display: grid;
  gap: 12px;
}

.client-risk-match-card {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(180px, .8fr) auto;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft, #faf8f3);
}

.client-risk-match-card > div,
.client-risk-match-profile {
  display: grid;
  gap: 3px;
}

.client-risk-match-card span,
.client-risk-match-card small,
.client-risk-empty p {
  color: var(--muted);
}

.client-risk-match-profile > span {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.client-risk-create-card {
  appearance: none;
  width: 100%;
  display: grid;
  gap: 5px;
  padding: 16px;
  text-align: left;
  border: 1px solid #17140f;
  border-radius: 10px;
  background: #17140f;
  color: #fff;
  cursor: pointer;
  font: inherit;
  line-height: 1.35;
}

.client-risk-create-card:hover,
.client-risk-create-card:focus-visible {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(199, 154, 43, .14);
}

.client-risk-create-card strong {
  font-size: 14px;
}

.client-risk-create-card span {
  color: rgba(255, 255, 255, .72);
  font-size: 12px;
  overflow-wrap: anywhere;
}

@media (max-width: 720px) {
  .client-risk-match-card {
    grid-template-columns: 1fr;
  }

  .client-risk-match-card .button {
    width: 100%;
  }

  .modal-head-actions {
    align-items: flex-end;
    flex-direction: column-reverse;
  }
}

.fact-find-choice-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  align-items: center;
  gap: 28px;
  padding-block: 22px;
  border-left: 5px solid var(--gold);
}

.fact-find-choice-card h2 {
  margin: 4px 0 6px;
  font-size: 22px;
}

.fact-find-choice-card p {
  margin: 0;
}

.choice-kicker {
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.fact-find-choice-control .segmented {
  width: 100%;
}

.housing-question-flow {
  display: grid;
  gap: 18px;
  margin: 18px 0 4px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
}

.housing-question-flow .segmented {
  max-width: 420px;
}

.housing-follow-up {
  display: grid;
  gap: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.housing-rent-amount {
  max-width: 420px;
}

.people-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px;
  box-shadow: 0 2px 8px rgba(16, 24, 40, 0.06);
}

.people-card.wide {
  grid-column: 1 / -1;
}

.people-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 26px;
}

.people-card.collapsed .collapsible-body {
  display: none;
}

.people-card.collapsed .people-card-head {
  margin-bottom: 0;
}

.people-card h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.1;
}

.people-card h2 span {
  color: var(--muted);
  font-size: 18px;
  font-weight: 600;
}

.people-card h3,
.subhead {
  margin: 28px 0 14px;
  font-size: 17px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.people-card-head em,
.split-head em {
  color: var(--muted);
  font-style: italic;
  font-weight: 600;
  white-space: normal;
}

.compliance-policy-list {
  display: grid;
  gap: 18px;
}

.compliance-page .section-body {
  padding: 0;
}

.compliance-add-area {
  margin: 0 0 18px;
}

.compliance-policy-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px;
  background: #fffdf8;
  box-shadow: none;
}

.section-header.compact {
  padding: 0;
  margin-bottom: 14px;
  border-bottom: 0;
}

.section-header.compact h3 {
  margin: 0;
  font-size: 18px;
}

.checklist-block {
  display: grid;
  gap: 16px;
  margin-top: 8px;
}

.checklist-block h3 {
  margin: 0;
  font-size: 16px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.compliance-question-list {
  display: grid;
  gap: 18px;
}

.compliance-question-list.compact {
  gap: 10px;
}

.compliance-policy-checklist {
  margin-top: 18px;
}

.compliance-check-row {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-weight: 650;
  line-height: 1.4;
}

.compliance-check-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.compliance-question-group {
  display: grid;
  gap: 8px;
}

.compliance-question-group h4 {
  margin: 8px 0 4px;
  color: var(--ink);
  font-size: 14px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.compliance-qa-row {
  display: grid;
  grid-template-columns: minmax(260px, 1.25fr) minmax(180px, .75fr) minmax(220px, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.compliance-question {
  margin: 0;
  padding-top: 10px;
  color: var(--ink);
  font-weight: 750;
  line-height: 1.35;
}

.compliance-answer select,
.compliance-answer input,
.compliance-answer textarea,
.compliance-notes textarea {
  width: 100%;
}

.compliance-answer textarea,
.compliance-notes textarea {
  min-height: 44px;
  resize: vertical;
}

.compliance-notes {
  display: grid;
  gap: 4px;
  margin: 0;
}

.compliance-notes span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.compliance-policy-notes {
  display: grid;
  gap: 6px;
  margin-top: 18px;
  font-weight: 700;
}

.compliance-policy-notes textarea {
  min-height: 130px;
}

.document-checklist-page {
  gap: 18px;
}

.document-checklist-card .section-body {
  padding: 0;
}

.document-checklist-card .muted-copy {
  margin: 0 0 14px;
}

.document-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffdf8;
}

.document-checklist-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  table-layout: auto;
}

.document-checklist-table th,
.document-checklist-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid rgba(198, 178, 132, .35);
  vertical-align: top;
  text-align: left;
}

.document-checklist-table th:last-child,
.document-checklist-table td:last-child {
  border-right: 0;
}

.document-checklist-table tr:last-child td {
  border-bottom: 0;
}

.document-checklist-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--ink);
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.document-checklist-table td {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
}

.document-checklist-table td:first-child {
  min-width: 150px;
  font-weight: 800;
}

.document-checklist-table .document-input,
.document-checklist-table .document-date,
.document-checklist-table select,
.document-checklist-table .document-notes {
  width: 100%;
  min-width: 130px;
  border-radius: 8px;
  background: #fff;
}

.document-checklist-table .document-notes {
  min-width: 220px;
  min-height: 42px;
  resize: vertical;
}

.document-mode-property,
.document-mode-account,
.document-mode-loan {
  min-width: 1120px;
}

.document-mode-company {
  min-width: 900px;
}

.help-dot {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-left: 8px;
  border-radius: 50%;
  background: #e5e8ff;
  color: var(--brand);
  font-size: 14px;
  vertical-align: middle;
}

.person-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.field-block {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.field-block.compact {
  margin-top: 0;
}

.field-label {
  color: var(--muted);
  font-weight: 600;
}

.muted-copy {
  color: var(--muted);
  line-height: 1.5;
  font-size: 16px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f6fa;
}

.segmented.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.segmented.six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.segmented.employment { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.segmented button {
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #5b6472;
  font-weight: 600;
}

.segmented button.selected {
  background: #fff;
  color: #020617;
  box-shadow: 0 1px 6px rgba(16, 24, 40, .14);
}

.people-table-wrap {
  margin-top: 18px;
  overflow-x: visible;
}

.people-table {
  min-width: 0;
}

.people-table th {
  background: #f8fafc;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.people-table td {
  background: #fff;
}

.plain-input,
.people-table select {
  border-color: transparent;
  background: #f8fafc;
}

.add-wide {
  width: 100%;
  min-height: 44px;
  margin-top: 14px;
  border: 1px dashed #d4d9e4;
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-weight: 700;
}

.estate-toggle {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.inheritance-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  margin-top: 14px;
  background: #fff;
}

.inheritance-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.inheritance-grid {
  display: grid;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.inheritance-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.inheritance-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.mini-note {
  margin: 10px 0 0;
  color: var(--muted);
}

.beneficiary-box {
  max-width: 620px;
}

.split-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.employment-card .segmented {
  margin-bottom: 20px;
}

.employment-card > label {
  display: block;
  margin-bottom: 18px;
}

.income-note {
  margin-bottom: 18px;
  padding: 15px 18px;
  border-left: 3px solid #d88426;
  border-radius: 6px;
  background: #fff4c7;
  color: #5f6675;
  line-height: 1.45;
  font-size: 16px;
}

.income-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 18px;
}

.income-total-box {
  display: grid;
  align-content: center;
  min-height: 66px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf8ef;
}

.income-total-box span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.income-total-box strong {
  color: var(--ink);
  font-size: 20px;
  line-height: 1.2;
}

.income-source-list {
  display: grid;
  gap: 16px;
}

.income-source-row {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
}

.income-source-row .button {
  justify-self: end;
}

.income-row-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 6px;
}

.income-source-name {
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.35;
}

.income-row-summary small {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  margin-left: 8px;
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbf8ef;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
  vertical-align: 2px;
}

.income-row-summary strong {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  margin-right: 10px;
  color: var(--ink);
  font-size: 20px;
  font-weight: 900;
}

.income-row-summary strong em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.tax-assessment-note {
  display: grid;
  gap: 8px;
  margin: 14px 0 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  background: #fbf8ef;
  color: var(--muted);
}

.tax-assessment-note strong {
  color: var(--ink);
}

.tax-assessment-note label {
  max-width: 360px;
}

.other-income-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.inline-financial-card {
  margin-top: 18px;
  padding: 18px;
  box-shadow: none;
  background: #fffdf8;
}

.inline-financial-card .financial-head {
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 14px;
}

.inline-financial-card .section-body {
  padding: 0;
}

.notice.compact {
  margin-bottom: 12px;
  padding: 12px 14px;
}

.other-income-record {
  margin-top: 0;
}

.social-welfare-record {
  display: grid;
  gap: 14px;
}

.social-welfare-grid {
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
}

.social-welfare-grid label {
  min-width: 0;
}

.social-welfare-record .record-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 2px;
}

.social-welfare-record .record-actions .button.small {
  margin: 0;
  min-width: 84px;
}

.tax-credit-record {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  gap: 12px;
  margin-top: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffdf8;
}

.tax-credit-grid {
  grid-template-columns: minmax(280px, 1.35fr) minmax(180px, .65fr);
  gap: 14px;
}

.tax-credit-grid label:first-child,
.tax-credit-grid label:last-child {
  grid-column: 1 / -1;
}

.tax-credit-grid select,
.tax-credit-grid input {
  min-height: 48px;
}

.tax-credit-grid label:first-child select {
  font-size: 1rem;
  white-space: normal;
}

.tax-credit-grid label:last-child input {
  min-width: 100%;
}

.tax-credit-record .button.small {
  align-self: start;
  justify-self: end;
  white-space: nowrap;
}

.other-income-main-block {
  display: grid;
  gap: 14px;
  padding: 16px 0;
  border-top: 1px dashed var(--line);
}

.other-income-main-block:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.subhead-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.subhead-row .subhead {
  margin: 0;
}

.continue-row {
  display: flex;
  justify-content: flex-end;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.financial-page {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.financial-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px;
  box-shadow: 0 2px 8px rgba(16, 24, 40, 0.06);
  min-width: 0;
}

.financial-card.collapsed > :not(.financial-head) {
  display: none !important;
}

.financial-card.collapsed {
  display: block;
  min-height: 0;
}

.financial-card.collapsed .financial-head {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.section-comment {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
}

.section-comment span {
  color: var(--muted);
  font-weight: 800;
  font-size: 13px;
}

.section-comment textarea {
  min-height: 84px;
  resize: vertical;
}

.section-comment.standalone {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.final-notes-card textarea {
  min-height: 150px;
}

.notes-case-team {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px dashed var(--line);
}

.notes-case-team h3 {
  margin: 0 0 14px;
  font-size: 16px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text);
}

.financial-head {
  display: grid;
  gap: 22px;
  padding-bottom: 22px;
  border-bottom: 1px dashed var(--line);
  margin-bottom: 22px;
}

.financial-head.compact {
  border-bottom: 0;
  margin-bottom: 6px;
  padding-bottom: 0;
}

.financial-title-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.collapse-toggle {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
  line-height: 1;
}

.financial-head h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.1;
}

.financial-head span {
  color: var(--muted);
  font-weight: 700;
}

.financial-add-area {
  display: grid;
  gap: 10px;
  margin-bottom: 22px;
  padding-bottom: 22px;
  border-bottom: 1px dashed var(--line);
}

.financial-add-area > span {
  color: var(--muted);
  font-weight: 700;
}

.section-total {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--ink);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
}

.section-total span {
  display: block;
  color: var(--ink);
  font-weight: 800;
  line-height: 1.35;
}

.section-total span + span {
  margin-top: 2px;
}

.section-total.stacked {
  border-radius: 12px;
  max-width: min(780px, 100%);
  white-space: normal;
}

.pill-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill-actions button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 8px 16px;
  font-weight: 700;
  color: var(--ink);
}

.finance-form-record {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 20px;
  margin-top: 14px;
}

.finance-form-record > .button.small {
  display: flex;
  width: max-content;
  margin: 14px 0 0 auto;
}

.finance-form-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
}

.finance-form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.finance-form-grid.one {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.finance-form-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.finance-form-grid.revenue-profit-row {
  margin-top: 16px;
  margin-bottom: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.finance-form-grid.pension-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.state-pension-qualify {
  margin-bottom: 18px;
}

.finance-form-grid label span {
  color: #98a2b3;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.pill-field input {
  color: var(--brand);
  font-weight: 800;
  text-transform: uppercase;
  border-radius: 999px;
  background: #f6ead1;
  border-color: transparent;
}

.financial-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.financial-table {
  width: 100%;
  min-width: 860px;
  table-layout: auto;
}

.financial-table th {
  background: #f8fafc;
  color: #697386;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.financial-table td {
  background: #fff;
  overflow-wrap: normal;
}

.financial-table .plain-input,
.financial-table select {
  width: 100%;
  min-width: 130px;
  border-color: transparent;
  background: #f8fafc;
}

.financial-nav-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.monthly-card {
  display: grid;
  gap: 22px;
}

.monthly-toolbar {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 22px;
  align-items: end;
}

.monthly-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.monthly-summary div,
.monthly-summary .kpi-card,
.month-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 14px;
}

.monthly-summary span,
.monthly-summary .kpi-card span,
.month-card span,
.month-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.monthly-summary strong,
.monthly-summary .kpi-card strong,
.month-card strong {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-size: 20px;
}

.monthly-report-note {
  display: grid;
  gap: 4px;
  padding: 16px 18px;
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  background: #fbf8ef;
  color: var(--muted);
}

.monthly-report-note strong {
  color: var(--ink);
  font-size: 18px;
}

.subaccount-card {
  display: grid;
  gap: 18px;
}

.subaccount-tabs {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.subaccount-subtitle {
  margin: 18px 0 10px;
  font-size: 15px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.subaccount-table-wrap {
  max-width: 100%;
}

.subaccount-table .plain-input,
.subaccount-table select {
  min-width: 140px;
}

.subaccount-year-column-table {
  min-width: 1080px;
}

.subaccount-year-column-table th,
.subaccount-year-column-table td {
  text-align: right;
}

.subaccount-year-column-table th:first-child,
.subaccount-year-column-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 170px;
  text-align: left;
}

.subaccount-year-column-table th:first-child {
  z-index: 2;
  background: #0f1020;
}

.subaccount-year-column-table td:first-child {
  background: #fff;
  font-weight: 800;
}

.subaccount-detail-toggle {
  align-items: center;
}

.subaccount-detail-tables {
  display: grid;
  gap: 14px;
  padding: 0 18px 18px;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.subaccount-detail-tables > .section {
  margin: 0;
  box-shadow: none;
  max-width: 100%;
  min-width: 0;
  padding: 0;
}

.subaccount-detail-tables .section-body {
  max-width: 100%;
  min-width: 0;
}

.subaccount-detail-tables .year-table-wrap {
  display: block;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
}

.subaccount-detail-tables .year-table-wrap > table.year-table {
  min-width: 880px !important;
  width: 100%;
}

.section-note {
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf8ef;
  color: var(--muted);
}

.section-note.warning {
  border-color: #c79a2b;
  color: var(--ink);
}

.linked-income-picker {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  gap: 14px;
  align-items: end;
  margin: 0;
  padding: 18px;
  border-top: 1px solid var(--line);
  background: #fbf8ef;
}

.linked-income-picker label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.2;
}

.linked-income-picker select {
  min-width: 0;
  height: 46px;
}

.linked-income-picker .button {
  height: 46px;
  align-self: end;
  white-space: nowrap;
}

.ad-hoc-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.ad-hoc-panel h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

.monthly-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.subaccount-monthly-chart-grid {
  grid-template-columns: 1fr;
}

.budget-report-dashboard {
  display: grid;
  gap: 18px;
}

.budget-report-topline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.budget-report-card,
.budget-report-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #11100e;
  color: #fff8e8;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.budget-report-card {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 310px;
}

.budget-report-card-table {
  border-bottom: 1px solid rgba(223, 195, 134, 0.45);
  background: #090908;
}

.budget-report-card-table h3,
.budget-panel-heading h3 {
  margin: 0;
  padding: 14px 16px;
  color: var(--gold);
  font-size: 15px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.budget-report-card-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.budget-mini-stat {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-top: 1px solid rgba(223, 195, 134, 0.35);
  border-right: 1px solid rgba(223, 195, 134, 0.35);
  background: #fff7df;
  color: #111;
}

.budget-mini-stat:last-child {
  border-right: 0;
}

.budget-mini-stat span {
  color: #5d5140;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.budget-mini-stat strong {
  font-size: 17px;
}

.budget-mini-chart {
  min-width: 0;
  display: grid;
  align-items: center;
  min-height: 205px;
  padding: 18px 20px;
}

.budget-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.budget-chart-value {
  fill: #ffe08a;
  font-size: 12px;
  font-weight: 800;
}

.budget-axis-label {
  fill: #ffe8ad;
  font-size: 10px;
  font-weight: 800;
}

.budget-report-analysis-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.budget-panel-heading {
  border-bottom: 1px solid rgba(223, 195, 134, 0.28);
}

.budget-panel-heading span {
  display: block;
  margin: -8px 16px 14px;
  color: #d7c8a7;
  font-size: 13px;
}

.budget-panel-heading.centered {
  text-align: center;
}

.budget-split-panel {
  display: grid;
  grid-template-columns: minmax(280px, 0.82fr) minmax(380px, 1.18fr);
  gap: 22px;
  padding: 18px;
  align-items: center;
}

.budget-table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(223, 195, 134, 0.58);
  border-radius: 6px;
  background: #fffaf0;
}

.budget-report-table {
  width: 100%;
  min-width: 360px;
  border-collapse: collapse;
  color: #111;
  font-size: 12px;
}

.budget-report-table th,
.budget-report-table td {
  padding: 9px 10px;
  border-bottom: 1px solid #dfd4bf;
  border-right: 1px solid rgba(195, 160, 91, 0.28);
  text-align: right;
  white-space: nowrap;
}

.budget-report-table th:last-child,
.budget-report-table td:last-child {
  border-right: 0;
}

.budget-report-table th:first-child,
.budget-report-table td:first-child {
  text-align: left;
  white-space: normal;
}

.budget-report-table th {
  background: #080806;
  color: #f5d77a;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.budget-report-table td {
  background: #fff8e7;
  color: #17130c;
}

.budget-report-table tbody tr:nth-child(even) td {
  background: #f6ecd8;
}

.budget-report-table tfoot td {
  background: #080806;
  color: #f5d77a;
  font-weight: 900;
}

.budget-donut-panel {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 28px;
  align-items: center;
  justify-content: center;
  min-height: 310px;
}

.budget-donut {
  display: grid;
  place-items: center;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  position: relative;
  justify-self: center;
}

.budget-donut::after {
  content: "";
  position: absolute;
  inset: 68px;
  border-radius: 50%;
  background: #11100e;
}

.budget-donut span {
  position: relative;
  z-index: 1;
  color: #ffe08a;
  font-weight: 900;
}

.budget-donut-empty {
  padding: 36px;
  border: 1px dashed rgba(223, 195, 134, 0.45);
  border-radius: 8px;
  color: #d7c8a7;
  text-align: center;
}

.budget-donut-legend {
  display: grid;
  gap: 8px;
  color: #f8efd7;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
}

.budget-donut-legend span {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.budget-donut-legend i {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  flex: 0 0 auto;
}

.budget-horizontal-bars {
  display: grid;
  gap: 10px;
  min-width: 0;
  min-height: 285px;
  align-content: center;
  padding: 10px 4px 4px;
}

.budget-hbar-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(160px, 1.45fr) 92px;
  gap: 10px;
  align-items: center;
  color: #f8efd7;
  font-size: 11px;
}

.budget-hbar-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.budget-hbar-row div {
  height: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.budget-hbar-row i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #dfc386, #fff1bd);
}

.budget-hbar-row strong {
  color: #ffe08a;
  text-align: right;
}

.budget-net-svg {
  display: block;
  padding: 10px 14px 18px;
  min-height: 300px;
}

.monthly-chart {
  min-height: 270px;
  height: auto;
  max-width: 100%;
  aspect-ratio: 16 / 8;
}

.subaccount-chart {
  min-height: 0;
  aspect-ratio: 1240 / 460;
}

.annual-owner-chart {
  aspect-ratio: 1240 / 560;
  min-height: 460px;
}

.monthly-chart rect:not(.chart-hit),
.monthly-chart circle,
.monthly-chart path,
.monthly-chart text,
.monthly-chart line:not(.focus-ring) {
  pointer-events: none;
}

.chart-legend text {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.axis-label {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.monthly-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.monthly-detail-table .year-table-wrap > table.year-table {
  min-width: 880px !important;
}

.monthly-detail-table {
  max-width: 100%;
  min-width: 0;
}

.monthly-detail-table .section,
.monthly-detail-table .section-body {
  max-width: 100%;
  min-width: 0;
}

.month-card.surplus {
  border-color: #dfc386;
  background: #fbf8ef;
}

.month-card.shortfall {
  border-color: #ffd0d7;
  background: #fff5f6;
}

.monthly-table {
  min-width: 0;
}

.household-page {
  display: grid;
  gap: 18px;
}

.expense-card {
  padding: 34px;
}

.expense-title h1 {
  margin: 0 0 28px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 28px;
  line-height: 1.1;
}

.expense-warning {
  margin-bottom: 18px;
  padding: 16px 20px;
  border-left: 4px solid #f0a12b;
  border-radius: 6px;
  background: #fff7e3;
  color: #5d3b00;
  line-height: 1.45;
}

.expense-warning ul {
  margin: 8px 0 0 20px;
  padding: 0;
}

.expense-retirement-box {
  margin: 22px 0 26px;
  padding: 16px 20px;
  border-left: 4px solid var(--brand);
  border-radius: 6px;
  background: #fbf8ef;
}

.expense-retirement-box label {
  gap: 10px;
  color: var(--muted);
}

.inline-input {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.inline-input .plain-input {
  width: 116px;
}

.inline-input em {
  font-style: normal;
  color: var(--muted);
}

.expense-single-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.expense-intro {
  margin: 0 0 18px;
}

.factfind-expense-panel {
  display: grid;
  gap: 14px;
  margin: 18px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffdf8;
}

.factfind-expense-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}

.factfind-expense-head div {
  display: grid;
  gap: 4px;
}

.factfind-expense-head strong {
  color: var(--ink);
  font-size: 16px;
}

.factfind-expense-head span {
  color: var(--muted);
  line-height: 1.4;
}

.factfind-expense-head b {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: #fff;
  color: var(--ink);
  white-space: nowrap;
}

.factfind-expense-list {
  display: grid;
  gap: 10px;
}

.factfind-expense-bulk {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px dashed rgba(198, 178, 132, .7);
  border-radius: 10px;
  background: #fff;
}

.factfind-expense-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(140px, 180px) minmax(220px, .9fr);
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(198, 178, 132, .45);
  border-radius: 10px;
  background: #fff;
}

.factfind-expense-name {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.factfind-expense-row span {
  color: var(--muted);
  font-size: 13px;
}

.expense-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 12px;
}

.expense-detail-head p {
  margin: 0;
}

.expense-rows {
  display: grid;
  gap: 16px;
}

.expense-group {
  display: grid;
  gap: 14px;
  padding-top: 12px;
}

.expense-group h3 {
  margin: 20px 0 4px;
  font-size: 18px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.expense-row {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 220px 220px auto;
  gap: 14px;
  align-items: center;
}

.expense-row-name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  font-weight: 700;
}

.expense-name-input {
  width: min(100%, 360px);
}

.prefix-field {
  position: relative;
}

.prefix-field span {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #98a2b3;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  pointer-events: none;
}

.prefix-field input {
  padding-left: 88px;
  background: #fbfcfe;
}

.prefix-field.readonly input {
  color: var(--muted);
}

.imported-row {
  padding: 8px 0 8px 12px;
  border-left: 4px solid var(--brand);
  background: linear-gradient(90deg, rgba(198, 161, 91, .12), rgba(198, 161, 91, 0));
}

.expense-row-name b {
  border-radius: 999px;
  background: #f6ead1;
  color: var(--brand);
  padding: 4px 8px;
  font-size: 11px;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.source-pill {
  width: min(100%, fit-content);
  max-width: 260px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
}

.people-action-bar {
  position: sticky;
  bottom: 16px;
  z-index: 12;
  display: flex;
  gap: 8px;
  width: fit-content;
  margin: -8px auto 0;
  padding: 8px;
  border-radius: 8px;
  background: #080808;
  box-shadow: var(--shadow);
}

.people-action-bar .button {
  min-width: 112px;
  border-color: rgba(255,255,255,.16);
  background: transparent;
  color: #fff;
  font-weight: 700;
}

.people-action-bar .button.accent {
  background: var(--brand);
  border-color: var(--brand);
  color: #080808;
}

.table-wrap { overflow-x: visible; }
.year-table-wrap {
  overflow-x: auto;
}
.year-table {
  min-width: 980px;
  white-space: nowrap;
  display: table;
  border-collapse: collapse;
}

.year-table thead { display: table-header-group; }
.year-table tbody { display: table-row-group; }
.year-table tr { display: table-row; }
.year-table th,
.year-table td {
  display: table-cell;
}
.year-table td::before { content: none; }

.retirement-test-table {
  min-width: 1320px;
}

.retirement-test-workspace {
  padding: 22px;
}

.retirement-client-wrap {
  margin-bottom: 16px;
}

.retirement-client-table {
  min-width: 720px;
}

.retirement-client-table th,
.retirement-client-table td {
  padding: 9px 10px;
  vertical-align: middle;
}

.retirement-client-table th:first-child {
  width: 240px;
  background: #0f1020;
  color: var(--brand);
  text-align: left;
}

.retirement-client-input {
  min-width: 220px;
  width: 100%;
}

.retirement-client-table .muted-cell {
  color: #6a5d48;
  font-weight: 800;
  background: #fff8e4;
}

.retirement-test-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.retirement-test-field {
  display: grid;
  grid-template-columns: minmax(130px, .45fr) minmax(150px, 1fr);
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
}

.retirement-test-field span {
  color: #6a5d48;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.retirement-test-field input,
.retirement-test-field select {
  min-width: 0;
  padding: 8px;
  border-radius: 6px;
}

.retirement-test-split {
  display: grid;
  grid-template-columns: minmax(560px, .78fr) minmax(760px, 1.42fr);
  gap: 14px;
  align-items: start;
}

.retirement-test-layout {
  display: grid;
  grid-template-columns: minmax(320px, .78fr) minmax(560px, 1.62fr);
  gap: 18px;
  align-items: start;
}

.retirement-test-sidebar,
.retirement-test-main {
  min-width: 0;
}

.section-header.compact {
  margin-bottom: 12px;
}

.section-header.compact h2 {
  font-size: 18px;
}

.section-header.compact p {
  font-size: 13px;
}

.retirement-test-lines {
  margin-top: 18px;
}

.retirement-line-table {
  min-width: 920px;
}

.retirement-line-table th,
.retirement-line-table td {
  padding: 7px;
  font-size: 12px;
}

.retirement-line-table .plain-input,
.retirement-line-table select {
  min-width: 108px;
  font-size: 12px;
}

.retirement-setup-table {
  min-width: 980px;
  font-size: 11px;
}

.retirement-setup-table th,
.retirement-setup-table td {
  padding: 6px;
  vertical-align: middle;
}

.retirement-setup-table .plain-input,
.retirement-setup-table select {
  min-width: 94px;
  height: 32px;
  padding: 5px 7px;
  font-size: 11px;
}

.retirement-setup-table td:first-child .plain-input,
.retirement-setup-table td:nth-child(2) .plain-input {
  min-width: 170px;
}

.retirement-year-grid {
  min-width: 3800px;
  font-size: 11px;
}

.retirement-combined-grid {
  min-width: 4400px;
}

.retirement-arf-grid {
  min-width: 4500px;
}

.retirement-year-grid.compact-grid {
  min-width: 2200px;
}

.retirement-year-grid th,
.retirement-year-grid td {
  padding: 6px 7px;
  text-align: right;
}

.retirement-year-grid th:first-child {
  min-width: 220px;
  text-align: left;
  position: sticky;
  left: 0;
  z-index: 3;
  background: #0f1020;
  color: #fff;
}

.retirement-combined-grid th:nth-child(2),
.retirement-combined-grid td:nth-child(2),
.retirement-combined-grid th:nth-child(3),
.retirement-combined-grid td:nth-child(3),
.retirement-combined-grid th:nth-child(4),
.retirement-combined-grid td:nth-child(4),
.retirement-arf-grid th:nth-child(3),
.retirement-arf-grid td:nth-child(3),
.retirement-arf-grid th:nth-child(4),
.retirement-arf-grid td:nth-child(4),
.retirement-arf-grid th:nth-child(5),
.retirement-arf-grid td:nth-child(5) {
  min-width: 124px;
}

.retirement-combined-grid th:nth-child(5),
.retirement-combined-grid td:nth-child(5),
.retirement-combined-grid th:nth-child(6),
.retirement-combined-grid td:nth-child(6),
.retirement-combined-grid th:nth-child(7),
.retirement-combined-grid td:nth-child(7),
.retirement-combined-grid th:nth-child(8),
.retirement-combined-grid td:nth-child(8),
.retirement-arf-grid th:nth-child(6),
.retirement-arf-grid td:nth-child(6),
.retirement-arf-grid th:nth-child(7),
.retirement-arf-grid td:nth-child(7),
.retirement-arf-grid th:nth-child(8),
.retirement-arf-grid td:nth-child(8),
.retirement-arf-grid th:nth-child(9),
.retirement-arf-grid td:nth-child(9) {
  min-width: 112px;
}

.retirement-combined-grid .plain-input,
.retirement-combined-grid select,
.retirement-arf-grid .plain-input,
.retirement-arf-grid select {
  min-width: 110px;
  height: 34px;
  padding: 6px 8px;
  font-size: 11px;
}

.retirement-combined-grid td:first-child .plain-input,
.retirement-arf-grid td:nth-child(2) .plain-input {
  min-width: 220px;
}

.retirement-year-grid thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #0f1020;
  color: var(--brand);
}

.retirement-year-grid thead tr:nth-child(2) th,
.retirement-year-grid thead tr:nth-child(3) th {
  background: #151515;
  color: #fff;
}

.retirement-year-grid thead th:first-child {
  z-index: 5;
}

.retirement-combined-grid th:first-child,
.retirement-combined-grid td:first-child,
.retirement-arf-grid th:first-child,
.retirement-arf-grid td:first-child {
  position: static;
  left: auto;
}

.retirement-combined-grid thead th:first-child,
.retirement-arf-grid thead th:first-child {
  z-index: 4;
}

.retirement-zoom-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.retirement-zoom-controls .button.small {
  min-width: 44px;
  padding: 7px 10px;
}

.retirement-zoom-wrap {
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.retirement-zoom--2 table.year-table {
  font-size: 9px;
}

.retirement-zoom--1 table.year-table {
  font-size: 10px;
}

.retirement-zoom-1 table.year-table {
  font-size: 12px;
}

.retirement-zoom-2 table.year-table {
  font-size: 13px;
}

.retirement-zoom--2 .retirement-year-input,
.retirement-zoom--2 .plain-input,
.retirement-zoom--2 select {
  min-width: 82px;
  width: 82px;
  height: 28px;
  font-size: 9px;
}

.retirement-zoom--1 .retirement-year-input,
.retirement-zoom--1 .plain-input,
.retirement-zoom--1 select {
  min-width: 96px;
  width: 96px;
  height: 30px;
  font-size: 10px;
}

.retirement-zoom-1 .retirement-year-input,
.retirement-zoom-1 .plain-input,
.retirement-zoom-1 select {
  min-width: 132px;
  width: 132px;
  height: 38px;
  font-size: 12px;
}

.retirement-zoom-2 .retirement-year-input,
.retirement-zoom-2 .plain-input,
.retirement-zoom-2 select {
  min-width: 150px;
  width: 150px;
  height: 42px;
  font-size: 13px;
}

.retirement-section-row th {
  background: #6d6d6d !important;
  color: var(--brand) !important;
  font-weight: 900;
}

.retirement-super-row th {
  background: #050505 !important;
  color: var(--brand) !important;
  font-weight: 900;
  text-align: center !important;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.retirement-year-input {
  width: 116px;
  min-width: 116px;
  height: 34px;
  padding: 6px 8px;
  text-align: right;
  font-size: 11px;
}

.retirement-total-row th {
  background: #0f1020 !important;
  color: var(--brand) !important;
}

.retirement-net-row th {
  background: var(--brand) !important;
  color: #080808 !important;
  font-weight: 900;
}

.retirement-matrix-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffdf8;
  padding: 14px;
  box-shadow: 0 8px 20px rgba(17, 18, 32, .04);
}

.retirement-matrix-wrap {
  max-height: 620px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.retirement-matrix {
  min-width: 2200px;
  font-size: 11px;
}

.retirement-matrix th,
.retirement-matrix td {
  padding: 6px 8px;
  text-align: right;
}

.retirement-matrix thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #0f1020;
  color: #fff;
}

.retirement-matrix th:first-child {
  position: sticky;
  left: 0;
  z-index: 3;
  min-width: 185px;
  text-align: left;
  background: #0f1020;
  color: #fff;
  box-shadow: 1px 0 0 var(--line);
}

.retirement-matrix thead th:first-child {
  z-index: 5;
}

.retirement-matrix th small {
  display: block;
  color: #d8b56d;
  font-size: 10px;
  font-weight: 700;
  margin-top: 3px;
}

.retirement-matrix .age-row td {
  background: #fbf8ef;
  font-weight: 800;
  color: #5b4a2f;
}

.retirement-matrix .age-row th {
  background: #2b2b2b;
}

.retirement-matrix .section-row th {
  position: static;
  background: var(--brand);
  color: #080808;
  text-transform: uppercase;
  letter-spacing: .08em;
  text-align: left;
}

.retirement-matrix .net-row td {
  font-weight: 900;
  color: #0f5f99;
  background: #eef6fb;
}

.retirement-test-chart {
  width: 100%;
  max-width: 100%;
  height: auto;
  min-height: 300px;
}

.retirement-test-chart-grid {
  align-items: stretch;
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 18px;
}

.retirement-test-chart-grid .chart-panel {
  min-width: 0;
  margin-bottom: 0;
  overflow: hidden;
}

.retirement-test-chart-grid .chart-svg {
  display: block;
  width: 100%;
  height: auto;
}

@media (max-width: 980px) {
  .retirement-test-workspace {
    padding: 14px;
  }

  .retirement-test-layout {
    grid-template-columns: 1fr;
  }

  .retirement-test-split,
  .retirement-test-detail-grid {
    grid-template-columns: 1fr;
  }

  .retirement-test-field {
    grid-template-columns: 1fr;
  }

  .retirement-matrix-wrap {
    max-height: none;
  }

  .retirement-matrix th:first-child {
    min-width: 165px;
  }
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 0;
}

th {
  background: #0f1020;
  color: #fff;
  font-weight: 600;
  font-size: 12px;
  text-align: left;
  padding: 10px;
}

td {
  border-bottom: 1px solid var(--line);
  padding: 9px;
  vertical-align: middle;
}

td input, td select { padding: 7px 8px; }
tr.shortfall td { background: #fff1f3; }
tr.surplus td { background: #fbf8ef; }

.inline-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 14px;
}

.tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
  flex-wrap: wrap;
  overflow-x: visible;
}

.tabs button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 11px 12px;
  border-bottom: 3px solid transparent;
  white-space: normal;
}

.tabs button.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

.chart-panel {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  overflow-x: visible;
}

.chart-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.chart-title h3 { margin: 0; font-size: 16px; }
.chart-title span { color: var(--muted); font-size: 12px; }

.chart {
  width: 100%;
  height: auto;
  max-width: 100%;
  min-width: 0;
  min-height: 320px;
  display: block;
}

.chart-hit {
  fill: transparent;
  cursor: pointer;
  pointer-events: all;
}

.chart-hit:focus {
  outline: none;
}

.chart-hit:focus + .focus-ring,
.chart-hit:hover + .focus-ring {
  opacity: 1;
}

.focus-ring {
  opacity: 0;
  pointer-events: none;
}

.chart-tooltip {
  position: fixed;
  z-index: 60;
  width: 250px;
  max-width: calc(100vw - 24px);
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101120;
  color: #fff;
  box-shadow: var(--shadow);
  pointer-events: none;
}

.chart-tooltip[hidden] {
  display: none;
}

.chart-tooltip strong {
  display: block;
  margin-bottom: 8px;
}

.tooltip-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: rgba(255,255,255,.82);
  margin-top: 5px;
}

.tooltip-row b {
  color: #fff;
  font-weight: 600;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 16, 32, .42);
}

.modal {
  width: min(720px, 100%);
  max-height: min(720px, calc(100vh - 36px));
  overflow: auto;
  background: #fff;
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.wide-modal {
  width: min(1120px, 100%);
}

.wide-modal .detail-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

.modal-head p {
  margin: 0;
  color: var(--muted);
}

.modal-body {
  padding: 18px;
}

.print-options-modal {
  width: min(680px, 100%);
  overflow: hidden;
}

.print-option-grid {
  display: grid;
  gap: 12px;
}

.print-option-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.print-option-card:hover,
.print-option-card:focus-visible {
  border-color: #8a6b32;
  box-shadow: 0 12px 28px rgba(25, 22, 17, .1);
  transform: translateY(-1px);
  outline: none;
}

.print-option-card:disabled {
  cursor: not-allowed;
  opacity: .58;
  transform: none;
  box-shadow: none;
}

.print-option-card.featured {
  border-color: #c6a15b;
  background: linear-gradient(135deg, #fffdf8, #f8f1df);
}

.print-option-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 10px;
  background: #11100d;
  color: #f5d47a;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
}

.print-option-icon.current {
  background: #f1ede5;
  color: #4f493f;
}

.print-option-copy strong,
.print-option-copy small {
  display: block;
}

.print-option-copy strong {
  margin-bottom: 5px;
  font-size: 16px;
}

.print-option-copy small,
.print-options-note {
  color: var(--muted);
  line-height: 1.45;
}

.print-option-arrow {
  color: #8a6b32;
  font-size: 24px;
}

.print-options-note {
  margin: 14px 2px 0;
  font-size: 12px;
}

@media (max-width: 600px) {
  .print-options-backdrop {
    align-items: end;
    padding: 10px;
  }

  .print-options-modal {
    max-height: calc(100dvh - 20px);
    border-radius: 18px 18px 10px 10px;
  }

  .print-options-modal .modal-head,
  .print-options-modal .modal-body {
    padding: 16px;
  }

  .print-option-card {
    gap: 12px;
    padding: 15px 13px;
  }

  .print-option-icon {
    width: 46px;
    height: 46px;
  }
}

/* WYSIWYG report editor: the workspace mirrors the finished A4 report. */
.report-builder-layout {
  display: block;
}

.report-builder-canvas {
  display: grid;
  justify-items: center;
  gap: 30px;
  padding: 24px;
  border-radius: 16px;
  background: radial-gradient(circle at 10% 0, rgba(198, 161, 91, .13), transparent 28%), #d9d6cf;
}

.report-page-editor {
  position: relative;
  width: min(794px, 100%);
  min-height: 1123px;
  padding: 74px 38px 58px;
  overflow: visible;
  background: #fff;
  color: #11100e;
  box-shadow: 0 12px 34px rgba(17, 16, 14, .2);
}

.report-page-content {
  min-height: 930px;
}

.report-page-letterhead {
  position: absolute;
  inset: 24px 38px auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 2px solid #c6a15b;
  font-size: 11px;
}

.report-page-letterhead small {
  margin-left: auto;
  color: #6f685c;
}

.report-page-logo {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  background: #11100e;
  color: #d7b563;
  font-weight: 900;
}

.report-page-footer {
  position: absolute;
  inset: auto 38px 24px;
  display: flex;
  justify-content: space-between;
  padding-top: 9px;
  border-top: 1px solid #ded7ca;
  color: #756f64;
  font-size: 9px;
}

.report-delete-page {
  position: absolute;
  top: 20px;
  right: -84px;
  padding: 7px 9px;
  border: 0;
  border-radius: 7px;
  background: #fff;
  color: #a13c31;
  box-shadow: 0 4px 14px rgba(17, 16, 14, .16);
  font-size: 11px;
}

.report-page-block {
  position: relative;
  padding-top: var(--report-space, 0);
  margin-bottom: 20px;
}

.report-page-block h2 {
  margin: 0 0 17px;
  padding-bottom: 11px;
  border-bottom: 2px solid #c6a15b;
  font-size: 21px;
  line-height: 1.15;
  text-transform: uppercase;
}

.report-block-toolbar {
  position: absolute;
  z-index: 5;
  top: max(0px, var(--report-space, 0));
  right: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 620px;
  padding: 5px;
  border-radius: 8px;
  opacity: 0;
  transform: translateY(-105%);
  background: #11100e;
  box-shadow: 0 5px 18px rgba(17, 16, 14, .24);
  transition: opacity .15s ease;
}

.report-page-block:hover .report-block-toolbar,
.report-page-block:focus-within .report-block-toolbar {
  opacity: 1;
}

.report-block-toolbar button,
.report-block-toolbar span {
  padding: 5px 7px;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}

.report-block-toolbar span {
  color: #d7b563;
  cursor: grab;
}

.report-block-toolbar .danger {
  color: #ff9b8e;
}

.report-page-block.dragging {
  opacity: .45;
}

.report-editable {
  display: inline-block;
  min-width: 20px;
  max-width: 100%;
  outline: 0;
  overflow-wrap: anywhere;
}

.report-editable:hover,
.report-editable:focus {
  border-radius: 3px;
  background: rgba(198, 161, 91, .12);
  box-shadow: 0 0 0 3px rgba(198, 161, 91, .12);
}

.report-multiline {
  display: block;
  white-space: pre-wrap;
}

.report-copy,
.report-section-intro {
  color: #5f5a51;
  font-size: 14px;
  line-height: 1.55;
}

.report-metrics-grid,
.report-inputs-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.report-metrics-item {
  display: grid;
  gap: 7px;
  min-height: 90px;
  padding: 14px;
  border: 1px solid #ded7ca;
  background: #fbf8f1;
}

.report-inputs-item {
  display: grid;
  gap: 6px;
  padding: 8px 0;
  border-bottom: 1px solid #ded7ca;
}

.report-item-label {
  color: #716b61;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.report-item-value {
  font-size: 17px;
  font-weight: 900;
}

.report-item-note {
  color: #716b61;
  font-size: 11px;
}

.report-page-editor .report-chart-preview {
  height: 620px;
  padding: 12px;
  border-radius: 0;
}

.report-page-editor .report-chart-preview img {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
}

.report-page-editor .report-legend-editor {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 12px;
  color: #655f55;
  font-size: 12px;
}

.report-page-editor .report-table-editor {
  overflow: visible;
  border: 0;
  border-radius: 0;
}

.report-page-editor .report-table-editor table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: collapse;
}

.report-page-editor .report-table-editor th,
.report-page-editor .report-table-editor td {
  padding: 7px 5px;
  border: 1px solid #ded7ca;
  font-size: 9px;
  vertical-align: top;
}

.report-page-editor .report-table-editor th {
  background: #11100e;
  color: #fff;
}

.report-page-editor .report-table-editor tr:nth-child(even) td {
  background: #fbf8f1;
}

.report-empty-page {
  display: grid;
  min-height: 850px;
  place-content: center;
  gap: 6px;
  border: 2px dashed #d7cebc;
  color: #837a6a;
  text-align: center;
}

.report-page-editor.cover-page {
  padding: 0;
  overflow: hidden;
  background: #fff;
}

.cover-page::before,
.cover-page::after {
  content: "";
  position: absolute;
  left: -8%;
  width: 116%;
  height: 180px;
  border-radius: 50%;
  transform: rotate(-4deg);
}

.cover-page::before {
  top: -85px;
  background: #11100e;
  box-shadow: 0 30px 0 #c6a15b;
}

.cover-page::after {
  bottom: -92px;
  background: #11100e;
  box-shadow: 0 -28px 0 #c6a15b;
}

.report-cover-brand {
  position: absolute;
  top: 150px;
  right: 65px;
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  background: #f8f3e9;
  color: #c6a15b;
  font-size: 34px;
  font-weight: 900;
}

.report-cover-copy {
  position: absolute;
  top: 390px;
  left: 64px;
  display: grid;
  width: calc(100% - 128px);
  gap: 15px;
}

.report-cover-title,
.report-cover-subtitle,
.report-cover-client,
.report-cover-prepared,
.report-cover-date {
  display: block;
}

.report-cover-title {
  font-size: 44px;
  font-weight: 950;
  line-height: 1;
  text-transform: uppercase;
}

.report-cover-subtitle {
  color: #c6a15b;
  font-size: 31px;
  font-weight: 900;
  text-transform: uppercase;
}

.report-cover-client {
  margin-top: 20px;
  font-size: 20px;
  font-weight: 900;
}

.report-cover-prepared,
.report-cover-date {
  color: #676158;
  font-size: 13px;
}

.report-library-modal {
  width: min(760px, calc(100vw - 28px));
  max-height: min(820px, calc(100vh - 28px));
}

.report-library-body {
  display: grid;
  gap: 16px;
  overflow-y: auto;
}

.report-library-modal .report-library-list article {
  background: #fbf8f1;
  color: #11100e;
}

.report-library-modal .report-library-list article p {
  color: #686156;
}

.report-library-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding-top: 14px;
  border-top: 1px solid #ded7ca;
}

@media (max-width: 900px) {
  .report-builder-canvas { padding: 10px; }
  .report-page-editor { min-height: auto; aspect-ratio: 210 / 297; padding: 9.4% 4.8% 7%; }
  .report-page-content { min-height: 82%; }
  .report-delete-page { right: 8px; top: 64px; }
  .report-page-editor .report-chart-preview { height: auto; aspect-ratio: 4 / 3; }
  .report-block-toolbar { opacity: 1; position: relative; transform: none; margin-bottom: 8px; }
}

@media (max-width: 600px) {
  .report-page-editor { font-size: 10px; }
  .report-page-block h2 { font-size: 14px; margin-bottom: 8px; padding-bottom: 6px; }
  .report-copy, .report-section-intro { font-size: 9px; }
  .report-metrics-grid, .report-inputs-grid { gap: 6px; }
  .report-metrics-item { min-height: 54px; padding: 7px; }
  .report-item-value { font-size: 11px; }
  .report-cover-copy { top: 35%; left: 8%; width: 84%; gap: 7px; }
  .report-cover-title { font-size: clamp(22px, 7vw, 36px); }
  .report-cover-subtitle { font-size: clamp(17px, 5vw, 25px); }
  .report-cover-brand { top: 14%; right: 8%; width: 44px; height: 44px; }
}

.tool-entry-options {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tool-entry-options.three-options {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tool-entry-option {
  align-content: start;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  cursor: pointer;
  display: grid;
  gap: 7px;
  min-height: 168px;
  padding: 17px;
  text-align: left;
}

.tool-entry-option:hover,
.tool-entry-option:focus-visible {
  border-color: var(--brand);
  box-shadow: 0 10px 24px rgba(65, 51, 20, .1);
  outline: none;
  transform: translateY(-1px);
}

.tool-entry-option.primary {
  background: linear-gradient(145deg, #171411, #2d281f);
  border-color: #171411;
  color: #fffaf0;
}

.tool-entry-option > span {
  color: var(--brand-dark, #8a671e);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.tool-entry-option.primary > span {
  color: #e0ba60;
}

.tool-entry-option > strong {
  font-size: 17px;
  line-height: 1.2;
}

.tool-entry-option > small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.tool-entry-option.primary > small {
  color: #d9d0bf;
}

.tool-link-status {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 10px;
}

.tool-link-status span {
  background: #f3ead7;
  border: 1px solid rgba(185, 144, 54, .38);
  border-radius: 999px;
  color: #6b511b;
  font-size: 12px;
  font-weight: 850;
  padding: 7px 11px;
}

.ai-import-form {
  display: grid;
  gap: 16px;
}

.fact-find-workbook-import {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(198, 161, 91, .55);
  border-radius: 12px;
  background: linear-gradient(135deg, #fffaf0, #f7edd8);
}

.fact-find-workbook-import > div {
  display: grid;
  gap: 4px;
}

.fact-find-workbook-import strong {
  font-family: Georgia, serif;
  font-size: 20px;
}

.fact-find-workbook-import span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.ai-import-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.ai-import-divider::before,
.ai-import-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.import-review-source-detail {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid #ead8ad;
  border-radius: 9px;
  background: #fffaf0;
  color: #684f1e;
  font-size: 12px;
}

.ai-import-source {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.ai-import-source label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  font-weight: 800;
}

.ai-import-source input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.ai-import-form textarea {
  width: 100%;
  min-height: 280px;
  resize: vertical;
  font: inherit;
  line-height: 1.45;
}

.ai-import-form .tiny-note {
  margin: 0;
  color: var(--muted);
}

.fact-find-import-button {
  border-color: rgba(185, 144, 54, .55);
  background: #fff8e8;
  color: #5f4511;
  font-weight: 850;
}

.fact-find-upload-button,
.fact-find-file-picker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.fact-find-upload-button {
  border-color: rgba(23, 122, 98, .45);
  background: #effaf6;
  color: #125e4e;
  font-weight: 850;
}

.fact-find-file-picker {
  min-width: 190px;
}

.import-review-form {
  display: grid;
  gap: 16px;
}

.import-review-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.import-review-summary > div {
  display: grid;
  align-content: start;
  gap: 4px;
  min-height: 72px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.import-review-summary span,
.import-review-current span,
.import-review-proposed > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.import-review-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.import-review-toolbar p {
  margin: 0;
  color: var(--muted);
}

.import-review-toolbar > div {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.import-review-list {
  display: grid;
  gap: 10px;
  max-height: 54vh;
  padding-right: 4px;
  overflow-y: auto;
}

.import-review-row {
  display: grid;
  grid-template-columns: 72px minmax(170px, .8fr) minmax(150px, .65fr) minmax(230px, 1fr);
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.import-review-confirm {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 850;
}

.import-review-confirm input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.import-review-field,
.import-review-current,
.import-review-proposed {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.import-review-field small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.import-review-current strong {
  overflow-wrap: anywhere;
}

.import-review-proposed input,
.import-review-proposed select,
.import-review-proposed textarea {
  width: 100%;
}

.import-review-actions {
  position: sticky;
  z-index: 2;
  bottom: -18px;
  margin: 0 -2px -18px;
  padding: 12px 2px 18px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, .92), #fff 30%);
}

.import-review-empty {
  display: grid;
  gap: 14px;
}

.import-review-empty p {
  margin: 0;
}

@media (max-width: 760px) {
  .import-review-summary {
    grid-template-columns: 1fr;
  }

  .import-review-summary > div {
    min-height: 0;
  }

  .import-review-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .import-review-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .import-review-confirm,
  .import-review-field {
    grid-column: 1 / -1;
  }
}

.client-notes-shell {
  display: grid;
  gap: 18px;
}

.client-notes-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}

.client-notes-tabs button {
  appearance: none;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-weight: 850;
  padding: 11px 15px;
}

.client-notes-tabs button.active {
  border-bottom-color: var(--brand);
  color: var(--ink);
}

.client-notes-toolbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  align-items: end;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}

.client-notes-toolbar label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.client-notes-toolbar select,
.client-notes-toolbar input {
  width: 100%;
  min-height: 43px;
}

.client-notes-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
}

.client-notes-summary > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.client-notes-summary strong {
  color: var(--ink);
  font-size: 24px;
}

.client-notes-summary-meta {
  justify-content: flex-end;
  min-width: 0;
}

.client-notes-summary-meta small {
  text-align: right;
}

.client-notes-summary .button.compact {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 8px 11px;
  font-size: 12px;
}

.client-notes-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding-top: 4px;
  color: var(--muted);
}

.client-notes-pagination span {
  text-align: center;
}

.highlevel-add-note-form {
  display: grid;
  gap: 15px;
}

.highlevel-add-note-form textarea {
  width: 100%;
  min-height: 180px;
  resize: vertical;
}

.client-opportunity-list {
  display: grid;
  gap: 14px;
}

.client-opportunity-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.client-opportunity-head {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  background: linear-gradient(135deg, #15120f, #2d281f);
  color: #fffaf0;
}

.client-opportunity-head > div {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 17px 18px;
}

.client-opportunity-head > div + div {
  border-left: 1px solid rgba(255, 255, 255, .14);
}

.client-opportunity-head span {
  color: #e4bd64;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.client-opportunity-head strong {
  overflow-wrap: anywhere;
  font-size: 18px;
}

.client-opportunity-status {
  display: grid;
  gap: 4px;
  justify-items: end;
  flex: 0 0 auto;
}

.client-opportunity-contact,
.client-opportunity-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}

.client-opportunity-layout {
  display: grid;
  grid-template-columns: minmax(260px, .8fr) minmax(0, 1.2fr);
  height: 440px;
}

.client-opportunity-layout .client-opportunity-summary {
  grid-template-columns: 1fr;
  grid-template-rows: repeat(8, minmax(0, 1fr));
  align-content: start;
  border-right: 1px solid var(--line);
  border-bottom: 0;
}

.client-opportunity-layout .client-opportunity-summary > div {
  padding: 8px 14px;
}

.client-opportunity-notes-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 16px 18px;
  background: #fff;
}

.client-opportunity-notes-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.client-opportunity-notes-head span {
  font-weight: 900;
}

.client-opportunity-notes-head > div {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
}

.client-opportunity-notes-head .button.compact {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}

.client-opportunity-notes-head small,
.client-opportunity-notes-scroll {
  color: var(--muted);
}

.client-opportunity-notes-scroll {
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
  touch-action: pan-y;
  overscroll-behavior: contain;
  padding: 14px 4px 14px 0;
}

.client-opportunity-notes-scroll p {
  margin: 0;
}

.client-opportunity-notes-scroll .client-opportunity-note-list {
  margin-top: 0;
}

.client-opportunity-contact div,
.client-opportunity-summary div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 13px 15px;
  background: #fff;
}

.client-opportunity-contact span,
.client-opportunity-summary span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.client-opportunity-contact strong,
.client-opportunity-summary strong {
  overflow-wrap: anywhere;
}

.client-opportunity-fields {
  padding: 13px 18px 16px;
}

.client-opportunity-fields summary {
  cursor: pointer;
  font-weight: 850;
}

.client-opportunity-fields dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0 0;
}

.client-opportunity-fields dl div {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.client-opportunity-fields dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.client-opportunity-fields dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  font-weight: 750;
}

.client-opportunity-notes {
  border-bottom: 1px solid var(--line);
}

.client-opportunity-note-list {
  display: grid;
  gap: 9px;
  min-width: 0;
  margin-top: 13px;
}

.client-opportunity-note-list article {
  min-width: 0;
  padding: 11px 12px;
  border-left: 3px solid var(--brand);
  border-radius: 6px;
  background: var(--panel-soft);
}

.client-opportunity-note-list p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.client-opportunity-note-list small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
}

.highlevel-settings-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr);
  gap: 24px;
  padding: 18px;
  border-radius: 12px;
  background: linear-gradient(135deg, #15120f, #2d281f);
  color: #fffaf0;
}

.highlevel-settings-intro h3,
.highlevel-settings-intro p {
  margin: 4px 0 0;
}

.highlevel-settings-intro > div > span {
  color: #e4bd64;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.highlevel-settings-intro ul {
  margin: 0;
  padding-left: 20px;
  line-height: 1.7;
}

.highlevel-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.highlevel-connection-card {
  display: grid;
  gap: 16px;
  align-content: start;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.highlevel-connection-card.new {
  border-style: dashed;
  background: var(--panel-soft);
}

.highlevel-connection-card .field-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.highlevel-connection-card .field.full {
  grid-column: 1 / -1;
}

.highlevel-connection-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.highlevel-connection-head span,
.highlevel-connection-head small {
  color: var(--brand-dark);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.highlevel-connection-head h3 {
  margin: 4px 0 0;
}

.highlevel-pipeline-picker {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.highlevel-pipeline-picker legend {
  padding: 0 6px;
  font-weight: 850;
}

.highlevel-pipeline-picker label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 9px;
  border-radius: 7px;
  background: var(--panel-soft);
}

.highlevel-pipeline-picker input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.highlevel-pipeline-picker span {
  display: grid;
  gap: 2px;
}

.highlevel-pipeline-picker small {
  color: var(--muted);
}

.highlevel-mapping-form,
.highlevel-mapping-list {
  display: grid;
  gap: 12px;
}

.highlevel-mapping-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.highlevel-mapping-row .icon-btn {
  margin-bottom: 2px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfe;
}

.detail-row span {
  color: var(--muted);
}

.detail-row strong {
  text-align: right;
}

.tax-workings {
  border: 1px solid var(--ink);
  border-bottom: 0;
  font-size: 14px;
}

.tax-working-section {
  display: grid;
  grid-template-columns: minmax(210px, .9fr) minmax(0, 1fr);
  border-bottom: 1px solid var(--ink);
}

.tax-working-label,
.tax-working-values {
  padding: 9px 10px;
}

.tax-working-label {
  border-right: 1px solid var(--ink);
  background: #fff;
}

.tax-working-label strong {
  display: block;
  margin-bottom: 3px;
  text-transform: uppercase;
  color: var(--ink);
}

.tax-working-label span {
  display: block;
  color: var(--muted);
  line-height: 1.35;
}

.tax-working-values {
  background: #fffaf4;
}

.tax-working-row,
.tax-working-total {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  padding: 3px 0;
}

.tax-working-row span {
  min-width: 0;
}

.tax-working-row small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.tax-working-row strong,
.tax-working-total strong {
  text-align: right;
  white-space: nowrap;
}

.tax-working-row strong.negative {
  color: var(--danger);
}

.tax-working-row.muted {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.tax-working-total {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--ink);
  font-weight: 800;
}

.tax-working-row.footer {
  margin-top: 3px;
  color: var(--ink);
}

.vault-modal {
  width: min(820px, 100%);
}

.users-modal {
  width: min(1180px, calc(100vw - 28px));
  max-height: min(820px, calc(100vh - 28px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.users-modal .modal-head {
  flex: 0 0 auto;
  background: #fff;
}

.users-modal .modal-body {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.vault-panel {
  display: grid;
  gap: 14px;
}

.vault-panel h3 {
  margin: 0;
  font-size: 18px;
}

.vault-save-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
}

.vault-error,
.vault-info {
  border-radius: 8px;
  padding: 11px 12px;
}

.vault-error {
  background: #fff1f3;
  color: #b42318;
  border: 1px solid #ffd2dc;
}

.vault-info {
  background: #fbf8ef;
  color: #6f4f14;
  border: 1px solid #dfc386;
}

.user-create-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffdfa;
}

.user-create-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}

.user-create-head p {
  margin: 3px 0 0;
  color: var(--muted);
}

.user-create-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.users-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  -webkit-overflow-scrolling: touch;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  background: #fff;
  white-space: nowrap;
}

.status-pill.good {
  color: #0f6b45;
  border-color: rgba(15, 107, 69, .24);
  background: #effaf5;
}

.vault-table {
  min-width: 0;
}

.users-table {
  min-width: 1080px;
}

.users-table th,
.users-table td {
  vertical-align: middle;
}

.users-table td {
  background: #fff;
}

.users-table select {
  width: 100%;
  min-width: 132px;
}

.users-table .inline-check {
  min-width: 108px;
}

.user-row-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.login-as-button {
  color: #17130b;
  background: #f8e5a5;
  border-color: #c6a15b;
}

.login-as-button:disabled {
  opacity: .45;
}

@media (max-width: 720px) {
  .fact-find-workbook-import {
    grid-template-columns: 1fr;
  }

  .fact-find-workbook-import .button {
    width: 100%;
  }
  .impersonation-banner {
    align-items: stretch;
    gap: 8px;
    padding: 9px 12px;
  }

  .impersonation-banner > div {
    display: grid;
    gap: 1px;
  }

  .impersonation-banner span {
    font-size: 11px;
    line-height: 1.25;
  }

  .impersonation-banner .button {
    min-height: 38px;
  }
}

.users-table .button.small {
  min-height: 34px;
  padding: 7px 12px;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}

.inline-check input {
  inline-size: 18px;
  block-size: 18px;
  accent-color: var(--gold);
}

.plan-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.plan-search-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

.client-list-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.client-list-pager {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.modal-eyebrow {
  display: block;
  margin-bottom: 4px;
  color: #8a6b32;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.client-library-modal {
  display: flex;
  flex-direction: column;
  width: min(920px, 100%);
  max-height: min(90vh, 900px);
  overflow: hidden;
}

.client-library-modal .modal-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  max-height: none;
  overflow: hidden;
}

.client-search-field {
  position: relative;
  display: block;
}

.client-search-field > span {
  position: absolute;
  top: 50%;
  left: 14px;
  width: 14px;
  height: 14px;
  border: 2px solid #8b816e;
  border-radius: 50%;
  transform: translateY(-58%);
  pointer-events: none;
}

.client-search-field > span::after {
  content: "";
  position: absolute;
  right: -5px;
  bottom: -3px;
  width: 6px;
  height: 2px;
  border-radius: 99px;
  background: #8b816e;
  transform: rotate(45deg);
}

.client-search-field input {
  width: 100%;
  min-height: 44px;
  padding-left: 42px;
  border-radius: 10px;
  background: #fbfaf7;
}

.client-library-list {
  display: grid;
  flex: 1 1 auto;
  gap: 10px;
  min-height: 180px;
  padding-right: 5px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.client-library-modal .client-list-pager {
  flex: 0 0 auto;
  justify-content: space-between;
  margin: 12px -22px -22px;
  padding: 13px 22px;
  border-top: 1px solid var(--line);
  background: #fffdf8;
  box-shadow: 0 -8px 22px rgba(17, 16, 14, .06);
}

.client-library-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 5px 18px rgba(18, 15, 8, .045);
}

.client-card-avatar {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(145deg, #17140f, #332918);
  color: #efd28d;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .06em;
}

.client-card-content,
.client-card-heading > div {
  min-width: 0;
}

.client-card-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.client-card-heading h3 {
  margin: 0 0 3px;
  overflow: hidden;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-card-heading p {
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-updated {
  flex: 0 0 auto;
  color: #817766;
  font-size: 11px;
}

.client-card-meta {
  display: flex;
  gap: 18px;
  margin-top: 9px;
  color: #3e392f;
  font-size: 12px;
}

.client-card-meta span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-card-meta small {
  margin-right: 5px;
  color: #8a8172;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.client-card-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  min-width: 110px;
}

.client-library-empty {
  display: grid;
  gap: 6px;
  place-items: center;
  min-height: 180px;
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
}

.client-library-empty strong {
  color: var(--ink);
  font-size: 17px;
}

.mobile-app-nav,
.mobile-menu-backdrop,
.mobile-menu-drawer {
  display: none;
}

.vault-actions {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  align-items: center;
}

.user-create-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.assign-control {
  display: grid;
  gap: 6px;
  min-width: 180px;
}

.assign-control select {
  min-height: 94px;
}

.assign-control small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.timeline {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px 18px 18px;
  overflow-x: auto;
}

.timeline-track {
  position: relative;
  height: 156px;
  min-width: 1320px;
  margin: 8px 46px 4px;
}

.timeline-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 78px;
  height: 3px;
  background: linear-gradient(90deg, var(--teal), var(--brand), var(--rose));
}

.milestone {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  display: block;
  width: 150px;
  height: 156px;
  text-align: center;
}

.milestone.lane-0,
.milestone.lane-1 { top: 0; }

.milestone span {
  position: absolute;
  left: 0;
  display: -webkit-box;
  max-width: 150px;
  min-height: 30px;
  padding: 2px 5px;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  border-radius: 6px;
  background: rgba(255, 255, 255, .9);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
}

.milestone.lane-0 span { bottom: 104px; }
.milestone.lane-1 span { top: 106px; }

.milestone-dot {
  position: absolute;
  left: 50%;
  top: 72px;
  transform: translateX(-50%);
  width: 14px;
  height: 14px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 1px var(--line);
}

.milestone strong {
  position: absolute;
  left: 0;
  width: 150px;
  font-size: 12px;
  white-space: nowrap;
}

.milestone.lane-0 strong { bottom: 86px; }
.milestone.lane-1 strong { top: 90px; }

.scenario-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 18px;
}

.scenario-list {
  display: grid;
  gap: 10px;
}

.scenario-card {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.scenario-card.active { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(198, 161, 91, 0.18); }
.scenario-card strong { display: block; margin-bottom: 4px; }
.scenario-card span { color: var(--muted); font-size: 12px; }
.scenario-select {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-align: left;
}
.scenario-remove {
  justify-self: start;
  min-height: 34px;
  padding: 8px 12px;
}

.scenario-expense-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 16px 0;
  padding: 14px;
  background: #fbfaf6;
}

.scenario-expense-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.scenario-expense-head strong,
.scenario-expense-head span {
  display: block;
}

.scenario-expense-head span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.scenario-expense-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 12px;
}

.toggle-line {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.switch {
  width: 46px;
  height: 26px;
  border: 0;
  border-radius: 999px;
  background: #cbd5e1;
  padding: 3px;
}

.switch span {
  display: block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s ease;
}

.switch.on { background: var(--brand); }
.switch.on span { transform: translateX(20px); }

.settings-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.footer-bar {
  position: sticky;
  bottom: 16px;
  z-index: 10;
  width: fit-content;
  margin: 24px auto 0;
  display: flex;
  gap: 8px;
  background: #080808;
  padding: 8px;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.footer-bar .button {
  background: transparent;
  color: #fff;
  border-color: rgba(255,255,255,.16);
}

.footer-bar .button.accent { background: var(--brand); border-color: var(--brand); }

.report-band {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.report-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px;
}

.report-card strong { display: block; font-size: 20px; margin-top: 8px; }
.report-card span { color: var(--muted); font-size: 12px; }

.report-hero-section .section-header {
  border-bottom: 2px solid #080808;
}

.report-subtitle {
  margin: 10px 0 12px;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: .02em;
}

.report-metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.report-metric-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.report-metric-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.report-metric-grid.six {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.report-metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  background: #fff;
  min-height: 94px;
}

.report-metric span {
  display: block;
  color: var(--muted);
  font-weight: 800;
  font-size: 12px;
  margin-bottom: 8px;
}

.report-metric strong {
  display: block;
  font-size: clamp(20px, 2vw, 28px);
  line-height: 1.05;
  color: var(--ink);
}

.report-metric small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.25;
}

.report-metric.positive strong { color: #13845f; }
.report-metric.negative strong { color: #c43d35; }

.report-callout-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.report-outcome {
  border: 2px solid #13845f;
  border-radius: 8px;
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  background: #fff;
}

.report-outcome.negative {
  border-color: #c43d35;
}

.report-outcome strong {
  font-size: clamp(22px, 3vw, 34px);
  color: #13845f;
}

.report-outcome.negative strong {
  color: #c43d35;
}

.report-outcome span {
  color: var(--ink);
  font-weight: 800;
  text-align: right;
}

.report-page .section {
  break-inside: avoid;
}

.report-section .section-body {
  padding-top: 18px;
}

.report-chart-stack {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
}

.report-chart {
  min-height: 320px;
}

.report-legend text {
  font-size: 12px;
  fill: #2d2a24;
  font-weight: 700;
}

.muted-axis {
  fill: #7a7164;
  font-size: 11px;
}

.report-note-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.report-note {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fffdf8;
}

.report-note strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
}

.report-note span {
  color: var(--muted);
  line-height: 1.5;
}

.scenario-report-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.scenario-report-selector-section {
  margin-bottom: 14px;
}

.scenario-report-selector {
  display: grid;
  grid-template-columns: minmax(240px, 520px) minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.scenario-report-selector label {
  margin: 0;
}

.scenario-report-selector select {
  width: 100%;
}

.scenario-report-selector-meta {
  align-self: center;
  border-left: 3px solid var(--brand);
  padding-left: 12px;
  min-width: 0;
}

.scenario-report-selector-meta strong,
.scenario-report-selector-meta span {
  display: block;
}

.scenario-report-selector-meta strong {
  color: var(--ink);
  font-weight: 900;
}

.scenario-report-selector-meta span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.report-active-scenario {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 12px;
  border: 1px solid #e6d8bf;
  border-radius: 999px;
  background: #fffaf1;
  padding: 8px 12px;
  color: var(--ink);
}

.report-active-scenario span {
  color: var(--muted);
}

.scenario-report-card.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(198, 161, 91, 0.18);
}

.scenario-report-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.scenario-detail-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  margin: 0 0 12px;
}

.scenario-detail-list div {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.scenario-detail-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.scenario-detail-list dd {
  margin: 2px 0 0;
  color: var(--ink);
  font-weight: 800;
}

.scenario-suggestion {
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  background: #fbf8ef;
  padding: 10px 12px;
}

.insight-card-stack {
  display: grid;
  gap: 16px;
}

.insight-card {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 16px;
  border: 1px solid #e3c45d;
  border-radius: 10px;
  padding: 18px;
  background: #fffdf7;
}

.insight-card.info {
  border-color: #7aa7d9;
  background: #f8fbff;
}

.insight-card.scenario {
  border-color: var(--brand);
  background: #fbf8ef;
}

.insight-marker {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 2px solid #d49400;
  border-radius: 50%;
  color: #9a6500;
  font-weight: 900;
}

.insight-card.info .insight-marker {
  border-color: #367ec5;
  color: #255d92;
}

.insight-card.scenario .insight-marker {
  border-color: var(--brand-dark);
  color: var(--brand-dark);
}

.insight-content h3 {
  margin: 8px 0;
  font-size: 20px;
}

.insight-content p {
  margin: 0 0 12px;
  color: var(--ink);
  line-height: 1.55;
}

.insight-meta,
.insight-mini-chart > div:first-child,
.insight-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.insight-meta {
  color: var(--muted);
  font-size: 13px;
}

.insight-meta strong {
  color: #a46c00;
}

.insight-card.info .insight-meta strong {
  color: #2267a6;
}

.insight-mini-chart {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  margin: 12px 0;
  background: #fff;
}

.insight-mini-chart span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.insight-mini-chart strong {
  color: var(--ink);
}

.insight-bar {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #f1eadc;
  margin-top: 8px;
}

.insight-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), #111);
}

.insight-suggestions {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
}

.insight-suggestions ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.insight-suggestions li {
  margin: 6px 0;
}

.insight-actions {
  justify-content: flex-start;
  margin-top: 12px;
  flex-wrap: wrap;
}

.insight-actions button {
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  padding: 7px 12px;
  font-weight: 800;
}

.report-reference-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.report-reference-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.report-reference-card h3 {
  margin: 0;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 16px;
}

.report-reference-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.report-reference-table td {
  padding: 11px 16px;
  border-bottom: 1px solid #eee8dc;
}

.report-reference-table tr:last-child td {
  border-bottom: 0;
}

.report-reference-table td:first-child {
  color: var(--muted);
  font-weight: 700;
}

.report-reference-table td:last-child {
  text-align: right;
  font-weight: 800;
  color: var(--ink);
}

.report-tax-alert-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.report-tax-alert {
  border: 1px solid #d5a33a;
  border-left: 4px solid #c6a15b;
  border-radius: 8px;
  padding: 13px 14px;
  background: #fffaf0;
}

.report-tax-alert.neutral {
  margin-bottom: 12px;
  border-color: var(--line);
  border-left-color: #6f7d5d;
  background: #fbfcf8;
}

.report-tax-alert strong {
  display: block;
  margin-bottom: 6px;
}

.report-tax-alert span {
  color: var(--muted);
  line-height: 1.45;
}

@media (max-width: 1100px) {
  .report-metric-grid,
  .report-metric-grid.three,
  .report-metric-grid.four,
  .report-metric-grid.six,
  .report-reference-grid,
  .report-tax-alert-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .report-metric-grid,
  .report-metric-grid.three,
  .report-metric-grid.four,
  .report-metric-grid.six,
  .report-callout-row,
  .report-reference-grid,
  .report-tax-alert-grid,
  .report-note-grid {
    grid-template-columns: 1fr;
  }

  .report-outcome {
    align-items: flex-start;
    flex-direction: column;
  }

  .report-outcome span {
    text-align: left;
  }

  .insight-card {
    grid-template-columns: 1fr;
  }

  .insight-marker {
    width: 34px;
    height: 34px;
  }

  .insight-meta,
  .insight-mini-chart > div:first-child {
    align-items: flex-start;
    flex-direction: column;
  }

  .scenario-expense-head {
    flex-direction: column;
  }

  .scenario-expense-row {
    grid-template-columns: 1fr;
  }
}

.empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
}

@media (max-width: 1500px) {
  .topbar {
    grid-template-columns: minmax(220px, .75fr) minmax(0, auto) minmax(0, auto);
    gap: 10px 16px;
  }
  .brand {
    grid-column: 1;
    grid-row: 1;
  }
  .actions {
    grid-column: 3;
    grid-row: 1;
    justify-content: flex-end;
  }
  .save-controls {
    grid-column: 3;
    grid-row: 2;
  }
  .main-nav {
    grid-column: 1 / 3;
    grid-row: 2;
  }
  .sub-nav {
    grid-column: 1 / -1;
    grid-row: 3;
  }
}

@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: minmax(180px, 1fr) minmax(0, auto) minmax(0, auto);
  }
  .brand-logo,
  .brand-mark {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }
  .brand-mark {
    font-size: 11px;
  }
  .brand strong { font-size: 14px; }
  .brand div span { font-size: 11px; }
  .main-nav button {
    min-height: 44px;
    padding: 8px 10px;
  }
  .main-nav button small {
    display: none;
  }

  .financial-table,
  .people-table,
  .monthly-table,
  .vault-table,
  .table-wrap table {
    border-collapse: separate;
    border-spacing: 0;
  }

  .financial-table thead,
  .people-table thead,
  .monthly-table thead,
  .vault-table thead,
  .table-wrap thead {
    display: none;
  }

  .financial-table tbody,
  .people-table tbody,
  .monthly-table tbody,
  .vault-table tbody,
  .table-wrap tbody {
    display: grid;
    gap: 12px;
  }

  .financial-table tr,
  .people-table tr,
  .monthly-table tr,
  .vault-table tr,
  .table-wrap tr {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
  }

  .financial-table td,
  .people-table td,
  .monthly-table td,
  .vault-table td,
  .table-wrap td {
    display: grid;
    grid-template-columns: minmax(110px, 38%) minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    border-bottom: 0;
    padding: 0;
  }

  .financial-table td::before,
  .people-table td::before,
  .monthly-table td::before,
  .vault-table td::before,
  .table-wrap td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
  }

  .financial-table td input,
  .financial-table td select,
  .people-table td input,
  .people-table td select,
  .monthly-table td input,
  .monthly-table td select {
    width: 100%;
  }

  .plan-toolbar,
  .plan-search-row {
    grid-template-columns: 1fr;
  }

  .client-list-status {
    align-items: stretch;
    flex-direction: column;
  }

  .client-list-pager {
    justify-content: space-between;
    white-space: normal;
  }

  .year-table-wrap > .year-table {
    display: table !important;
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
  }

  .year-table-wrap > .year-table thead {
    display: table-header-group !important;
  }

  .year-table-wrap > .year-table tbody {
    display: table-row-group !important;
  }

  .year-table-wrap > .year-table tr {
    display: table-row !important;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .year-table-wrap > .year-table td,
  .year-table-wrap > .year-table th {
    display: table-cell !important;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
  }

  .year-table-wrap > .year-table td::before {
    content: none !important;
  }
}

@media (max-width: 980px) {
  .fact-find-choice-card { grid-template-columns: 1fr; gap: 16px; }
  .topbar {
    grid-template-columns: minmax(126px, 1fr) minmax(0, auto) minmax(0, auto);
    gap: 8px 10px;
    padding: 14px 16px;
  }
  .brand {
    grid-column: 1;
    grid-row: 1;
  }
  .actions {
    grid-column: 3;
    grid-row: 1;
  }
  .save-controls {
    grid-column: 3;
    grid-row: 2;
  }
  .main-nav {
    grid-column: 1 / 3;
    grid-row: 2;
  }
  .sub-nav {
    grid-column: 1 / -1;
    grid-row: 3;
  }
  .brand strong,
  .brand span {
    white-space: normal;
  }
  .actions {
    justify-content: flex-end;
    overflow-x: visible;
    flex-wrap: nowrap;
    padding-bottom: 2px;
  }
  .save-controls small {
    display: none;
  }
  .sub-nav {
    align-items: flex-start;
    flex-direction: column;
  }
  .main { width: min(100% - 22px, 1320px); padding-top: 18px; }
  .page-head {
    flex-direction: column;
    align-items: stretch;
  }
  .page-head > .actions {
    justify-content: flex-start;
    width: 100%;
  }
  .summary-grid, .report-band, .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .networth-chart-grid,
  .networth-analysis {
    grid-template-columns: 1fr;
  }
  .landing-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .landing-hero, .landing-next { flex-direction: column; }
  .landing-status { min-width: 0; }
  .landing-link-row { justify-content: flex-start; }
  .user-create-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col, .scenario-grid, .people-grid { grid-template-columns: 1fr; }
  .scenario-report-selector { grid-template-columns: minmax(0, 1fr) auto; }
  .scenario-report-selector-meta { grid-column: 1 / -1; }
  .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .segmented.six, .segmented.employment { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inheritance-grid.three, .inheritance-grid.two, .income-grid { grid-template-columns: 1fr; }
  .income-grid > label:nth-child(1),
  .income-grid > label:nth-child(2) { grid-column: auto; }
  .finance-form-grid, .finance-form-grid.pension-grid, .finance-form-grid.two, .finance-form-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tax-credit-record { grid-template-columns: 1fr; }
  .tax-credit-grid { grid-template-columns: minmax(0, 1fr); }
  .tax-credit-grid label:first-child,
  .tax-credit-grid label:last-child { grid-column: 1 / -1; }
  .tax-credit-record .button.small { justify-self: end; }
  .social-welfare-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .social-welfare-record .record-actions { justify-content: stretch; }
  .social-welfare-record .record-actions .button.small { width: 100%; }
  .compliance-qa-row { grid-template-columns: 1fr 1fr; }
  .compliance-question { grid-column: 1 / -1; }
  .monthly-toolbar { grid-template-columns: 1fr; }
  .monthly-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .monthly-chart-grid { grid-template-columns: 1fr; }
  .budget-report-topline,
  .budget-report-analysis-grid,
  .budget-report-card,
  .budget-split-panel,
  .budget-donut-panel {
    grid-template-columns: 1fr;
  }
  .budget-report-card {
    min-height: 0;
  }
  .budget-report-card-table {
    border-right: 0;
    border-bottom: 1px solid rgba(223, 195, 134, 0.45);
  }
  .budget-donut {
    width: 150px;
    height: 150px;
    margin: 0 auto;
  }
  .budget-hbar-row {
    grid-template-columns: 1fr;
    gap: 5px;
  }
  .budget-hbar-row strong {
    text-align: left;
  }
  .monthly-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .expense-row { grid-template-columns: 1fr 190px 190px; }
  .expense-row .button.small, .source-pill { grid-column: 1 / -1; }
  .factfind-expense-head { flex-direction: column; }
  .factfind-expense-bulk { grid-template-columns: 1fr; }
  .factfind-expense-row { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .summary-grid, .report-band, .settings-grid, .field-grid, .landing-actions { grid-template-columns: 1fr; }
  .landing-hero,
  .landing-next,
  .landing-card {
    padding: 18px;
  }
  .landing-card {
    min-height: 150px;
  }
  .landing-link-row .button {
    width: 100%;
  }
  .user-create-grid { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; }
  .page-head > .actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }
  .page-head > .actions > *,
  .page-head > .actions .button,
  .page-head > .actions .toolbar-action,
  .factfind-calculator-menu {
    width: 100%;
    min-width: 0;
  }
  .page-head > .actions .button,
  .page-head > .actions .toolbar-action {
    min-height: 42px;
    padding: 9px 10px;
    font-size: 13px;
    white-space: normal;
    line-height: 1.15;
  }
  .page-head > .actions .toolbar-action span {
    flex: 0 0 auto;
  }
  .factfind-calculator-dropdown {
    left: 0;
    right: auto;
    width: min(260px, calc(100vw - 34px));
    min-width: 0;
  }
  .section-header { flex-direction: column; }
  .footer-bar { width: calc(100% - 24px); justify-content: center; }
  .detail-grid { grid-template-columns: 1fr; }
  .wide-modal .detail-grid { grid-template-columns: 1fr; }
  .tool-entry-options,
  .tool-entry-options.three-options { grid-template-columns: 1fr; }
  .tool-entry-option { min-height: 0; }
  .tax-working-section {
    grid-template-columns: 1fr;
  }
  .tax-working-label {
    border-right: 0;
    border-bottom: 1px solid var(--ink);
  }
  .tax-working-row,
  .tax-working-total {
    grid-template-columns: 1fr;
    gap: 3px;
  }
  .tax-working-row strong,
  .tax-working-total strong {
    text-align: left;
  }
  .people-card,
  .financial-card,
  .section {
    padding: 18px;
  }
  .chart-panel {
    padding: 12px;
  }
  .chart {
    min-width: 0;
  }
  .networth-chart-grid .chart {
    min-height: 240px;
  }
  .networth-composition-chart text,
  .networth-projection-chart text {
    font-size: 11px;
  }
  .person-fields, .segmented.three, .segmented.six, .segmented.employment { grid-template-columns: 1fr; }
  .income-grid > label:nth-child(1),
  .income-grid > label:nth-child(2) { grid-column: auto; }
  .scenario-report-selector {
    grid-template-columns: 1fr;
  }
  .scenario-report-selector .button {
    width: 100%;
  }
  .subaccount-tabs {
    grid-template-columns: 1fr;
  }
  .people-card-head, .split-head { flex-direction: column; }
  .continue-row .button { width: 100%; }
  .vault-save-row { grid-template-columns: 1fr; }
  .finance-form-grid, .finance-form-grid.pension-grid, .finance-form-grid.one, .finance-form-grid.two, .finance-form-grid.three { grid-template-columns: 1fr; }
  .social-welfare-grid { grid-template-columns: 1fr; }
  .compliance-qa-row { grid-template-columns: 1fr; }
  .compliance-question { padding-top: 0; }
  .financial-nav-row { flex-direction: column; }
  .financial-nav-row .button { width: 100%; }
  .monthly-card {
    gap: 16px;
  }
  .monthly-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .monthly-summary div,
  .monthly-summary .kpi-card,
  .month-card {
    padding: 10px;
  }
  .monthly-summary span,
  .monthly-summary .kpi-card span,
  .month-card span,
  .month-card small {
    font-size: 10px;
    line-height: 1.25;
  }
  .monthly-summary strong,
  .monthly-summary .kpi-card strong,
  .month-card strong {
    font-size: 15px;
    line-height: 1.2;
  }
  .monthly-report-note {
    padding: 12px;
  }
  .monthly-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .monthly-chart {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: auto;
  }
  .subaccount-chart {
    min-height: 0;
    aspect-ratio: 1240 / 460;
  }
  .annual-owner-chart {
    aspect-ratio: 1240 / 560;
    min-height: 380px;
  }
  .monthly-chart-grid .chart-panel {
    overflow: hidden;
  }
  .monthly-detail-table {
    display: block;
    max-width: 100%;
    min-width: 0;
  }
  .monthly-detail-table .year-table-wrap {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  .monthly-detail-table .year-table-wrap > table.year-table {
    min-width: 1040px !important;
  }
  .linked-income-picker {
    grid-template-columns: 1fr;
  }
  .linked-income-picker .button {
    width: 100%;
  }
  .subaccount-detail-tables {
    padding: 0 0 12px;
    overflow: hidden;
  }
  .subaccount-detail-tables .year-table-wrap {
    overflow-x: auto !important;
    max-width: 100%;
  }
  .subaccount-detail-tables .year-table-wrap > table.year-table {
    min-width: 880px !important;
  }
  .expense-card { padding: 20px; }
  .expense-single-grid, .expense-row { grid-template-columns: 1fr; }
  .expense-detail-head { align-items: stretch; flex-direction: column; }
  .topbar {
    grid-template-columns: minmax(104px, 1fr) auto auto;
    padding: 10px;
  }
  .save-controls {
    gap: 4px;
  }
  .top-save-button {
    min-width: 82px;
    min-height: 32px;
    padding: 6px 8px;
    font-size: 12px;
  }
  .top-cancel-button {
    min-width: 58px;
    min-height: 32px;
    padding: 6px 7px;
    font-size: 11px;
  }
  .autosave-toggle {
    min-height: 32px;
    padding: 5px 6px;
  }
  .autosave-toggle strong {
    display: none;
  }
  .actions {
    gap: 4px;
  }
  .app-update-button {
    min-height: 32px;
    padding: 6px 7px;
    font-size: 11px;
  }
  .actions .user-pill {
    display: none;
  }
  .actions .nav-category,
  .actions .nav-category-trigger {
    width: auto;
  }
  .actions .nav-category-trigger {
    min-width: 58px;
    min-height: 32px;
    padding: 6px 7px;
  }
  .actions .nav-category-trigger span {
    font-size: 12px;
  }
  .actions .nav-category-trigger small {
    display: none;
  }
  .actions .utility-menu {
    width: auto;
  }
  .actions .utility-menu-toggle {
    width: 34px;
    height: 32px;
    gap: 4px;
  }
  .actions .utility-menu-toggle span {
    width: 15px;
  }
  .actions .utility-menu-panel {
    width: min(180px, calc(50vw - 12px));
  }
  .actions .utility-menu-panel .nav-category,
  .actions .utility-menu-panel .nav-category-trigger {
    width: 100%;
  }
  .actions .utility-menu-panel .nav-category > .nav-dropdown {
    top: 0;
    right: 100%;
    left: auto;
    width: min(185px, calc(50vw - 12px));
    min-width: 0;
  }
  .main-nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    justify-self: start;
    gap: 5px;
    padding: 4px;
  }
  .main-nav button {
    min-height: 32px;
    padding: 6px 7px;
  }
  .main-nav button span {
    font-size: 12px;
    line-height: 1.15;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }
  .sub-nav > div {
    width: 100%;
  }
  .sub-nav button {
    flex: 1 1 72px;
    min-height: 30px;
    padding: 6px 7px;
    font-size: 12px;
  }
  .sub-nav > span { display: none; }
  .nav-category,
  .nav-category-trigger {
    width: 100%;
  }
  .nav-category-trigger {
    min-width: 0;
    padding: 8px 10px;
  }
  .nav-dropdown,
  .nav-dropdown-right {
    position: static;
    width: 100%;
    max-width: none;
    margin-top: 6px;
  }
  .actions .nav-dropdown,
  .actions .nav-dropdown-right {
    position: absolute;
    right: 0;
    left: auto;
    width: max-content;
    max-width: calc(100vw - 24px);
    margin-top: 0;
  }
  .financial-table td,
  .people-table td,
  .monthly-table td,
  .vault-table td,
  .table-wrap td {
    grid-template-columns: 1fr;
  }
  .people-action-bar {
    width: calc(100% - 22px);
    justify-content: center;
  }
  .people-action-bar .button {
    min-width: 0;
    flex: 1;
  }
}

/* Final annual-table and timeline overrides: keep forecast data as true rows on every viewport. */
.year-table-wrap {
  display: block !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
}

.year-table-wrap > table.year-table {
  display: table !important;
  min-width: 1040px !important;
  width: 100% !important;
  border-collapse: collapse !important;
  border-spacing: 0 !important;
  white-space: nowrap !important;
}

.year-table-wrap > table.year-table thead {
  display: table-header-group !important;
}

.year-table-wrap > table.year-table tbody {
  display: table-row-group !important;
}

.year-table-wrap > table.year-table tr {
  display: table-row !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
}

.year-table-wrap > table.year-table th,
.year-table-wrap > table.year-table td {
  display: table-cell !important;
  padding: 10px 12px !important;
  border-bottom: 1px solid var(--line) !important;
}

.year-table-wrap > table.year-table td::before {
  display: none !important;
  content: none !important;
}

/* Financial fact-find record tables stay tabular on every viewport. */
.financial-table-wrap {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
}

.financial-table-wrap > table.financial-table {
  display: table !important;
  width: 100% !important;
  min-width: max(860px, 100%) !important;
  table-layout: auto !important;
  border-collapse: collapse !important;
  border-spacing: 0 !important;
  white-space: nowrap !important;
}

.financial-table-wrap > table.financial-table thead {
  display: table-header-group !important;
}

.financial-table-wrap > table.financial-table tbody {
  display: table-row-group !important;
}

.financial-table-wrap > table.financial-table tr {
  display: table-row !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
}

.financial-table-wrap > table.financial-table th,
.financial-table-wrap > table.financial-table td {
  display: table-cell !important;
  padding: 10px 12px !important;
  border-bottom: 1px solid var(--line) !important;
  vertical-align: middle !important;
  overflow-wrap: normal !important;
}

.financial-table-wrap > table.financial-table td::before {
  display: none !important;
  content: none !important;
}

.financial-table-wrap > table.financial-table input,
.financial-table-wrap > table.financial-table select {
  width: 100%;
  min-width: 130px;
  max-width: 220px;
}

.financial-table-wrap > table.financial-table td:last-child,
.financial-table-wrap > table.financial-table th:last-child {
  width: 96px;
  min-width: 96px;
}

.financial-table-wrap > table.financial-table td:last-child .button {
  min-width: 78px;
  padding: 9px 12px;
}

.transposed-table-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  -webkit-overflow-scrolling: touch;
}

.transposed-financial-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.transposed-financial-table th,
.transposed-financial-table td {
  min-width: 220px;
  width: 220px;
  padding: 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  background: #fff;
}

.transposed-financial-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #11111d;
  color: #f5d47a;
  text-align: left;
  white-space: normal;
}

.transposed-financial-table thead th span,
.transposed-financial-table thead th small {
  display: block;
}

.transposed-financial-table thead th span {
  font-weight: 900;
}

.transposed-financial-table thead th small {
  margin-top: 4px;
  color: #f7efe1;
  font-size: 12px;
  line-height: 1.25;
}

.transposed-financial-table .sticky-question-cell {
  position: sticky;
  left: 0;
  z-index: 3;
  min-width: 210px;
  width: 210px;
  background: #f3ead8;
  color: #1a1a1a;
  font-weight: 900;
  text-align: left;
  box-shadow: 1px 0 0 var(--line);
}

.transposed-financial-table thead .sticky-question-cell {
  z-index: 6;
  background: #050507;
  color: #f5d47a;
}

.transposed-financial-table .plain-input,
.transposed-financial-table select {
  width: 100%;
  min-width: 0;
  max-width: none;
  border-color: transparent;
  background: #f8fafc;
}

.insurance-client-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.insurance-client-split label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.insurance-client-split label > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.transposed-financial-table .transposed-row-divider th,
.transposed-financial-table .transposed-row-divider td {
  padding-top: 16px;
  padding-bottom: 10px;
  background: #fbf4df;
  border-top: 2px solid rgba(197, 160, 89, 0.45);
  border-bottom: 2px solid rgba(197, 160, 89, 0.35);
}

.transposed-financial-table .transposed-row-divider .sticky-question-cell {
  background: #eadfc8;
  color: #6d5424;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.transposed-financial-table .transposed-action-row th,
.transposed-financial-table .transposed-action-row td {
  background: #fffbf2;
}

.transposed-financial-table .transposed-action-row .button {
  width: 100%;
  white-space: nowrap;
}

.timeline {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
}

.timeline-track {
  width: 1320px !important;
  min-width: 1320px !important;
  height: 156px !important;
}

@media (max-width: 1180px) {
  .users-modal {
    width: min(760px, calc(100vw - 20px));
  }

  .users-modal .modal-head {
    position: sticky;
    top: 0;
    z-index: 2;
  }

  .users-table-wrap {
    max-height: min(520px, 52vh);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px;
    background: #fbf8ef;
  }

  .users-table {
    min-width: 0;
    width: 100%;
    display: block;
  }

  .users-table tbody {
    display: grid;
    gap: 10px;
  }

  .users-table tr {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(18, 15, 8, .05);
  }

  .users-table td {
    display: grid;
    grid-template-columns: minmax(112px, 32%) minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 0;
    border: 0;
  }

  .users-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
  }

  .users-table select,
  .users-table .button,
  .users-table .status-pill,
  .users-table .inline-check {
    width: 100%;
  }

  .users-table .inline-check {
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .users-modal {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    border-radius: 10px;
  }

  .users-modal .modal-head,
  .users-modal .modal-body {
    padding: 14px;
  }

  .user-create-card {
    padding: 12px;
  }

  .user-create-card .finance-form-grid.four {
    grid-template-columns: 1fr;
  }

  .user-create-actions,
  .user-create-actions .button {
    width: 100%;
  }

  .users-table-wrap {
    max-height: 48vh;
    padding: 8px;
  }

  .users-table td {
    grid-template-columns: 1fr;
    gap: 5px;
  }
}

@media (max-width: 720px) {
  body {
    padding-top: 58px;
    padding-bottom: calc(74px + env(safe-area-inset-bottom));
  }

  .topbar {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    min-height: 58px;
    padding: 8px 12px;
  }

  .topbar .brand {
    grid-column: 1;
    grid-row: 1;
  }

  .brand-logo,
  .brand-mark {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  .brand strong {
    display: block;
    max-width: 46vw;
    font-size: 13px;
    white-space: nowrap;
  }

  .brand div span,
  .main-nav,
  .topbar .save-controls,
  .topbar .app-update-button {
    display: none;
  }

  .topbar .actions {
    display: none;
  }

  .workspace-layout,
  .workspace-layout.has-section-nav {
    width: 100%;
    gap: 0;
  }

  .section-nav-open {
    max-width: calc(100vw - 24px);
    margin: 10px 12px 0;
    padding: 8px 12px;
    border-radius: 12px;
  }

  .main {
    width: calc(100% - 20px);
    padding-top: 12px;
    padding-bottom: 16px;
  }

  .people-action-bar,
  .footer-bar {
    bottom: calc(82px + env(safe-area-inset-bottom));
  }

  .mobile-app-nav {
    position: fixed;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    left: 8px;
    z-index: 65;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    min-height: 62px;
    padding: 5px 6px;
    border: 1px solid rgba(222, 213, 196, .9);
    border-radius: 18px;
    background: rgba(255, 253, 248, .96);
    box-shadow: 0 14px 38px rgba(8, 8, 8, .2);
    backdrop-filter: blur(18px);
  }

  .mobile-app-nav button {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 2px;
    min-width: 0;
    min-height: 50px;
    padding: 3px 2px;
    border: 0;
    border-radius: 13px;
    background: transparent;
    color: #756d60;
  }

  .mobile-app-nav button.active {
    background: #17140f;
    color: #f3d58f;
  }

  .mobile-app-nav small {
    overflow: hidden;
    max-width: 100%;
    font-size: 9px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-nav-icon {
    position: relative;
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    color: currentColor;
  }

  .mobile-nav-home::before {
    content: "";
    width: 13px;
    height: 13px;
    border: 2px solid currentColor;
    border-top: 0;
    border-left: 0;
    border-radius: 2px;
    transform: translateY(2px) rotate(45deg);
  }

  .mobile-nav-home::after {
    content: "";
    position: absolute;
    bottom: 3px;
    width: 5px;
    height: 8px;
    border: 2px solid currentColor;
    border-bottom: 0;
  }

  .mobile-nav-clients::before {
    content: "";
    position: absolute;
    top: 2px;
    width: 8px;
    height: 8px;
    border: 2px solid currentColor;
    border-radius: 50%;
  }

  .mobile-nav-clients::after {
    content: "";
    position: absolute;
    bottom: 2px;
    width: 16px;
    height: 9px;
    border: 2px solid currentColor;
    border-radius: 10px 10px 4px 4px;
  }

  .mobile-nav-factfind::before {
    content: "";
    width: 14px;
    height: 18px;
    border: 2px solid currentColor;
    border-radius: 3px;
  }

  .mobile-nav-factfind::after {
    content: "";
    position: absolute;
    top: 8px;
    width: 8px;
    height: 2px;
    background: currentColor;
    box-shadow: 0 5px 0 currentColor;
  }

  .mobile-nav-planning::before {
    content: "";
    width: 17px;
    height: 14px;
    border-bottom: 2px solid currentColor;
    border-left: 2px solid currentColor;
  }

  .mobile-nav-planning::after {
    content: "";
    position: absolute;
    width: 14px;
    height: 8px;
    border-top: 2px solid currentColor;
    transform: translate(2px, 1px) rotate(-28deg);
  }

  .mobile-nav-menu-icon {
    gap: 3px;
    align-content: center;
  }

  .mobile-nav-menu-icon i {
    display: block;
    width: 17px;
    height: 2px;
    border-radius: 99px;
    background: currentColor;
  }

  .mobile-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 72;
    display: block;
    background: rgba(8, 8, 8, .48);
    backdrop-filter: blur(3px);
  }

  .mobile-menu-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 75;
    display: flex;
    width: min(88vw, 380px);
    flex-direction: column;
    border-left: 1px solid rgba(198, 161, 91, .42);
    background: #fbf8ef;
    box-shadow: -20px 0 60px rgba(0, 0, 0, .25);
    animation: mobile-drawer-in .22s ease-out both;
  }

  .mobile-menu-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: calc(18px + env(safe-area-inset-top)) 18px 16px;
    border-bottom: 1px solid var(--line);
    background: #11100e;
    color: #fff7df;
  }

  .mobile-menu-head > div {
    display: grid;
    gap: 3px;
  }

  .mobile-menu-head span {
    color: #cdbb93;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .14em;
    text-transform: uppercase;
  }

  .mobile-menu-head strong {
    font-size: 22px;
  }

  .mobile-menu-head .icon-btn {
    width: 38px;
    height: 38px;
    padding: 0;
    border-color: rgba(255, 255, 255, .2);
    background: rgba(255, 255, 255, .08);
    color: #fff;
    font-size: 24px;
  }

  .mobile-menu-scroll {
    overflow-y: auto;
    padding: 12px 14px calc(24px + env(safe-area-inset-bottom));
  }

  .mobile-menu-group {
    display: grid;
    gap: 4px;
    margin-bottom: 18px;
  }

  .mobile-menu-group p {
    margin: 0 8px 5px;
    color: #8a6b32;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .12em;
    text-transform: uppercase;
  }

  .mobile-menu-group button {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 11px;
    background: transparent;
    color: #28241e;
    text-align: left;
  }

  .mobile-menu-group button.active {
    border-color: #dbcba9;
    background: #fff;
    box-shadow: 0 5px 16px rgba(18, 15, 8, .06);
    font-weight: 800;
  }

  .mobile-menu-group button small {
    color: #9a8e78;
    font-size: 22px;
  }

  .client-library-modal {
    width: 100%;
    max-height: min(90dvh, 900px);
    border: 0;
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -18px 60px rgba(0, 0, 0, .24);
    animation: client-sheet-in .24s ease-out both;
  }

  .modal-backdrop:has(.client-library-modal) {
    place-items: end center;
    padding: 0;
    background: rgba(8, 8, 8, .52);
    backdrop-filter: blur(3px);
  }

  .client-library-modal .modal-head {
    position: relative;
    padding: 20px 18px 14px;
    background: #fffdf8;
  }

  .client-library-modal .modal-head::before {
    content: "";
    position: absolute;
    top: 7px;
    left: 50%;
    width: 38px;
    height: 4px;
    border-radius: 99px;
    background: #d8d0c2;
    transform: translateX(-50%);
  }

  .client-library-modal .modal-head h2 {
    font-size: 22px;
  }

  .client-library-modal .modal-head p {
    font-size: 12px;
  }

  .client-library-modal .modal-body {
    min-height: 0;
    max-height: none;
    padding: 14px 12px calc(18px + env(safe-area-inset-bottom));
    overflow: hidden;
    background: #f7f3eb;
  }

  .client-library-modal .plan-toolbar {
    position: sticky;
    top: -14px;
    z-index: 2;
    gap: 8px;
    margin: -2px -2px 0;
    padding: 2px 2px 10px;
    background: linear-gradient(#f7f3eb 84%, rgba(247, 243, 235, 0));
  }

  .client-library-modal .plan-search-row {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .client-search-button {
    min-width: 72px;
  }

  .client-save-button {
    width: 100%;
    min-height: 42px;
  }

  .client-list-status {
    flex-direction: row;
    align-items: center;
    padding: 0 3px;
    font-size: 11px;
  }

  .client-library-card {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    padding: 12px;
    border-radius: 16px;
  }

  .client-card-avatar {
    width: 42px;
    height: 42px;
    border-radius: 13px;
  }

  .client-card-heading {
    display: grid;
    gap: 6px;
  }

  .client-card-heading h3 {
    font-size: 15px;
  }

  .client-updated {
    font-size: 10px;
  }

  .client-card-meta {
    gap: 12px;
    margin-top: 7px;
    font-size: 11px;
  }

  .client-card-actions {
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr) minmax(0, .7fr);
    min-width: 0;
  }

  .client-card-actions .button {
    min-height: 40px;
  }

  .client-list-pager {
    position: static;
    z-index: 2;
    justify-content: space-between;
    margin: 10px -12px calc(-18px - env(safe-area-inset-bottom));
    padding: 11px 14px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: #fffdf8;
    box-shadow: 0 -8px 20px rgba(17, 16, 14, .07);
  }

  .client-list-pager .button {
    min-width: 92px;
  }
}

@keyframes mobile-drawer-in {
  from { opacity: .7; transform: translateX(35px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes client-sheet-in {
  from { opacity: .8; transform: translateY(28px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 390px) {
  .mobile-app-nav {
    right: 5px;
    left: 5px;
    padding-inline: 3px;
  }

  .mobile-app-nav small {
    font-size: 8px;
  }

  .client-library-modal .plan-search-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .client-library-modal [data-plan-search-clear] {
    grid-column: 1 / -1;
  }
}

@media print {
  @page {
    size: A4 landscape;
    margin: 10mm;
  }

  body {
    background: #fff !important;
    color: #000 !important;
  }

  .topbar,
  .actions,
  .sub-nav,
  .main-nav,
  .footer-bar,
  .button,
  .chart-tooltip,
  .modal-backdrop,
  .people-action-bar {
    display: none !important;
  }

  .shell,
  .main {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .page-head {
    display: block !important;
    margin-bottom: 10px !important;
    padding-bottom: 8px !important;
    border-bottom: 1px solid #b8aa8d !important;
  }

  .page-title h1 {
    font-size: 24px !important;
    margin: 0 0 4px !important;
  }

  .section,
  .financial-card,
  .chart-panel,
  .report-card {
    break-inside: auto;
    page-break-inside: auto;
    box-shadow: none !important;
    border-color: #d8cfbd !important;
    background: #fff !important;
  }

  .section,
  .financial-card,
  .chart-panel {
    margin-bottom: 8px !important;
    padding: 8px !important;
  }

  .section-header,
  .financial-head,
  .expense-detail-head,
  .page-title,
  .chart-title {
    break-after: avoid;
    page-break-after: avoid;
  }

  .report-card,
  .networth-item,
  .monthly-summary div,
  .monthly-summary .kpi-card,
  .month-card,
  .chart-panel {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .report-band {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
  }

  .monthly-summary,
  .monthly-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 6px !important;
  }

  .chart-panel svg {
    max-height: 210px !important;
  }

  .year-table-wrap {
    overflow: visible !important;
  }

  .monthly-detail-table {
    display: block !important;
  }

  .year-table-wrap > table.year-table,
  .year-table {
    min-width: 0 !important;
    width: 100% !important;
    white-space: normal !important;
    font-size: 8.5px !important;
  }

  .year-table th,
  .year-table td {
    padding: 4px 5px !important;
  }

  table {
    break-inside: auto;
    page-break-inside: auto;
  }

  thead {
    display: table-header-group;
  }

  tfoot {
    display: table-footer-group;
  }

  tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  th {
    background: #111 !important;
    color: #fff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  tr.shortfall td,
  tr.surplus td {
    background: #fff !important;
  }
}

.networth-breakdown {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.networth-total-card {
  margin-bottom: 16px;
  padding: 20px;
  border: 1px solid #c9a24f;
  border-radius: 14px;
  background: linear-gradient(135deg, #11111d, #242016);
  color: #fff;
  box-shadow: var(--soft-shadow);
}

.networth-total-card span {
  display: block;
  color: #f5d47a;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.networth-total-card strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(32px, 6vw, 56px);
  line-height: 1;
}

.networth-total-card small {
  display: block;
  margin-top: 10px;
  color: #f7efe1;
  line-height: 1.35;
}

.networth-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.networth-composition-chart {
  min-height: 280px;
}

.networth-projection-chart {
  min-height: 280px;
}

.networth-composition-chart text {
  fill: var(--ink);
}

.networth-analysis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.networth-analysis article {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .84);
  padding: 14px;
  box-shadow: var(--soft-shadow);
}

.networth-analysis article.wide {
  grid-column: 1 / -1;
}

.networth-analysis span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.networth-analysis strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: clamp(20px, 2.4vw, 28px);
  line-height: 1;
}

.networth-analysis p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.networth-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  background: #fff;
  box-shadow: var(--soft-shadow);
}

.networth-item span {
  display: block;
  color: var(--muted);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.networth-item strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(20px, 3vw, 30px);
  color: var(--ink);
}

.networth-item small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.35;
}

.networth-item.debt {
  border-color: #e6d7c2;
  background: #fffaf1;
}

/* Retirement cashflow test uses worksheet-style grids with many year columns. */
.year-table-wrap.retirement-zoom-wrap {
  overflow-x: auto !important;
  overflow-y: visible !important;
  max-width: 100% !important;
}

.year-table-wrap.retirement-zoom-wrap > table.year-table {
  width: max-content !important;
  table-layout: auto !important;
  white-space: nowrap !important;
  font-size: 11px !important;
}

.year-table-wrap.retirement-zoom-wrap > table.retirement-combined-grid {
  min-width: 4400px !important;
}

.year-table-wrap.retirement-zoom-wrap > table.retirement-arf-grid {
  min-width: 4500px !important;
}

.year-table-wrap.retirement-zoom-wrap > table.compact-grid {
  min-width: 2200px !important;
}

.year-table-wrap.retirement-zoom-wrap > table.pension-access-table {
  min-width: 1180px !important;
}

.year-table-wrap.retirement-zoom-wrap > table.year-table th,
.year-table-wrap.retirement-zoom-wrap > table.year-table td {
  padding: 7px 8px !important;
  min-width: 86px;
  overflow: visible !important;
}

.year-table-wrap.retirement-zoom-wrap > table.retirement-combined-grid th:first-child,
.year-table-wrap.retirement-zoom-wrap > table.retirement-combined-grid td:first-child,
.year-table-wrap.retirement-zoom-wrap > table.retirement-arf-grid th:first-child,
.year-table-wrap.retirement-zoom-wrap > table.retirement-arf-grid td:first-child {
  position: static !important;
  left: auto !important;
}

.year-table-wrap.retirement-zoom--2 > table.year-table {
  font-size: 9px !important;
}

.year-table-wrap.retirement-zoom--1 > table.year-table {
  font-size: 10px !important;
}

.year-table-wrap.retirement-zoom-1 > table.year-table {
  font-size: 12px !important;
}

.year-table-wrap.retirement-zoom-2 > table.year-table {
  font-size: 13px !important;
}

@media print {
  .retirement-zoom-controls {
    display: none !important;
  }
}

/* Retirement cashflow test line layout: setup inputs first, then year-by-year cells. */
.year-table-wrap.retirement-zoom-wrap > table.retirement-combined-grid {
  min-width: 4500px !important;
}

.retirement-combined-grid th:first-child,
.retirement-combined-grid td:first-child {
  min-width: 250px !important;
  text-align: center !important;
}

.retirement-combined-grid th:nth-child(2),
.retirement-combined-grid td:nth-child(2) {
  min-width: 115px !important;
}

.retirement-combined-grid th:nth-child(3),
.retirement-combined-grid td:nth-child(3) {
  min-width: 160px !important;
}

.retirement-combined-grid th:nth-child(4),
.retirement-combined-grid td:nth-child(4),
.retirement-combined-grid th:nth-child(5),
.retirement-combined-grid td:nth-child(5),
.retirement-combined-grid th:nth-child(6),
.retirement-combined-grid td:nth-child(6),
.retirement-combined-grid th:nth-child(7),
.retirement-combined-grid td:nth-child(7),
.retirement-combined-grid th:nth-child(8),
.retirement-combined-grid td:nth-child(8) {
  min-width: 110px !important;
}

.retirement-combined-grid th,
.retirement-combined-grid td {
  text-align: center !important;
  vertical-align: middle !important;
}

.retirement-combined-grid thead tr:first-child th:nth-child(9),
.retirement-combined-grid thead tr:nth-child(n + 2) th:nth-child(2),
.retirement-combined-grid tbody tr > :nth-child(9),
.retirement-combined-grid .retirement-section-row th:nth-child(2),
.retirement-combined-grid .retirement-total-row th:nth-child(2),
.retirement-combined-grid .retirement-net-row th:nth-child(2) {
  border-left: 3px solid rgba(185, 144, 54, 0.75) !important;
}

.retirement-combined-grid .retirement-main-row td {
  border-bottom: 1px solid var(--line) !important;
}

.retirement-combined-grid .plain-input,
.retirement-combined-grid select {
  min-width: 104px !important;
  text-align: center !important;
  width: 100% !important;
}

.retirement-combined-grid td:first-child .plain-input {
  min-width: 240px !important;
}

.retirement-combined-grid td:nth-child(3) select {
  min-width: 150px !important;
}

/* Retirement cashflow test split tables: inflows keep tax fields, outflows stay expense-only. */
.retirement-table-block {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.retirement-subtable-head,
.retirement-outflow-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.retirement-subtable-head h3,
.retirement-outflow-title h4 {
  margin: 0;
}

.retirement-subtable-head p {
  margin: 4px 0 0;
  color: var(--muted);
}

.retirement-outflow-block {
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.retirement-row-remove {
  min-width: 72px !important;
  padding-inline: 10px !important;
}

.retirement-cashflow-scroll {
  overflow-x: auto !important;
  overflow-y: visible !important;
  overscroll-behavior-x: contain;
  scroll-behavior: auto;
  will-change: scroll-position;
}

.retirement-cashflow-wide {
  display: grid;
  gap: 18px;
  min-width: var(--retirement-cashflow-width, 4700px) !important;
  width: var(--retirement-cashflow-width, 4700px) !important;
  transform-origin: top left;
}

.year-table-wrap.retirement-zoom-wrap > .retirement-cashflow-wide,
.year-table-wrap.retirement-zoom-wrap > table.year-table {
  transform-origin: top left;
}

.year-table-wrap.retirement-zoom--2 > .retirement-cashflow-wide,
.year-table-wrap.retirement-zoom--2 > table.year-table {
  zoom: .72;
}

.year-table-wrap.retirement-zoom--1 > .retirement-cashflow-wide,
.year-table-wrap.retirement-zoom--1 > table.year-table {
  zoom: .86;
}

.year-table-wrap.retirement-zoom-1 > .retirement-cashflow-wide,
.year-table-wrap.retirement-zoom-1 > table.year-table {
  zoom: 1.14;
}

.year-table-wrap.retirement-zoom-2 > .retirement-cashflow-wide,
.year-table-wrap.retirement-zoom-2 > table.year-table {
  zoom: 1.28;
}

.year-table-wrap.retirement-zoom-wrap > table.year-table,
.year-table-wrap.retirement-zoom-wrap > .retirement-cashflow-wide table.year-table {
  font-size: 11px !important;
}

.year-table-wrap.retirement-zoom-wrap .retirement-year-input,
.year-table-wrap.retirement-zoom-wrap .plain-input,
.year-table-wrap.retirement-zoom-wrap select {
  min-width: 104px !important;
  width: 100% !important;
  height: 34px !important;
  font-size: 11px !important;
}

.retirement-cashflow-wide .retirement-table-block,
.retirement-cashflow-wide .retirement-outflow-block,
.retirement-cashflow-wide .retirement-net-flow-block,
.retirement-cashflow-wide table.year-table {
  width: 100% !important;
  min-width: 100% !important;
}

.retirement-cashflow-wide table.retirement-inflow-grid,
.retirement-cashflow-wide table.retirement-outflow-grid,
.retirement-cashflow-wide table.retirement-net-flow-grid {
  display: table !important;
  table-layout: fixed !important;
  border-collapse: collapse !important;
  white-space: nowrap !important;
}

.retirement-cashflow-wide table.retirement-inflow-grid thead,
.retirement-cashflow-wide table.retirement-outflow-grid thead {
  display: table-header-group !important;
}

.retirement-cashflow-wide table.retirement-inflow-grid tbody,
.retirement-cashflow-wide table.retirement-outflow-grid tbody,
.retirement-cashflow-wide table.retirement-net-flow-grid tbody {
  display: table-row-group !important;
}

.retirement-cashflow-wide table.retirement-inflow-grid tr,
.retirement-cashflow-wide table.retirement-outflow-grid tr,
.retirement-cashflow-wide table.retirement-net-flow-grid tr {
  display: table-row !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent;
}

.retirement-cashflow-wide table.retirement-inflow-grid th,
.retirement-cashflow-wide table.retirement-inflow-grid td,
.retirement-cashflow-wide table.retirement-outflow-grid th,
.retirement-cashflow-wide table.retirement-outflow-grid td,
.retirement-cashflow-wide table.retirement-net-flow-grid th,
.retirement-cashflow-wide table.retirement-net-flow-grid td {
  display: table-cell !important;
}

.retirement-cashflow-wide table.retirement-inflow-grid td::before,
.retirement-cashflow-wide table.retirement-outflow-grid td::before,
.retirement-cashflow-wide table.retirement-net-flow-grid td::before {
  content: none !important;
  display: none !important;
}

.retirement-inflow-grid th,
.retirement-inflow-grid td,
.retirement-outflow-grid th,
.retirement-outflow-grid td,
.retirement-net-flow-grid th,
.retirement-net-flow-grid td {
  box-sizing: border-box !important;
  border-bottom: 1px solid rgba(83, 71, 47, 0.2) !important;
  text-align: center !important;
  vertical-align: middle !important;
}

.retirement-cashflow-wide .retirement-subtable-head,
.retirement-cashflow-wide .retirement-outflow-title {
  justify-content: flex-start;
}

.retirement-row-actions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  flex: 0 0 auto;
}

.retirement-cashflow-wide .retirement-subtable-head > div:not(.retirement-row-actions),
.retirement-cashflow-wide .retirement-outflow-title h4 {
  min-width: 0;
}

.retirement-inflow-grid tbody :is(th, td):nth-child(-n + 9),
.retirement-outflow-grid tbody :is(th, td):nth-child(-n + 9),
.retirement-net-flow-grid tbody :is(th, td):nth-child(-n + 9) {
  background-color: #f0e7d2 !important;
}

.retirement-inflow-grid tbody :is(th, td):nth-child(n + 10),
.retirement-outflow-grid tbody :is(th, td):nth-child(n + 10),
.retirement-net-flow-grid tbody :is(th, td):nth-child(n + 10) {
  background-color: #fffaf0 !important;
  border-left: 1px solid rgba(185, 144, 54, 0.25) !important;
  border-right: 1px solid rgba(185, 144, 54, 0.16) !important;
}

.retirement-arf-grid th,
.retirement-arf-grid td {
  box-sizing: border-box !important;
  border-bottom: 1px solid rgba(83, 71, 47, 0.2) !important;
  text-align: center !important;
  vertical-align: middle !important;
}

.retirement-arf-grid tbody :is(th, td):nth-child(-n + 9) {
  background-color: #f0e7d2 !important;
}

.retirement-arf-grid tbody :is(th, td):nth-child(n + 10) {
  background-color: #fffaf0 !important;
  border-left: 1px solid rgba(185, 144, 54, 0.25) !important;
  border-right: 1px solid rgba(185, 144, 54, 0.16) !important;
}

.retirement-inflow-grid thead th,
.retirement-outflow-grid thead th,
.retirement-arf-grid thead th {
  background-color: #10111f !important;
  color: var(--brand) !important;
  border-left: 1px solid rgba(198, 161, 91, 0.18) !important;
  border-right: 1px solid rgba(198, 161, 91, 0.18) !important;
}

.retirement-inflow-grid thead tr:nth-child(n + 2) th,
.retirement-outflow-grid thead tr:nth-child(n + 2) th,
.retirement-arf-grid thead tr:nth-child(n + 2) th {
  background-color: #151515 !important;
  color: #ffffff !important;
}

.retirement-inflow-grid .retirement-total-row th,
.retirement-outflow-grid .retirement-total-row th,
.retirement-net-flow-grid .retirement-total-row th,
.retirement-net-flow-grid .retirement-net-row th {
  background-color: #10111f !important;
  color: var(--brand) !important;
  border-left: 1px solid rgba(198, 161, 91, 0.2) !important;
  border-right: 1px solid rgba(198, 161, 91, 0.2) !important;
}

.retirement-inflow-grid .retirement-total-row th:not(.retirement-total-label),
.retirement-outflow-grid .retirement-total-row th:not(.retirement-total-label),
.retirement-net-flow-grid .retirement-total-row th:not(.retirement-total-label),
.retirement-net-flow-grid .retirement-net-row th:not(.retirement-total-label) {
  background-color: #fffaf0 !important;
  color: var(--brand) !important;
  border-left: 1px solid rgba(185, 144, 54, 0.25) !important;
  border-right: 1px solid rgba(185, 144, 54, 0.16) !important;
}

.retirement-year-value.is-zero {
  color: rgba(99, 89, 72, 0.42) !important;
  font-weight: 700;
}

.retirement-year-input.is-zero {
  background-color: rgba(255, 250, 240, 0.58) !important;
  color: rgba(99, 89, 72, 0.4) !important;
  font-weight: 600;
}

.retirement-total-row .retirement-year-value.is-zero,
.retirement-net-row .retirement-year-value.is-zero,
.retirement-closing-row .retirement-year-value.is-zero {
  color: rgba(99, 89, 72, 0.48) !important;
}

.retirement-inflow-grid .retirement-age-label,
.retirement-outflow-grid .retirement-age-label,
.retirement-inflow-grid .retirement-total-label,
.retirement-outflow-grid .retirement-total-label,
.retirement-net-flow-grid .retirement-total-label {
  text-align: right !important;
}

.retirement-age-label {
  white-space: nowrap;
}

.retirement-inflow-grid th:first-child,
.retirement-inflow-grid td:first-child,
.retirement-outflow-grid th:first-child,
.retirement-outflow-grid td:first-child {
  min-width: 92px !important;
  position: static !important;
  left: auto !important;
}

.retirement-inflow-grid th:nth-child(2),
.retirement-inflow-grid td:nth-child(2),
.retirement-outflow-grid th:nth-child(2),
.retirement-outflow-grid td:nth-child(2) {
  min-width: 260px !important;
}

.retirement-inflow-grid th:nth-child(3),
.retirement-inflow-grid td:nth-child(3),
.retirement-outflow-grid th:nth-child(3),
.retirement-outflow-grid td:nth-child(3),
.retirement-inflow-grid th:nth-child(4),
.retirement-inflow-grid td:nth-child(4),
.retirement-inflow-grid th:nth-child(5),
.retirement-inflow-grid td:nth-child(5),
.retirement-outflow-grid th:nth-child(4),
.retirement-outflow-grid td:nth-child(4),
.retirement-outflow-grid th:nth-child(5),
.retirement-outflow-grid td:nth-child(5) {
  min-width: 140px !important;
}

.retirement-inflow-grid th:nth-child(6),
.retirement-inflow-grid td:nth-child(6),
.retirement-inflow-grid th:nth-child(7),
.retirement-inflow-grid td:nth-child(7),
.retirement-inflow-grid th:nth-child(8),
.retirement-inflow-grid td:nth-child(8),
.retirement-inflow-grid th:nth-child(9),
.retirement-inflow-grid td:nth-child(9),
.retirement-outflow-grid th:nth-child(6),
.retirement-outflow-grid td:nth-child(6),
.retirement-outflow-grid th:nth-child(7),
.retirement-outflow-grid td:nth-child(7),
.retirement-outflow-grid th:nth-child(8),
.retirement-outflow-grid td:nth-child(8),
.retirement-outflow-grid th:nth-child(9),
.retirement-outflow-grid td:nth-child(9) {
  min-width: 112px !important;
}

.retirement-outflow-grid .retirement-alignment-spacer {
  padding: 0 !important;
  background: rgba(20, 18, 13, 0.12) !important;
  color: transparent !important;
  pointer-events: none !important;
}

.retirement-net-flow-block {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.retirement-net-flow-grid th,
.retirement-net-flow-grid td {
  min-width: 112px !important;
}

.retirement-net-flow-grid th:first-child,
.retirement-net-flow-grid td:first-child {
  position: static !important;
  left: auto !important;
}

.retirement-net-flow-grid .retirement-closing-row th {
  background: rgba(20, 18, 13, 0.82) !important;
  color: var(--brand) !important;
  font-weight: 900;
}

.retirement-net-flow-grid .retirement-net-row th:nth-child(2),
.retirement-net-flow-grid .retirement-closing-row th:nth-child(2),
.retirement-net-flow-grid .retirement-total-row th:nth-child(2) {
  border-left: 3px solid rgba(185, 144, 54, 0.75) !important;
}

.retirement-inflow-grid .plain-input,
.retirement-inflow-grid select,
.retirement-outflow-grid .plain-input,
.retirement-outflow-grid select {
  min-width: 104px !important;
  width: 100% !important;
  text-align: center !important;
}

.retirement-inflow-grid td:nth-child(2) .plain-input,
.retirement-outflow-grid td:nth-child(2) .plain-input {
  min-width: 245px !important;
}

.retirement-inflow-grid td:nth-child(4) select {
  min-width: 150px !important;
}

.retirement-inflow-grid thead tr:first-child th:nth-child(10),
.retirement-inflow-grid thead tr:nth-child(n + 2) th:nth-child(2),
.retirement-inflow-grid tbody tr > :nth-child(10),
.retirement-inflow-grid .retirement-section-row th:nth-child(2),
.retirement-inflow-grid .retirement-total-row th:nth-child(2) {
  border-left: 1px solid rgba(185, 144, 54, 0.25) !important;
}

.retirement-outflow-grid thead tr:first-child th:nth-child(10),
.retirement-outflow-grid thead tr:nth-child(n + 2) th:nth-child(2),
.retirement-outflow-grid tbody tr > :nth-child(10),
.retirement-outflow-grid .retirement-total-row th:nth-child(2) {
  border-left: 1px solid rgba(185, 144, 54, 0.25) !important;
}

@media (max-width: 720px) {
  .ai-import-source {
    grid-template-columns: 1fr;
  }

  .client-notes-toolbar,
  .highlevel-settings-intro,
  .highlevel-settings-grid,
  .highlevel-connection-card .field-grid.two,
  .highlevel-mapping-row,
  .client-opportunity-contact,
  .client-opportunity-summary,
  .client-opportunity-fields dl {
    grid-template-columns: 1fr;
  }

  .client-opportunity-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .client-opportunity-layout .client-opportunity-summary {
    grid-template-rows: none;
  }

  .client-opportunity-notes-scroll {
    max-height: 420px;
  }

  .client-opportunity-head {
    grid-template-columns: 1fr;
  }

  .client-opportunity-head > div + div {
    border-top: 1px solid rgba(255, 255, 255, .14);
    border-left: 0;
  }

  .client-opportunity-layout .client-opportunity-summary {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .client-notes-summary,
  .client-opportunity-head,
  .highlevel-connection-head {
    align-items: stretch;
    flex-direction: column;
  }

  .client-notes-summary small {
    margin-left: 0;
    text-align: left;
  }

  .client-notes-summary > div,
  .client-notes-summary-meta {
    align-items: stretch;
    flex-direction: column;
  }

  .client-notes-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .client-opportunity-status {
    justify-items: start;
  }

  .retirement-subtable-head,
  .retirement-outflow-title {
    align-items: stretch;
    flex-direction: column;
  }
}

.income-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 0 0 18px;
}

.income-summary-card {
  background: #fff;
  border: 1px solid var(--line, #ded4c2);
  border-radius: 12px;
  padding: 12px 14px;
}

.income-summary-card span {
  display: block;
  color: #6e6659;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.income-summary-card strong {
  display: block;
  margin-top: 6px;
  font-size: 1.35rem;
}

.income-summary-card.total {
  background: #0d0d0f;
  border-color: #c9a85a;
  color: #fff;
}

.income-summary-card.total span {
  color: #d4b35f;
}

.compact-income-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.tax-client-grid {
  display: grid;
  gap: 18px;
}

.tax-client-card .muted-copy {
  margin: 0 0 12px;
}

.tax-workings-panel {
  margin-top: 14px;
  overflow-x: auto;
}

@media (max-width: 760px) {
  .income-summary-grid {
    grid-template-columns: 1fr;
  }

  .income-row-summary {
    min-width: 0;
  }
}

/* Dashboard Test: decision-first cashflow review, kept separate from the full report. */
.dashboard-test-page {
  display: grid;
  width: 100%;
  min-width: 0;
  gap: 18px;
}

.dashboard-test-page > * {
  min-width: 0;
}

.dashboard-test-page .section {
  min-width: 0;
  margin-bottom: 0;
  padding: 0;
  border-radius: 16px;
}

.dashboard-test-notice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px 16px;
  align-items: center;
  border: 1px solid #2d2a24;
  border-radius: 14px;
  padding: 14px 18px;
  background: #121316;
  color: #fff;
}

.dashboard-test-notice strong {
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--brand);
  color: #121316;
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.dashboard-test-notice span {
  color: #e8e1d5;
  line-height: 1.45;
}

.dashboard-test-status {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 15px;
  align-items: center;
  margin-bottom: 18px;
  border: 1px solid #a8cfc1;
  border-left: 6px solid #0d6b58;
  border-radius: 12px;
  padding: 17px 18px;
  background: #f3faf7;
}

.dashboard-test-status.warning,
.dashboard-test-status.watch {
  border-color: #e1c17d;
  border-left-color: #9b6811;
  background: #fff9ec;
}

.dashboard-test-status.negative {
  border-color: #e4a8a2;
  border-left-color: #a52f27;
  background: #fff4f3;
}

.dashboard-test-status-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #0d6b58;
  color: #fff;
  font-size: 21px;
  font-weight: 900;
}

.dashboard-test-status.warning .dashboard-test-status-icon,
.dashboard-test-status.watch .dashboard-test-status-icon {
  background: #9b6811;
}

.dashboard-test-status.negative .dashboard-test-status-icon {
  background: #a52f27;
}

.dashboard-test-status strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 19px;
}

.dashboard-test-status p {
  margin: 0;
  color: #4f4a42;
  line-height: 1.5;
}

.dashboard-test-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.dashboard-test-kpi {
  position: relative;
  min-width: 0;
  border: 1px solid var(--line);
  border-top: 4px solid #6f7682;
  border-radius: 12px;
  padding: 15px 16px;
  background: #fff;
}

.dashboard-test-kpi.positive { border-top-color: #0d6b58; }
.dashboard-test-kpi.warning { border-top-color: #9b6811; }
.dashboard-test-kpi.negative { border-top-color: #a52f27; }
.dashboard-test-kpi.neutral { border-top-color: #4f6074; }

.dashboard-test-kpi > span {
  display: block;
  min-height: 30px;
  color: #5e584e;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .035em;
  text-transform: uppercase;
}

.dashboard-test-kpi > strong {
  display: block;
  margin: 7px 0;
  color: var(--ink);
  font-size: clamp(22px, 2.1vw, 31px);
  line-height: 1.08;
}

.dashboard-test-kpi > small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.dashboard-test-definition {
  margin: 16px 0 0;
  border-left: 3px solid var(--brand);
  padding: 10px 13px;
  background: #fbf8ef;
  color: #5c5549;
  line-height: 1.5;
}

.dashboard-test-timeline {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(190px, 1fr);
  gap: 12px;
  overflow-x: auto;
  padding: 6px 2px 10px;
  scrollbar-width: thin;
}

.dashboard-test-milestone {
  position: relative;
  min-height: 165px;
  border: 1px solid var(--line);
  border-top: 5px solid #5f6e7b;
  border-radius: 12px;
  padding: 15px;
  background: #fff;
}

.dashboard-test-milestone.retirement { border-top-color: #6f50a8; }
.dashboard-test-milestone.warning,
.dashboard-test-milestone.drawdown { border-top-color: #9b6811; }
.dashboard-test-milestone.negative { border-top-color: #a52f27; }
.dashboard-test-milestone.end { border-top-color: #0d6b58; }

.dashboard-test-milestone > div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}

.dashboard-test-milestone > div strong {
  color: var(--ink);
  font-size: 21px;
}

.dashboard-test-milestone > div span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.dashboard-test-milestone h3 {
  margin: 14px 0 7px;
  color: var(--ink);
  font-size: 16px;
}

.dashboard-test-milestone p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.dashboard-test-funding-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 320px);
  gap: 18px;
  align-items: start;
}

.dashboard-test-chart-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 15px;
  background: #fff;
  overflow: hidden;
}

.dashboard-test-chart-mobile-hint {
  display: none;
}

.dashboard-test-chart-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
}

.dashboard-test-capital-chart {
  display: block;
  width: 100%;
  height: auto;
  min-height: 320px;
}

.dashboard-test-chart-marker line,
.dashboard-test-chart-marker text {
  stroke: #6f50a8;
  fill: #5b3d91;
}

.dashboard-test-chart-marker text {
  stroke: none;
  font-size: 12px;
  font-weight: 900;
}

.dashboard-test-chart-marker.negative line,
.dashboard-test-chart-marker.negative text {
  stroke: #a52f27;
  fill: #8f211b;
}

.dashboard-test-funding-summary {
  display: grid;
  gap: 10px;
}

.dashboard-test-funding-summary .dashboard-test-kpi > span {
  min-height: 0;
}

.dashboard-test-funding-summary .dashboard-test-kpi > strong {
  font-size: 23px;
}

.dashboard-test-split {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: 18px;
  align-items: start;
}

.dashboard-test-panel {
  min-width: 0;
}

.dashboard-test-goal-list,
.dashboard-test-priority-list {
  display: grid;
  gap: 10px;
}

.dashboard-test-goal {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 12px 13px;
  background: #fff;
}

.dashboard-test-goal-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #8a3c35;
  color: #fff;
  font-size: 20px;
  font-weight: 900;
}

.dashboard-test-goal.income .dashboard-test-goal-icon {
  background: #0d6b58;
}

.dashboard-test-goal h3 {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 15px;
}

.dashboard-test-goal p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.dashboard-test-goal > strong {
  color: #8a3c35;
  font-size: 16px;
  white-space: nowrap;
}

.dashboard-test-goal.income > strong { color: #0d6b58; }

.dashboard-test-priority {
  border: 1px solid var(--line);
  border-left: 5px solid #5f6e7b;
  border-radius: 11px;
  padding: 13px 14px;
  background: #fff;
}

.dashboard-test-priority.positive { border-left-color: #0d6b58; }
.dashboard-test-priority.warning,
.dashboard-test-priority.watch { border-left-color: #9b6811; }
.dashboard-test-priority.negative { border-left-color: #a52f27; }

.dashboard-test-priority > span {
  color: #5e584e;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .055em;
  text-transform: uppercase;
}

.dashboard-test-priority h3 {
  margin: 5px 0;
  color: var(--ink);
  font-size: 16px;
}

.dashboard-test-priority p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.dashboard-test-assumption-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.dashboard-test-assumption-strip > div {
  min-width: 0;
  border-right: 1px solid var(--line);
  padding: 13px 14px;
}

.dashboard-test-assumption-strip > div:last-child { border-right: 0; }

.dashboard-test-assumption-strip span,
.dashboard-test-assumption-strip strong {
  display: block;
}

.dashboard-test-assumption-strip span {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.dashboard-test-assumption-strip strong {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.3;
}

.dashboard-test-boundaries {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 15px;
}

.dashboard-test-boundaries article {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 14px;
  background: #fbf8ef;
}

.dashboard-test-boundaries strong {
  color: var(--ink);
}

.dashboard-test-boundaries p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.dashboard-test-footer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 16px;
}

.dashboard-test-position-layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}

.dashboard-test-net-worth {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  border: 1px solid #25221d;
  border-left: 6px solid #0d6b58;
  border-radius: 13px;
  padding: 20px;
  background: #151515;
  color: #fff;
}

.dashboard-test-net-worth.negative {
  border-left-color: #d6675f;
}

.dashboard-test-net-worth > span {
  color: #d8c9a8;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .055em;
  text-transform: uppercase;
}

.dashboard-test-net-worth > strong {
  margin: 9px 0;
  color: #fff;
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.dashboard-test-net-worth > p {
  margin: 0;
  color: #e4ded2;
  font-size: 13px;
  line-height: 1.5;
}

.dashboard-test-position-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.dashboard-test-position-kpis .dashboard-test-kpi > span {
  min-height: 0;
}

.dashboard-test-position-kpis .dashboard-test-kpi > strong {
  font-size: 24px;
}

.dashboard-test-position-breakdown {
  display: grid;
  gap: 9px;
  margin-top: 16px;
}

.dashboard-test-position-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.15fr) minmax(160px, 1.5fr) auto;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 13px;
  background: #fff;
}

.dashboard-test-position-row > div:first-child {
  min-width: 0;
}

.dashboard-test-position-row > div:first-child strong,
.dashboard-test-position-row > div:first-child span {
  display: block;
}

.dashboard-test-position-row > div:first-child strong {
  color: var(--ink);
  font-size: 14px;
}

.dashboard-test-position-row > div:first-child span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.dashboard-test-position-row > strong {
  color: var(--ink);
  font-size: 15px;
  white-space: nowrap;
}

.dashboard-test-position-bar {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #ece7dd;
}

.dashboard-test-position-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0d6b58, #6f50a8);
}

.dashboard-test-debt-note,
.dashboard-test-movement-note {
  margin: 14px 0 0;
  border-left: 3px solid var(--brand);
  padding: 11px 13px;
  background: #fbf8ef;
  color: #5c5549;
  line-height: 1.5;
}

.dashboard-test-movement-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}

.dashboard-test-stage {
  min-width: 0;
  border: 1px solid var(--line);
  border-top: 5px solid #0d6b58;
  border-radius: 13px;
  padding: 15px;
  background: #fff;
}

.dashboard-test-stage.warning {
  border-top-color: #9b6811;
}

.dashboard-test-stage.negative {
  border-top-color: #a52f27;
}

.dashboard-test-stage-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.dashboard-test-stage-head span {
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
}

.dashboard-test-stage-head strong {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.dashboard-test-stage-summary {
  min-height: 58px;
  margin: 9px 0 13px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.dashboard-test-stage-label {
  margin: 12px 0 7px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 5px;
  color: #5e584e;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .055em;
  text-transform: uppercase;
}

.dashboard-test-stage-values {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.dashboard-test-stage-values > div {
  min-width: 0;
  border-radius: 8px;
  padding: 9px 10px;
  background: #f7f4ed;
}

.dashboard-test-stage-values > div.wide {
  grid-column: 1 / -1;
}

.dashboard-test-stage-values span,
.dashboard-test-stage-values strong {
  display: block;
}

.dashboard-test-stage-values span {
  min-height: 28px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.3;
  text-transform: uppercase;
}

.dashboard-test-stage-values strong {
  margin-top: 4px;
  color: var(--ink);
  font-size: 15px;
  overflow-wrap: anywhere;
}

.dashboard-test-stage-values strong.positive {
  color: #0d6b58;
}

.dashboard-test-stage-values strong.negative {
  color: #a52f27;
}

.dashboard-test-stage-values.assets > div {
  background: #f3f6f5;
}

.dashboard-test-projection-total-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin: 20px 0 10px;
}

.dashboard-test-projection-total-title strong {
  color: var(--ink);
  font-size: 16px;
}

.dashboard-test-projection-total-title span {
  color: var(--muted);
  font-size: 12px;
}

.dashboard-test-projection-totals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.dashboard-test-projection-totals .dashboard-test-kpi > span {
  min-height: 0;
}

.dashboard-test-projection-totals .dashboard-test-kpi > strong {
  font-size: 22px;
}

@media (max-width: 1180px) {
  .dashboard-test-kpis,
  .dashboard-test-assumption-strip,
  .dashboard-test-boundaries {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-test-assumption-strip > div:nth-child(2n) {
    border-right: 0;
  }

  .dashboard-test-assumption-strip > div {
    border-bottom: 1px solid var(--line);
  }

  .dashboard-test-assumption-strip > div:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .dashboard-test-funding-layout,
  .dashboard-test-split {
    grid-template-columns: 1fr;
  }

  .dashboard-test-funding-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-test-position-layout,
  .dashboard-test-movement-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-test-projection-totals {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .dashboard-test-page {
    gap: 12px;
  }

  .dashboard-test-page .page-head {
    gap: 12px;
    margin-bottom: 2px;
  }

  .dashboard-test-page .page-title h1 {
    font-size: 24px;
  }

  .dashboard-test-page .page-head > .actions {
    grid-template-columns: 1fr;
  }

  .dashboard-test-page .page-head > .actions > *,
  .dashboard-test-page .page-head > .actions .button,
  .dashboard-test-page .section-header > .button,
  .dashboard-test-footer-actions .button {
    width: 100%;
  }

  .dashboard-test-page .section {
    padding: 0;
    border-radius: 12px;
  }

  .dashboard-test-page .section-header,
  .dashboard-test-page .section-body {
    padding: 14px;
  }

  .dashboard-test-page .section-header {
    flex-direction: column;
    gap: 10px;
  }

  .dashboard-test-notice {
    grid-template-columns: 1fr;
    gap: 9px;
    padding: 12px 14px;
    border-radius: 12px;
  }

  .dashboard-test-notice strong {
    justify-self: start;
  }

  .dashboard-test-status {
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 11px;
    margin-bottom: 14px;
    padding: 14px;
  }

  .dashboard-test-status-icon {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }

  .dashboard-test-status strong {
    font-size: 17px;
  }

  .dashboard-test-kpis,
  .dashboard-test-position-kpis,
  .dashboard-test-funding-summary,
  .dashboard-test-projection-totals,
  .dashboard-test-assumption-strip,
  .dashboard-test-boundaries {
    grid-template-columns: 1fr;
  }

  .dashboard-test-kpi {
    padding: 13px 14px;
  }

  .dashboard-test-kpi > span {
    min-height: 0;
  }

  .dashboard-test-kpi > strong {
    overflow-wrap: anywhere;
    font-size: 24px;
  }

  .dashboard-test-definition {
    margin-top: 13px;
  }

  .dashboard-test-net-worth {
    padding: 17px;
  }

  .dashboard-test-position-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
  }

  .dashboard-test-position-row > strong {
    grid-column: 2;
    grid-row: 1;
  }

  .dashboard-test-position-bar {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .dashboard-test-stage {
    padding: 13px;
  }

  .dashboard-test-stage-head,
  .dashboard-test-projection-total-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .dashboard-test-stage-head strong {
    text-align: left;
  }

  .dashboard-test-stage-summary {
    min-height: 0;
  }

  .dashboard-test-timeline {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    grid-template-columns: 1fr;
    overflow: visible;
    padding: 0;
  }

  .dashboard-test-milestone {
    min-height: 0;
    padding: 13px 14px;
  }

  .dashboard-test-chart-panel {
    padding: 12px;
  }

  .dashboard-test-chart-mobile-hint {
    display: block;
    margin: 4px 0 10px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
  }

  .dashboard-test-chart-scroll {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
  }

  .dashboard-test-assumption-strip > div,
  .dashboard-test-assumption-strip > div:nth-child(2n),
  .dashboard-test-assumption-strip > div:nth-last-child(-n + 2) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .dashboard-test-assumption-strip > div:last-child {
    border-bottom: 0;
  }

  .dashboard-test-goal {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .dashboard-test-goal > strong {
    grid-column: 2;
    white-space: normal;
  }

  .dashboard-test-capital-chart {
    width: 820px;
    max-width: none;
    min-width: 820px;
    min-height: 0;
  }

  .dashboard-test-priority .button {
    width: 100%;
  }

  .dashboard-test-footer-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .dashboard-test-page p,
  .dashboard-test-page strong,
  .dashboard-test-page span {
    overflow-wrap: anywhere;
  }
}

@media print {
  .dashboard-test-page .dashboard-test-timeline {
    grid-auto-flow: row;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: visible;
  }

  .dashboard-test-page .dashboard-test-milestone {
    min-height: 0;
  }

  .dashboard-test-page .dashboard-test-split,
  .dashboard-test-page .dashboard-test-funding-layout {
    grid-template-columns: 1fr;
  }
}

/* Keep shared analysis summaries readable after late-loaded desktop styles. */
@media screen and (max-width: 980px) {
  .networth-analysis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .networth-analysis strong {
    overflow-wrap: anywhere;
  }
}

@media screen and (max-width: 600px) {
  .networth-analysis {
    grid-template-columns: 1fr;
  }

  .inheritance-analysis-grid article:not(.wide) {
    display: grid;
    grid-template-columns: minmax(118px, .8fr) minmax(0, 1.2fr);
    column-gap: 14px;
    align-items: start;
  }

  .inheritance-analysis-grid article:not(.wide) > span,
  .inheritance-analysis-grid article:not(.wide) > strong {
    grid-column: 1;
  }

  .inheritance-analysis-grid article:not(.wide) > span {
    grid-row: 1;
  }

  .inheritance-analysis-grid article:not(.wide) > strong {
    grid-row: 2;
    margin-bottom: 0;
    overflow-wrap: normal;
    font-size: clamp(18px, 4vw, 22px);
    white-space: nowrap;
  }

  .inheritance-analysis-grid article:not(.wide) > p {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
  }
}

@media screen and (max-width: 430px) {
  .inheritance-analysis-grid article:not(.wide) {
    grid-template-columns: 1fr;
  }

  .inheritance-analysis-grid article:not(.wide) > span,
  .inheritance-analysis-grid article:not(.wide) > strong,
  .inheritance-analysis-grid article:not(.wide) > p {
    grid-column: 1;
    grid-row: auto;
  }

  .inheritance-analysis-grid article:not(.wide) > strong {
    margin-bottom: 8px;
  }
}

.report-builder-shell {
  display: grid;
  gap: 18px;
  padding-bottom: 40px;
}

.report-builder-header {
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  padding: 26px 28px;
  border: 1px solid #2b2924;
  border-radius: 16px;
  background: linear-gradient(115deg, #11100e 0 66%, #c6a15b 66% 69%, #f7f2e8 69%);
  color: #fff;
  box-shadow: 0 18px 42px rgba(17, 16, 14, .16);
}

.report-builder-header > div:first-child {
  min-width: 0;
  width: min(690px, 100%);
}

.report-builder-header .eyebrow,
.report-library-heading .eyebrow {
  display: block;
  margin-bottom: 7px;
  color: #d8b86f;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.report-builder-document-title {
  width: 100%;
  padding: 4px 0 8px;
  border: 0;
  border-bottom: 1px solid rgba(255,255,255,.25);
  outline: 0;
  background: transparent;
  color: #fff;
  font-size: clamp(24px, 4vw, 38px);
  font-weight: 900;
  letter-spacing: -.03em;
}

.report-builder-header p {
  margin: 9px 0 0;
  color: #cfc7b8;
}

.report-builder-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  max-width: 390px;
}

.report-builder-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(270px, 330px);
  gap: 18px;
  align-items: start;
}

.report-builder-canvas {
  display: grid;
  gap: 14px;
}

.report-component-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(17, 16, 14, .07);
  transition: border-color .18s ease, opacity .18s ease, transform .18s ease;
}

.report-component-card.dragging {
  opacity: .48;
  transform: scale(.99);
}

.report-component-card > header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 9px 12px 9px 16px;
  border-bottom: 1px solid #e9e1d2;
  background: linear-gradient(90deg, #f8f3e9, #fff);
}

.report-component-kind {
  color: #705729;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.report-component-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.report-component-controls button {
  min-width: 34px;
  min-height: 32px;
  padding: 5px 9px;
  border: 1px solid #d9cfbd;
  border-radius: 7px;
  background: #fff;
  color: #292720;
  font-size: 12px;
  font-weight: 800;
}

.report-component-controls button.danger {
  color: #a53f32;
}

.report-drag-handle {
  padding: 6px;
  color: #958970;
  cursor: grab;
  font-weight: 900;
  letter-spacing: -4px;
}

.report-component-editor {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.report-component-editor label,
.report-library-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.report-component-editor input,
.report-component-editor textarea,
.report-library-form input,
.report-library-form textarea,
.report-library-form select {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid #d9cfbd;
  border-radius: 8px;
  outline: 0;
  background: #fff;
  color: var(--ink);
}

.report-component-editor input:focus,
.report-component-editor textarea:focus,
.report-library-form input:focus,
.report-library-form textarea:focus,
.report-library-form select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(198, 161, 91, .14);
}

.report-cover-editor,
.report-chart-editor-fields,
.report-item-editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.report-cover-editor label:first-child,
.report-cover-editor label:nth-child(2) {
  grid-column: 1 / -1;
}

.report-item-editor {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid #e8dfcf;
  border-radius: 10px;
  background: #fcfaf5;
}

.report-chart-preview {
  display: grid;
  place-items: center;
  padding: 14px;
  border: 1px solid #e1d7c5;
  border-radius: 10px;
  background: #fff;
}

.report-chart-preview img {
  display: block;
  width: min(100%, 780px);
  max-height: 520px;
  object-fit: contain;
}

.report-legend-editor {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.report-table-editor {
  overflow: auto;
  border: 1px solid #ddd3c1;
  border-radius: 10px;
}

.report-table-editor table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.report-table-editor td,
.report-table-editor th {
  padding: 0;
  border: 1px solid #e6ddcd;
}

.report-table-editor th input {
  background: #171411;
  color: #fff;
  font-weight: 800;
}

.report-table-editor input {
  min-width: 120px;
  border: 0;
  border-radius: 0;
  font-size: 12px;
}

.report-page-break-preview {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: #857758;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.report-page-break-preview span {
  border-top: 2px dashed #cdbc98;
}

.report-component-library {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 16px;
  max-height: calc(100vh - 32px);
  padding: 18px;
  border: 1px solid #2b2924;
  border-radius: 14px;
  overflow-y: auto;
  background: #11100e;
  color: #fff;
  box-shadow: 0 16px 36px rgba(17, 16, 14, .18);
}

.report-library-heading h2,
.report-library-form h3 {
  margin: 0;
}

.report-library-empty,
.report-library-permission {
  padding: 14px;
  border: 1px dashed rgba(198, 161, 91, .45);
  border-radius: 10px;
  color: #d4c8b0;
}

.report-library-empty p,
.report-library-permission {
  margin: 6px 0 0;
  line-height: 1.45;
}

.report-library-list {
  display: grid;
  gap: 9px;
}

.report-library-list article {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid rgba(198, 161, 91, .32);
  border-radius: 9px;
  background: rgba(255,255,255,.05);
}

.report-library-list article > span {
  color: #c6a15b;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.report-library-list article p {
  margin: 0;
  color: #c9c0af;
  font-size: 12px;
}

.report-library-list article div {
  display: flex;
  gap: 7px;
}

.report-library-form {
  display: grid;
  gap: 11px;
  padding-top: 16px;
  border-top: 1px solid rgba(198, 161, 91, .3);
}

.report-library-form label {
  color: #d8cfbe;
}

.report-builder-empty {
  min-height: 50vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  text-align: center;
}

@media (max-width: 980px) {
  .report-builder-header {
    align-items: stretch;
    background: linear-gradient(155deg, #11100e 0 82%, #c6a15b 82% 85%, #f7f2e8 85%);
    flex-direction: column;
  }

  .report-builder-actions {
    justify-content: flex-start;
  }

  .report-builder-layout {
    grid-template-columns: 1fr;
  }

  .report-component-library {
    position: static;
    max-height: none;
    order: -1;
  }
}

@media (max-width: 600px) {
  .report-builder-header {
    padding: 20px;
  }

  .report-builder-actions,
  .report-builder-actions .button {
    width: 100%;
  }

  .report-cover-editor,
  .report-chart-editor-fields,
  .report-item-editor-grid,
  .report-legend-editor {
    grid-template-columns: 1fr;
  }

  .report-component-card > header {
    align-items: flex-start;
    flex-direction: column;
  }

  .report-component-controls {
    width: 100%;
  }

.report-component-controls button.danger {
    margin-left: auto;
  }
}

.report-builder-shell .report-builder-layout {
  display: block;
  grid-template-columns: none;
}

.report-builder-shell .report-builder-canvas {
  gap: 30px;
}

@media (max-width: 600px) {
  .report-builder-shell,
  .report-builder-header,
  .report-builder-header > div,
  .report-builder-actions,
  .report-builder-layout,
  .report-builder-canvas,
  .report-page-editor,
  .report-page-content,
  .report-page-block {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }

  .report-builder-shell .report-builder-canvas {
    gap: 18px;
    padding: 6px;
    overflow: hidden;
  }

  .report-page-editor.cover-page::before,
  .report-page-editor.cover-page::after {
    height: 15%;
  }

  .report-page-editor {
    min-height: calc((100vw - 64px) * 1.414);
  }

  .report-page-editor.cover-page::before {
    top: -7%;
    box-shadow: 0 12px 0 #c6a15b;
  }

  .report-page-editor.cover-page::after {
    bottom: -7%;
    box-shadow: 0 -12px 0 #c6a15b;
  }
}

/* Simplified report-editing controls. */
.report-builder-shell .report-builder-header {
  position: relative;
  align-items: center;
  padding: 18px 20px;
  border: 1px solid #d9cfbd;
  border-top: 4px solid #c6a15b;
  background: linear-gradient(110deg, #fff 0 72%, #f8f3e9 72%);
  color: #11100e;
  box-shadow: 0 8px 24px rgba(17, 16, 14, .09);
}

.report-builder-shell .report-builder-header .eyebrow {
  color: #806326;
}

.report-builder-shell .report-builder-document-title {
  border-bottom-color: #ded7ca;
  color: #11100e;
  font-size: clamp(22px, 3vw, 31px);
}

.report-builder-shell .report-builder-header p {
  color: #716b61;
}

.report-builder-shell .report-builder-actions {
  max-width: 520px;
}

.report-builder-shell .report-builder-actions .button {
  min-height: 40px;
  padding: 9px 13px;
}

.report-editor-help {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 15px;
  border: 1px solid #eadfca;
  border-radius: 10px;
  background: #fffaf0;
  color: #6c6354;
  font-size: 13px;
}

.report-editor-help strong {
  color: #5f4718;
  white-space: nowrap;
}

.report-page-block.type-cover {
  position: static;
}

.report-page-block:not(.type-cover) {
  border: 1px solid transparent;
  border-radius: 6px;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.report-page-block:not(.type-cover):hover,
.report-page-block:not(.type-cover):focus-within {
  border-color: rgba(198, 161, 91, .55);
  box-shadow: 0 0 0 4px rgba(198, 161, 91, .08);
}

.report-page-block .report-block-toolbar {
  position: relative;
  top: auto;
  right: auto;
  display: flex;
  max-width: none;
  min-height: 30px;
  justify-content: flex-end;
  gap: 4px;
  margin: 0 0 8px;
  padding: 0 0 6px;
  border-bottom: 1px solid #ece6db;
  border-radius: 0;
  opacity: 1;
  transform: none;
  background: transparent;
  box-shadow: none;
}

.report-page-block .report-block-toolbar button,
.report-page-block .report-block-toolbar span {
  min-height: 26px;
  padding: 4px 8px;
  border: 1px solid #ddd5c7;
  border-radius: 6px;
  background: #fff;
  color: #655e52;
  font-size: 9px;
  line-height: 1;
}

.report-page-block .report-block-toolbar span {
  margin-right: auto;
  border-color: transparent;
  background: #f8f3e9;
  color: #735921;
}

.report-page-block .report-block-toolbar .report-settings-button {
  border-color: #c6a15b;
  background: #fffaf0;
  color: #5f4718;
}

.report-page-block h2 {
  padding-inline: 2px;
}

.report-delete-page {
  top: auto;
  right: 95px;
  bottom: 16px;
  padding: 2px 5px;
  background: transparent;
  box-shadow: none;
  color: #9b4b40;
  font-size: 8px;
}

.report-settings-modal {
  width: min(560px, calc(100vw - 28px));
}

.report-settings-body,
.report-settings-body label {
  display: grid;
  gap: 9px;
}

.report-settings-body label > span {
  color: #5f594f;
  font-size: 12px;
  font-weight: 850;
}

.report-settings-body input,
.report-settings-body select {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid #d8cfbf;
  border-radius: 8px;
  background: #fff;
  color: #11100e;
}

.report-spacing-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px;
  align-items: center;
  gap: 12px;
}

.report-spacing-control output {
  color: #6c6354;
  font-size: 12px;
  text-align: right;
}

.report-settings-order,
.report-settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.report-settings-actions {
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid #e7dfd2;
}

@media (max-width: 700px) {
  .report-builder-shell .report-builder-header {
    padding: 15px;
    background: #fff;
  }

  .report-builder-shell .report-builder-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    max-width: none;
  }

  .report-builder-shell .report-builder-actions .button {
    width: auto;
    min-width: 0;
    font-size: 12px;
  }

  .report-builder-shell .report-builder-actions .button.primary {
    grid-column: 1 / -1;
  }

  .report-editor-help {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .report-page-block .report-block-toolbar {
    margin-bottom: 5px;
  }

  .report-page-block .report-block-toolbar button,
  .report-page-block .report-block-toolbar span {
    min-height: 24px;
    padding: 4px 6px;
    font-size: 8px;
  }

  .report-cover-copy {
    top: 33%;
  }

  .report-cover-brand {
    top: 14%;
  }

  .report-page-editor:not(.cover-page) {
    padding-top: 58px;
  }

  .report-page-letterhead {
    inset: 13px 18px auto;
    gap: 6px;
    padding-bottom: 6px;
    font-size: 7px;
  }

  .report-page-letterhead small {
    font-size: 6px;
  }

  .report-page-logo {
    width: 22px;
    height: 22px;
  }
}

