/* GridAssets · Standalone Warm Paper Design Tokens & Base Primitives */
:root {
  --bg-main: #f7f5f0;
  --bg-card: #ffffff;
  --bg-card-elevated: #faf9f6;
  --bg-subcard: #fcfbf8;
  --bg-input: #ffffff;
  --border-subtle: #e7e2d8;
  --border-highlight: #cfc7b8;
  --text-primary: #2d3436;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --accent-emerald: #2f9e77;
  --accent-emerald-soft: rgba(47, 158, 119, 0.10);
  --accent-amber: #d98a1c;
  --accent-amber-soft: rgba(217, 138, 28, 0.10);
  --accent-indigo: #6c7ae0;
  --accent-indigo-soft: rgba(108, 122, 224, 0.10);
  --accent-rose: #e05d6f;
  --accent-rose-soft: rgba(224, 93, 111, 0.10);
  --radius-lg: 16px;
  --radius-md: 11px;
  --radius-sm: 6px;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100%;
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.48;
  overflow-x: hidden;
  overflow-y: auto;
}

body {
  background-image:
    radial-gradient(circle at 8% 0%, rgba(167, 216, 196, 0.30), transparent 35%),
    radial-gradient(circle at 92% 6%, rgba(196, 204, 245, 0.30), transparent 38%),
    radial-gradient(circle at 50% 100%, rgba(250, 221, 190, 0.25), transparent 45%);
  background-attachment: fixed;
}

.gridassets-shell {
  width: 100%;
  max-width: 1380px;
  margin: 0 auto;
  padding: 10px 12px 24px 12px;
}

body.mode-lifeos .gridassets-shell {
  max-width: 100%;
  padding: 0;
}

body.mode-lifeos .assets-panel {
  border: none;
  border-radius: 0;
  box-shadow: none;
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

button {
  font-family: var(--font-sans);
  cursor: pointer;
}

.btn-primary {
  background: var(--accent-emerald);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 7px 13px;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.btn-accent {
  background: var(--accent-indigo);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 0.81rem;
  font-weight: 600;
  white-space: nowrap;
}

.btn-outline {
  background: #ffffff;
  border: 1px solid #3b7dd8;
  color: #3b7dd8;
  padding: 6px 11px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
}

.btn-sm,
.btn-xs {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 0.72rem;
  white-space: nowrap;
}

.btn-xs {
  padding: 3px 8px;
  font-size: 0.68rem;
}

.btn-danger-outline {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #ef4444;
  padding: 6px 14px;
  border-radius: var(--radius-sm, 7px);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.btn-danger-outline:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: #ef4444;
  color: #dc2626;
}

.form-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 8px;
}

.save-hint {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* Modal Styles */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(30, 35, 45, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 440px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.18);
  animation: modal-pop 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-pop {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-card-elevated);
}

.modal-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 4px;
}

.modal-close-btn:hover {
  background: var(--border-subtle);
  color: var(--text-primary);
}

.modal-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.modal-field label {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.modal-field input[type="text"],
.modal-field input[type="number"],
.modal-field input[type="password"],
.modal-field textarea,
.modal-field select {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 0.85rem;
  color: var(--text-primary);
  font-family: var(--font-sans);
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.modal-field select {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-field input[type="text"],
.modal-field input[type="number"],
.modal-field input[type="password"],
.modal-field select {
  height: 38px;
}

.modal-field input:focus,
.modal-field textarea:focus,
.modal-field select:focus {
  outline: none;
  border-color: var(--accent-indigo);
  box-shadow: 0 0 0 2px var(--accent-indigo-soft);
}

.modal-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.modal-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

/* Standalone Toast */
.gridassets-toast-container {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.gridassets-toast {
  background: #1f2937;
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: 380px;
}

.gridassets-toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.gridassets-toast.warn {
  background: #b91c1c;
}

@media (max-width: 640px) {
  .modal-backdrop { padding: 8px; }
  .modal-card { max-width: calc(100vw - 16px) !important; width: 100% !important; }
  .modal-row-2, .modal-row-3, .form-row-3, .form-row-2 { grid-template-columns: 1fr !important; }
}

/* Brokerage Positions Drawer */
.positions-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(47, 158, 119, 0.30);
  background: rgba(47, 158, 119, 0.08);
  color: #1f6f54;
  font-size: 0.66rem;
  font-weight: 700;
  cursor: pointer;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.positions-toggle-btn:hover,
.positions-toggle-btn.expanded {
  background: rgba(47, 158, 119, 0.16);
  border-color: rgba(47, 158, 119, 0.5);
}
.pos-ticker-preview {
  color: var(--text-secondary);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
}
.positions-subrow td {
  padding: 0 !important;
  background: var(--bg-subcard) !important;
  border-bottom: 1px solid var(--border-subtle);
}
.positions-drawer {
  padding: 8px 12px 10px 22px;
  background: linear-gradient(180deg, rgba(47, 158, 119, 0.04), rgba(252, 251, 248, 0.9));
}
.positions-mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
}
.positions-mini-table th {
  text-align: left;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  padding: 3px 8px;
  border-bottom: 1px solid var(--border-subtle);
}
.positions-mini-table td {
  padding: 4px 8px !important;
  border-bottom: 1px dashed rgba(207, 199, 184, 0.5);
  background: transparent !important;
}
.positions-mini-table tr:last-child td {
  border-bottom: none;
}
.positions-mini-table .num-col {
  text-align: right;
}
.pos-sym {
  font-family: var(--font-mono);
  font-weight: 800;
  color: var(--text-primary);
}
.pos-desc {
  color: var(--text-secondary);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pos-gain { color: #1f7a56; font-weight: 700; }
.pos-loss { color: #c0392b; font-weight: 700; }
.pos-unval {
  font-size: 0.64rem;
  font-weight: 700;
  color: #b45309;
  background: rgba(217, 138, 28, 0.14);
  padding: 1px 5px;
  border-radius: 4px;
}


/* Life OS · Assets & Succession Module Styles
 * Matches Life OS warm paper design system, Pixel Fold unfolded & mobile responsive breakpoints
 */

.assets-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 9px 11px 16px 11px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 18px rgba(80, 70, 50, 0.05);
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

/* =========================================================================
   1. ULTRA-COMPACT SINGLE-ROW TOP BAR, PROFILE ICONS & COLLAPSED MENU
   ========================================================================= */
.assets-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
}

.assets-header-left-slot {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 1 auto;
  min-width: 0;
}

.assets-header-left-slot:empty {
  display: none;
}

/* Upper-Left Asset Owner/Trust Dropdown */
.assets-owner-menu-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.assets-owner-trigger {
  height: 32px;
  padding: 0 9px 0 9px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card-elevated);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  max-width: 100%;
  transition: all 0.15s ease;
}

.assets-owner-trigger:hover,
.assets-owner-menu-wrap.is-open .assets-owner-trigger {
  background: #ffffff;
  border-color: var(--accent-emerald);
  box-shadow: 0 2px 8px rgba(47, 158, 119, 0.16);
}

.assets-owner-trigger-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  font-size: 0.9rem;
  line-height: 1;
  flex-shrink: 0;
}

.assets-owner-trigger-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assets-owner-menu-wrap.is-open .assets-menu-caret {
  transform: rotate(180deg);
  color: var(--accent-emerald);
}

.assets-owner-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 150;
  min-width: 196px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 11px;
  box-shadow: 0 10px 30px rgba(28, 35, 45, 0.15);
  padding: 5px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.assets-owner-dropdown-menu.hidden {
  display: none !important;
}

.assets-owner-item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  font-size: 0.92rem;
  line-height: 1;
  flex-shrink: 0;
}

.assets-owner-item-icon svg,
.assets-owner-trigger-icon svg {
  width: 17px;
  height: 17px;
  display: block;
}

.assets-owner-dropdown-menu .assets-menu-item.active {
  background: var(--accent-emerald-soft);
  color: #1f6f54;
}

.assets-owner-dropdown-menu .assets-menu-item.active .assets-menu-check {
  color: var(--accent-emerald);
}

.assets-header-right-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}

/* Instant Compact Hover/Focus Hints for Profiles, Menu & Tabs */
.assets-hint-target {
  position: relative;
}

@media (hover: hover) {
  .assets-hint-target[data-hint]::after {
    content: attr(data-hint);
    position: absolute;
    top: calc(100% + 7px);
    left: 0;
    z-index: 180;
    width: max-content;
    max-width: 245px;
    padding: 5px 8px;
    border-radius: 7px;
    background: rgba(24, 32, 38, 0.95);
    color: #f8fafc;
    font-family: var(--font-sans);
    font-size: 0.69rem;
    font-weight: 500;
    line-height: 1.35;
    text-align: left;
    white-space: normal;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.22);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-2px);
    transition: opacity 0.14s ease 0.08s, transform 0.14s ease 0.08s, visibility 0.14s ease 0.08s;
  }

  .assets-hint-target.assets-hint-right[data-hint]::after {
    left: auto;
    right: 0;
  }

  .assets-hint-target.assets-hint-left[data-hint]::after {
    top: 50%;
    left: auto;
    right: calc(100% + 10px);
    transform: translateY(-50%) translateX(3px);
  }

  .assets-hint-target.assets-hint-right-side[data-hint]::after {
    top: 50%;
    left: calc(100% + 10px);
    right: auto;
    transform: translateY(-50%) translateX(-3px);
  }

  .assets-hint-target[data-hint]:hover::after,
  .assets-hint-target[data-hint]:focus-visible::after {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .assets-hint-target.assets-hint-left[data-hint]:hover::after,
  .assets-hint-target.assets-hint-left[data-hint]:focus-visible::after,
  .assets-hint-target.assets-hint-right-side[data-hint]:hover::after,
  .assets-hint-target.assets-hint-right-side[data-hint]:focus-visible::after {
    transform: translateY(-50%) translateX(0);
  }

  .assets-menu-wrap.is-open .assets-menu-trigger::after,
  .assets-owner-menu-wrap.is-open .assets-owner-trigger::after {
    opacity: 0 !important;
    visibility: hidden !important;
  }
}

