:root {
  --background: #f4f7f9;
  --surface: #ffffff;
  --surface-secondary: #f5f8fa;
  --surface-tertiary: #eaf0f3;
  --ink: #111820;
  --ink-soft: #3a4855;
  --muted: #71808d;
  --muted-light: #a1adb6;
  --brand-950: #0b1219;
  --brand-900: #151f29;
  --brand-800: #1c303d;
  --brand: #0b7f8e;
  --brand-deep: #075c6b;
  --brand-bright: #49c9d1;
  --brand-soft: #d5eef1;
  --brand-pale: #eaf7f8;
  --gold: #ad7a2d;
  --gold-soft: #fbf3e4;
  --red: #b45160;
  --red-soft: #faeaed;
  --warning: #916d27;
  --warning-soft: #fbf4e5;
  --info: #4d7184;
  --info-soft: #eaf2f5;
  --border: #dce4e9;
  --border-subtle: #e8eef2;
  --border-strong: #c6d2da;
  --shadow-xs: 0 1px 2px rgba(15, 24, 33, 0.045);
  --shadow-sm: 0 8px 24px rgba(15, 24, 33, 0.055);
  --shadow-dialog: 0 24px 70px rgba(7, 14, 21, 0.22);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;
  --text-display: 40px;
  --text-title: 28px;
  --text-section: 17px;
  --text-body: 13px;
  --text-label: 11px;
  --text-caption: 10px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --radius-sm: 6px;
  --radius: 9px;
  --radius-lg: 13px;
  --radius-xl: 16px;
  --radius-pill: 999px;
  --font-sans: "DM Sans", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-display: "Noto Sans SC", "DM Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--background);
  font-family: var(--font-sans);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

.ui-icon {
  display: block;
  width: 18px;
  height: 18px;
  flex: none;
  overflow: visible;
}

html {
  min-width: 320px;
  background: var(--background);
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--background);
  -webkit-text-size-adjust: 100%;
}

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

button,
a {
  touch-action: manipulation;
}

button {
  color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(11, 127, 142, 0.24);
  outline-offset: 2px;
}

svg {
  display: block;
  width: 18px;
  height: 18px;
  flex: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  min-height: 100vh;
}

/* App shell */
.sidebar {
  position: fixed;
  z-index: 10;
  inset: 0 auto 0 0;
  width: 236px;
  color: #e8f0e9;
  background: var(--brand-950);
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 30px 16px 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 8px 30px;
  color: #ffffff;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: #dce9de;
  border: 1px solid rgba(220, 233, 222, 0.36);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.055);
}

.brand-mark svg {
  width: 22px;
  height: 22px;
}

.brand-copy strong {
  display: block;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.1;
}

.brand-copy small {
  display: block;
  margin-top: 5px;
  color: #91aa97;
  font-size: 9px;
  letter-spacing: 0.21em;
  line-height: 1;
}

.nav-label,
.panel-kicker,
.eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.nav-label {
  padding: 0 14px 10px;
  color: #718d79;
  font-size: 9px;
}

.side-nav {
  display: grid;
  gap: 6px;
}

.side-nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 48px;
  padding: 0 14px;
  color: #a9bcad;
  border-radius: 12px;
  font-size: 13px;
  text-decoration: none;
  transition: background 180ms ease-out, color 180ms ease-out, border-color 180ms ease-out;
}

.side-nav a::before {
  position: absolute;
  left: 8px;
  width: 3px;
  height: 18px;
  content: "";
  border-radius: 3px;
  background: transparent;
  transition: background 180ms ease-out;
}

.side-nav a svg {
  width: 19px;
  height: 19px;
  color: #8da692;
}

.side-nav a:hover {
  color: #f1f6f1;
  background: rgba(255, 255, 255, 0.055);
}

.side-nav a.active {
  color: #f6faf6;
  background: rgba(151, 190, 158, 0.14);
  box-shadow: inset 0 0 0 1px rgba(190, 219, 195, 0.08);
}

.side-nav a.active svg {
  color: #c2ddc7;
}

.side-nav a.active::before {
  background: #b7d4bc;
}

.nav-placeholder {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 48px;
  padding: 0 14px;
  color: #6f8876;
  border-radius: 12px;
  cursor: default;
  font-size: 13px;
  opacity: 0.56;
}

.nav-placeholder svg {
  width: 19px;
  height: 19px;
}

.sidebar-spacer {
  flex: 1;
  min-height: 30px;
}

.security-note {
  display: flex;
  gap: 10px;
  padding: 13px 12px;
  border: 1px solid rgba(220, 239, 223, 0.09);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.055);
}

.status-dot,
.live-pill i {
  display: inline-block;
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: #b7d1b9;
}

.status-dot {
  margin-top: 4px;
  box-shadow: 0 0 0 4px rgba(183, 209, 185, 0.11);
}

.security-note strong {
  display: block;
  color: #dfeae0;
  font-size: 11px;
  font-weight: 600;
}

.security-note p {
  margin: 5px 0 0;
  color: #8da492;
  font-size: 10px;
  line-height: 1.4;
}

.sidebar-foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
  padding: 16px 12px 0;
  color: #8ba290;
  border-top: 1px solid rgba(220, 239, 223, 0.1);
  font-size: 10px;
  line-height: 1.6;
}

.sidebar-foot span:last-child {
  text-align: right;
}

.sidebar-foot b {
  display: block;
  color: #bfd0c1;
  font-weight: 500;
}

.main {
  width: calc(100% - 236px);
  max-width: 1660px;
  min-height: 100vh;
  margin-left: 236px;
  padding: 34px clamp(26px, 4vw, 64px) 64px;
}

.topbar,
.main > #alert-area,
.main > .view {
  width: 100%;
  max-width: 1520px;
  margin-right: auto;
  margin-left: auto;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 24px;
}

.page-heading {
  min-width: 0;
}

.eyebrow {
  margin: 0;
  color: #7d8b81;
  font-size: 9px;
  line-height: 1.4;
}

.topbar h1 {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(25px, 2.2vw, 30px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.18;
}

.top-actions,
.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

/* The global eye/refresh actions belong to the dashboard only. Keep the
   container hidden even when component styles set an explicit display value. */
.top-actions[hidden] {
  display: none !important;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: background 180ms ease-out, border-color 180ms ease-out, color 180ms ease-out, box-shadow 180ms ease-out, transform 180ms ease-out;
}

.button svg {
  width: 16px;
  height: 16px;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.button.is-loading {
  position: relative;
  color: transparent !important;
  cursor: wait;
}

.button.is-loading::after {
  position: absolute;
  width: 14px;
  height: 14px;
  content: "";
  border: 1.5px solid rgba(255, 255, 255, 0.38);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.button-secondary.is-loading::after,
.button-ghost.is-loading::after {
  border-color: rgba(25, 38, 30, 0.16);
  border-top-color: var(--brand);
}

.button-primary {
  color: #ffffff;
  border-color: var(--brand);
  background: var(--brand);
  box-shadow: 0 4px 10px rgba(39, 91, 62, 0.12);
}

.button-primary:hover:not(:disabled) {
  border-color: var(--brand-800);
  background: var(--brand-800);
  box-shadow: 0 7px 14px rgba(39, 91, 62, 0.16);
}

.button-secondary {
  color: var(--brand-800);
  border-color: var(--border);
  background: var(--surface);
}

.button-secondary:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--surface-secondary);
}

.button-ghost {
  color: var(--ink-soft);
  border-color: transparent;
  background: transparent;
}

.button-ghost:hover:not(:disabled) {
  color: var(--brand-800);
  background: var(--surface-secondary);
}

.refresh-button {
  min-width: 74px;
}

.refresh-button svg {
  color: var(--muted);
}

.is-loading .refresh-button svg {
  animation: spin 800ms linear infinite;
}

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

.view[hidden] {
  display: none;
}

#alert-area:not(:empty) {
  margin-bottom: 18px;
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 12px 14px;
  color: var(--warning);
  border: 1px solid #eadcb9;
  border-radius: 10px;
  background: var(--warning-soft);
  font-size: 11px;
  line-height: 1.5;
}

.alert::before {
  content: "!";
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  flex: none;
  color: #ffffff;
  border-radius: 50%;
  background: var(--warning);
  font-size: 10px;
  font-weight: 700;
}

.alert.alert-error {
  color: var(--red);
  border-color: #edd8d5;
  background: var(--red-soft);
}

.alert.alert-error::before {
  content: "×";
  background: var(--red);
}

/* Shared cards and data hierarchy */
.panel,
.metric-card,
.net-worth-card,
.account-card,
.rate-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.panel,
.metric-card,
.account-card,
.rate-card {
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.panel {
  overflow: hidden;
}

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

.panel-head h2,
.table-panel-head h2,
.rate-intro h2 {
  margin: 5px 0 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.35;
}

.panel-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.panel-kicker {
  display: block;
  color: #94a097;
  font-size: 9px;
  line-height: 1.2;
}

.panel-index {
  color: #a1ada4;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.panel-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 3px;
  color: var(--brand);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.panel-link span {
  font-size: 15px;
  line-height: 0.8;
  transition: transform 180ms ease-out;
}

.panel-link:hover span {
  transform: translateX(3px);
}

.metric-number,
.metric-value,
.amount,
.rate-value,
.toolbar-count,
.metric-index,
.panel-index {
  font-variant-numeric: tabular-nums;
}

.negative {
  color: var(--red) !important;
}

/* Dashboard */
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(190px, 0.75fr) minmax(190px, 0.75fr);
  gap: 16px;
  margin-bottom: 16px;
}

.net-worth-card {
  position: relative;
  min-height: 258px;
  overflow: hidden;
  padding: 25px 27px 20px;
  color: #ffffff;
  border-color: var(--brand-900);
  background: var(--brand-900);
  box-shadow: 0 9px 20px rgba(20, 56, 38, 0.13);
}

.net-worth-card::before,
.net-worth-card::after {
  position: absolute;
  content: "";
  pointer-events: none;
  border: 1px solid rgba(211, 231, 214, 0.08);
  border-radius: 50%;
}

.net-worth-card::before {
  width: 290px;
  height: 290px;
  right: -175px;
  bottom: -168px;
}

.net-worth-card::after {
  width: 166px;
  height: 166px;
  right: -76px;
  bottom: -91px;
}

.card-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.card-label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #d9e7dc;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}

.card-label-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  color: #b8d2bc;
  border: 1px solid rgba(211, 231, 214, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.065);
}

.card-label-icon svg {
  width: 15px;
  height: 15px;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  color: #b7d0bb;
  border: 1px solid rgba(211, 231, 214, 0.18);
  border-radius: var(--radius-pill);
  font-size: 9px;
  line-height: 1;
}

.live-pill i {
  width: 5px;
  height: 5px;
  background: #9fc4a5;
}

.net-amount {
  position: relative;
  z-index: 1;
  margin: 22px 0 3px;
  color: #ffffff;
  font-size: clamp(31px, 3.2vw, 43px);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 1.1;
}

.net-amount-row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  margin: 22px 0 3px;
}

.net-amount-row .net-amount {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-caption {
  position: relative;
  z-index: 1;
  margin: 0;
  color: #a8c1ad;
  font-size: 10px;
  line-height: 1.5;
}

.net-split {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 48px;
  margin-top: 22px;
}

.net-split div {
  min-width: 118px;
}

.net-split small,
.metric-label,
.metric-helper {
  display: block;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.net-split small {
  color: #92ad99;
  margin-bottom: 4px;
}

.net-split strong {
  color: #f1f6f1;
  font-size: 14px;
  font-weight: 600;
}

.net-card-footer {
  position: absolute;
  right: 27px;
  bottom: 20px;
  left: 27px;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  padding-top: 12px;
  color: #7f9e86;
  border-top: 1px solid rgba(211, 231, 214, 0.13);
  font-size: 9px;
}

.metric-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 258px;
  padding: 23px;
  transition: border-color 180ms ease-out, box-shadow 180ms ease-out, transform 180ms ease-out;
}

.metric-card:hover,
.account-card:hover,
.rate-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.metric-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.metric-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
}

.metric-icon svg {
  width: 19px;
  height: 19px;
}

.icon-green {
  color: var(--brand);
  background: var(--brand-pale);
}

.icon-gold {
  color: #8a6b36;
  background: var(--gold-soft);
}

.metric-index {
  color: #b1bbb3;
  font-size: 10px;
}

.metric-copy {
  padding-top: 35px;
}

.metric-label {
  color: var(--muted);
  font-size: 11px;
}

.metric-value {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 31px;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
}

