/* —— DESIGN TOKENS — Default: Atelier (Variant C) ——————————————————— */
:root {
  --pb-font-heading: 'Playfair Display', Georgia, serif;
  --pb-font-body:    'Lato', system-ui, sans-serif;

  --pb-nav-bg:            #FFFFFF;
  --pb-nav-border:        #E4E9F0;
  --pb-nav-text:          #5A6B7E;
  --pb-nav-active-text:   #0B1F3A;
  --pb-nav-active-bg:     #EEF3FA;
  --pb-nav-hover-bg:      #F7FAFD;
  --pb-sidebar-logo-bg:   #0B1F3A;
  --pb-sidebar-logo-text: #C9A84C;
  --pb-sidebar-w:         220px;

  --pb-content-bg:    #EEF2F8;
  --pb-card-bg:       #FFFFFF;
  --pb-card-border:   #DDE4EE;
  --pb-card-shadow:   0 1px 8px rgba(11,31,58,.06);
  --pb-card-radius:   12px;

  --pb-text-1:  #0B1F3A;
  --pb-text-2:  #3D5068;
  --pb-text-3:  #7A8FA6;
  --pb-border:  #DDE4EE;
  --pb-accent:  #C9A84C;

  --pb-tbl-head-bg:   #F4F7FC;
  --pb-tbl-head-text: #0B1F3A;
  --pb-tbl-stripe:    #FAFBFD;
  --pb-tbl-border:    #DDE4EE;

  --pb-positive:  #1A6B3A;
  --pb-pos-bg:    #EAF5EE;
  --pb-badge-pos-bg:   #EAF5EE; --pb-badge-pos-text: #1A6B3A;
  --pb-badge-neg-bg:   #FEF0F0; --pb-badge-neg-text: #9B1C1C;
  --pb-badge-neu-bg:   #EEF2F8; --pb-badge-neu-text: #3D5068;

  --pb-btn-primary-bg:    #0B1F3A;
  --pb-btn-primary-text:  #FFFFFF;
  --pb-btn-primary-hover: #132F57;
  --pb-btn-ghost-border:  #C9A84C;

  --pb-stat-accent-bg:     #FDF8EE;
  --pb-stat-accent-text:   #6B5420;
  --pb-stat-accent-val:    #0B1F3A;
  --pb-stat-accent-border: 3px solid #C9A84C;

  --pb-tab-active-border: #C9A84C;
  --pb-tab-active-text:   #0B1F3A;

  --pb-input-bg:     #FFFFFF;
  --pb-input-border: #C5CEDB;
  --pb-input-focus:  #0B1F3A;

  --pb-modal-bg:      #FFFFFF;
  --pb-modal-overlay: rgba(11,31,58,.5);
}

/* Variant A: Prestige — dark navy sidebar */
body.pb-variant-prestige {
  --pb-nav-bg:            #0B1F3A;
  --pb-nav-border:        rgba(201,168,76,.15);
  --pb-nav-text:          rgba(200,215,235,.7);
  --pb-nav-active-text:   #C9A84C;
  --pb-nav-active-bg:     rgba(201,168,76,.1);
  --pb-nav-hover-bg:      rgba(255,255,255,.06);
  --pb-sidebar-logo-bg:   #C9A84C;
  --pb-sidebar-logo-text: #0B1F3A;
  --pb-content-bg:        #F5F4F0;
  --pb-card-border:       #E4E0D6;
  --pb-card-shadow:       0 2px 12px rgba(11,31,58,.07);
  --pb-text-2:            #3D4F66;
  --pb-text-3:            #8094AD;
  --pb-border:            #DDD9CE;
  --pb-tbl-head-bg:       #0B1F3A;
  --pb-tbl-head-text:     #E8D9B5;
  --pb-tbl-stripe:        #FAFAF7;
  --pb-tbl-hover:         #F0EDE5;
  --pb-tbl-border:        #E4E0D6;
  --pb-btn-primary-text:  #C9A84C;
  --pb-btn-ghost-border:  #CBD5E1;
  --pb-stat-accent-bg:    #0B1F3A;
  --pb-stat-accent-text:  #C9A84C;
  --pb-stat-accent-val:   #F5EDD3;
  --pb-stat-accent-border: none;
}