/* Floating Rich Hover Hint Popover for Institutional / Non-Public Fund Codes (M219, 7741, etc.) */
.fund-hint-popover {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  width: max-content;
  max-width: min(380px, calc(100vw - 20px));
  padding: 9px 11px;
  border-radius: 9px;
  background: rgba(24, 32, 38, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.22);
  color: #f8fafc;
  font-family: var(--font-sans);
  font-size: 0.71rem;
  line-height: 1.38;
  text-align: left;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.30);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-2px);
  transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s ease;
}

.fund-hint-popover.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.fund-hint-grid {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 10px;
  align-items: baseline;
}

.fund-hint-grid dt {
  margin: 0;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #86efac;
  white-space: nowrap;
}

.fund-hint-grid dd {
  margin: 0;
  color: #f1f5f9;
  font-weight: 500;
}

.fund-hint-grid dd.fund-hint-name {
  font-weight: 700;
  color: #ffffff;
}

.fund-hint-grid dd.fund-hint-mono {
  font-family: var(--font-mono);
  font-weight: 700;
  color: #fde68a;
}

.comp-chip.has-fund-hint {
  border-style: dashed;
  border-color: rgba(47, 158, 119, 0.55);
  cursor: help;
}

.comp-chip.has-fund-hint:hover,
.comp-chip.has-fund-hint:focus-visible {
  background: #e9f6f0;
  border-color: #2f9e77;
  outline: none;
}

.pos-sym.has-fund-hint,
.pos-ticker-hint.has-fund-hint,
.sankey-comp-pill.has-fund-hint .sankey-comp-pill-name {
  text-decoration: underline dotted rgba(47, 158, 119, 0.78);
  text-underline-offset: 2px;
}

.pos-sym.has-fund-hint,
.pos-desc.has-fund-hint-desc {
  cursor: help;
}

.assets-role-switcher {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 2px 3px;
}

.role-switcher-pills {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 3px;
}

.role-pill-btn.role-icon-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 999px;
  border: 1.5px solid transparent;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.45;
  filter: saturate(0.6);
  transition: opacity 0.15s ease, transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
  flex-shrink: 0;
}

.role-pill-btn.role-icon-btn:hover {
  opacity: 0.92;
  filter: none;
  background: rgba(255, 255, 255, 0.85);
  transform: translateY(-1px);
}

.role-pill-btn.role-icon-btn.active {
  opacity: 1;
  filter: none;
  background: #ffffff;
  transform: scale(1.04);
}

.role-pill-btn.role-icon-btn.active[data-assets-role="me"] {
  border-color: var(--accent-emerald);
  box-shadow: 0 0 0 2px rgba(47, 158, 119, 0.2);
}

.role-pill-btn.role-icon-btn.active[data-assets-role="partner"] {
  border-color: var(--accent-indigo);
  box-shadow: 0 0 0 2px rgba(108, 122, 224, 0.22);
}

.role-pill-btn.role-icon-btn.active[data-assets-role="eldest"] {
  border-color: var(--accent-amber);
  box-shadow: 0 0 0 2px rgba(217, 138, 28, 0.24);
}

.role-pill-btn.role-icon-btn.active[data-assets-role="second"] {
  border-color: #0d9488;
  box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.22);
}

.role-avatar-svg {
  width: 24px;
  height: 24px;
  display: block;
  pointer-events: none;
}

/* Collapsed Views & Tools Dropdown Menu (Right of Profile Switcher) */
.assets-menu-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.assets-menu-trigger {
  height: 32px;
  padding: 0 8px 0 9px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card-elevated);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.15s ease;
}

.assets-menu-trigger:hover,
.assets-menu-wrap.is-open .assets-menu-trigger {
  background: #ffffff;
  border-color: var(--accent-indigo);
  box-shadow: 0 2px 8px rgba(108, 122, 224, 0.18);
}

.assets-menu-active-icon {
  font-size: 0.9rem;
  line-height: 1;
}

.assets-menu-caret {
  color: var(--text-secondary);
  transition: transform 0.15s ease;
}

.assets-menu-wrap.is-open .assets-menu-caret {
  transform: rotate(180deg);
  color: var(--accent-indigo);
}

.assets-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 150;
  min-width: 205px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 11px;
  box-shadow: 0 10px 30px rgba(28, 35, 45, 0.15);
  padding: 5px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.assets-dropdown-menu.hidden {
  display: none !important;
}

.assets-menu-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.assets-menu-section-label {
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 3px 8px 2px 8px;
}

.assets-menu-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 4px 4px;
}

.assets-menu-divider.hidden {
  display: none !important;
}

.assets-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.77rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease;
}

.assets-menu-item:hover {
  background: var(--bg-card-elevated);
  color: var(--text-primary);
}