.metric-helper {
  margin-top: 8px;
  color: var(--muted-light);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.distribution-panel {
  grid-column: span 7;
}

.category-panel {
  grid-column: span 5;
}

.chart-panel {
  min-height: 324px;
  padding: 23px 25px;
}

.distribution-body {
  display: flex;
  align-items: center;
  gap: clamp(24px, 4vw, 48px);
  min-height: 231px;
  padding: 20px 10px 2px;
}

.donut {
  position: relative;
  display: grid;
  place-items: center;
  width: 176px;
  height: 176px;
  flex: none;
  border-radius: 50%;
  background: conic-gradient(var(--brand) 0 62%, #9bb39e 62% 83%, #c7a66d 83% 100%);
}

.donut::after {
  position: absolute;
  width: 115px;
  height: 115px;
  content: "";
  border: 1px solid rgba(223, 231, 223, 0.65);
  border-radius: 50%;
  background: var(--surface);
}

.donut > div {
  position: relative;
  z-index: 1;
  text-align: center;
}

.donut strong {
  display: block;
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.donut span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.legend {
  display: grid;
  gap: 13px;
  min-width: 0;
  width: min(220px, 100%);
}

.legend-item {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-width: 0;
  font-size: 11px;
}

.legend-item i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.legend-item span {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend-item strong {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 600;
}

.bars {
  display: grid;
  gap: 18px;
  padding-top: 31px;
}

.bar-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
  font-size: 11px;
}

.bar-meta span {
  overflow: hidden;
  color: var(--ink-soft);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.bar-label .ui-icon {
  width: 20px;
  height: 20px;
  padding: 4px;
  color: var(--brand);
  border-radius: 6px;
  background: var(--brand-pale);
}

.bar-meta strong {
  color: var(--ink);
  font-size: 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bar-track {
  height: 7px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--surface-tertiary);
}

.bar-fill {
  height: 100%;
  min-width: 3px;
  border-radius: 3px;
  background: var(--brand);
  transition: width 300ms ease-out;
}

.holdings-preview {
  padding: 23px 25px 9px;
}

/* Toolbars and tables */
.page-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 19px;
}

.toolbar-intro {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.toolbar-count {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  color: var(--brand-800);
  border: 1px solid #d7e4d9;
  border-radius: 9px;
  background: var(--brand-pale);
  font-size: 12px;
  font-weight: 600;
}

.toolbar-intro strong,
.toolbar-intro span:not(.toolbar-count) {
  display: block;
}

.toolbar-intro strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

.toolbar-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 270px;
  height: 40px;
  padding: 0 12px;
  color: var(--muted-light);
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  transition: border-color 180ms ease-out, box-shadow 180ms ease-out;
}

.search-box:focus-within {
  border-color: #92b19a;
  box-shadow: 0 0 0 3px rgba(46, 101, 72, 0.1);
}

.search-box svg {
  width: 16px;
  height: 16px;
}

.search-box input {
  width: 100%;
  min-width: 0;
  padding: 0;
  color: var(--ink);
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 11px;
}

.search-box input::placeholder {
  color: var(--muted-light);
}

.select-wrap select,
.field select,
.field input,
.field textarea {
  appearance: none;
  width: 100%;
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 9px;
  outline: 0;
  background: var(--surface);
  font-size: 12px;
  transition: border-color 180ms ease-out, box-shadow 180ms ease-out, background 180ms ease-out;
}

.select-wrap {
  position: relative;
}

.select-wrap::after {
  position: absolute;
  top: 50%;
  right: 12px;
  width: 6px;
  height: 6px;
  content: "";
  pointer-events: none;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: translateY(-65%) rotate(45deg);
}

.select-wrap select {
  width: auto;
  min-width: 112px;
  height: 40px;
  padding: 0 32px 0 12px;
  cursor: pointer;
  font-size: 11px;
}

.table-panel {
  padding: 23px 25px 8px;
}

.table-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.table-note {
  padding-top: 11px;
  color: var(--muted-light);
  font-size: 10px;
  white-space: nowrap;
}

.table-wrap {
  margin-top: 21px;
  overflow-x: auto;
  scrollbar-color: var(--border-strong) transparent;
  scrollbar-width: thin;
}

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

th {
  padding: 0 12px 11px;
  color: #8c998f;
  border-bottom: 1px solid var(--border);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.09em;
  line-height: 1.3;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

td {
  padding: 13px 12px;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 11px;
  line-height: 1.45;
  vertical-align: middle;
}

tbody tr {
  transition: background 150ms ease-out;
}

tbody tr:hover {
  background: #fafcf9;
}

tbody tr:last-child td {
  border-bottom: 0;
}

th.numeric,
td.numeric,
td.amount {
  text-align: right;
}

td.amount {
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
}

.asset-name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 150px;
}

.asset-name > div {
  min-width: 0;
}

.asset-name strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-path {
  min-width: 0;
}

.account-path-institution {
  color: var(--muted);
  font-weight: 500;
}

.account-path-separator {
  color: var(--muted-light);
  font-weight: 400;
}

.asset-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  color: var(--brand-800);
  border-radius: 8px;
  background: var(--brand-pale);
  font-size: 12px;
  font-weight: 600;
}

.asset-icon .ui-icon {
  width: 17px;
  height: 17px;
}

.asset-icon.is-liability {
  color: var(--red);
  background: var(--red-soft);
}

.cell-muted {
  overflow: hidden;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 3px 8px;
  color: var(--brand-800);
  border: 1px solid #dfe9df;
  border-radius: 6px;
  background: var(--brand-pale);
  font-size: 9px;
  line-height: 1.2;
  white-space: nowrap;
}

.badge.liability {
  color: var(--red);
  border-color: #efdcd9;
  background: var(--red-soft);
}

.more-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  min-height: 30px;
  padding: 5px 7px;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  transition: color 150ms ease-out, border-color 150ms ease-out, background 150ms ease-out;
}

.more-btn:hover {
  color: var(--brand);
  border-color: var(--border);
  background: var(--surface-secondary);
}

.empty {
  padding: 44px 20px !important;
  color: var(--muted);
  text-align: center;
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 180px;
  padding: 32px 20px;
  color: var(--muted);
  text-align: center;
}

.grid-full {
  grid-column: 1 / -1;
}

.empty-state > svg {
  width: 38px;
  height: 38px;
  padding: 10px;
  color: var(--brand);
  border-radius: 11px;
  background: var(--brand-pale);
}

.empty-state-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: var(--brand);
  border-radius: 11px;
  background: var(--brand-pale);
}

.empty-state strong {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
}

.empty-state p {
  max-width: 260px;
  margin: 0;
  font-size: 10px;
  line-height: 1.6;
}

.empty-action {
  margin-top: 6px;
}

.compact-empty {
  min-height: 142px;
  padding: 24px 12px;
}

.mini-empty {
  display: grid;
  place-items: center;
  gap: 6px;
  width: 100%;
  color: var(--muted);
  text-align: center;
}

.mini-empty > span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--brand);
  border-radius: 9px;
  background: var(--brand-pale);
}

.mini-empty > span svg {
  width: 16px;
  height: 16px;
}

.mini-empty strong {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
}

.mini-empty small {
  font-size: 10px;
}

.loading-state {
  min-height: 168px;
}

.loading-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
}

.loading-dots i {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--brand);
  animation: loading-pulse 900ms ease-in-out infinite;
}

.loading-dots i:nth-child(2) {
  animation-delay: 120ms;
}

.loading-dots i:nth-child(3) {
  animation-delay: 240ms;
}

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

/* Accounts */
.account-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap: 16px;
}

.account-card {
  overflow: hidden;
  transition: border-color 180ms ease-out, box-shadow 180ms ease-out, transform 180ms ease-out;
}

.account-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border-bottom: 1px solid var(--border-subtle);
}

.institution-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
  padding: 19px 8px 19px 20px;
  color: inherit;
  border: 0;
  border-radius: 15px;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background 150ms ease-out;
}

.institution-toggle:hover {
  background: var(--surface-secondary);
}

.institution-toggle:focus-visible {
  position: relative;
  z-index: 1;
  outline-offset: -3px;
}

.institution-logo {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 10px;
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
}

.institution-logo .ui-icon {
  width: 22px;
  height: 22px;
}

.institution-logo-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: inherit;
}

.account-card-head > div,
.institution-heading {
  min-width: 0;
  flex: 1;
}

.account-card-head h3 {
  overflow: hidden;
  margin: 0 0 4px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-card-head p {
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-card-head .more-btn {
  margin: 0 12px 0 0;
}

.institution-chevron {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  transition: color 180ms ease-out, border-color 180ms ease-out, background 180ms ease-out, transform 180ms ease-out;
}

.institution-chevron svg {
  width: 19px;
  height: 19px;
}

.institution-toggle:hover .institution-chevron,
.institution-toggle:focus-visible .institution-chevron {
  color: var(--brand);
  border-color: var(--border-strong);
  background: var(--brand-pale);
}

.account-card.is-expanded .institution-chevron {
  color: var(--brand);
  border-color: #c3d7c7;
  background: var(--brand-pale);
  transform: rotate(90deg);
}

.sub-list {
  padding: 5px 12px 10px;
}

.sub-list[hidden] {
  display: none;
}

.sub-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 12px 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.sub-row[data-edit-account] {
  min-height: 68px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 150ms ease-out;
}

.sub-row[data-edit-account]:hover {
  background: var(--surface-secondary);
}

.sub-row[data-edit-account]:focus-visible {
  outline: 3px solid rgba(46, 101, 72, 0.18);
  outline-offset: -2px;
}

.sub-row:last-child {
  border-bottom: 0;
}

.sub-row > span:first-child {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  color: var(--brand);
  border-radius: 8px;
  background: var(--surface-secondary);
  font-size: 11px;
  font-weight: 600;
}

.account-type-icon .ui-icon {
  width: 17px;
  height: 17px;
}

.account-type-icon.is-liability {
  color: var(--red);
  background: var(--red-soft);
}

.sub-row > div {
  min-width: 0;
  flex: 1;
}

.sub-row strong,
.sub-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-holding-summary {
  display: block;
  margin-top: 5px;
  color: var(--brand);
  font-size: 10px;
  font-style: normal;
  font-variant-numeric: tabular-nums;
}

.sub-row strong {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
}

.sub-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.row-arrow {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  transition: color 150ms ease-out, border-color 150ms ease-out, background 150ms ease-out, transform 150ms ease-out;
}

.row-arrow svg {
  width: 20px;
  height: 20px;
}

.sub-row[data-edit-account]:hover .row-arrow,
.sub-row[data-edit-account]:focus-visible .row-arrow {
  color: var(--brand);
  border-color: #c3d7c7;
  background: var(--brand-pale);
  transform: translateX(2px);
}

/* Settings */
.main > .view.settings-page {
  max-width: 1120px;
}

.settings-layout {
  display: block;
  margin-bottom: 18px;
}

.settings-column {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  display: grid;
  gap: 14px;
}

.settings-group {
  padding: 0;
  border-radius: 18px;
}

.settings-group-head {
  padding: 22px 24px 17px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface-secondary);
}

.settings-group-head h2 {
  margin: 5px 0 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
}

.settings-group-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  min-height: 78px;
  padding: 15px 24px;
  color: var(--ink);
  border: 0;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface);
  text-align: left;
}

.settings-row:last-child {
  border-bottom: 0;
}

.settings-list > .settings-row:first-child {
  border-top-left-radius: 17px;
  border-top-right-radius: 17px;
}

.settings-list > .settings-row:last-child {
  border-bottom-right-radius: 17px;
  border-bottom-left-radius: 17px;
}

.settings-row-button {
  position: relative;
  cursor: pointer;
  border-left: 3px solid transparent;
  user-select: none;
  transition: background 150ms ease-out, border-color 150ms ease-out;
}

.settings-row-button:hover {
  border-left-color: #b8d2bd;
  background: #fafcf9;
}

.settings-row-button:focus-visible {
  position: relative;
  z-index: 1;
  outline-offset: -3px;
}

.settings-row-button[aria-expanded="true"] {
  border-left-color: var(--brand);
  background: var(--brand-pale);
}

.settings-row-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  color: var(--brand);
  border-radius: 10px;
  background: var(--brand-pale);
}

.settings-row-icon svg {
  width: 19px;
  height: 19px;
}

.settings-row-icon.icon-neutral {
  color: var(--ink-soft);
  background: var(--surface-secondary);
}

.settings-row-icon.icon-green {
  background: var(--brand-pale);
}

.settings-row-icon strong {
  font-size: 19px;
  font-weight: 600;
}

.settings-row-copy {
  min-width: 0;
  flex: 1;
}

.settings-row-copy strong,
.settings-row-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-row-copy strong {
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
}

.settings-row-copy small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.settings-row-meta {
  flex: none;
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.settings-chevron {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  color: var(--muted-light);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  transition: color 150ms ease-out, border-color 150ms ease-out, background 150ms ease-out, transform 180ms ease-out;
}

.settings-chevron svg {
  width: 17px;
  height: 17px;
}

.settings-row-button:hover .settings-chevron,
.settings-row-button[aria-expanded="true"] .settings-chevron {
  color: var(--brand);
  border-color: #c3d7c7;
  background: var(--brand-pale);
}

.settings-row-button[aria-expanded="true"] .settings-chevron {
  transform: rotate(90deg);
}

.settings-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  color: var(--brand);
  font-size: 10px;
  white-space: nowrap;
}

.settings-status i {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
}

.settings-summary {
  align-self: start;
  min-height: 0;
  padding: 24px;
  border-color: #d5e3d6;
  background: linear-gradient(145deg, #f9fcf9 0%, #edf5ee 100%);
}

.settings-summary h2 {
  margin: 8px 0 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
}

.settings-summary > p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}

.settings-summary-list {
  display: grid;
  gap: 0;
  margin-top: 25px;
  border-top: 1px solid var(--border-subtle);
}

.settings-summary-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.settings-summary-list span {
  color: var(--muted);
  font-size: 10px;
}

.settings-summary-list strong {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.settings-summary-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  color: var(--muted-light);
  font-size: 9px;
}

.settings-detail {
  max-width: 820px;
  margin: 0 auto 18px;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.settings-detail[hidden] {
  display: none;
}

.settings-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 24px;
  border: 1px solid #d5e3d6;
  border-radius: 18px;
  background: var(--surface-secondary);
  box-shadow: var(--shadow-xs);
}

.settings-detail-copy {
  min-width: 0;
  flex: 1;
}

.settings-detail-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.settings-collapse {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 34px;
  flex: none;
  padding: 0 10px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  cursor: pointer;
  font-size: 10px;
  font-weight: 600;
  transition: color 150ms ease-out, border-color 150ms ease-out, background 150ms ease-out;
}

.settings-collapse svg {
  width: 15px;
  height: 15px;
}

.settings-collapse:hover {
  color: var(--brand);
  border-color: var(--border-strong);
  background: var(--brand-pale);
}

.settings-detail-head h2 {
  margin: 5px 0 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
}

.settings-detail-head p {
  max-width: 700px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}

.archive-list {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.archive-group {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.archive-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface-secondary);
}

.archive-group-head h3 {
  margin: 5px 0 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
}

.archive-group-head > span {
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.archive-record-list {
  display: grid;
}

.archive-record {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.archive-record:last-child {
  border-bottom: 0;
}

.archive-record-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 700;
}

.archive-record-icon .ui-icon {
  width: 20px;
  height: 20px;
}

.archive-record-icon.institution {
  color: #ffffff;
  background: var(--brand);
}

.archive-record-icon.account {
  color: var(--brand-800);
  background: var(--brand-pale);
}

.archive-record-icon.holding {
  color: #80601f;
  background: #f5eddc;
}

.archive-record-copy {
  min-width: 0;
  flex: 1;
}

.archive-record-copy strong,
.archive-record-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.archive-record-copy strong {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
}

.archive-record-copy small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.archive-record-copy em {
  display: inline-flex;
  margin-top: 6px;
  padding: 2px 6px;
  color: var(--warning);
  border-radius: 5px;
  background: var(--warning-soft);
  font-size: 9px;
  font-style: normal;
  line-height: 1.2;
}

.archive-record-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex: none;
}

.archive-action {
  min-height: 36px;
  padding: 0 10px;
  color: var(--brand);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  transition: color 150ms ease-out, border-color 150ms ease-out, background 150ms ease-out;
}