/* Variant B: Obsidian — deep dark */
body.pb-variant-obsidian {
  --pb-nav-bg:            #060D19;
  --pb-nav-border:        rgba(212,168,67,.12);
  --pb-nav-text:          rgba(148,163,184,.8);
  --pb-nav-active-text:   #D4A843;
  --pb-nav-active-bg:     rgba(212,168,67,.1);
  --pb-nav-hover-bg:      rgba(255,255,255,.04);
  --pb-sidebar-logo-bg:   #D4A843;
  --pb-sidebar-logo-text: #060D19;
  --pb-content-bg:        #0D1826;
  --pb-card-bg:           #142030;
  --pb-card-border:       rgba(255,255,255,.07);
  --pb-card-shadow:       0 4px 24px rgba(0,0,0,.35);
  --pb-text-1:            #E8EFF8;
  --pb-text-2:            #94A3B8;
  --pb-text-3:            #566880;
  --pb-border:            rgba(255,255,255,.07);
  --pb-accent:            #D4A843;
  --pb-tbl-head-bg:       #0A1520;
  --pb-tbl-head-text:     #D4A843;
  --pb-tbl-stripe:        rgba(255,255,255,.025);
  --pb-tbl-hover:         rgba(212,168,67,.06);
  --pb-tbl-border:        rgba(255,255,255,.07);
  --pb-positive:          #4ADE80;
  --pb-negative:          #F87171;
  --pb-pos-bg:            rgba(74,222,128,.12);
  --pb-neg-bg:            rgba(248,113,113,.12);
  --pb-badge-pos-bg:      rgba(74,222,128,.15); --pb-badge-pos-text: #4ADE80;
  --pb-badge-neg-bg:      rgba(248,113,113,.15); --pb-badge-neg-text: #F87171;
  --pb-badge-neu-bg:      rgba(148,163,184,.12); --pb-badge-neu-text: #94A3B8;
  --pb-btn-primary-bg:    #D4A843;
  --pb-btn-primary-text:  #060D19;
  --pb-btn-primary-hover: #B89438;
  --pb-btn-ghost-border:  rgba(255,255,255,.14);
  --pb-stat-accent-bg:    #D4A843;
  --pb-stat-accent-text:  #060D19;
  --pb-stat-accent-val:   #060D19;
  --pb-stat-accent-border: none;
  --pb-input-bg:          #0A1520;
  --pb-input-border:      rgba(255,255,255,.12);
  --pb-modal-bg:          #142030;
  --pb-modal-overlay:     rgba(0,0,0,.75);
  --pb-tab-active-border: #D4A843;
  --pb-tab-active-text:   #D4A843;
}

/* —— RESET & BASE ————————————————————————————————————————————————————— */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: var(--pb-font-body);
  background: var(--pb-content-bg);
  color: var(--pb-text-1);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* —— LAYOUT ————————————————————————————————————————————————————————— */
#pb-page-wrapper {
  display: flex;
  min-height: 100vh;
}

#pb-main-content {
  flex: 1;
  margin-left: var(--pb-sidebar-w);
  min-width: 0;
  overflow-y: auto;
}

.pb-site-header { display: none !important; }

.pb-page-content {
  padding: 28px 32px 40px;
  max-width: 1200px;
  width: 100%;
}
.pb-page-content .entry-content { padding: 0; }

/* Admin bar offset */
body.admin-bar .pb-sidebar { top: 32px; height: calc(100vh - 32px); }
body.admin-bar #pb-main-content { margin-top: 32px; }
@media screen and (max-width: 782px) {
  body.admin-bar .pb-sidebar { top: 46px; height: calc(100vh - 46px); }
  body.admin-bar #pb-main-content { margin-top: 46px; }
}