.assets-menu-item.active {
  background: var(--accent-indigo-soft);
  color: #4338ca;
  font-weight: 700;
}

.assets-menu-item.hidden {
  display: none !important;
}

.assets-menu-item:disabled {
  opacity: 0.55;
  cursor: wait;
}

.assets-menu-check {
  margin-left: auto;
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--accent-indigo);
  opacity: 0;
}

.assets-menu-item.active .assets-menu-check {
  opacity: 1;
}

.btn-assets-emergency {
  background: linear-gradient(135deg, #fff5f5, #fef3c7);
  border: 1px solid rgba(224, 93, 111, 0.55) !important;
  color: #b91c1c !important;
  font-weight: 700 !important;
  padding: 4px 9px !important;
  border-radius: 8px !important;
  white-space: nowrap;
}

.btn-assets-emergency:hover {
  background: linear-gradient(135deg, #fee2e2, #fde68a);
  transform: translateY(-1px);
}

.btn-assets-exit-emergency {
  background: #fee2e2 !important;
  border: 1px solid #ef4444 !important;
  color: #991b1b !important;
  font-weight: 700 !important;
  padding: 4px 9px !important;
  border-radius: 8px !important;
  white-space: nowrap;
}

/* =========================================================================
   2. EMERGENCY MODE BANNER
   ========================================================================= */
.assets-emergency-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #fff5f5 0%, #fffbeb 100%);
  border: 1.5px solid #e05d6f;
  border-left: 5px solid #dc2626;
  box-shadow: 0 3px 12px rgba(220, 38, 38, 0.1);
}

.emergency-banner-content {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex: 1 1 300px;
}

.emergency-banner-icon {
  font-size: 1.35rem;
  line-height: 1.1;
}

.emergency-banner-content strong {
  display: block;
  font-size: 0.88rem;
  color: #991b1b;
}

.emergency-banner-content p {
  font-size: 0.76rem;
  color: #7f1d1d;
  margin-top: 2px;
}

.emergency-banner-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

/* (Section 3 sub-nav items now live inside .assets-dropdown-menu in Section 1) */

/* =========================================================================
   4. COMMON CARDS, SECTION HEADERS & CONTROLS
   ========================================================================= */
.assets-stage {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
}

.assets-section-card {
  background: var(--bg-subcard);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.assets-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}

.assets-section-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.assets-section-sub {
  font-size: 0.71rem;
  color: var(--text-secondary);
  margin-top: 1px;
}

/* Filter Toolbar (Overview) */
.assets-filter-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 9px;
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.assets-owner-pills {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.owner-filter-btn {
  padding: 3px 9px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: #ffffff;
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 600;
  transition: all 0.15s ease;
}

.owner-filter-btn:hover {
  border-color: var(--accent-emerald);
  color: var(--text-primary);
}

.owner-filter-btn.active {
  background: var(--accent-emerald);
  border-color: var(--accent-emerald);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(47, 158, 119, 0.25);
}

.assets-reserve-toggle-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-primary);
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
}

.assets-reserve-toggle-wrap.is-active {
  border-color: rgba(217, 138, 28, 0.55);
  background: rgba(217, 138, 28, 0.08);
  color: #9a5d09;
}

.assets-reserve-toggle-wrap input[type="checkbox"] {
  accent-color: var(--accent-amber);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

/* =========================================================================
   5. NET WORTH HERO + 4 BUCKET CARDS + SVG DONUT CHART (COMPACT)
   ========================================================================= */
.assets-overview-top-grid {
  display: grid;
  grid-template-columns: minmax(230px, 285px) 1fr;
  gap: 9px;
  align-items: stretch;
}

.assets-networth-hero {
  background: linear-gradient(145deg, #ffffff 0%, #f3faf6 60%, #eef2ff 100%);
  border: 1px solid rgba(47, 158, 119, 0.3);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
}

.nw-kicker {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #1f6f54;
}

.nw-big-figure {
  font-family: var(--font-mono);
  font-size: 1.52rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.nw-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 8px;
  padding-top: 6px;
  border-top: 1px dashed var(--border-highlight);
  font-size: 0.69rem;
}

.nw-meta-item span {
  display: block;
  color: var(--text-secondary);
  font-size: 0.65rem;
}

.nw-meta-item strong {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-primary);
}

.nw-reserve-note {
  font-size: 0.67rem;
  color: #9a5d09;
  background: rgba(217, 138, 28, 0.1);
  border-radius: 5px;
  padding: 3px 7px;
}

.assets-chart-and-buckets {
  display: grid;
  grid-template-columns: minmax(145px, 165px) 1fr;
  gap: 9px;
  background: var(--bg-subcard);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 9px 11px;
  align-items: center;
}

.assets-donut-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.assets-donut-svg {
  width: 132px;
  height: 132px;
  display: block;
}

.assets-buckets-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.bucket-kpi-card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-left: 3.5px solid var(--bucket-color, var(--accent-emerald));
  border-radius: 8px;
  padding: 7px 9px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bucket-kpi-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.bucket-kpi-pct {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--bg-card-elevated);
  color: var(--text-primary);
}

.bucket-kpi-val {
  font-family: var(--font-mono);
  font-size: 0.96rem;
  font-weight: 800;
  color: var(--text-primary);
}

.bucket-kpi-sub {
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* =========================================================================
   6. DAF & GST EXEMPTION TRACKER MODULE (COMPACT)
   ========================================================================= */
.assets-daf-gst-module {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Permanent High-Visibility GST No-Portability Warning Banner */
.gst-warning-banner {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 11px;
  border-radius: 9px;
  background: linear-gradient(135deg, #fff7ed 0%, #fff1f2 100%);
  border: 1px solid rgba(224, 93, 111, 0.5);
  border-left: 4px solid #dc2626;
}

.gst-warning-icon {
  font-size: 1.05rem;
  line-height: 1.1;
  flex-shrink: 0;
}

.gst-warning-zh {
  font-size: 0.77rem;
  font-weight: 700;
  color: #991b1b;
  line-height: 1.38;
}

.gst-warning-en {
  font-size: 0.68rem;
  color: #7c2d12;
  margin-top: 2px;
}

/* Dual-Spouse GST & Lifetime Exemption Grid */
.gst-spouses-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.gst-spouse-card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.gst-spouse-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.gst-spouse-title {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-primary);
}

.gst-cap-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent-indigo-soft);
  color: #4a57ba;
}

.gst-track {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.gst-track-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  font-size: 0.7rem;
}

.gst-track-name {
  font-weight: 700;
  color: var(--text-primary);
}

.gst-track-nums {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-secondary);
}

.gst-bar-bg {
  height: 7px;
  border-radius: 999px;
  background: #ece8df;
  overflow: hidden;
  position: relative;
}

.gst-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease;
  min-width: 4px;
}