.archive-action:hover {
  border-color: var(--border-strong);
  background: var(--brand-pale);
}

.archive-action-danger {
  color: var(--red);
}

.archive-action-danger:hover {
  border-color: #eac7c3;
  background: var(--red-soft);
}

.archive-hint {
  color: var(--warning);
  font-size: 10px;
  white-space: nowrap;
}

.archive-state {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 190px;
  padding: 28px 20px;
  border: 1px dashed var(--border-strong);
  border-radius: 16px;
  background: var(--surface-secondary);
  color: var(--muted);
  text-align: center;
}

.archive-state strong {
  color: var(--ink-soft);
  font-size: 14px;
}

.archive-state p {
  max-width: 420px;
  margin: 0;
  font-size: 11px;
  line-height: 1.55;
}

.archive-state-error {
  border-color: #eac7c3;
  background: var(--red-soft);
}

/* Exchange rates */
.rate-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
  padding: 22px 25px;
  border: 1px solid #dce7dc;
  border-radius: var(--radius-lg);
  background: var(--surface-secondary);
}

.rate-intro-copy {
  display: flex;
  align-items: center;
  gap: 15px;
  min-width: 0;
}

.rate-symbol {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: none;
  color: #ffffff;
  border-radius: 11px;
  background: var(--brand);
}

.rate-symbol svg {
  width: 22px;
  height: 22px;
}

.rate-intro h2 {
  margin-top: 4px;
}

.rate-intro p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
}

.rate-source-link {
  display: block;
  width: max-content;
  max-width: 100%;
  margin: 7px 0 0;
  color: var(--brand);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 2px;
}

.rate-intro-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: none;
  flex-wrap: wrap;
  gap: 8px;
}

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

.rate-card {
  min-height: 214px;
  padding: 18px;
  border-radius: 16px;
  transition: border-color 180ms ease-out, box-shadow 180ms ease-out, transform 180ms ease-out;
}

.rate-card-head,
.rate-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.currency-code {
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.currency-flag {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--brand);
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface-secondary);
  font-size: 10px;
  font-weight: 600;
}

.rate-value {
  margin: 21px 0 4px;
  color: var(--ink);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.035em;
}

.rate-card > p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.rate-card-foot {
  margin-top: 18px;
  padding-top: 13px;
  color: var(--muted);
  border-top: 1px solid var(--border-subtle);
  font-size: 10px;
}

/* Drawer form */
dialog {
  width: min(560px, calc(100% - 28px));
  max-width: none;
  height: 100vh;
  max-height: 100vh;
  margin: 0 0 0 auto;
  padding: 0;
  overflow: auto;
  color: var(--ink);
  border: 0;
  border-left: 1px solid var(--border);
  border-radius: 20px 0 0 20px;
  background: var(--surface);
  box-shadow: var(--shadow-dialog);
  animation: drawer-in 220ms ease-out;
}

dialog::backdrop {
  background: rgba(16, 45, 31, 0.37);
}

@keyframes drawer-in {
  from {
    opacity: 0;
    transform: translateX(18px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

#entity-form {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 30px;
}

.account-detail-sheet {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 30px;
}

.account-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
}

.account-detail-meta span + span::before {
  margin-right: 7px;
  content: "·";
}

.account-detail-totals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 22px 0 14px;
}

.account-detail-totals > div {
  padding: 15px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--surface-secondary);
}

.account-detail-totals span,
.account-detail-list-head {
  color: var(--muted);
  font-size: 10px;
}

.account-detail-totals strong {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.account-detail-actions {
  display: flex;
  gap: 9px;
  margin-bottom: 20px;
}

.account-detail-actions .button:first-child { margin-right: auto; }

.account-detail-list { border-top: 1px solid var(--border-subtle); }

.account-detail-list-head {
  display: flex;
  justify-content: space-between;
  padding: 15px 0 9px;
  font-weight: 600;
}

.account-holding-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto 16px;
  align-items: center;
  width: 100%;
  gap: 10px;
  padding: 12px 2px;
  color: var(--ink);
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--border-subtle);
  background: transparent;
  cursor: pointer;
}

.account-holding-row:hover { color: var(--brand); }
.account-holding-row .asset-icon { width: 34px; height: 34px; }
.account-holding-row span:nth-child(2) { min-width: 0; }
.account-holding-row strong,
.account-holding-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-holding-row strong { font-size: 12px; }
.account-holding-row small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.account-holding-row b { font-size: 12px; font-variant-numeric: tabular-nums; }
.account-holding-row i { color: var(--muted); font-size: 21px; font-style: normal; }
.account-detail-empty { padding: 28px 0; color: var(--muted); text-align: center; }
.account-detail-empty strong { display: block; color: var(--ink-soft); font-size: 13px; }
.account-detail-empty p { margin: 7px 0 0; font-size: 11px; }

.dialog-grip {
  display: none;
}

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

.dialog-head h2 {
  margin: 7px 0 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

dialog.is-sub-account-edit .dialog-head {
  justify-content: flex-end;
  margin-bottom: 18px;
}

dialog.is-sub-account-edit .dialog-heading {
  display: none;
}

.close-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  cursor: pointer;
  transition: color 150ms ease-out, background 150ms ease-out, border-color 150ms ease-out;
}

.close-btn:hover {
  color: var(--ink);
  border-color: var(--border-strong);
  background: var(--surface-secondary);
}

.close-btn svg {
  width: 17px;
  height: 17px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 17px 15px;
}

.field {
  display: grid;
  align-content: start;
  gap: 7px;
  min-width: 0;
}

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

.field label {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
}

.field input,
.field select,
.field textarea {
  min-height: 42px;
  padding: 0 12px;
}

.field input[type="color"] {
  height: 42px;
  padding: 5px;
  cursor: pointer;
}

.field input[type="date"] {
  color-scheme: light;
}

.field textarea {
  min-height: 84px;
  padding: 11px 12px;
  resize: vertical;
  line-height: 1.5;
}

.icon-file-picker {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 68px;
  padding: 10px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  background: var(--surface-secondary);
  cursor: pointer;
  transition: border-color 150ms ease-out, background 150ms ease-out;
}

.icon-file-picker:hover,
.icon-file-picker:focus-within,
.icon-file-picker.has-file {
  border-color: #8eaf97;
  background: var(--brand-pale);
}

.icon-file-picker > input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}

.icon-file-preview {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: none;
  overflow: hidden;
  color: var(--brand);
  border-radius: 12px;
  background: var(--surface);
}

.icon-file-preview .ui-icon {
  width: 23px;
  height: 23px;
}

.icon-file-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.icon-file-copy strong,
.icon-file-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-file-copy strong {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
}

.icon-file-copy small {
  color: var(--muted);
  font-size: 11px;
}

.icon-file-action {
  flex: none;
  padding: 7px 10px;
  color: var(--brand);
  border: 1px solid #c3d7c7;
  border-radius: 8px;
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
}

.field select {
  cursor: pointer;
}

.field select {
  appearance: auto;
}

.field select.currency-select {
  color: var(--brand-800);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.field input[aria-invalid="true"],
.field select[aria-invalid="true"],
.field textarea[aria-invalid="true"] {
  border-color: #d38a83;
  box-shadow: 0 0 0 3px rgba(167, 96, 92, 0.1);
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--muted-light);
}

.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: var(--border-strong);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: #8eaf97;
  box-shadow: 0 0 0 3px rgba(46, 101, 72, 0.1);
}

.field input:disabled,
.field select:disabled,
.field textarea:disabled {
  cursor: not-allowed;
  color: var(--muted-light);
  background: var(--surface-secondary);
}

.field-error {
  min-height: 12px;
  color: var(--red);
  font-size: 9px;
  line-height: 1.3;
}

.dialog-feedback {
  margin-top: 18px;
  padding: 11px 13px;
  color: var(--red);
  border: 1px solid #eac7c3;
  border-radius: 9px;
  background: var(--red-soft);
  font-size: 11px;
  line-height: 1.5;
}

.dialog-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: auto;
  padding-top: 28px;
}

.dialog-spacer {
  flex: 1;
}

.danger-text,
.archive-text {
  padding: 8px 3px;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
}

.danger-text {
  color: var(--red);
}

.archive-text {
  margin-left: 5px;
  color: var(--warning);
}

.danger-text:hover,
.archive-text:hover {
  text-decoration: underline;
}

/* Feedback */
.toast {
  position: fixed;
  z-index: 100;
  right: 28px;
  bottom: 28px;
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 16px;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 9px;
  background: var(--ink);
  box-shadow: var(--shadow-sm);
  font-size: 11px;
  line-height: 1.4;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 180ms ease-out, transform 180ms ease-out;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  background: var(--red);
}

.mobile-nav {
  display: none;
}

@media (max-width: 1260px) {
  .main {
    padding-right: 30px;
    padding-left: 30px;
  }

  .hero-grid {
    grid-template-columns: minmax(0, 1.5fr) repeat(2, minmax(170px, 0.75fr));
  }

  .distribution-body {
    gap: 24px;
    padding-right: 0;
    padding-left: 0;
  }

  .donut {
    width: 150px;
    height: 150px;
  }

  .donut::after {
    width: 98px;
    height: 98px;
  }

  .account-grid {
    grid-template-columns: repeat(2, minmax(240px, 1fr));
  }

  .rate-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

@media (max-width: 960px) {
  .sidebar {
    width: 76px;
  }

  .sidebar-inner {
    align-items: center;
    padding-right: 10px;
    padding-left: 10px;
  }

  .brand {
    padding-right: 0;
    padding-left: 0;
  }

  .brand-copy,
  .nav-label,
  .security-note p,
  .sidebar-foot,
  .nav-placeholder span {
    display: none;
  }

  .side-nav {
    width: 100%;
  }

  .side-nav a,
  .nav-placeholder {
    justify-content: center;
    padding: 0;
  }

  .side-nav a svg {
    width: 20px;
    height: 20px;
  }

  .main {
    width: calc(100% - 76px);
    margin-left: 76px;
  }

  .hero-grid {
    grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(145px, 0.75fr));
  }

  .metric-card {
    padding-right: 18px;
    padding-left: 18px;
  }

  .distribution-panel,
  .category-panel {
    grid-column: span 12;
  }

  .distribution-panel {
    min-height: 270px;
  }

  .category-panel {
    min-height: 290px;
  }

  .distribution-body {
    justify-content: center;
    min-height: 190px;
  }
}