/* —— SIDEBAR ————————————————————————————————————————————————————————— */
.pb-sidebar {
  position: fixed;
  left: 0; top: 0;
  width: var(--pb-sidebar-w);
  height: 100vh;
  background: var(--pb-nav-bg);
  border-right: 1px solid var(--pb-nav-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1000;
}

.pb-sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 18px;
  border-bottom: 1px solid var(--pb-nav-border);
  flex-shrink: 0;
}

.pb-sidebar__logo {
  width: 32px; height: 32px;
  background: var(--pb-sidebar-logo-bg);
  color: var(--pb-sidebar-logo-text);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--pb-font-heading);
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.pb-sidebar__name {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--pb-nav-active-text);
  line-height: 1.2;
}

.pb-sidebar__nav {
  flex: 1;
  padding: 12px 8px;
  list-style: none;
  overflow-y: auto;
}
.pb-sidebar__nav li { margin-bottom: 2px; }

.pb-sidebar__link {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--pb-nav-text);
  font-family: var(--pb-font-body);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s, color .15s;
  position: relative;
  text-align: left;
}
.pb-sidebar__link:hover,
.pb-sidebar__link:focus-visible {
  background: var(--pb-nav-hover-bg);
  color: var(--pb-nav-active-text);
}
.pb-sidebar__link.is-active {
  background: var(--pb-nav-active-bg);
  color: var(--pb-nav-active-text);
  font-weight: 700;
}

.pb-sidebar__icon {
  opacity: .8;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  width: 16px; height: 16px;
}
.pb-sidebar__link.is-active .pb-sidebar__icon { opacity: 1; }

.pb-sidebar__active-bar {
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px;
  background: var(--pb-nav-active-text);
  border-radius: 0 2px 2px 0;
}

.pb-sidebar__footer {
  padding: 12px 12px 16px;
  border-top: 1px solid var(--pb-nav-border);
  flex-shrink: 0;
}

.pb-sidebar__user,
.pb-sidebar__user-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

.pb-sidebar__avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--pb-sidebar-logo-bg);
  color: var(--pb-sidebar-logo-text);
  font-size: 11px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.pb-sidebar__user-name {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--pb-nav-active-text);
}

.pb-sidebar__user-role {
  display: block;
  font-size: 11px;
  color: var(--pb-nav-text);
}

/* —— BUTTONS ————————————————————————————————————————————————————————— */
.pb-button-primary,
.pb-button-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--pb-font-body);
  transition: background .15s, opacity .15s, transform .1s;
  white-space: nowrap;
  cursor: pointer;
}
.pb-button-primary:active,
.pb-button-secondary:active { transform: scale(.98); }

.pb-button-primary {
  background: var(--pb-btn-primary-bg);
  color: var(--pb-btn-primary-text);
  border: none;
}
.pb-button-primary:hover { background: var(--pb-btn-primary-hover); }

.pb-button-secondary {
  background: transparent;
  color: var(--pb-text-2);
  border: 1px solid var(--pb-btn-ghost-border);
}
.pb-button-secondary:hover { background: var(--pb-tbl-hover); }

/* —— SECTION TITLE ——————————————————————————————————————————————————— */
.pb-section-title {
  font-family: var(--pb-font-heading);
  font-size: 18px;
  font-weight: 600;
  color: var(--pb-text-1);
  margin: 28px 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.pb-section-title:first-child { margin-top: 0; }

/* —— HEATMAP ————————————————————————————————————————————————————————— */
.pb-heatmap-wrap {
  position: relative;
  width: 100%;
  border-radius: 0;
  margin-top: 4px;
}
.pb-hm-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  height: 100%;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #fff;
  border-radius: 0;
  box-sizing: border-box;
  overflow: hidden;
  cursor: default;
  transition: opacity .12s;
}
.pb-hm-tile:hover { opacity: .82; }
.pb-hm-tile__name {
  font-family: var(--pb-font-body);
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.2;
}
.pb-hm-tile__rend {
  font-family: var(--pb-font-body);
  font-size: 11px;
  font-weight: 500;
  color: rgba(255,255,255,.9);
  margin-top: 3px;
}
.pb-hm-tooltip {
  position: fixed;
  background: rgba(11,31,58,.92);
  color: #fff;
  padding: 7px 12px;
  border-radius: 7px;
  font-family: var(--pb-font-body);
  font-size: 12px;
  line-height: 1.6;
  pointer-events: none;
  z-index: 99999;
  display: none;
  white-space: pre-line;
  max-width: 220px;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
}
.pb-heatmap-legend {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 10px;
  padding: 0 2px;
}
.pb-heatmap-legend__track {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, #7F1D1D, #DC2626 25%, #FCA5A5 49%, #86EFAC 51%, #4CAF66 75%, #2E7D4A);
}
.pb-heatmap-legend__labels {
  display: flex;
  justify-content: space-between;
  font-family: var(--pb-font-body);
  font-size: 11px;
  color: var(--pb-text-3);
}