.gst-bar-fill.track-lifetime {
  background: linear-gradient(90deg, #6c7ae0, #4f46e5);
}

.gst-bar-fill.track-gst {
  background: linear-gradient(90deg, #2f9e77, #0d9488);
}

.gst-track-remaining {
  font-size: 0.66rem;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
}

.gst-annual-note {
  font-size: 0.67rem;
  color: #1f5f4a;
  background: var(--accent-emerald-soft);
  border-radius: 6px;
  padding: 4px 8px;
}

/* DAF Accounts Cards */
.daf-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.daf-card {
  background: #ffffff;
  border: 1px solid rgba(47, 158, 119, 0.28);
  border-top: 3px solid var(--accent-emerald);
  border-radius: 9px;
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.daf-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}

.daf-card-name {
  font-size: 0.84rem;
  font-weight: 800;
  color: var(--text-primary);
}

.daf-card-sponsor {
  font-size: 0.69rem;
  color: var(--text-secondary);
}

.daf-card-balance {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 800;
  color: var(--accent-emerald);
  white-space: nowrap;
}

.daf-estate-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.66rem;
  font-weight: 700;
  color: #1f5f4a;
  background: #e9f6f0;
  border: 1px solid rgba(47, 158, 119, 0.3);
  border-radius: 5px;
  padding: 3px 7px;
}

.daf-meta-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.71rem;
  color: var(--text-primary);
}

.daf-meta-row {
  display: flex;
  gap: 5px;
  align-items: baseline;
}

.daf-meta-key {
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
  font-size: 0.68rem;
}

.daf-advisor-chips {
  display: inline-flex;
  gap: 4px;
  flex-wrap: wrap;
}

.advisor-chip {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent-amber-soft);
  color: #9a5d09;
  border: 1px solid rgba(217, 138, 28, 0.3);
}

/* =========================================================================
   7. COMPACT INTERACTIVE ASSET TABLE (SEPARATE ASSET/NOTES, 1/5 RETITLING, CLICKABLE ROWS)
   ========================================================================= */
.assets-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}

.assets-search-input {
  padding: 4px 9px;
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  font-size: 0.74rem;
  background: #ffffff;
  color: var(--text-primary);
  min-width: 190px;
  flex: 0 1 250px;
}

.assets-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  background: #ffffff;
}

.assets-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.71rem;
  line-height: 1.28;
  min-width: 640px;
}

.assets-master-table {
  table-layout: fixed;
  width: 100%;
  min-width: 840px;
}

.col-w-asset   { width: 13%; }
.col-w-inst    { width: 8%; }
.col-w-owner   { width: 6.5%; }
.col-w-tax     { width: 8.5%; }
.col-w-val     { width: 9%; }
.col-w-basis   { width: 10%; }
.col-w-ben     { width: 13.5%; }
.col-w-retitle { width: 5.5%; } /* Ultra-compact ~1/5 width column */
.col-w-vis     { width: 8.5%; }
.col-w-notes   { width: 17.5%; }

.assets-table th {
  text-align: left;
  padding: 6px 5px;
  background: var(--bg-card-elevated);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.63rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
  line-height: 1.18;
  word-wrap: break-word;
}

.assets-table td {
  padding: 5px 5px;
  border-bottom: 1px solid #f0ece3;
  vertical-align: top;
  color: var(--text-primary);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.assets-table tbody tr:hover {
  background: #faf8f3;
}

.assets-clickable-row {
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.assets-clickable-row:hover {
  background: rgba(47, 158, 119, 0.07) !important;
}

.assets-clickable-row:focus-visible {
  outline: 2px solid var(--accent-emerald);
  outline-offset: -2px;
  background: rgba(47, 158, 119, 0.09) !important;
}

.assets-table tr.is-reserve-excluded {
  opacity: 0.56;
  background: #faf6ed;
}

.asset-name-cell {
  font-weight: 700;
  font-size: 0.72rem;
  color: var(--text-primary);
  line-height: 1.24;
}

.asset-notes-cell {
  font-size: 0.67rem;
  color: var(--text-secondary);
  line-height: 1.28;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ben-line {
  font-size: 0.67rem;
  line-height: 1.24;
}

.ben-line.ben-sub {
  color: var(--text-secondary);
  margin-top: 1px;
}

.retitling-pill {
  display: inline-block;
  max-width: 100%;
  font-size: 0.59rem;
  font-weight: 700;
  line-height: 1.15;
  padding: 2px 4px;
  border-radius: 5px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card-elevated);
  color: var(--text-secondary);
  white-space: normal;
  word-break: break-word;
}

.vis-tags-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

.num-mono {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.71rem;
  white-space: nowrap;
}

.num-debt {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: #b91c1c;
  display: block;
  line-height: 1.22;
}

.num-basis {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-secondary);
  display: block;
  line-height: 1.22;
}

.asset-tag-pill {
  display: inline-block;
  font-size: 0.59rem;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 5px;
  line-height: 1.2;
  white-space: normal;
  word-break: break-word;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card-elevated);
  color: var(--text-secondary);
}

.asset-tag-pill.tag-second {
  background: rgba(13, 148, 136, 0.11);
  border-color: rgba(13, 148, 136, 0.35);
  color: #0f766e;
}

.asset-tag-pill.tag-eldest {
  background: var(--accent-amber-soft);
  border-color: rgba(217, 138, 28, 0.35);
  color: #9a5d09;
}

.asset-tag-pill.tag-reserve {
  background: rgba(224, 93, 111, 0.11);
  border-color: rgba(224, 93, 111, 0.35);
  color: #be123c;
}

.owner-badge {
  display: inline-block;
  font-size: 0.64rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--accent-indigo-soft);
  color: #4a57ba;
  white-space: nowrap;
}