@media (max-width: 720px) {
  body {
    padding-bottom: 66px;
  }

  .sidebar {
    display: none;
  }

  .main {
    width: 100%;
    margin-left: 0;
    padding: 23px 16px 40px;
  }

  .topbar {
    display: none;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
  }

  .topbar h1 {
    margin-top: 0;
    font-size: 24px;
  }

  .top-actions {
    gap: 7px;
  }

  .refresh-button {
    min-width: 40px;
    padding: 0 10px;
  }

  .refresh-button span {
    display: none;
  }

  .top-actions .button-primary {
    width: 40px;
    padding: 0;
  }

  .top-actions .button-primary span {
    display: none;
  }

  .hero-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .net-worth-card {
    grid-column: 1 / -1;
    min-height: 224px;
    padding: 22px 21px 18px;
  }

  .net-amount-row {
    margin-top: 19px;
  }

  .net-amount {
    font-size: 35px;
  }

  .net-split {
    gap: 26px;
    margin-top: 20px;
  }

  .net-split div {
    min-width: 0;
  }

  .net-card-footer {
    right: 21px;
    bottom: 18px;
    left: 21px;
  }

  .metric-card {
    min-height: 148px;
    padding: 16px;
  }

  .metric-icon {
    width: 35px;
    height: 35px;
  }

  .metric-copy {
    padding-top: 16px;
  }

  .metric-value {
    font-size: 25px;
  }

  .dashboard-grid {
    display: block;
    margin-top: 12px;
  }

  .category-panel {
    margin-top: 12px;
  }

  .chart-panel {
    min-height: 0;
    padding: 20px;
  }

  .distribution-body {
    justify-content: flex-start;
    gap: 18px;
    min-height: 0;
    padding: 24px 0 4px;
  }

  .donut {
    width: 138px;
    height: 138px;
  }

  .donut::after {
    width: 90px;
    height: 90px;
  }

  .donut strong {
    font-size: 14px;
  }

  .legend {
    gap: 11px;
  }

  .bars {
    gap: 17px;
    padding-top: 25px;
  }

  .holdings-preview,
  .table-panel {
    margin-top: 12px;
    padding: 20px 16px 7px;
  }

  .table-panel {
    margin-top: 0;
  }

  .table-note {
    display: none;
  }

  .panel-head h2,
  .table-panel-head h2 {
    font-size: 15px;
  }

  .page-toolbar {
    display: block;
    margin-bottom: 13px;
  }

  .toolbar-intro {
    margin-bottom: 14px;
  }

  .toolbar-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .search-box {
    grid-column: 1 / -1;
    width: 100%;
  }

  .toolbar-actions .button-secondary {
    display: inline-flex;
    min-width: 112px;
  }

  .toolbar-actions .button-primary {
    min-width: 112px;
  }

  .account-grid,
  .rate-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .rate-intro {
    align-items: flex-end;
    gap: 14px;
    padding: 19px;
  }

  .rate-intro-copy {
    align-items: flex-start;
    gap: 11px;
  }

  .rate-symbol {
    width: 40px;
    height: 40px;
  }

  .rate-intro p {
    line-height: 1.5;
  }

  .rate-intro .button {
    min-width: 40px;
    padding: 0 11px;
  }

  .rate-intro .button span {
    display: none;
  }

  .rate-intro-actions {
    gap: 7px;
  }

  .mobile-nav {
    position: fixed;
    z-index: 20;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 7px 10px max(7px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.97);
  }

  .mobile-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    min-height: 48px;
    padding: 4px;
    color: var(--muted-light);
    border-radius: 12px;
    font-size: 9px;
    text-decoration: none;
    transition: color 150ms ease-out, background 150ms ease-out;
  }

  .mobile-nav a svg {
    width: 18px;
    height: 18px;
  }

  .mobile-nav a.active {
    color: var(--brand);
    background: var(--brand-pale);
  }

  .mobile-nav-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    min-height: 48px;
    padding: 4px;
    color: var(--muted-light);
    border-radius: 12px;
    font-size: 9px;
    opacity: 0.58;
  }

  .mobile-nav-placeholder svg {
    width: 18px;
    height: 18px;
  }

  .mobile-nav button {
    display: grid;
    place-items: center;
    width: 45px;
    height: 45px;
    justify-self: center;
    margin-top: -22px;
    padding: 0;
    color: #ffffff;
    border: 5px solid var(--background);
    border-radius: 50%;
    background: var(--brand);
    box-shadow: 0 4px 12px rgba(25, 63, 41, 0.2);
    cursor: pointer;
  }

  .mobile-nav button svg {
    width: 20px;
    height: 20px;
  }

  .toast {
    right: 16px;
    bottom: 82px;
    left: 16px;
    max-width: none;
    text-align: center;
  }

  dialog {
    width: 100%;
    height: auto;
    max-height: 92vh;
    margin: auto 0 0;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 20px 20px 0 0;
    animation-name: sheet-in;
  }

  @keyframes sheet-in {
    from {
      opacity: 0;
      transform: translateY(18px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  #entity-form {
    min-height: auto;
    padding: 12px 20px max(20px, env(safe-area-inset-bottom));
  }

  .account-detail-sheet { min-height: auto; padding: 12px 20px max(20px, env(safe-area-inset-bottom)); }

  .account-detail-actions .button { min-width: 0; padding: 0 12px; }

  .dialog-grip {
    display: block;
    width: 32px;
    height: 4px;
    margin: 0 auto 20px;
    border-radius: 4px;
    background: var(--border-strong);
  }

  .dialog-head {
    margin-bottom: 22px;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .field.full {
    grid-column: auto;
  }

  .dialog-actions {
    position: sticky;
    bottom: 0;
    margin-right: -20px;
    margin-left: -20px;
    padding: 15px 20px max(5px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--border-subtle);
    background: var(--surface);
  }
}

/* Configurable site branding */
.brand-mark.has-custom-logo {
  padding: 4px;
  color: var(--brand);
  border-color: rgba(73, 201, 209, 0.34);
  background: #f7fbfc;
}

.site-logo-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: inherit;
}

.visibility-toggle {
  width: 40px;
  min-width: 40px;
  padding: 0;
  color: var(--muted);
}

.visibility-toggle:hover:not(:disabled),
.visibility-toggle[aria-pressed="true"] {
  color: var(--brand);
  border-color: #add5da;
  background: var(--brand-pale);
}

.net-worth-card .refresh-button {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  color: #a9c8cd;
  border-color: rgba(203, 232, 235, .2);
  border-radius: 10px;
  background: rgba(255, 255, 255, .06);
}

.net-worth-card .refresh-button span {
  display: none;
}

.net-worth-card .refresh-button:hover:not(:disabled) {
  color: #ffffff;
  border-color: rgba(203, 232, 235, .42);
  background: rgba(73, 201, 209, .14);
}

.net-amount-row .visibility-toggle {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  color: #b5d2d6;
  border-color: rgba(203, 232, 235, .22);
  border-radius: 10px;
  background: rgba(255, 255, 255, .06);
}

.net-amount-row .visibility-toggle:hover:not(:disabled),
.net-amount-row .visibility-toggle[aria-pressed="true"] {
  color: #ffffff;
  border-color: rgba(203, 232, 235, .45);
  background: rgba(73, 201, 209, .16);
}

@media (max-width: 720px) {
  .visibility-toggle {
    width: 46px;
    min-width: 46px;
    height: 46px;
    padding: 0;
  }
}

/* Keep the simplified dashboard headings close to their data. */
.dashboard-grid .bars {
  padding-top: 14px;
}

@media (max-width: 720px) {
  .dashboard-grid .bars {
    padding-top: 12px;
  }
}

@media (max-width: 720px) {
  /*
   * Mobile type scale
   * Keep form controls at 16px or larger so iOS Safari does not zoom the page on focus.
   */
  input,
  select,
  textarea {
    font-size: 16px;
  }

  .eyebrow {
    font-size: 10px;
    letter-spacing: 0.14em;
  }

  .button {
    height: 46px;
    min-height: 46px;
    padding: 0 16px;
    border-radius: 11px;
    font-size: 14px;
  }

  .refresh-button,
  .top-actions .button-primary {
    width: 46px;
    height: 46px;
  }

  .refresh-button {
    min-width: 46px;
  }

  .toolbar-count {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    font-size: 14px;
  }

  .toolbar-intro strong {
    font-size: 16px;
  }

  .search-box {
    height: 52px;
    padding: 0 14px;
    border-radius: 12px;
  }

  .search-box input {
    font-size: 16px;
    line-height: 1.35;
  }

  .select-wrap select {
    height: 52px;
    min-width: 128px;
    padding: 0 40px 0 14px;
    border-radius: 12px;
    font-size: 16px;
  }

  .select-wrap::after {
    right: 16px;
    width: 8px;
    height: 8px;
  }

  .toolbar-actions .button-primary {
    min-width: 132px;
  }

  .panel-head h2,
  .table-panel-head h2 {
    font-size: 17px;
  }

  .panel-head p {
    font-size: 12px;
  }

  .account-card-head {
    padding: 0;
  }

  .institution-toggle {
    gap: 11px;
    padding: 16px 6px 16px 18px;
  }

  .institution-chevron {
    width: 40px;
    height: 40px;
    border-radius: 11px;
  }

  .institution-logo {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    font-size: 17px;
  }

  .institution-logo .ui-icon {
    width: 24px;
    height: 24px;
  }

  .account-card-head h3 {
    font-size: 16px;
  }

  .account-card-head p {
    font-size: 12px;
  }

  .sub-row {
    gap: 11px;
    padding: 14px 7px;
  }

  .sub-row > span:first-child {
    width: 36px;
    height: 36px;
    font-size: 13px;
  }

  .account-type-icon .ui-icon {
    width: 19px;
    height: 19px;
  }

  .sub-row strong {
    font-size: 14px;
  }

  .sub-row small {
    font-size: 12px;
  }

  .sub-row .more-btn,
  .account-card-head .more-btn {
    min-width: 36px;
    min-height: 36px;
    font-size: 13px;
  }

  .account-card-head .more-btn {
    margin-right: 10px;
  }

  .rate-intro h2 {
    font-size: 17px;
  }

  .rate-intro p {
    font-size: 12px;
  }

  .currency-code {
    font-size: 18px;
  }

  .rate-value {
    font-size: 28px;
  }

  .mobile-nav a {
    gap: 4px;
    font-size: 10px;
  }

  .mobile-nav a svg {
    width: 20px;
    height: 20px;
  }

  .dialog-head h2 {
    font-size: 24px;
  }

  .close-btn {
    width: 42px;
    height: 42px;
    border-radius: 11px;
  }

  .close-btn svg {
    width: 19px;
    height: 19px;
  }

  .field {
    gap: 8px;
  }

  .field label {
    font-size: 13px;
  }

  .field input,
  .field select,
  .field textarea {
    min-height: 50px;
    padding: 0 14px;
    border-radius: 12px;
    font-size: 16px;
  }

  .field select {
    appearance: none;
    padding-right: 43px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='m7 9 5 5 5-5' stroke='%23566b5e' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-position: right 14px center;
    background-repeat: no-repeat;
    background-size: 18px;
  }

  .field input[type="color"] {
    height: 50px;
  }

  .field textarea {
    min-height: 96px;
    padding-top: 13px;
    padding-bottom: 13px;
  }

  .icon-file-picker {
    min-height: 64px;
    padding: 8px 10px;
  }

  .icon-file-preview {
    width: 44px;
    height: 44px;
  }

  .icon-file-action {
    padding: 8px 10px;
  }

  .field-error {
    min-height: 14px;
    font-size: 11px;
  }

  .dialog-actions {
    gap: 10px;
  }

  .dialog-actions .button {
    min-width: 82px;
    height: 48px;
    font-size: 15px;
  }

  .danger-text,
  .archive-text {
    font-size: 13px;
  }
}

@media (max-width: 420px) {
  .topbar {
    align-items: flex-start;
  }

  .top-actions {
    margin-top: 2px;
  }

  .net-amount {
    font-size: 31px;
  }

  .net-split {
    gap: 18px;
  }

  .net-split strong {
    font-size: 12px;
  }

  .distribution-body {
    gap: 13px;
  }

  .donut {
    width: 124px;
    height: 124px;
  }

  .donut::after {
    width: 80px;
    height: 80px;
  }

  .donut strong {
    font-size: 12px;
  }

  .legend-item {
    gap: 6px;
    font-size: 10px;
  }

  .legend-item strong {
    font-size: 9px;
  }

  .rate-intro {
    align-items: flex-start;
    flex-direction: column;
  }

  .rate-intro .button {
    align-self: flex-end;
  }

  .rate-intro-actions {
    align-self: flex-end;
  }
}

@media (max-width: 720px) {
  .main > .view.settings-page {
    max-width: none;
  }

  .settings-layout {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 14px;
  }

  .settings-column {
    width: 100%;
    gap: 14px;
  }

  .settings-group-head {
    padding: 19px 18px 15px;
  }

  .settings-group-head h2 {
    font-size: 17px;
  }

  .settings-group-head p {
    font-size: 12px;
  }

  .settings-row {
    min-height: 76px;
    gap: 11px;
    padding: 15px 16px;
  }

  .settings-row-icon {
    width: 42px;
    height: 42px;
  }

  .settings-row-copy strong {
    font-size: 15px;
  }

  .settings-row-copy small {
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.45;
    white-space: normal;
  }

  .settings-row-meta {
    font-size: 11px;
  }

  .settings-chevron {
    width: 38px;
    height: 38px;
    border-radius: 10px;
  }

  .settings-summary {
    width: 100%;
    min-height: 0;
    padding: 21px 18px;
  }

  .settings-summary h2 {
    font-size: 19px;
  }

  .settings-summary > p {
    font-size: 12px;
  }

  .settings-summary-list span {
    font-size: 11px;
  }

  .settings-summary-list strong {
    font-size: 14px;
  }

  .settings-detail {
    margin-top: 0;
    margin-bottom: 14px;
  }

  .settings-detail-head {
    flex-direction: column;
    gap: 18px;
    padding: 19px 16px 16px;
    border-radius: 18px;
  }

  .settings-detail-copy {
    width: 100%;
  }

  .settings-detail-head h2 {
    font-size: 20px;
  }

  .settings-detail-head p {
    font-size: 13px;
  }

  .settings-collapse {
    min-height: 40px;
    padding: 0 11px;
    border-radius: 10px;
    font-size: 11px;
  }

  .settings-detail-head .rate-intro-actions {
    align-self: stretch;
    justify-content: stretch;
    width: 100%;
    flex-wrap: nowrap;
  }

  .settings-detail-head .rate-intro-actions .button {
    min-width: 0;
    min-height: 48px;
    flex: 1;
    padding-right: 10px;
    padding-left: 10px;
    font-size: 14px;
  }

  .rate-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 12px;
  }

  .rate-card {
    min-height: 208px;
    padding: 16px;
    border-radius: 16px;
  }

  .currency-code {
    font-size: 17px;
  }

  .currency-flag {
    width: 34px;
    height: 34px;
  }

  .rate-value {
    margin-top: 18px;
    font-size: 26px;
  }

  .rate-card > p {
    font-size: 10px;
  }

  .rate-card-foot {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
    margin-top: 16px;
    padding-top: 11px;
    font-size: 10px;
  }
}

@media (max-width: 380px) {
  .rate-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .archive-list {
    gap: 12px;
    margin-top: 12px;
  }

  .archive-group-head {
    padding: 14px 16px;
  }

  .archive-group-head h3 {
    font-size: 16px;
  }

  .archive-group-head > span {
    font-size: 11px;
  }

  .archive-record {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 11px;
    padding: 14px 16px;
  }

  .archive-record-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    font-size: 14px;
  }

  .archive-record-copy strong {
    font-size: 14px;
  }

  .archive-record-copy small {
    font-size: 11px;
  }

  .archive-record-actions {
    width: 100%;
    padding-left: 53px;
    justify-content: stretch;
  }

  .archive-action {
    min-height: 42px;
    flex: 1;
    font-size: 12px;
  }

  .archive-hint {
    align-self: center;
    flex: 1;
    font-size: 11px;
    text-align: center;
  }

  .archive-state {
    min-height: 180px;
    padding: 25px 18px;
  }

  .archive-state strong {
    font-size: 15px;
  }

  .archive-state p {
    font-size: 12px;
  }

  .dialog-feedback {
    margin-top: 16px;
    padding: 12px 13px;
    font-size: 12px;
  }
}

/* Account management redesign */
.account-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.accounts-control-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.account-tabs { display:flex; align-self:stretch; gap:26px; }
.account-tabs button { position:relative; min-height:51px; padding:0 2px; color:var(--muted); border:0; background:transparent; cursor:pointer; font-size:11px; font-weight:500; }
.account-tabs button::after { position:absolute; right:0; bottom:-1px; left:0; height:2px; border-radius:2px; background:var(--brand); content:""; opacity:0; transform:scaleX(.5); transition:150ms ease-out; }
.account-tabs button:hover,
.account-tabs button.active { color:var(--brand); }
.account-tabs button.active::after { opacity:1; transform:scaleX(1); }
.account-controls { padding-bottom:10px; }
.account-controls .search-box { width:230px; }
.account-controls .select-wrap select { min-width:174px; }

.account-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.account-list-footer {
  margin-top:14px;
}

.account-list-add {
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  width:100%;
  min-height:64px;
  padding:0 12px;
  color:var(--brand);
  border:1px dashed var(--border-strong);
  border-radius:12px;
  background:rgba(244,249,245,.72);
  cursor:pointer;
  font:inherit;
  font-size:13px;
  font-weight:600;
  transition:color .2s ease, background .2s ease, border-color .2s ease;
}