.pb-year-select {
  padding: 5px 10px;
  border-radius: 7px;
  border: 1px solid var(--pb-border);
  background: var(--pb-card-bg);
  color: var(--pb-text-1);
  font-family: var(--pb-font-body);
  font-size: 13px;
  cursor: pointer;
}

/* —— TOPBAR (legacy — keep for action-button rows) ——————————————————— */
.pb-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  padding: 0;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--pb-text-3);
  cursor: pointer;
  text-decoration: none;
  transition: color .15s;
}
.pb-back-btn:hover { color: var(--pb-text-1); }

/* —— Filter bar (transactions) ————————————————————————————————————— */
.pb-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.pb-range-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border: 1.5px solid var(--pb-border);
  border-radius: 20px;
  background: var(--pb-card-bg);
  color: var(--pb-text-2);
  font-family: var(--pb-font-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
}
.pb-range-btn:hover {
  border-color: var(--pb-text-3);
  color: var(--pb-text-1);
}
.pb-range-btn.is-active {
  border-color: var(--pb-text-1);
  background: var(--pb-text-1);
  color: #FFFFFF;
}
.pb-filter-bar select {
  padding: 6px 12px;
  border: 1.5px solid var(--pb-border);
  border-radius: 20px;
  background: var(--pb-card-bg);
  color: var(--pb-text-2);
  font-family: var(--pb-font-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: border-color .15s;
}
.pb-filter-bar select:focus { border-color: var(--pb-text-3); }

/* —— Transaction type badges ————————————————————————————————————— */
.pb-tx-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .3px;
  white-space: nowrap;
}
.pb-tx-badge--buy  { background: var(--pb-badge-neg-bg); color: var(--pb-badge-neg-text); }
.pb-tx-badge--sell { background: var(--pb-badge-pos-bg); color: var(--pb-badge-pos-text); }
.pb-tx-badge--neu  { background: var(--pb-badge-neu-bg); color: var(--pb-badge-neu-text); }

.pb-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}
.pb-topbar__title {
  font-family: var(--pb-font-heading);
  font-size: 26px;
  font-weight: 600;
  color: var(--pb-text-1);
  line-height: 1.2;
  margin: 0;
}
.pb-topbar__sub {
  font-size: 13px;
  color: var(--pb-text-3);
  margin-top: 2px;
}
.pb-topbar__actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
  padding-top: 4px;
}

/* —— STAT ROW ——————————————————————————————————————————————————————— */
.pb-stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.pb-stat-card {
  background: var(--pb-card-bg);
  border: 1px solid var(--pb-card-border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--pb-card-shadow);
}
.pb-stat-card--accent {
  background: var(--pb-stat-accent-bg);
  border-color: transparent;
  border-left: var(--pb-stat-accent-border, none);
}
.pb-stat-card--accent .pb-stat-card__label { color: var(--pb-stat-accent-text); opacity: .75; }
.pb-stat-card--accent .pb-stat-card__value { color: var(--pb-stat-accent-val); }