.owner-badge.owner-me { background: var(--accent-emerald-soft); color: #1f6f54; }
.owner-badge.owner-partner { background: var(--accent-indigo-soft); color: #4a57ba; }
.owner-badge.owner-joint { background: rgba(59, 130, 246, 0.11); color: #1d4ed8; }
.owner-badge.owner-living-trust { background: rgba(124, 58, 237, 0.11); color: #6d28d9; }
.owner-badge.owner-gst { background: rgba(224, 93, 111, 0.12); color: #be123c; }
.owner-badge.owner-eldest { background: var(--accent-amber-soft); color: #9a5d09; }
.owner-badge.owner-second { background: rgba(13, 148, 136, 0.12); color: #0f766e; }
.owner-badge.owner-custom { background: rgba(217, 119, 6, 0.13); color: #92400e; }

/* =========================================================================
   8. RESTRICTED ROLE VIEWS (ELDEST NORMAL & SECOND NORMAL / EMERGENCY)
   ========================================================================= */
.role-welcome-hero {
  background: linear-gradient(135deg, #ffffff 0%, #f3faf6 60%, #fffbeb 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.role-welcome-hero h3 {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 4px 0;
}

.role-welcome-hero p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  max-width: 680px;
}

.successor-roles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.successor-role-card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-top: 3px solid var(--accent-amber);
  border-radius: 10px;
  padding: 12px 13px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.successor-role-card-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 800;
  font-size: 0.86rem;
  color: var(--text-primary);
}

.successor-role-scope {
  font-size: 0.7rem;
  font-weight: 700;
  color: #9a5d09;
  background: var(--accent-amber-soft);
  padding: 2px 7px;
  border-radius: 5px;
  align-self: flex-start;
}

.successor-role-card p {
  font-size: 0.76rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.eldest-notes-textarea {
  width: 100%;
  min-height: 110px;
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  padding: 10px 12px;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-primary);
  background: #ffffff;
  resize: vertical;
}

/* =========================================================================
   9. PAGE 2: LIFECYCLE & TAX ROADMAP (TIMELINE + KANBAN)
   ========================================================================= */
.roadmap-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.roadmap-view-toggle {
  display: inline-flex;
  gap: 3px;
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 3px;
}

.roadmap-view-btn {
  padding: 4px 10px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 700;
}

.roadmap-view-btn.active {
  background: #ffffff;
  color: var(--text-primary);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.roadmap-kanban-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 11px;
  align-items: start;
}

.roadmap-timeline-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.roadmap-phase-col {
  background: var(--bg-subcard);
  border: 1px solid var(--border-subtle);
  border-top: 4px solid var(--phase-color, var(--accent-emerald));
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.phase-head {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.phase-badge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.phase-timeframe {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--phase-color, var(--accent-emerald));
  background: rgba(0, 0, 0, 0.04);
  padding: 2px 7px;
  border-radius: 999px;
}

.phase-progress-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-secondary);
  font-weight: 700;
}

.phase-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 2px 0 0 0;
}

.phase-subtitle {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.phase-progress-bar {
  height: 5px;
  background: #e9e4da;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 4px;
}

.phase-progress-fill {
  height: 100%;
  background: var(--phase-color, var(--accent-emerald));
  border-radius: 999px;
  transition: width 0.25s ease;
}

.roadmap-milestones-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.roadmap-timeline-stack .roadmap-milestones-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 9px;
}

.milestone-card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  padding: 10px 11px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.15s ease;
}

.milestone-card:hover {
  border-color: var(--border-highlight);
}

.milestone-card.is-completed {
  background: #f5fbf8;
  border-color: rgba(47, 158, 119, 0.35);
}

.milestone-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.milestone-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.35;
}

.milestone-card.is-completed .milestone-title {
  text-decoration: line-through;
  color: var(--text-secondary);
}

.ms-status-btn {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card-elevated);
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.ms-status-btn.status-in_progress {
  background: var(--accent-amber-soft);
  border-color: rgba(217, 138, 28, 0.4);
  color: #9a5d09;
}

.ms-status-btn.status-completed {
  background: var(--accent-emerald-soft);
  border-color: rgba(47, 158, 119, 0.4);
  color: #1f6f54;
}

.milestone-notes {
  font-size: 0.73rem;
  color: var(--text-secondary);
  line-height: 1.42;
}

.milestone-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 5px;
  padding-top: 4px;
  border-top: 1px dashed #efebe2;
}

.ms-tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.ms-tag {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--bg-card-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.ms-tag.tag-gst { background: #fff1f2; color: #be123c; border-color: rgba(224, 93, 111, 0.35); }
.ms-tag.tag-daf { background: #ecfdf5; color: #047857; border-color: rgba(47, 158, 119, 0.35); }
.ms-tag.tag-critical { background: #fef3c7; color: #92400e; border-color: rgba(217, 138, 28, 0.4); }

/* =========================================================================
   10. PAGES 3 & 4: DPOA & AFTER-LIFE SCENARIO PLAYBOOKS
   ========================================================================= */
.scenario-selector-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.scenario-pills {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.scenario-pill-btn {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: #ffffff;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
  transition: all 0.15s ease;
}

.scenario-pill-btn:hover {
  border-color: var(--accent-indigo);
  color: var(--text-primary);
}

.scenario-pill-btn.active {
  background: var(--accent-indigo);
  border-color: var(--accent-indigo);
  color: #ffffff;
  box-shadow: 0 2px 7px rgba(108, 122, 224, 0.28);
}

.readonly-lock-pill {
  font-size: 0.71rem;
  font-weight: 700;
  color: #4a57ba;
  background: var(--accent-indigo-soft);
  border: 1px solid rgba(108, 122, 224, 0.3);
  padding: 3px 9px;
  border-radius: 999px;
}

/* Contacts & Doc Locations */
.authority-locations-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.authority-loc-box {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  padding: 10px 12px;
}

.authority-loc-label {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--accent-indigo);
  margin-bottom: 4px;
}

.authority-loc-text {
  font-size: 0.78rem;
  color: var(--text-primary);
  line-height: 1.45;
}

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

.contact-card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.contact-role {
  font-size: 0.69rem;
  font-weight: 800;
  color: var(--accent-emerald);
  text-transform: uppercase;
}

.contact-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
}

.contact-line {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.contact-note {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* POA Matrix status badges */
.poa-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.poa-status-badge.status-verified {
  background: var(--accent-emerald-soft);
  color: #1f6f54;
  border: 1px solid rgba(47, 158, 119, 0.35);
}

.poa-status-badge.status-pending {
  background: var(--accent-amber-soft);
  color: #9a5d09;
  border: 1px solid rgba(217, 138, 28, 0.35);
}

.poa-status-badge.status-not_started {
  background: rgba(224, 93, 111, 0.1);
  color: #be123c;
  border: 1px solid rgba(224, 93, 111, 0.35);
}

/* Cashflow Waterfall */
.waterfall-steps-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.waterfall-step-card {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  padding: 10px 12px;
}

.waterfall-step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-emerald);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.waterfall-step-title {
  font-size: 0.84rem;
  font-weight: 800;
  color: var(--text-primary);
}

.waterfall-step-desc {
  font-size: 0.77rem;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1.45;
}

.budget-callout-box {
  background: linear-gradient(135deg, #fffbeb, #f3faf6);
  border: 1px solid rgba(217, 138, 28, 0.35);
  border-radius: 10px;
  padding: 11px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.budget-callout-amount {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 800;
  color: #9a5d09;
}

/* After-Life: 30-Day Checklist */
.checklist-items-stack {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.checklist-item-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 11px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
}

.checklist-item-row.is-done {
  background: #f5fbf8;
  border-color: rgba(47, 158, 119, 0.32);
}

.checklist-item-row input[type="checkbox"] {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  accent-color: var(--accent-emerald);
  cursor: pointer;
}

.checklist-item-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
}

.checklist-item-row.is-done .checklist-item-title {
  text-decoration: line-through;
  color: var(--text-secondary);
}

.checklist-item-detail {
  font-size: 0.74rem;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1.42;
}

/* 9-Month GST Post-Death Alert Card */
.gst-9month-card {
  background: linear-gradient(135deg, #fff5f5 0%, #fffbeb 100%);
  border: 1.5px solid #e05d6f;
  border-left: 5px solid #dc2626;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gst-9month-title {
  font-size: 0.94rem;
  font-weight: 800;
  color: #991b1b;
  margin: 0;
}

.gst-9month-body {
  font-size: 0.8rem;
  color: #7f1d1d;
  white-space: pre-line;
  line-height: 1.55;
}

/* DAF Handover Charter Card (Scenario 3 Both Parents) */
.daf-charter-card {
  background: linear-gradient(135deg, #f3faf6 0%, #ffffff 55%, #eef2ff 100%);
  border: 1.5px solid rgba(47, 158, 119, 0.4);
  border-left: 5px solid var(--accent-emerald);
  border-radius: var(--radius-md);
  padding: 15px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.daf-charter-block {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  padding: 11px 13px;
}

.daf-charter-block h4 {
  font-size: 0.8rem;
  font-weight: 800;
  color: #1f6f54;
  margin: 0 0 5px 0;
}

.daf-charter-block p {
  font-size: 0.77rem;
  color: var(--text-primary);
  white-space: pre-line;
  line-height: 1.5;
}

/* Directives & Digital Legacy */
.directives-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.directive-box {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  padding: 11px 13px;
}

.directive-box h4 {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 6px 0;
}

.directive-box p {
  font-size: 0.76rem;
  color: var(--text-secondary);
  white-space: pre-line;
  line-height: 1.5;
}

.digital-security-banner {
  font-size: 0.75rem;
  font-weight: 700;
  color: #4a57ba;
  background: var(--accent-indigo-soft);
  border: 1px solid rgba(108, 122, 224, 0.35);
  border-radius: 8px;
  padding: 8px 11px;
}

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

/* Personal Letters (Warm Stationery Style) */
.letters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 11px;
}

.letter-card {
  background: linear-gradient(180deg, #fffdf9 0%, #fcf8f0 100%);
  border: 1px solid #e4dccb;
  border-top: 3px solid #d98a1c;
  border-radius: 11px;
  padding: 13px 15px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  box-shadow: 0 2px 8px rgba(120, 90, 40, 0.04);
}

.letter-recipient {
  font-size: 0.82rem;
  font-weight: 800;
  color: #9a5d09;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.letter-body {
  font-size: 0.8rem;
  color: var(--text-primary);
  line-height: 1.6;
  white-space: pre-line;
}

.memorial-wishes-box {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  padding: 11px 13px;
  font-size: 0.79rem;
  color: var(--text-primary);
  line-height: 1.55;
}

/* =========================================================================
   11. MODALS HELPERS
   ========================================================================= */
.assets-modal-sm { max-width: 440px !important; width: 94%; }
.assets-modal-md { max-width: 580px !important; width: 94%; }
.assets-modal-lg { max-width: 670px !important; width: 95%; }

.assets-modal-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 14px !important;
}

.assets-modal-header-top h3 {
  font-size: 0.92rem;
  margin: 0;
}

.assets-modal-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.assets-modal-header-actions .btn-xs {
  padding: 4px 9px;
  font-size: 0.72rem;
  font-weight: 700;
}

.assets-modal-body-compact {
  padding: 10px 14px 14px 14px !important;
  gap: 7px !important;
}

.assets-modal-body-compact .modal-field {
  margin-bottom: 0;
}

.assets-modal-body-compact .modal-field label {
  font-size: 0.71rem;
  margin-bottom: 2px;
}

.assets-modal-body-compact input,
.assets-modal-body-compact select,
.assets-modal-body-compact textarea {
  padding: 5px 8px;
  font-size: 0.78rem;
}

.assets-pin-warning-box {
  background: #fffbeb;
  border: 1px solid rgba(217, 138, 28, 0.4);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.78rem;
  color: #78350f;
  line-height: 1.48;
  margin-bottom: 10px;
}

.assets-checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.77rem;
  color: var(--text-primary);
  cursor: pointer;
  margin: 6px 0 8px 0;
}

.assets-checkbox-row input[type="checkbox"] {
  margin-top: 2px;
  accent-color: var(--accent-emerald);
}

.assets-pin-error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #f87171;
  border-radius: 7px;
  padding: 7px 10px;
  font-size: 0.77rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.assets-inline-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.assets-check-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 5px 9px;
  border-radius: 7px;
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
}

.assets-check-chip-amber {
  background: rgba(217, 138, 28, 0.09);
  border-color: rgba(217, 138, 28, 0.35);
  color: #9a5d09;
}

.assets-gst-modal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.assets-gst-modal-col {
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  padding: 10px 12px;
}

.assets-gst-modal-col h4 {
  font-size: 0.84rem;
  margin: 0 0 8px 0;
  color: var(--text-primary);
}

.assets-backups-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 170px;
  overflow-y: auto;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 8px;
  background: var(--bg-card-elevated);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

/* =========================================================================
   12. RESPONSIVE BREAKPOINTS (LAPTOP, PIXEL FOLD UNFOLDED 884px & MOBILE <=640px)
   ========================================================================= */
@media (max-width: 1180px) {
  .roadmap-kanban-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .assets-overview-top-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 880px) {
  .assets-chart-and-buckets {
    grid-template-columns: 1fr;
  }
  .gst-spouses-grid,
  .daf-cards-grid,
  .authority-locations-grid,
  .directives-grid,
  .daf-charter-grid,
  .digital-pointers-grid,
  .assets-gst-modal-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .assets-panel {
    padding: 8px 9px 16px 9px;
  }
  .assets-header-bar {
    flex-wrap: nowrap;
    gap: 5px;
  }
  .assets-header-left-slot {
    flex: 0 1 auto;
    min-width: 0;
  }
  .assets-owner-trigger {
    height: 30px;
    padding: 0 7px 0 8px;
    gap: 4px;
    font-size: 0.74rem;
    max-width: 132px;
  }
  .assets-header-right-controls {
    gap: 4px;
  }
  .assets-header-right-controls .btn-assets-emergency,
  .assets-header-right-controls .btn-assets-exit-emergency {
    padding: 3px 7px !important;
    font-size: 0.68rem !important;
  }
  .assets-role-switcher {
    width: auto;
    padding: 2px;
  }
  .role-switcher-pills {
    gap: 2px;
  }
  .role-pill-btn.role-icon-btn {
    width: 26px;
    height: 26px;
  }
  .role-avatar-svg {
    width: 22px;
    height: 22px;
  }
  .assets-menu-trigger {
    height: 30px;
    padding: 0 7px 0 8px;
  }
  .assets-hint-target[data-hint]::after {
    max-width: 195px;
  }
  .assets-buckets-grid,
  .roadmap-kanban-grid {
    grid-template-columns: 1fr;
  }
  .nw-big-figure {
    font-size: 1.42rem;
  }
}

@media print {
  .left-sidebar,
  .assets-header-right-controls,
  .assets-role-switcher,
  .assets-menu-wrap,
  .scenario-selector-bar,
  .chat-fab,
  .ai-chat-drawer {
    display: none !important;
  }
  .assets-panel {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
}

/* =========================================================================
   13. COMPACT NET WORTH STRIP, WEALTH FLOW SANKEY & LINKED ASSETS UI
   ========================================================================= */
.assets-nw-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 16px;
  padding: 7px 13px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #ffffff 0%, #f3faf6 62%, #eef2ff 100%);
  border: 1px solid rgba(47, 158, 119, 0.30);
}

.assets-nw-strip .nw-big-figure {
  font-size: 1.38rem;
}

.nw-strip-primary {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nw-strip-kpis {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 18px;
}

.nw-strip-kpi {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nw-strip-kpi span {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
}

.nw-strip-kpi strong {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  font-weight: 800;
  color: var(--text-primary);
}

.nw-improv-note {
  font-style: normal;
  font-size: 0.69rem;
  font-weight: 700;
  color: #0f766e;
}

/* Sankey Card */
.sankey-card {
  padding: 8px 11px;
  gap: 5px;
}

.sankey-comp-strip {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border-subtle);
}

.sankey-comp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}

.sankey-comp-title {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-primary);
}

.sankey-comp-sub {
  font-weight: 500;
  font-size: 0.67rem;
  color: var(--text-secondary);
}

.sankey-seg-toggle {
  display: inline-flex;
  background: var(--bg-main);
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  padding: 2px;
  gap: 2px;
}

.sankey-seg-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.67rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
  transition: all 0.14s ease;
}

.sankey-seg-btn.active {
  background: var(--accent-emerald);
  color: #ffffff;
}

.sankey-comp-bar {
  width: 100%;
  height: 9px;
  border-radius: 999px;
  overflow: hidden;
  display: flex;
  gap: 1.5px;
  background: #ece8df;
}

.sankey-comp-slice {
  height: 100%;
  cursor: pointer;
  transition: opacity 0.14s ease, filter 0.14s ease;
}

.sankey-comp-slice:hover {
  opacity: 0.82;
}

.sankey-comp-slice.is-pinned {
  filter: brightness(1.06);
  box-shadow: inset 0 0 0 1.5px #1f2937;
}

.sankey-comp-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 5px;
  align-items: center;
}

.sankey-comp-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 3px;
  border-radius: 5px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 0.64rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.12s ease;
}

.sankey-comp-pill:hover {
  background: var(--bg-card-elevated);
  border-color: var(--border-subtle);
}

.sankey-comp-pill.is-pinned {
  background: var(--accent-emerald-soft);
  border-color: var(--accent-emerald);
}

.sankey-comp-pill i {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  flex-shrink: 0;
}

.sankey-comp-pill-name {
  font-weight: 700;
}

.sankey-comp-pill-val {
  font-family: var(--font-mono);
  color: var(--text-secondary);
  font-size: 0.61rem;
}

/* Sankey Lens & Column Controls */
.sankey-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 8px;
}

.sankey-lens-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.sankey-lens-btn {
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: #ffffff;
  color: var(--text-secondary);
  font-size: 0.68rem;
  font-weight: 700;
  transition: all 0.14s ease;
}

.sankey-lens-btn:hover {
  border-color: var(--accent-emerald);
  color: var(--text-primary);
}

.sankey-lens-btn.active {
  background: var(--accent-emerald);
  border-color: var(--accent-emerald);
  color: #ffffff;
}

.sankey-opt-checks {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.sankey-opt-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.sankey-opt-check input {
  accent-color: var(--accent-emerald);
  cursor: pointer;
}

.sankey-cols-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
  padding-top: 2px;
}

.sankey-cols-label {
  font-size: 0.64rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-right: 2px;
}

.sankey-col-pill {
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: #ffffff;
  color: var(--text-muted);
  font-size: 0.66rem;
  font-weight: 600;
  transition: all 0.12s ease;
}

.sankey-col-pill:hover:not(:disabled) {
  border-color: var(--accent-emerald);
  color: var(--text-primary);
}

.sankey-col-pill.active {
  background: var(--accent-emerald-soft);
  border-color: rgba(47, 158, 119, 0.45);
  color: #1f6f54;
  font-weight: 700;
}

.sankey-col-pill:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Pinned Multi-Select Bar */
.sankey-pinned-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 9px;
  border-radius: 8px;
  background: #f3faf6;
  border: 1px solid rgba(47, 158, 119, 0.42);
}

.sankey-pinned-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.sankey-pinned-kicker {
  font-size: 0.7rem;
  font-weight: 800;
  color: #1f6f54;
  margin-right: 2px;
}

.sankey-pin-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  border: none;
  background: var(--accent-emerald);
  color: #ffffff;
  font-size: 0.69rem;
  font-weight: 700;
}