.account-list-add .ui-icon { width:18px; height:18px; }
.account-list-add:hover,
.account-list-add:focus-visible { color:var(--brand-deep); border-color:#9fbea8; background:var(--brand-pale); }

.account-card.account-overview-card {
  width: 100%;
  min-height: 0;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.account-overview-card .account-card-head {
  display: flex;
  align-items: stretch;
  padding: 0;
  border-bottom: 0;
}

.account-overview-card .institution-toggle {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(220px, .8fr) auto;
  grid-template-areas: "logo heading summary chevron";
  align-items: center;
  gap: 16px;
  min-height: 112px;
  padding: 18px 10px 18px 20px;
  border-radius: 16px;
}

.account-overview-card .institution-toggle:hover,
.account-overview-card .institution-toggle:active {
  background: transparent;
}

.account-overview-card .institution-logo {
  grid-area: logo;
  width: 64px;
  height: 64px;
  border-radius: 18px;
}

.account-overview-card .institution-logo .ui-icon {
  width: 34px;
  height: 34px;
}

.account-overview-card .institution-heading {
  grid-area: heading;
}

.account-overview-card .account-card-head h3 { margin:0; font-size:18px; }

.account-overview-card .institution-summary {
  display:flex;
  grid-area: summary;
  min-width:0;
  flex-direction:column;
  align-items:flex-end;
  gap:4px;
  text-align:right;
}

.account-overview-card .institution-summary strong {
  color:var(--ink);
  font-size:24px;
  font-variant-numeric:tabular-nums;
  letter-spacing:-.03em;
  line-height:1.05;
}

.account-overview-card .institution-chevron {
  grid-area: chevron;
  width:44px;
  height:44px;
  border-radius:12px;
}

.account-overview-card.is-expanded .institution-chevron {
  color:var(--brand);
  border-color:#c3d7c7;
  background:var(--brand-pale);
  transform:rotate(90deg);
}

.account-overview-card .account-card-head .more-btn {
  align-self:center;
  margin:0 14px 0 0;
}

.account-overview-card .sub-list {
  padding:10px 22px 18px;
  border-top:1px solid var(--border-subtle);
}

.account-overview-card.is-expanded {
  box-shadow:0 8px 22px rgba(26,48,35,.07);
}

.account-overview-card .sub-row {
  gap: 14px;
  min-height: 78px;
  padding: 14px 12px;
}

.account-overview-card .sub-row > span:first-child {
  width: 42px;
  height: 42px;
  border-radius: 12px;
}

.account-overview-card .account-type-icon .ui-icon {
  width: 21px;
  height: 21px;
}

.account-overview-card .sub-row strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.account-overview-card .sub-row small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.account-overview-card .account-holding-summary {
  margin-top: 5px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 600;
}

.sub-account-add {
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  width:100%;
  min-height:48px;
  margin-top:10px;
  padding:0 12px;
  color:var(--brand);
  border:1px dashed var(--border-strong);
  border-radius:10px;
  background:rgba(244,249,245,.72);
  cursor:pointer;
  font:inherit;
  font-size:13px;
  font-weight:600;
  transition:color .2s ease, background .2s ease, border-color .2s ease;
}

.sub-account-add .ui-icon { width:16px; height:16px; }
.sub-account-add:hover,
.sub-account-add:focus-visible { color:var(--brand-deep); border-color:#9fbea8; background:var(--brand-pale); }

@media (max-width: 1260px) {
  .account-controls .search-box { display:none; }
}

@media (max-width: 960px) {
  .accounts-control-bar { align-items:flex-end; }
  .account-controls .select-wrap { display:none; }
}

@media (max-width: 720px) {
  .accounts-control-bar { display:block; margin-bottom:14px; border-bottom:0; }
  .account-tabs { gap:22px; overflow-x:auto; border-bottom:1px solid var(--border-subtle); }
  .account-tabs button { flex:none; min-height:46px; font-size:12px; }
  .account-controls { display:block; padding:12px 0 0; }
  .account-controls .search-box { display:flex; width:auto; }
  .account-controls .select-wrap { display:none; }
  .account-grid { gap:10px; }
  .account-card.account-overview-card { border-radius:14px; }
  .account-overview-card .institution-toggle {
    grid-template-columns:auto minmax(0,1fr) auto;
    grid-template-areas:
      "logo heading chevron"
      "logo summary chevron";
    gap:4px 12px;
    min-height:100px;
    padding:14px 8px 14px 14px;
    border-radius:14px;
  }
  .account-overview-card .institution-logo { width:52px; height:52px; border-radius:15px; }
  .account-overview-card .institution-logo .ui-icon { width:30px; height:30px; }
  .account-overview-card .account-card-head h3 { font-size:17px; }
  .account-overview-card .institution-summary {
    display:flex;
    min-width:0;
    flex-direction:row;
    align-items:baseline;
    gap:6px;
    justify-content:flex-start;
    text-align:left;
  }
  .account-overview-card .institution-summary strong { font-size:19px; }
  .account-overview-card .institution-chevron { width:42px; height:42px; border-radius:11px; }
  .account-overview-card .account-card-head .more-btn { margin-right:10px; }
  .account-overview-card .sub-list { padding:8px 12px 14px; }
  .account-list-footer { margin-top:10px; }
  .account-list-add { min-height:56px; font-size:13px; }
  .account-overview-card .sub-row { min-height:72px; padding:12px 10px; gap:12px; }
  .account-overview-card .sub-row > span:first-child { width:40px; height:40px; border-radius:11px; }
  .account-overview-card .sub-row strong { font-size:15px; }
  .account-overview-card .sub-row small { font-size:12px; }
  .account-overview-card .account-holding-summary { font-size:13px; }
  .sub-account-add { min-height:48px; font-size:13px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* FinTech visual theme */
:root {
  color-scheme: light;
}

html,
body {
  background: var(--background);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline-color: rgba(11, 127, 142, 0.26);
}

/* Obsidian navigation */
.sidebar {
  color: #d7e1e8;
  border-right: 1px solid rgba(151, 196, 207, 0.12);
  background: var(--brand-950);
}

.brand-mark {
  color: #cfe8ec;
  border-color: rgba(188, 225, 231, 0.28);
  background: rgba(255, 255, 255, 0.045);
}

.brand-copy small {
  color: #8da2ad;
}

.nav-label {
  color: #71848f;
}

.side-nav a {
  color: #aab9c2;
}

.side-nav a svg {
  color: #8499a5;
}

.side-nav a:hover {
  color: #f1f7f8;
  background: rgba(136, 211, 219, 0.07);
}

.side-nav a.active {
  color: #f2fbfc;
  background: rgba(54, 178, 189, 0.15);
  box-shadow: inset 0 0 0 1px rgba(107, 210, 219, 0.13);
}

.side-nav a.active svg {
  color: #9ce1e5;
}

.side-nav a.active::before {
  background: var(--brand-bright);
}

.nav-placeholder {
  color: #697d89;
}

.security-note {
  border-color: rgba(174, 216, 223, 0.11);
  background: rgba(255, 255, 255, 0.045);
}

.status-dot,
.live-pill i {
  background: #7ac8cf;
}

.status-dot {
  box-shadow: 0 0 0 4px rgba(122, 200, 207, 0.11);
}

.security-note strong {
  color: #dce8ed;
}

.security-note p,
.sidebar-foot {
  color: #8b9da8;
}

.sidebar-foot {
  border-top-color: rgba(174, 216, 223, 0.12);
}

.sidebar-foot b {
  color: #bfd0d7;
}

/* Shared controls */
.eyebrow,
.panel-kicker {
  color: #788894;
}

.button-primary {
  color: #f7fcfd;
  border-color: var(--brand);
  background: var(--brand);
  box-shadow: 0 4px 10px rgba(11, 127, 142, 0.13);
}

.button-primary:hover:not(:disabled) {
  border-color: var(--brand-deep);
  background: var(--brand-deep);
  box-shadow: 0 7px 16px rgba(11, 127, 142, 0.16);
}

.button-secondary {
  color: var(--brand-800);
  border-color: var(--border);
  background: var(--surface);
}

.button-secondary:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--surface-secondary);
}

.button-ghost:hover:not(:disabled) {
  color: var(--brand-800);
  background: var(--surface-secondary);
}

.alert {
  border-color: #eadfca;
  background: var(--warning-soft);
}

.alert.alert-error {
  border-color: #ebd1d8;
  background: var(--red-soft);
}

.panel,
.metric-card,
.account-card,
.rate-card {
  border-color: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

.metric-card:hover,
.account-card:hover,
.rate-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

/* Dashboard */
.net-worth-card {
  border-color: #263844;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #101820 0%, #1a2a35 100%);
  box-shadow: 0 12px 26px rgba(7, 14, 21, 0.12);
}

.net-worth-card::before,
.net-worth-card::after {
  border-color: rgba(143, 218, 224, 0.09);
}

.card-label {
  color: #d8e7ec;
}

.card-label-icon {
  color: #9fdbe1;
  border-color: rgba(157, 219, 225, 0.22);
  background: rgba(255, 255, 255, 0.055);
}

.live-pill {
  color: #a7dce1;
  border-color: rgba(157, 219, 225, 0.2);
}

.live-pill i {
  background: #76cbd1;
}

.metric-caption {
  color: #a9bdc5;
}

.net-split small {
  color: #91aab4;
}

.net-split strong {
  color: #eef7f8;
}

.net-card-footer {
  color: #849ba5;
  border-top-color: rgba(157, 219, 225, 0.15);
}

.icon-green {
  color: var(--brand);
  background: var(--brand-pale);
}

.icon-gold {
  color: #9a6e24;
  background: var(--gold-soft);
}

.metric-index,
.panel-index {
  color: var(--muted-light);
}

.donut {
  background: conic-gradient(var(--brand) 0 62%, #658492 62% 83%, #b3883e 83% 100%);
}

.donut::after {
  border-color: rgba(207, 218, 224, 0.82);
}

.bar-label .ui-icon {
  color: var(--brand);
  background: var(--brand-pale);
}

.bar-track {
  background: var(--surface-tertiary);
}

/* Tables and filters */
.toolbar-count {
  color: var(--brand-800);
  border-color: #cfe0e4;
  background: var(--brand-pale);
}

.search-box:focus-within {
  border-color: #77bdc5;
  box-shadow: 0 0 0 3px rgba(11, 127, 142, 0.11);
}

th {
  color: #7b8a95;
}

tbody tr:hover {
  background: #f7fafb;
}

.badge {
  color: var(--brand-800);
  border-color: #d1e3e6;
  background: var(--brand-pale);
}

.badge.liability {
  border-color: #ebd2d8;
  background: var(--red-soft);
}

.more-btn:hover {
  color: var(--brand);
  border-color: var(--border-strong);
  background: var(--surface-secondary);
}

/* Account cards */
.account-overview-card {
  border-color: var(--border);
  background: var(--surface);
}

.account-overview-card:hover,
.account-overview-card.is-expanded {
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
  transform: none;
}

.account-overview-card .institution-logo {
  color: var(--brand-800);
  border: 1px solid #d9e4e8;
  background: var(--surface-tertiary) !important;
}

.account-overview-card .institution-chevron {
  color: var(--muted);
  border-color: var(--border);
  background: var(--surface-secondary);
}

.account-overview-card.is-expanded .institution-chevron {
  color: var(--brand);
  border-color: #add5da;
  background: var(--brand-pale);
}

.account-overview-card .sub-list {
  border-top-color: var(--border-subtle);
}

.sub-row[data-edit-account]:hover {
  background: #f7fafb;
}

.sub-row[data-edit-account]:focus-visible {
  outline-color: rgba(11, 127, 142, 0.2);
}

.sub-row[data-edit-account]:hover .row-arrow,
.sub-row[data-edit-account]:focus-visible .row-arrow {
  color: var(--brand);
  border-color: #add5da;
  background: var(--brand-pale);
}

.account-list-add,
.sub-account-add {
  color: var(--brand-800);
  border-color: #bfd1d8;
  background: rgba(245, 249, 250, 0.72);
}

.account-list-add:hover,
.account-list-add:focus-visible,
.sub-account-add:hover,
.sub-account-add:focus-visible {
  color: var(--brand-deep);
  border-color: #8fc8cf;
  background: var(--brand-pale);
}

/* Settings and archive */
.settings-group,
.settings-detail,
.archive-group {
  border-color: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

.settings-group-head,
.archive-group-head {
  border-bottom-color: var(--border-subtle);
  background: var(--surface-secondary);
}

.settings-row-button:hover {
  border-left-color: #b2d6da;
  background: #f8fafb;
}

.settings-row-button[aria-expanded="true"] {
  border-left-color: var(--brand);
  background: var(--brand-pale);
}

.settings-row-icon {
  color: var(--brand);
  background: var(--brand-pale);
}

.settings-row-icon.icon-neutral {
  color: var(--ink-soft);
  background: var(--surface-tertiary);
}

.settings-row-button:hover .settings-chevron,
.settings-row-button[aria-expanded="true"] .settings-chevron {
  color: var(--brand);
  border-color: #add5da;
  background: var(--brand-pale);
}

.settings-detail-head {
  border-bottom-color: var(--border-subtle);
  background: var(--surface-secondary);
}

.settings-collapse:hover {
  color: var(--brand);
  border-color: #add5da;
  background: var(--brand-pale);
}

.archive-record {
  border-bottom-color: var(--border-subtle);
}

.archive-record-icon.institution {
  color: var(--brand-800);
  background: var(--surface-tertiary);
}

.archive-record-icon.account {
  color: var(--brand-800);
  background: var(--brand-pale);
}

.archive-record-icon.holding {
  color: #8d6523;
  background: var(--gold-soft);
}

.archive-action:hover {
  border-color: var(--border-strong);
  background: var(--brand-pale);
}

.archive-action-danger:hover {
  border-color: #e6c3cb;
  background: var(--red-soft);
}

.archive-state {
  border-color: #bfd1d8;
  background: var(--surface-secondary);
}

/* Rates and forms */
.rate-intro {
  border-color: var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-secondary);
}

.rate-symbol {
  background: var(--brand);
}

.currency-flag {
  border-color: var(--border);
  background: var(--surface-secondary);
}

dialog {
  border-color: var(--border);
  border-radius: var(--radius-xl) 0 0 var(--radius-xl);
  background: var(--surface);
}

dialog::backdrop {
  background: rgba(9, 17, 25, 0.45);
}

.account-detail-totals > div,
.icon-file-picker,
.field input:disabled,
.field select:disabled,
.field textarea:disabled {
  background: var(--surface-secondary);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: #77bdc5;
  box-shadow: 0 0 0 3px rgba(11, 127, 142, 0.11);
}

.field select.currency-select {
  color: var(--brand-800);
}

.icon-file-picker:hover,
.icon-file-picker:focus-within,
.icon-file-picker.has-file {
  border-color: #8fc8cf;
  background: var(--brand-pale);
}

.icon-file-action {
  color: var(--brand-800);
  border-color: #add5da;
}

.field input[aria-invalid="true"],
.field select[aria-invalid="true"],
.field textarea[aria-invalid="true"] {
  border-color: #d58b99;
  box-shadow: 0 0 0 3px rgba(180, 81, 96, 0.1);
}

.dialog-feedback {
  border-color: #e6c3cb;
  background: var(--red-soft);
}

.toast {
  border-color: rgba(158, 213, 220, 0.12);
  background: var(--brand-900);
}

/* Mobile chrome */
.mobile-nav {
  border-top-color: var(--border);
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.mobile-nav a.active {
  color: var(--brand);
  background: var(--brand-pale);
}

.mobile-nav button {
  color: #f7fcfd;
  border-color: var(--background);
  background: var(--brand);
  box-shadow: 0 4px 12px rgba(9, 58, 70, 0.2);
}

@media (max-width: 720px) {
  .account-overview-card:hover {
    border-color: var(--border);
    box-shadow: var(--shadow-xs);
  }

  .field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='m7 9 5 5 5-5' stroke='%230b7f8e' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  }

  dialog {
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }
}

/* Dashboard lower content: add structure without adding copy. */
.dashboard-grid .chart-panel,
.holdings-preview {
  border-color: #d6e1e7;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdfe 100%);
}

.dashboard-grid .chart-panel .panel-head,
.holdings-preview .panel-head {
  padding-bottom: 13px;
  border-bottom: 1px solid var(--border-subtle);
}

.dashboard-grid .chart-panel .panel-head h2,
.holdings-preview .panel-head h2 {
  position: relative;
  padding-left: 10px;
}

.dashboard-grid .chart-panel .panel-head h2::before,
.holdings-preview .panel-head h2::before {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  width: 3px;
  content: "";
  border-radius: 3px;
  background: var(--brand-bright);
}

.dashboard-grid .distribution-body,
.dashboard-grid .bars {
  margin-top: 15px;
  border: 1px solid #e3ebef;
  border-radius: 12px;
  background: rgba(245, 249, 251, 0.72);
}

.dashboard-grid .distribution-body {
  padding: 18px 14px 12px;
}

.dashboard-grid .bars {
  padding: 14px 14px 10px;
}

.holdings-preview .table-wrap {
  margin-top: 16px;
}

@media (max-width: 720px) {
  .dashboard-grid .chart-panel .panel-head,
  .holdings-preview .panel-head {
    padding-bottom: 11px;
  }

  .dashboard-grid .distribution-body,
  .dashboard-grid .bars {
    margin-top: 13px;
  }

  .dashboard-grid .distribution-body {
    gap: 14px;
    padding: 16px 12px 12px;
  }

  .dashboard-grid .bars {
    gap: 14px;
    padding: 14px 12px 10px;
  }
}

/* Account inclusion and geography */
.region-panel {
  grid-column: 1 / -1;
  min-height: 0;
}

.dashboard-grid .region-bars {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 15px;
  padding: 14px;
  border: 1px solid #e3ebef;
  border-radius: 12px;
  background: rgba(245, 249, 251, 0.72);
}

.region-bar {
  min-width: 0;
  padding: 15px 16px 13px;
  border: 1px solid var(--border-subtle);
  border-radius: 11px;
  background: var(--surface);
}

.region-bar-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
}

.region-bar-label {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.region-bar-label i {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
}

.region-bar-meta strong {
  color: var(--ink);
  font-size: 15px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.region-bar-meta em {
  min-width: 32px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.region-track {
  height: 5px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 99px;
  background: #e8eef1;
}

.region-fill {
  height: 100%;
  min-width: 0;
  border-radius: inherit;
  transition: width 220ms ease-out;
}

.checkbox-control {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  transition: border-color 180ms ease-out, background 180ms ease-out;
}

.field .field-label {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
}

.checkbox-control:hover {
  border-color: var(--border-strong);
  background: var(--surface-secondary);
}

.checkbox-control > input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 1px;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}

.field .checkbox-option {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.switch-track {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 36px;
  height: 22px;
  flex: none;
  padding: 2px;
  border-radius: 999px;
  background: #cbd8dc;
  transition: background 180ms ease-out;
}

.switch-track > span {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(16, 31, 43, 0.18);
  transition: transform 180ms ease-out;
}

.checkbox-control > input:checked + .checkbox-option .switch-track {
  background: var(--brand);
}

.checkbox-control > input:checked + .checkbox-option .switch-track > span {
  transform: translateX(14px);
}

.checkbox-control > input:focus-visible + .checkbox-option .switch-track {
  outline: 3px solid rgba(11, 127, 142, 0.18);
  outline-offset: 2px;
}

.account-overview-card .sub-row.is-excluded .account-holding-summary {
  color: var(--muted);
}

@media (max-width: 720px) {
  .region-panel {
    margin-top: 12px;
  }

  .dashboard-grid .region-bars {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 13px;
    padding: 12px;
  }

  .region-bar {
    padding: 13px 14px 12px;
  }

  .checkbox-control {
    min-height: 50px;
    padding: 0 14px;
    border-radius: 12px;
  }

  .field .checkbox-option {
    font-size: 14px;
  }

  .field .field-label {
    font-size: 13px;
  }
}

/* Account headers and rows are direct-click surfaces; no arrow affordances. */
.account-overview-card .institution-toggle {
  grid-template-columns: auto minmax(0, 1fr) minmax(220px, .8fr);
  grid-template-areas: "logo heading summary";
}

@media (max-width: 720px) {
  .account-overview-card .institution-toggle {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "logo heading"
      "logo summary";
  }
}

/* Mobile overview type rhythm */
@media (max-width: 720px) {
  .topbar h1 {
    font-size: 27px;
    letter-spacing: -0.045em;
    line-height: 1.12;
  }

  .topbar {
    margin-bottom: 20px;
  }

  .hero-grid {
    gap: 12px;
    margin-bottom: 14px;
  }

  .card-label {
    gap: 8px;
    font-size: 14px;
  }

  .net-amount {
    font-size: 36px;
    letter-spacing: -0.05em;
    line-height: 1.08;
  }

  .net-split {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
  }

  .net-split small {
    margin-bottom: 5px;
    font-size: 11px;
    line-height: 1.3;
  }

  .net-split strong {
    font-size: 13px;
    line-height: 1.2;
  }

  .metric-card {
    min-height: 142px;
    padding: 17px;
  }

  .metric-label {
    font-size: 12px;
    line-height: 1.3;
  }

  .metric-value {
    margin-top: 7px;
    font-size: 27px;
    line-height: 1.05;
  }

  .dashboard-grid {
    margin-top: 14px;
  }

  .dashboard-grid .chart-panel {
    padding: 18px;
  }

  .dashboard-grid .chart-panel .panel-head {
    padding-bottom: 12px;
  }

  .dashboard-grid .chart-panel .panel-head h2 {
    margin-top: 2px;
    font-size: 18px;
    letter-spacing: -0.025em;
    line-height: 1.25;
  }

  .dashboard-grid .distribution-body {
    gap: 16px;
    padding: 18px 0 3px;
  }

  .donut strong {
    font-size: 15px;
  }

  .donut span {
    margin-top: 4px;
    font-size: 10px;
  }

  .legend {
    gap: 12px;
  }

  .legend-item {
    gap: 8px;
    font-size: 12px;
    line-height: 1.3;
  }

  .legend-item strong {
    font-size: 11px;
  }

  .dashboard-grid .bars {
    gap: 15px;
    padding-top: 16px;
  }

  .bar-meta {
    margin-bottom: 8px;
    font-size: 12px;
  }
}

@media (max-width: 420px) {
  .topbar h1 {
    font-size: 26px;
  }

  .net-amount {
    font-size: 33px;
  }

  .net-split {
    gap: 18px;
  }

  .distribution-body {
    gap: 14px;
  }

  .legend-item {
    gap: 7px;
    font-size: 11px;
  }

  .legend-item strong {
    font-size: 10px;
  }
}

/* Floating glass navigation on mobile */
@media (max-width: 720px) {
  body {
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
  }

  .mobile-nav {
    isolation: isolate;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    right: auto;
    bottom: max(12px, env(safe-area-inset-bottom));
    left: 50%;
    width: min(460px, calc(100% - 28px));
    min-height: 64px;
    padding: 7px 8px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.34), rgba(232, 246, 249, 0.16));
    box-shadow: 0 16px 36px rgba(19, 38, 48, 0.12), 0 3px 9px rgba(19, 38, 48, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.86), inset 0 -1px 0 rgba(110, 163, 177, 0.1);
    -webkit-backdrop-filter: saturate(155%) blur(32px) contrast(103%);
    backdrop-filter: saturate(155%) blur(32px) contrast(103%);
    overflow: hidden;
    transform: translateX(-50%);
  }

  .mobile-nav::before {
    position: absolute;
    inset: 1px;
    z-index: -1;
    content: "";
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 999px;
    pointer-events: none;
  }

  .mobile-nav a,
  .mobile-nav-placeholder {
    min-height: 48px;
    padding: 5px 6px;
    border-radius: 999px;
  }

  .mobile-nav a {
    gap: 4px;
    color: #8c9ba3;
    font-size: 10px;
    font-weight: 500;
    line-height: 1.1;
  }

  .mobile-nav a svg,
  .mobile-nav-placeholder svg {
    width: 21px;
    height: 21px;
  }

  .mobile-nav a.active {
    color: var(--brand);
    background: rgba(208, 240, 244, 0.3);
    box-shadow: inset 0 0 0 1px rgba(112, 193, 201, 0.16), 0 3px 10px rgba(76, 157, 170, 0.05);
    font-weight: 650;
  }

  .mobile-nav-placeholder {
    gap: 4px;
    color: #9ba8ae;
    font-size: 10px;
    line-height: 1.1;
    opacity: 0.7;
  }

  .mobile-nav-add-placeholder {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    min-height: 42px;
    justify-self: center;
    align-self: center;
    margin: 0;
    padding: 0;
    color: #5f9aa6;
    border: 1px solid rgba(255, 255, 255, 0.74);
    border-radius: 999px;
    background: rgba(218, 240, 244, 0.25);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.68), 0 4px 12px rgba(9, 90, 103, 0.08);
    opacity: 0.78;
    pointer-events: none;
  }

  .mobile-nav-add-placeholder svg {
    width: 22px;
    height: 22px;
  }

  .toast {
    bottom: 96px;
  }
}

/* Settings workspace */
.main > .view.settings-page {
  max-width: 1120px;
}

.settings-page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.settings-page-heading h2 {
  margin: 4px 0 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.settings-page-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.settings-mobile-note {
  display: none;
}

.settings-search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(260px, 100%);
  min-height: 40px;
  padding: 0 8px 0 12px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.settings-search:focus-within {
  border-color: #add5da;
  box-shadow: 0 0 0 3px rgba(11, 127, 142, 0.09);
}

.settings-search .ui-icon {
  width: 16px;
  height: 16px;
  flex: none;
}

.settings-search input {
  width: 100%;
  min-width: 0;
  padding: 0;
  color: var(--ink);
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 11px;
}

.settings-search input::placeholder {
  color: var(--muted-light);
}

.settings-search kbd {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: none;
  color: var(--muted-light);
  border: 1px solid var(--border-subtle);
  border-radius: 5px;
  background: var(--surface-secondary);
  font-family: var(--font-sans);
  font-size: 10px;
}

.settings-shell {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  align-items: start;
  gap: 28px;
}

.settings-nav {
  position: sticky;
  top: 24px;
  min-width: 0;
}

.settings-nav-intro {
  padding: 2px 12px 17px;
}

.settings-nav-intro > span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
}

.settings-nav-intro p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.settings-nav-list {
  display: grid;
  gap: 5px;
}

.settings-nav-group {
  display: grid;
  gap: 5px;
}

.settings-nav-group-label {
  padding: 10px 12px 4px;
  color: var(--muted-light);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.settings-nav-group:first-child .settings-nav-group-label {
  padding-top: 2px;
}

.settings-nav-group-list {
  display: grid;
  gap: 5px;
}

.settings-nav-empty {
  padding: 12px;
  color: var(--muted);
  font-size: 10px;
}

.settings-nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 58px;
  padding: 9px 11px;
  color: var(--ink-soft);
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: color 150ms ease-out, border-color 150ms ease-out, background 150ms ease-out, box-shadow 150ms ease-out;
}

.settings-nav-item:hover {
  color: var(--brand-deep);
  background: rgba(255, 255, 255, 0.72);
}

.settings-nav-item.active {
  color: var(--brand-deep);
  border-color: #c7e0e3;
  background: var(--brand-pale);
  box-shadow: var(--shadow-xs);
}

.settings-nav-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  color: var(--muted);
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  background: var(--surface);
}

.settings-nav-item.active .settings-nav-icon {
  color: var(--brand);
  border-color: #b9dadd;
}

.settings-nav-icon svg {
  width: 17px;
  height: 17px;
}

.settings-nav-item > span:last-child {
  min-width: 0;
}

.settings-nav-item strong,
.settings-nav-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-nav-item strong {
  font-size: 12px;
  font-weight: 650;
}

.settings-nav-item small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.settings-content {
  display: grid;
  min-width: 0;
  gap: 18px;
}

.settings-empty {
  display: grid;
  place-items: center;
  gap: 9px;
  min-height: 250px;
  padding: 28px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-secondary);
  color: var(--muted);
  text-align: center;
}

.settings-empty strong {
  color: var(--ink-soft);
  font-size: 14px;
}

.settings-empty p {
  max-width: 360px;
  margin: 0;
  font-size: 11px;
  line-height: 1.55;
}

.settings-section {
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border-radius: var(--radius-lg);
  scroll-margin-top: 24px;
}

.settings-section-head {
  padding: 22px 24px 19px;
  border-bottom: 1px solid var(--border-subtle);
  background: linear-gradient(180deg, #ffffff 0%, var(--surface-secondary) 100%);
}

.settings-section-head-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.settings-section-heading {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  min-width: 0;
}

.settings-section-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  color: var(--brand);
  border-radius: 10px;
  background: var(--brand-pale);
}

.settings-section-icon-neutral {
  color: var(--ink-soft);
  background: var(--surface-tertiary);
}

.settings-section-icon svg {
  width: 19px;
  height: 19px;
}

.settings-section-heading h2 {
  margin: 1px 0 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 650;
}

.settings-section-kicker {
  display: block;
  color: var(--muted-light);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
}

.settings-section-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.brand-setting-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px 24px 24px;
}

.brand-logo-preview {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  flex: none;
  overflow: hidden;
  color: #e7f3f5;
  border: 1px solid #243743;
  border-radius: 14px;
  background: var(--brand-900);
}

.brand-logo-preview svg {
  width: 28px;
  height: 28px;
}

.brand-logo-preview.has-custom-logo {
  border-color: var(--border);
  background: var(--surface-secondary);
}

.brand-logo-preview .site-logo-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-setting-copy {
  min-width: 0;
  flex: 1;
}

.brand-setting-copy > strong {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 650;
}

.brand-setting-copy > p {
  margin: 5px 0 8px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.settings-status-badge,
.rate-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  color: var(--brand-deep);
  border-radius: var(--radius-pill);
  background: var(--brand-pale);
  font-size: 9px;
  font-weight: 600;
}

.brand-setting-action {
  flex: none;
}

.settings-source-note {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 13px 24px;
  color: var(--muted);
  border-bottom: 1px solid var(--border-subtle);
  background: #fbfcfd;
  font-size: 9px;
}

.settings-source-note .rate-source-link {
  display: inline;
  width: auto;
  margin: 0;
  font-size: inherit;
  font-weight: 600;
}

.settings-section .rate-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 18px 20px 20px;
}