.pb-stat-card__label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--pb-text-3);
}
.pb-stat-card__value {
  font-family: var(--pb-font-body);
  font-size: 19px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--pb-text-1);
  line-height: 1.2;
  letter-spacing: -.01em;
}
.pb-stat-card__value.pb-pos { color: var(--pb-positive); }
.pb-stat-card__value.pb-neg { color: var(--pb-negative); }
.pb-stat-card__sub {
  font-size: 11px;
  color: var(--pb-text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* —— TABLES —————————————————————————————————————————————————————————— */
.pb-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

/* Wrap table in a card — apply border/radius/shadow to container div or the table itself */
.pb-table-wrap,
.pb-table {
  background: var(--pb-card-bg);
  border: 1px solid var(--pb-card-border);
  border-radius: var(--pb-card-radius);
  box-shadow: var(--pb-card-shadow);
  overflow: hidden;
}
.pb-table-wrap { overflow-x: auto; }
.pb-table-wrap .pb-table { border: none; border-radius: 0; box-shadow: none; }

.pb-table thead th {
  background: var(--pb-tbl-head-bg);
  color: var(--pb-tbl-head-text);
  font-family: var(--pb-font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 11px 14px;
  white-space: nowrap;
  border-bottom: 1px solid var(--pb-tbl-border);
}
.pb-table thead th:first-child { border-radius: 8px 0 0 0; }
.pb-table thead th:last-child  { border-radius: 0 8px 0 0; }

.pb-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--pb-tbl-border);
  color: var(--pb-text-2);
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}
.pb-table tbody td strong { color: var(--pb-text-1); font-weight: 700; }
.pb-table tbody td.pb-pos, .pb-table tbody td .pb-pos { color: var(--pb-positive); }
.pb-table tbody td.pb-neg, .pb-table tbody td .pb-neg { color: var(--pb-negative); }
.pb-table tbody tr:last-child td { border-bottom: none; }
.pb-table tbody tr:nth-child(even) td { background: var(--pb-tbl-stripe); }
.pb-table tbody tr:hover td { background: var(--pb-tbl-hover); }

.pb-table tfoot td {
  padding: 11px 14px;
  border-top: 2px solid var(--pb-tbl-border);
  font-weight: 700;
  color: var(--pb-text-1);
  background: var(--pb-tbl-stripe);
  font-variant-numeric: tabular-nums;
}

.pb-table th.is-num,  .pb-table td.is-num  { text-align: right; }
.pb-table th.is-center, .pb-table td.is-center { text-align: center; }
.pb-port-value { min-width: 130px; white-space: nowrap; }

/* —— CHARTS ————————————————————————————————————————————————————————— */
.pb-chart-label {
  font-family: var(--pb-font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--pb-text-2);
  text-align: center;
  margin-bottom: 12px;
}
.pb-chart-year-form { display: inline-flex; }
.pb-chart-year-select { font-size: 13px; }
.pb-detail-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding: 6px 12px;
  font-family: var(--pb-font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--pb-text-2);
  background: transparent;
  border: 1px solid var(--pb-border);
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.pb-detail-toggle:hover { background: var(--pb-tbl-hover); color: var(--pb-text-1); }
.pb-detail-toggle svg { transition: transform .2s; }
.pb-detail-toggle.is-open svg { transform: rotate(180deg); }

/* —— COLORS ————————————————————————————————————————————————————————— */
.pb-pos { color: var(--pb-positive); font-weight: 600; }
.pb-neg { color: var(--pb-negative); font-weight: 600; }

/* —— STAT CARD CHANGE ——————————————————————————————————————————————— */
.pb-stat-card__change {
  font-size: 12px;
  font-weight: 600;
}
.pb-stat-card__change.pb-pos { color: var(--pb-positive); font-weight: 600; }
.pb-stat-card__change.pb-neg { color: var(--pb-negative); font-weight: 600; }
.pb-stat-card__change-label { font-weight: 400; opacity: .75; }

/* —— ICON BUTTONS ——————————————————————————————————————————————————— */
/* Note: .pb-icon-btn is now in assets/css/pb-components.css (Niveau-2). */

/* —— TABLE ROW CLICKABLE ———————————————————————————————————————————— */
.pb-tbl-row--clickable { cursor: pointer; }

/* —— BADGES ————————————————————————————————————————————————————————— */
.pb-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .03em;
}
.pb-badge--pos { background: var(--pb-badge-pos-bg); color: var(--pb-badge-pos-text); }
.pb-badge--neg { background: var(--pb-badge-neg-bg); color: var(--pb-badge-neg-text); }
.pb-badge--neu { background: var(--pb-badge-neu-bg); color: var(--pb-badge-neu-text); }