.sankey-pin-chip:hover {
  opacity: 0.88;
}

.sankey-pin-x {
  opacity: 0.8;
  font-size: 0.64rem;
}

.sankey-clear-btn {
  border-color: rgba(220, 38, 38, 0.35) !important;
  color: #b91c1c !important;
  font-weight: 700;
}

/* SVG Stage */
.sankey-svg-scroll {
  width: 100%;
  overflow-x: auto;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  padding: 4px 4px;
}

.sankey-svg {
  display: block;
  max-width: none;
}

.sankey-ribbon {
  cursor: pointer;
  transition: fill-opacity 0.14s ease, stroke-opacity 0.14s ease, stroke-width 0.14s ease;
}

.sankey-node {
  cursor: pointer;
  transition: opacity 0.14s ease;
}

.sankey-collateral-arc {
  transition: stroke-opacity 0.14s ease, stroke-width 0.14s ease;
}

/* Inspector Strip */
.sankey-inspector {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding-top: 4px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.69rem;
}

.sankey-inspector-hint {
  color: var(--text-secondary);
}

.sankey-inspector-hint kbd {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  padding: 1px 4px;
  border-radius: 4px;
  border: 1px solid var(--border-highlight);
  background: var(--bg-card-elevated);
  color: var(--text-primary);
}