.settings-section .rate-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 11px;
  min-height: 78px;
  padding: 13px 14px;
  border-radius: 11px;
  background: var(--surface);
  transform: none;
}

.settings-section .rate-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-xs);
  transform: none;
}

.settings-section .currency-flag {
  width: 36px;
  height: 36px;
}

.rate-card-copy {
  min-width: 0;
}

.rate-card-copy > div {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
}

.rate-card-copy .currency-code {
  flex: none;
  font-size: 13px;
}

.rate-card-copy span,
.rate-card-copy small {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rate-card-copy small {
  margin-top: 4px;
}

.settings-section .rate-value {
  margin: 0;
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
}

.rate-card-action {
  display: flex;
  justify-content: flex-end;
  min-width: 48px;
}

.rate-edit-button {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 32px;
  padding: 0 7px;
  color: var(--brand);
  border: 0;
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
  font-size: 9px;
  font-weight: 600;
}

.rate-edit-button:hover {
  background: var(--brand-pale);
}

.rate-edit-button svg {
  width: 13px;
  height: 13px;
}

.settings-section .archive-list {
  gap: 12px;
  margin: 0;
  padding: 18px 20px 20px;
}

.settings-section .archive-group {
  border-radius: 11px;
  box-shadow: none;
}

.backup-setting-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 24px 18px;
}