/* —— CARD ———————————————————————————————————————————————————————————— */
.pb-card {
  background: var(--pb-card-bg);
  border: 1px solid var(--pb-card-border);
  border-radius: var(--pb-card-radius);
  padding: 20px;
  box-shadow: var(--pb-card-shadow);
  margin-bottom: 16px;
}
.pb-card:last-child { margin-bottom: 0; }
.pb-card--no-pad { padding: 0; }

/* Legacy card selectors */
.pb-fund-card, .pb-market-news__card {
  background: var(--pb-card-bg);
  border: 1px solid var(--pb-card-border);
  border-radius: var(--pb-card-radius);
  box-shadow: var(--pb-card-shadow);
}

/* —— TABS ———————————————————————————————————————————————————————————— */
.pb-tab-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  border-bottom: 1px solid var(--pb-border);
  margin-bottom: 16px;
}
.pb-tab-btn {
  padding: 8px 16px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--pb-text-3);
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
  position: relative;
  top: 1px;
  background: none;
  border-left: none;
  border-right: none;
  border-top: none;
  cursor: pointer;
  font-family: var(--pb-font-body);
}
.pb-tab-btn:hover { color: var(--pb-text-1); }
.pb-tab-btn.is-active {
  color: var(--pb-tab-active-text);
  border-bottom-color: var(--pb-tab-active-border);
}

/* —— MODALS —————————————————————————————————————————————————————————— */
.pb-modal-backdrop,
.pb-modal {
  position: fixed;
  inset: 0;
  background: var(--pb-modal-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(3px);
}
.pb-modal__dialog {
  background: var(--pb-modal-bg);
  border-radius: 16px;
  width: min(480px, 95vw);
  box-shadow: 0 30px 70px rgba(0,0,0,.3);
  overflow: hidden;
  animation: pb-modal-in .2s ease;
}
.pb-modal__dialog--wide { width: min(720px, 95vw); }
.pb-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--pb-border);
}
.pb-modal__title {
  font-family: var(--pb-font-heading);
  font-size: 18px;
  font-weight: 600;
  color: var(--pb-text-1);
  margin: 0;
}
.pb-modal__close {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--pb-text-3);
  background: none;
  border: none;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.pb-modal__close:hover { background: var(--pb-tbl-hover); color: var(--pb-text-1); }
.pb-modal__body { padding: 20px 24px 24px; overflow-x: auto; }
.pb-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}
@keyframes pb-modal-in {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

/* —— FORM FIELDS ————————————————————————————————————————————————————— */
.pb-field { display: flex; flex-direction: column; gap: 5px; }
.pb-field__label { font-size: 12px; font-weight: 600; color: var(--pb-text-2); }
.pb-field__input {
  padding: 9px 12px;
  border-radius: 7px;
  border: 1px solid var(--pb-input-border);
  background: var(--pb-input-bg);
  color: var(--pb-text-1);
  font-family: var(--pb-font-body);
  font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
  box-sizing: border-box;
}
.pb-field__input:focus {
  outline: none;
  border-color: var(--pb-input-focus);
  box-shadow: 0 0 0 3px rgba(201,168,76,.2);
}

/* —— USER MENU POPOVER ——————————————————————————————————————————————— */
.pb-user-menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 1090;
  display: none;
}
.pb-user-menu-overlay.is-open { display: block; }

.pb-user-menu {
  position: fixed;
  left: calc(var(--pb-sidebar-w) + 16px);
  bottom: 16px;
  width: 360px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: var(--pb-modal-bg);
  border: 1px solid var(--pb-card-border);
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(11,31,58,.22);
  padding: 22px 24px;
  font-family: var(--pb-font-body);
  z-index: 1100;
}
.pb-user-menu[hidden] { display: none; }