.sankey-legend-mini {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.68rem;
}

.sankey-legend-mini span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.sankey-legend-mini i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.sankey-inspector-metrics {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
}

.sankey-inspector-title {
  color: var(--text-primary);
}

.sankey-metric {
  font-family: var(--font-mono);
  font-size: 0.71rem;
  color: var(--text-secondary);
}

.sankey-metric strong {
  color: var(--text-primary);
}

.sankey-metric-teal strong { color: #0f766e; }
.sankey-metric-olive strong { color: #4d7c0f; }
.sankey-metric-amber strong { color: #b45309; }
.sankey-metric-rose strong { color: #b91c1c; }
.sankey-metric-net {
  padding: 1px 7px;
  border-radius: 6px;
  background: #e9f6f0;
  border: 1px solid rgba(47, 158, 119, 0.35);
}
.sankey-metric-net strong { color: #1f6f54; }

/* Pixel Fold Unfolded (<=960px, e.g. 884px inner screen): keep 5-6 Sankey cols & NW strip on 1 screen */
@media (max-width: 960px) {
  .gridassets-shell {
    padding: 6px 6px 14px 6px;
  }
  .assets-panel {
    gap: 5px;
    padding: 6px 7px 12px 7px;
  }
  .assets-nw-strip {
    padding: 5px 10px;
    gap: 4px 10px;
    flex-wrap: nowrap;
  }
  .assets-nw-strip .nw-kicker {
    font-size: 0.6rem;
  }
  .assets-nw-strip .nw-big-figure {
    font-size: 1.14rem;
  }
  .nw-strip-kpis {
    gap: 4px 10px;
    flex-wrap: nowrap;
  }
  .nw-strip-kpi span {
    font-size: 0.57rem;
  }
  .nw-strip-kpi strong {
    font-size: 0.74rem;
  }
  .nw-improv-note {
    font-size: 0.6rem;
  }
  .overview-chart-tabs {
    padding: 2px;
  }
  .overview-chart-tab {
    padding: 3px 10px;
    font-size: 0.72rem;
  }
  .sankey-card {
    padding: 6px 7px;
    gap: 4px;
  }
  .sankey-comp-strip {
    gap: 3px;
    padding-bottom: 4px;
  }
  .sankey-comp-bar {
    height: 8px;
  }
  .sankey-comp-legend {
    gap: 1.5px 4px;
  }
  .sankey-comp-pill {
    padding: 0.5px 2.5px;
    font-size: 0.6rem;
    gap: 3px;
  }
  .sankey-comp-pill i {
    width: 6px;
    height: 6px;
  }
  .sankey-comp-pill-val {
    font-size: 0.58rem;
  }
  .sankey-toolbar {
    gap: 3px 6px;
  }
  .sankey-lens-btn {
    padding: 2.5px 7px;
    font-size: 0.65rem;
  }
  .sankey-opt-checks {
    gap: 6px;
  }
  .sankey-opt-check {
    font-size: 0.64rem;
    gap: 3px;
  }
  .sankey-cols-bar {
    gap: 2.5px;
    padding-top: 1px;
  }
  .sankey-cols-label {
    font-size: 0.59rem;
  }
  .sankey-col-pill {
    padding: 1.5px 5px;
    font-size: 0.61rem;
  }
  .sankey-svg-scroll {
    padding: 3px 3px;
    -webkit-overflow-scrolling: touch;
  }
  .sankey-inspector {
    padding-top: 3px;
    gap: 3px 8px;
    font-size: 0.64rem;
  }
  .sankey-legend-mini {
    gap: 6px;
    font-size: 0.62rem;
  }
}

/* Pixel Fold Folded / Narrow Mobile (<=640px, e.g. 412px cover screen):
   Single-row horizontal swipe strips for legend, presets & columns so the Sankey height fits 1 screen vertically */
@media (max-width: 640px) {
  .assets-nw-strip {
    flex-wrap: wrap;
    padding: 6px 9px;
    gap: 4px 10px;
  }
  .nw-strip-kpis {
    flex-wrap: wrap;
    gap: 4px 12px;
  }
  .sankey-comp-sub {
    display: none;
  }
  .sankey-comp-legend,
  .sankey-cols-bar,
  .sankey-lens-group {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  .sankey-comp-legend::-webkit-scrollbar,
  .sankey-cols-bar::-webkit-scrollbar,
  .sankey-lens-group::-webkit-scrollbar {
    display: none;
  }
  .sankey-comp-pill,
  .sankey-col-pill,
  .sankey-cols-label,
  .sankey-lens-btn {
    flex-shrink: 0;
  }
  .sankey-inspector-hint {
    display: none;
  }
}

/* Master Table Column Widths & Linked Child Rows */
.col-w-accttype { width: 9%; }
.col-w-comp     { width: 12%; }

.asset-name-row {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.assets-linked-child-row {
  background: #fdf9f9;
}

.assets-linked-child-row .col-asset-name {
  padding-left: 14px;
}

.linked-tree-glyph {
  color: var(--text-muted);
  font-size: 0.68rem;
  white-space: nowrap;
}

.is-debt-name {
  color: #b91c1c;
}

.btn-row-trace {
  margin-left: auto;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 5px;
  padding: 0 3px;
  font-size: 0.7rem;
  opacity: 0.45;
  transition: all 0.12s ease;
}

.assets-clickable-row:hover .btn-row-trace,
.btn-row-trace.is-pinned {
  opacity: 1;
}

.btn-row-trace:hover,
.btn-row-trace.is-pinned {
  background: var(--accent-emerald-soft);
  border-color: var(--accent-emerald);
}

.acct-type-pill {
  display: inline-block;
  font-size: 0.64rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  line-height: 1.2;
}

.acct-type-pill.acct-type-debt {
  background: #fff1f2;
  border-color: rgba(220, 38, 38, 0.35);
  color: #b91c1c;
}

.comp-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

.comp-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.62rem;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.comp-chip i {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.comp-chip-debt {
  color: #b91c1c;
  background: #fff5f5;
  border-color: rgba(220, 38, 38, 0.25);
}

.num-val-debt {
  color: #b91c1c;
}

.num-equity {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 700;
  color: #1f6f54;
  display: block;
  line-height: 1.22;
}

.num-improv {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 700;
  color: #0f766e;
  display: block;
  line-height: 1.22;
}

.income-tax-pill {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 5px;
  line-height: 1.2;
}

.tax-pill-free     { background: #e9f6f0; color: #1f6f54; border: 1px solid rgba(47, 158, 119, 0.32); }
.tax-pill-capgain  { background: #fff7ed; color: #b45309; border: 1px solid rgba(217, 138, 28, 0.35); }
.tax-pill-ca-only  { background: #fef3c7; color: #9a3412; border: 1px solid rgba(217, 119, 6, 0.45); }
.tax-pill-ordinary { background: #eef2ff; color: #4338ca; border: 1px solid rgba(108, 122, 224, 0.35); }
.tax-pill-debt     { background: #f3f4f6; color: #6b7280; border: 1px solid #e5e7eb; }

/* Asset Editor Modal Sub-Editors (Improvements & Holdings Split) */
.asset-subeditor-box {
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.asset-subeditor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}

.asset-subeditor-title {
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--text-primary);
}

.asset-subeditor-rows {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.subeditor-row {
  display: grid;
  gap: 5px;
  align-items: center;
}

.subeditor-row-3 {
  grid-template-columns: 88px 1fr 110px auto;
}

.subeditor-row-4 {
  grid-template-columns: 110px 1fr 95px 95px auto;
}

.subeditor-row input,
.subeditor-row select {
  height: 31px !important;
  padding: 4px 7px !important;
  font-size: 0.76rem !important;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
}

@media (max-width: 720px) {
  .subeditor-row-3,
  .subeditor-row-4 {
    grid-template-columns: 1fr 1fr;
  }
}

/* =========================================================================
   OVERVIEW CHART MODE SWITCHER & INDIVIDUAL ATTRIBUTION (ME VS. XUN)
   ========================================================================= */
.overview-chart-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  width: fit-content;
}

.overview-chart-tab {
  padding: 5px 12px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.14s ease;
  line-height: 1.2;
}

.overview-chart-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.7);
}

.overview-chart-tab.active {
  background: #ffffff;
  color: #1f6f54;
  border-color: rgba(47, 158, 119, 0.35);
  box-shadow: 0 1px 3px rgba(45, 52, 54, 0.08);
}

.attr-view-wrap {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.attr-scoreboard {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.attr-gap-pills {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.attr-gap-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e9f6f0;
  border: 1px solid rgba(47, 158, 119, 0.32);
  font-size: 0.69rem;
  color: #1f6f54;
}

.attr-gap-pill strong {
  font-family: var(--font-mono);
}

.attr-gap-pill.attr-gap-muted {
  background: var(--bg-card-elevated);
  border-color: var(--border-subtle);
  color: var(--text-secondary);
}

.attr-gap-pill.attr-gap-muted strong {
  color: var(--text-primary);
}

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

.attr-person-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
  padding: 8px 10px 8px 13px;
  border-radius: 9px;
  border: 1px solid var(--border-subtle);
  background: #ffffff;
  cursor: pointer;
  transition: all 0.14s ease;
  overflow: hidden;
}

.attr-person-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--p-color, var(--accent-emerald));
}

.attr-person-card:hover {
  border-color: var(--p-color, var(--accent-emerald));
  background: #fcfbf8;
  transform: translateY(-1px);
}

.attr-person-card.is-pinned {
  border-color: var(--p-color, var(--accent-emerald));
  background: #f3faf6;
  box-shadow: 0 0 0 1.5px var(--p-color, var(--accent-emerald));
}

.attr-person-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.attr-person-name {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--text-primary);
}

.attr-person-name i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.attr-person-pct {
  font-family: var(--font-mono);
  font-size: 0.71rem;
  font-weight: 800;
  color: var(--text-secondary);
}

.attr-person-val {
  font-family: var(--font-mono);
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.attr-person-sub {
  font-family: var(--font-mono);
  font-size: 0.67rem;
  color: var(--text-secondary);
}

.attr-loss-txt {
  color: #b91c1c;
  font-weight: 700;
}

.attr-subhead {
  display: flex;
  align-items: center;
  gap: 6px;
}

.attr-empty-state {
  background: #faf8f3;
  border: 1px dashed var(--border-highlight);
  border-radius: 10px;
  padding: 20px 18px;
  text-align: center;
}

.attr-empty-inner {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.attr-empty-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-primary);
}

.attr-empty-desc {
  margin: 0;
  font-size: 0.76rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.attr-empty-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.attr-ledger-wrap {
  margin-top: 2px;
}

.attr-ledger-table th,
.attr-ledger-table td {
  padding-top: 6px;
  padding-bottom: 6px;
}

@media (max-width: 720px) {
  .attr-person-grid {
    grid-template-columns: 1fr;
  }
}