.backup-setting-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  color: var(--brand);
  border: 1px solid #b9dadd;
  border-radius: 11px;
  background: var(--brand-pale);
}

.backup-setting-icon .ui-icon {
  width: 20px;
  height: 20px;
}

.backup-setting-copy {
  min-width: 0;
  flex: 1;
}

.backup-setting-copy > strong {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 650;
}

.backup-setting-copy > p {
  margin: 5px 0 8px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.backup-setting-action {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
}

.backup-setting-action .ui-icon {
  width: 16px;
  height: 16px;
}

.backup-setting-note {
  margin: 0;
  padding: 12px 24px 16px;
  color: var(--muted-light);
  border-top: 1px solid var(--border-subtle);
  background: #fbfcfd;
  font-size: 9px;
  line-height: 1.5;
}

@media (max-width: 960px) {
  .settings-page-heading {
    align-items: flex-start;
  }

  .settings-shell {
    display: block;
  }

  .settings-nav {
    position: sticky;
    z-index: 5;
    top: 0;
    margin: -4px -4px 16px;
    padding: 4px;
    background: rgba(244, 247, 249, 0.94);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
  }

  .settings-nav-intro {
    display: none;
  }

  .settings-nav-list {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .settings-nav-group {
    display: flex;
    gap: 6px;
    flex: none;
  }

  .settings-nav-group-label {
    display: none;
  }

  .settings-nav-group-list {
    display: flex;
    gap: 6px;
  }

  .settings-nav-list::-webkit-scrollbar {
    display: none;
  }

  .settings-nav-item {
    width: auto;
    min-width: max-content;
    min-height: 44px;
    padding: 6px 11px 6px 7px;
  }

  .settings-nav-icon {
    width: 30px;
    height: 30px;
  }

  .settings-nav-item small {
    display: none;
  }

  .settings-section {
    scroll-margin-top: 66px;
  }
}

@media (max-width: 720px) {
  .settings-page-heading {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 16px;
  }

  .settings-page-heading > div {
    display: none;
  }

  .settings-page-heading {
    gap: 0;
  }

  .settings-page-heading h2 {
    font-size: 22px;
  }

  .settings-page-heading p {
    font-size: 11px;
  }

  .settings-mobile-note {
    display: block;
    margin-top: 7px;
    color: var(--muted-light);
    font-size: 10px;
    line-height: 1.45;
  }

  .settings-search {
    width: 100%;
    min-height: 44px;
  }

  /* Keep iOS Safari from zooming the page when the settings search receives focus. */
  .settings-search input {
    font-size: 16px;
    line-height: 1.35;
  }

  .settings-content {
    gap: 14px;
  }

  .settings-section-head,
  .settings-section-head-actions {
    align-items: stretch;
    flex-direction: column;
    gap: 16px;
    padding: 18px 16px 16px;
  }

  .settings-section-heading {
    gap: 11px;
  }

  .settings-section-icon {
    width: 40px;
    height: 40px;
  }

  .settings-section-heading h2 {
    font-size: 17px;
  }

  .settings-section-heading p {
    font-size: 11px;
  }

  .settings-section-head-actions .rate-intro-actions,
  .settings-section-head-actions > .button {
    width: 100%;
  }

  .settings-section-head-actions .rate-intro-actions .button {
    min-height: 44px;
    min-width: 0;
    flex: 1;
  }

  .brand-setting-row {
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 18px 16px;
  }

  .brand-setting-copy {
    min-width: calc(100% - 76px);
  }

  .brand-setting-copy > p {
    font-size: 11px;
  }

  .brand-setting-action {
    width: 100%;
    min-height: 44px;
  }

  .backup-setting-row {
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 18px 16px 16px;
  }

  .backup-setting-copy {
    min-width: calc(100% - 58px);
  }

  .backup-setting-copy > p {
    font-size: 11px;
  }

  .backup-setting-action {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  .backup-setting-note {
    padding: 12px 16px 14px;
    font-size: 10px;
  }

  .settings-source-note {
    padding: 12px 16px;
    font-size: 10px;
  }

  .settings-section .rate-grid {
    grid-template-columns: 1fr;
    gap: 9px;
    padding: 14px;
  }

  .settings-section .rate-card {
    grid-template-columns: 38px minmax(0, 1fr) auto;
    min-height: 76px;
    padding: 12px;
  }

  .settings-section .rate-value {
    display: none;
  }

  .rate-edit-button {
    min-width: 44px;
    min-height: 44px;
    justify-content: center;
  }

  .rate-edit-button span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .rate-edit-button svg {
    width: 17px;
    height: 17px;
  }

  .settings-section .archive-list {
    padding: 14px;
  }
}

/* Reusable institution image library */
.institution-icon-control {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface-secondary);
}

.institution-icon-control-preview {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  flex: none;
  overflow: hidden;
  color: var(--brand);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  background: var(--surface);
}

.institution-icon-control-preview .ui-icon {
  width: 28px;
  height: 28px;
}

.institution-icon-control-main {
  display: grid;
  flex: 1;
  gap: 9px;
  min-width: 0;
}

.institution-icon-control-main select {
  width: 100%;
}

.institution-icon-control-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}

.institution-icon-control-actions .button {
  min-height: 36px;
  padding: 0 12px;
  font-size: 11px;
}

.institution-icon-control-actions small {
  overflow: hidden;
  min-width: 0;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-library-toolbar,
.image-library-dialog-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface-secondary);
}

.image-library-toolbar strong,
.image-library-dialog-toolbar strong {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 650;
}

.image-library-toolbar p,
.image-library-dialog-toolbar p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.image-library-upload-button {
  position: relative;
  flex: none;
  overflow: hidden;
  cursor: pointer;
}

.image-library-upload-button input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.image-library-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 18px 20px 20px;
}

.image-asset-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 82px;
  padding: 10px;
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.image-asset-card-select {
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: border-color 150ms ease-out, background 150ms ease-out, transform 150ms ease-out;
}

.image-asset-card-select:hover,
.image-asset-card-select:focus-visible {
  border-color: #8fc8cf;
  background: var(--brand-pale);
  transform: translateY(-1px);
}

.image-asset-preview {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  border-radius: 11px;
  background: var(--surface-secondary);
}

.image-asset-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.image-asset-card-copy {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.image-asset-card-copy strong,
.image-asset-card-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-asset-card-copy strong {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 650;
}

.image-asset-card-copy small {
  color: var(--muted);
  font-size: 9px;
}

.image-asset-delete {
  align-self: center;
  padding: 5px 3px;
  color: var(--muted);
  border: 0;
  background: transparent;
  font-size: 10px;
  cursor: pointer;
}

.image-asset-delete:hover {
  color: var(--red);
}

.image-library-state {
  display: grid;
  grid-column: 1 / -1;
  place-items: center;
  gap: 7px;
  min-height: 170px;
  padding: 22px;
  color: var(--muted);
  text-align: center;
}

.image-library-state strong {
  color: var(--ink-soft);
  font-size: 13px;
}

.image-library-state p {
  margin: 0;
  font-size: 10px;
  line-height: 1.5;
}

.image-library-state-error strong {
  color: var(--red);
}

.image-library-note {
  margin: 0;
  padding: 0 24px 18px;
  color: var(--muted-light);
  font-size: 9px;
  line-height: 1.5;
}

dialog.image-library-dialog {
  width: min(760px, calc(100% - 48px));
  height: auto;
  max-height: min(760px, calc(100vh - 48px));
  margin: auto;
  border: 1px solid var(--border);
  border-radius: 20px;
  animation: dialog-pop 180ms ease-out;
}

@keyframes dialog-pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.image-library-dialog-inner {
  display: flex;
  flex-direction: column;
  max-height: min(760px, calc(100vh - 48px));
  padding: 28px;
}

.image-library-dialog .dialog-head {
  margin-bottom: 0;
}

.image-library-dialog-toolbar {
  margin: 0 -28px;
  padding: 17px 28px;
}

.image-library-picker-grid {
  min-height: 160px;
  max-height: 460px;
  overflow: auto;
  padding-right: 4px;
  padding-left: 4px;
}

.image-library-dialog-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 14px;
}

@media (max-width: 720px) {
  .institution-icon-control {
    align-items: flex-start;
  }

  .image-library-toolbar,
  .image-library-dialog-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .image-library-upload-button {
    width: 100%;
    justify-content: center;
  }

  .image-library-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 14px;
  }

  .image-asset-card {
    grid-template-columns: 48px minmax(0, 1fr);
    min-height: 72px;
  }

  .image-asset-preview {
    width: 48px;
    height: 48px;
  }

  .image-asset-delete {
    grid-column: 2;
    justify-self: start;
    padding: 0;
  }

  dialog.image-library-dialog {
    width: 100%;
    max-height: 92vh;
    margin: auto 0 0;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }

  .image-library-dialog-inner {
    max-height: 92vh;
    padding: 20px;
  }

  .image-library-dialog-toolbar {
    margin: 0 -20px;
    padding: 16px 20px;
  }

  .image-library-picker-grid {
    max-height: 52vh;
  }
}

/* Credit-card management list */
.credit-cards-page {
  padding-bottom: 28px;
}

/* Credit-card typography keeps the Chinese hierarchy calm while leaving
   amounts and dates crisp and easy to scan. */
body.credit-cards-route .topbar h1 {
  font-weight: 500;
  letter-spacing: -.025em;
}

#credit-card-alert:not(:empty) {
  margin-bottom: 12px;
}

.credit-card-control-bar {
  margin-bottom: 20px;
}

.credit-card-controls .search-box {
  width: 260px;
}

.credit-card-controls .select-wrap select {
  min-width: 170px;
}

#credit-card-list.credit-card-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.credit-card-issuer-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  font-family: var(--font-sans);
  font-weight: 400;
}

.credit-card-issuer-card.is-expanded {
  box-shadow: 0 8px 22px rgba(26, 48, 35, .07);
}

.credit-card-issuer-card .account-card-head {
  display: flex;
  align-items: stretch;
  padding: 0;
  border-bottom: 0;
}

.credit-card-issuer-card .institution-toggle {
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "logo heading summary";
  width: 100%;
  min-height: 112px;
  padding: 18px 10px 18px 20px;
  border-radius: 16px;
}

.credit-card-issuer-card .institution-toggle:hover,
.credit-card-issuer-card .institution-toggle:active {
  background: transparent;
}

.credit-card-group-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--brand);
  border: 1px solid #cfe2df;
  background: var(--brand-pale);
}

.credit-card-group-logo .ui-icon {
  width: 34px;
  height: 34px;
}

.credit-card-group-logo .credit-card-issuer-initial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--brand-deep);
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 650;
}

.credit-card-issuer-card .institution-heading h3 {
  font-weight: 600;
  letter-spacing: -.018em;
  line-height: 1.25;
}

.credit-card-group-summary {
  display: flex;
  align-items: center;
  min-width: 0;
  justify-content: flex-end;
  flex-direction: column;
  gap: 4px;
  text-align: right;
}

.credit-card-issuer-card .credit-card-group-summary > strong {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .01em;
  line-height: 1.2;
  white-space: nowrap;
}

.credit-card-group-networks {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
}

.credit-card-group-network-tag {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 0 6px;
  color: var(--muted);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: #f7faf9;
  font-size: 10px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

.credit-card-issuer-card .account-card-head .credit-card-group-settings {
  align-self: center;
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  margin: 0 14px 0 0;
  padding: 0;
  border-radius: 10px;
}

.credit-card-group-settings .ui-icon {
  width: 18px;
  height: 18px;
}

.credit-card-issuer-card .sub-list.credit-card-group-list {
  display: flex;
  flex-direction: column;
  padding: 8px 22px 16px;
  border-top: 1px solid var(--border-subtle);
}

/* Keep the native hidden state effective despite the flex layout above. */
.credit-card-issuer-card .sub-list.credit-card-group-list[hidden] {
  display: none;
}

.credit-card-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 22px;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 78px;
  padding: 14px 12px;
  color: var(--ink);
  border: 0;
  border-bottom: 1px solid var(--border-subtle);
  background: transparent;
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: background .18s ease, color .18s ease;
}