.pb-um-section {
  padding: 16px 0;
  border-top: 1px solid var(--pb-border);
}
.pb-um-section:first-of-type { padding-top: 0; border-top: none; }
.pb-um-section:last-of-type  { padding-bottom: 0; }

.pb-um-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--pb-text-3);
  margin-bottom: 10px;
}

.pb-um-select {
  width: 100%;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--pb-border);
  background: var(--pb-input-bg);
  color: var(--pb-text-1);
  font-family: var(--pb-font-body);
  font-size: 14px;
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--pb-text-3) 50%),
                    linear-gradient(135deg, var(--pb-text-3) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}

.pb-um-check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--pb-text-1);
  cursor: pointer;
  user-select: none;
  margin-bottom: 12px;
}
.pb-um-check input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border: 1.5px solid var(--pb-border);
  border-radius: 4px;
  display: grid;
  place-items: center;
  cursor: pointer;
  background: var(--pb-input-bg);
  flex-shrink: 0;
  margin: 0;
}
.pb-um-check input[type="checkbox"]:checked { background: #2563EB; border-color: #2563EB; }
.pb-um-check input[type="checkbox"]:checked::after {
  content: '';
  display: block;
  width: 10px; height: 6px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
}

.pb-um-recipients-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--pb-text-1);
  margin-bottom: 6px;
}

.pb-um-textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--pb-border);
  background: var(--pb-input-bg);
  color: var(--pb-text-1);
  font-family: var(--pb-font-body);
  font-size: 13px;
  resize: vertical;
  min-height: 78px;
  box-sizing: border-box;
}
.pb-um-textarea:focus { outline: none; border-color: var(--pb-input-focus); box-shadow: 0 0 0 3px rgba(201,168,76,.2); }

.pb-um-help {
  font-size: 12px;
  color: var(--pb-text-3);
  margin-top: 8px;
  line-height: 1.5;
}

.pb-um-linkitem {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 0;
  font-size: 14px;
  color: var(--pb-text-1);
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
  transition: color .15s;
  font-family: var(--pb-font-body);
}
.pb-um-linkitem:hover { color: var(--pb-accent); }
.pb-um-linkitem--danger { color: #C9302C; font-weight: 700; }
.pb-um-linkitem--danger:hover { color: #a52525; opacity: 1; }

.pb-um-pdf-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  background: #2B6CB0;
  color: #fff;
  border: 1px solid #2B6CB0;
  border-radius: 6px;
  font-family: var(--pb-font-body);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s;
}
.pb-um-pdf-btn:hover { background: #2256A0; border-color: #2256A0; color: #fff; }

.pb-um-userid {
  font-size: 14px;
  color: var(--pb-text-1);
  margin-bottom: 10px;
  font-weight: 500;
}

.pb-um-feedback {
  font-size: 12px;
  min-height: 18px;
  margin-top: 6px;
  transition: color .2s;
}
.pb-um-feedback--ok  { color: var(--pb-positive); }
.pb-um-feedback--err { color: var(--pb-negative); }

body.admin-bar .pb-user-menu { bottom: 48px; }
@media screen and (max-width: 782px) {
  body.admin-bar .pb-user-menu { bottom: 62px; }
}

/* —— RESPONSIVE ————————————————————————————————————————————————————— */
@media (max-width: 960px) {
  :root { --pb-sidebar-w: 64px; }
  .pb-sidebar__name,
  .pb-sidebar__label,
  .pb-sidebar__user-info,
  .pb-sidebar__user-name,
  .pb-sidebar__user-role { display: none; }
  .pb-sidebar__brand { justify-content: center; padding: 16px 8px; }
  .pb-sidebar__link { justify-content: center; padding: 12px; }
  .pb-sidebar__footer { padding: 8px; }
  .pb-sidebar__user,
  .pb-sidebar__user-trigger { justify-content: center; }
  .pb-page-content { padding: 20px 16px 32px; }
  .pb-user-menu { left: calc(var(--pb-sidebar-w) + 8px); width: min(360px, calc(100vw - var(--pb-sidebar-w) - 16px)); }
}