.credit-card-row:last-child {
  border-bottom: 0;
}

.credit-card-row:hover {
  background: #f8fbfa;
}

.credit-card-row:focus-visible {
  position: relative;
  z-index: 1;
  outline: 2px solid rgba(11, 127, 142, .32);
  outline-offset: -2px;
  border-radius: 10px;
}

.credit-card-row-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  color: var(--brand);
  border: 1px solid #d9e8e5;
  border-radius: 12px;
  background: #f2f8f6;
}

.credit-card-row-icon .ui-icon {
  width: 21px;
  height: 21px;
}

.credit-card-row-main {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.credit-card-row-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.credit-card-row-top > strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.credit-card-row-status {
  display: inline-flex;
  align-items: center;
}

.credit-card-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 0 8px;
  color: var(--brand);
  border: 1px solid #cfe2da;
  border-radius: 999px;
  background: #f1f8f3;
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

.credit-card-status.warning {
  color: #996315;
  border-color: #ead5ad;
  background: #fffaf0;
}

.credit-card-status.muted {
  color: var(--muted);
  border-color: var(--border);
  background: var(--surface-secondary);
}

.credit-card-row-amount {
  color: var(--brand);
  font-family: var(--font-sans);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}

.credit-card-row-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 13px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 400;
  line-height: 1.45;
}

.credit-card-row-meta > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.credit-card-row-reminders {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
  color: #996315;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  line-height: 1.35;
}

.credit-card-row-reminder {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  color: inherit;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
}

.credit-card-row-reminder + .credit-card-row-reminder::before {
  margin: 0 10px;
  color: currentColor;
  content: "·";
  opacity: .55;
}

.credit-card-row-reminder.expired {
  color: #ad5960;
}

.credit-card-row-arrow {
  color: var(--muted-light);
  font-size: 24px;
  font-weight: 300;
  line-height: 1;
  text-align: center;
  transition: color .18s ease, transform .18s ease;
}

.credit-card-row:hover .credit-card-row-arrow {
  color: var(--brand);
  transform: translateX(2px);
}

.credit-card-list-footer {
  margin-top: 14px;
}

.credit-card-list-state {
  display: grid;
  justify-items: center;
  gap: 9px;
  min-height: 230px;
  padding: 40px 24px;
  text-align: center;
}

.credit-card-list-state .empty-state-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: var(--brand);
  border: 1px solid #d8e8e4;
  border-radius: 13px;
  background: #f1f8f6;
}

.credit-card-list-state .empty-state-icon .ui-icon {
  width: 20px;
  height: 20px;
}

.credit-card-list-state strong {
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 650;
}

.credit-card-list-state p {
  max-width: 390px;
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.credit-card-list-state .button {
  min-height: 40px;
}

.credit-card-loading-state {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.credit-card-loading-state .loading-dots {
  margin-bottom: 2px;
}

.credit-card-loading-state .loading-dots i {
  background: var(--brand);
}

.credit-card-empty-state {
  border: 1px dashed var(--border-strong);
  border-radius: 16px;
  background: rgba(248, 252, 250, .75);
}

.credit-card-state-error {
  border: 1px solid #ead6d6;
  border-radius: 16px;
  background: #fffafa;
}

.credit-card-state-error .empty-state-icon {
  color: #b15d64;
  border-color: #efdada;
  background: #fff1f1;
}

.credit-card-state-error strong {
  color: #a64d56;
}

.credit-card-detail-dialog {
  width: min(560px, calc(100vw - 40px));
  max-width: 100%;
  height: auto;
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  margin: auto;
  inset: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #f7f9fa;
  box-shadow: 0 24px 70px rgba(19, 42, 47, .2);
  animation: dialog-pop 180ms ease-out;
}

.credit-card-detail-dialog::backdrop {
  background: rgba(23, 37, 40, .34);
  backdrop-filter: blur(2px);
}

.credit-card-detail-dialog-inner {
  max-height: inherit;
  overflow-y: auto;
}

.credit-card-detail-dialog .dialog-head {
  position: sticky;
  z-index: 2;
  top: 0;
  margin-bottom: 0;
  padding: 21px 24px 17px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, .96);
}

.credit-card-detail-dialog .dialog-heading h2 {
  margin-top: 0;
  font-size: 20px;
}

.credit-card-detail-identity {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  margin: 14px 16px 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 5px 18px rgba(18, 39, 49, .035);
}

.credit-card-detail-identity-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  color: var(--brand);
  border: 1px solid #d2e4e1;
  border-radius: 14px;
  background: var(--brand-pale);
}

.credit-card-detail-identity-mark .ui-icon {
  width: 28px;
  height: 28px;
}

.credit-card-detail-identity-mark .credit-card-issuer-initial {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 650;
}

.credit-card-detail-identity-copy {
  min-width: 0;
}

.credit-card-detail-identity-copy > span {
  color: var(--muted);
  font-size: 10px;
}

.credit-card-detail-identity-copy h3 {
  margin: 3px 0 4px;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.credit-card-detail-identity-copy p {
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.credit-card-detail-identity-status {
  align-self: start;
}

.credit-card-detail-section {
  margin: 10px 16px 0;
  padding: 14px 16px 15px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
}

.credit-card-detail-section h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  color: #30434c;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
}

.credit-card-detail-section h3::before {
  width: 3px;
  height: 13px;
  border-radius: 99px;
  background: var(--accent);
  content: "";
}

.credit-card-detail-empty-copy {
  margin: 0;
  color: var(--muted-light);
  font-size: 10px;
}

.credit-card-detail-section dl {
  display: grid;
  gap: 0;
  margin: 0;
}

.credit-card-detail-field {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  min-height: 40px;
  padding: 8px 0;
}

.credit-card-detail-field + .credit-card-detail-field {
  border-top: 1px solid rgba(224, 233, 230, .72);
}

.credit-card-detail-field dt {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.credit-card-detail-field dd {
  min-width: 0;
  margin: 0;
  color: var(--ink);
  font-size: 11px;
  font-weight: 550;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.credit-card-detail-value-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  min-width: 0;
}

.credit-card-detail-value {
  min-width: 0;
}

.credit-card-detail-inline-reminder {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  color: #916118;
  border: 1px solid #ead5ad;
  border-radius: 999px;
  background: #fffaf0;
  font-size: 9px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.credit-card-detail-inline-reminder.expired {
  color: #b74949;
  border-color: #efc7c7;
  background: #fff4f4;
}

.credit-card-detail-field dd small {
  display: block;
  margin-top: 3px;
  color: var(--muted-light);
  font-size: 9px;
  font-weight: 400;
  line-height: 1.4;
}

.credit-card-detail-actions {
  display: flex;
  gap: 8px;
  margin: 10px 16px 0;
  padding: 4px 0 12px;
}

.credit-card-detail-actions .button {
  min-height: 40px;
  flex: 1;
}

.credit-card-detail-safety {
  margin: 0;
  padding: 0 20px 20px;
  color: var(--muted-light);
  font-size: 9px;
  line-height: 1.5;
  text-align: center;
}

.credit-card-detail-empty {
  display: grid;
  justify-items: center;
  gap: 9px;
  min-height: 220px;
  padding: 38px 24px;
  text-align: center;
}

.credit-card-detail-empty strong {
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-size: 15px;
}

.credit-card-detail-empty p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

#form-fields:has(.form-section) {
  display: block;
}

.form-section + .form-section {
  margin-top: 23px;
  padding-top: 21px;
  border-top: 1px solid var(--border-subtle);
}

.form-section > h3 {
  margin: 0 0 13px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.form-section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}

.form-section-grid .field.full {
  grid-column: 1 / -1;
}

.field-help {
  margin-top: -2px;
  color: var(--muted-light);
  font-size: 9px;
  line-height: 1.4;
}

#form-fields .form-section-collapsible {
  margin-top: 23px;
  padding-top: 0;
  border-top: 1px solid var(--border-subtle);
}

#form-fields .form-section-collapsible > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 19px 0 14px;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  list-style: none;
}

#form-fields .form-section-collapsible > summary::-webkit-details-marker {
  display: none;
}

#form-fields .form-section-collapsible > summary::after {
  width: 8px;
  height: 8px;
  content: "";
  flex: none;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  opacity: .5;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 160ms ease-out;
}

#form-fields .form-section-collapsible[open] > summary::after {
  transform: rotate(225deg) translate(-1px, -1px);
}

#form-fields .form-section-collapsible > summary small {
  margin-left: auto;
  color: var(--muted-light);
  font-size: 9px;
  font-weight: 500;
}

#form-fields .form-section-collapsible > summary:focus-visible {
  outline: 2px solid rgba(73, 201, 209, .4);
  outline-offset: 3px;
  border-radius: 4px;
}

#form-fields .form-section-collapsible .form-section-grid {
  padding-bottom: 3px;
}

.credit-card-form-safety {
  margin: 22px 0 0;
  padding: 11px 13px;
  color: var(--muted);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--surface-secondary);
  font-size: 9px;
  line-height: 1.5;
}

.mobile-nav-center {
  position: relative;
  z-index: 1;
  min-height: 54px !important;
  margin-top: -8px;
  padding-top: 9px !important;
  color: var(--brand-deep) !important;
  border: 4px solid var(--background);
  border-radius: 50% !important;
  background: var(--brand-pale);
  box-shadow: 0 4px 12px rgba(25, 63, 41, .13);
}

.mobile-nav-center:not(.active) {
  color: #7f929a !important;
  border: 3px solid rgba(255, 255, 255, .82);
  background: rgba(255, 255, 255, .42);
  box-shadow: 0 2px 8px rgba(25, 63, 41, .06), inset 0 1px 0 rgba(255, 255, 255, .72);
}

.mobile-nav-center.active {
  color: var(--brand-deep) !important;
  border: 3px solid rgba(255, 255, 255, .92);
  background: #d8eff1;
  box-shadow: 0 5px 14px rgba(9, 90, 103, .12), inset 0 1px 0 rgba(255, 255, 255, .78);
}

@media (max-width: 720px) {
  .credit-cards-page {
    padding-bottom: 10px;
  }

  .credit-card-control-bar {
    margin-bottom: 14px;
  }

  .credit-card-controls .search-box {
    width: auto;
  }

  #credit-card-list.credit-card-list {
    gap: 10px;
  }

  .credit-card-issuer-card {
    border-radius: 14px;
  }

  .credit-card-issuer-card .institution-toggle {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "logo heading"
      "logo summary";
    gap: 4px 12px;
    min-height: 100px;
    padding: 14px 8px 14px 14px;
    border-radius: 14px;
  }

  .credit-card-issuer-card .institution-logo {
    width: 52px;
    height: 52px;
    border-radius: 15px;
  }

  .credit-card-group-logo .ui-icon {
    width: 30px;
    height: 30px;
  }

  .credit-card-group-logo .credit-card-issuer-initial {
    font-size: 22px;
  }

  .credit-card-issuer-card .account-card-head h3 {
    font-size: 17px;
  }

  .credit-card-group-summary {
    align-items: baseline;
    flex-direction: row;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 3px 7px;
    text-align: left;
  }

  .credit-card-issuer-card .credit-card-group-summary > strong {
    font-size: 11px;
  }

  .credit-card-group-networks {
    justify-content: flex-start;
  }

  .credit-card-group-network-tag {
    min-height: 17px;
    padding: 0 5px;
    font-size: 9px;
  }

  .credit-card-issuer-card .account-card-head .credit-card-group-settings {
    width: 38px;
    min-width: 38px;
    height: 38px;
    min-height: 38px;
    margin-right: 10px;
    border-radius: 11px;
  }

  .credit-card-issuer-card .sub-list.credit-card-group-list {
    padding: 6px 12px 12px;
  }

  .credit-card-row {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 12px;
    min-height: 72px;
    padding: 12px 10px;
  }

  .credit-card-row-icon {
    width: 40px;
    height: 40px;
    border-radius: 11px;
  }

  .credit-card-row-top {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 8px;
  }

  .credit-card-row-top > strong {
    flex: 1 1 100px;
    font-size: 15px;
  }

  .credit-card-row-status {
    flex: none;
  }

  .credit-card-status {
    min-height: 20px;
    padding: 0 7px;
    font-size: 10px;
  }

  .credit-card-row-amount {
    flex: none;
    font-size: 12px;
  }

  .credit-card-row-meta {
    gap: 3px 9px;
    font-size: 11px;
  }

  .credit-card-row-reminder {
    font-size: 11px;
  }

  .credit-card-row-reminder + .credit-card-row-reminder::before {
    margin: 0 8px;
  }

  .credit-card-row-arrow {
    display: none;
  }

  .credit-card-list-footer {
    margin-top: 10px;
  }

  .credit-card-list-state,
  .credit-card-loading-state,
  .credit-card-state-error,
  .credit-card-empty-state {
    min-height: 250px;
    border-radius: 14px;
    padding: 32px 18px;
  }

  .credit-card-detail-dialog {
    width: 100%;
    max-height: calc(100vh - 8px);
    margin: auto 0 0;
    inset: auto 0 0;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 18px 18px 0 0;
  }

  .credit-card-detail-dialog .dialog-grip {
    display: block;
  }

  .credit-card-detail-dialog .dialog-head {
    padding: 12px 16px 13px;
  }

  .credit-card-detail-dialog .dialog-heading h2 {
    font-size: 18px;
  }

  .credit-card-detail-identity {
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 11px;
    margin: 10px 12px 0;
    padding: 14px;
  }

  .credit-card-detail-identity-mark {
    width: 44px;
    height: 44px;
    border-radius: 13px;
  }

  .credit-card-detail-identity-copy h3 {
    font-size: 16px;
  }

  .credit-card-detail-section {
    margin: 8px 12px 0;
    padding: 13px 14px;
  }

  .credit-card-detail-field {
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 10px;
  }

  .credit-card-detail-actions {
    margin: 10px 12px 0;
    padding: 2px 0 14px;
  }

  .credit-card-detail-safety {
    padding: 0 16px max(17px, env(safe-area-inset-bottom));
  }

  #form-fields .form-section-collapsible {
    margin-top: 20px;
  }

  .form-section-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .form-section-grid .field.full {
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  #form-fields .form-section-collapsible > summary::after,
  .credit-card-row-arrow {
    transition: none;
  }
}
