/* PA Empire final UI layer. Loaded after styles.css. */
:root {
  --accent: #08bcd4;
  --accent-2: #ff9f1c;
  --accent-3: #fffcbc;
  --cream: #fffcbc;
  --positive: #08d48c;
  --negative: #ff405e;
  --warning: #ffb84d;
  --bg: #030609;
  --panel: rgba(8, 13, 19, 0.82);
  --panel-2: rgba(12, 18, 27, 0.78);
  --panel-3: rgba(17, 25, 35, 0.78);
  --panel-soft: rgba(13, 20, 29, 0.76);
  --text: #f8fbff;
  --muted: #91a0b4;
  --line: rgba(255, 252, 188, 0.12);
  --glass-border: rgba(255, 252, 188, 0.14);
  --glass-highlight: rgba(255, 252, 188, 0.08);
  --shadow: 0 26px 82px rgba(0, 0, 0, 0.44);
  --app-font: "Inter", "Segoe UI", Arial, sans-serif;
  --display-font: "Space Grotesk", "Inter", "Segoe UI", Arial, sans-serif;
  --mobile-tabbar-height: 64px;
  --mobile-tabbar-gap: 10px;
}

* {
  letter-spacing: 0 !important;
}

body {
  background:
    linear-gradient(90deg, rgba(255, 252, 188, 0.028) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 252, 188, 0.02) 1px, transparent 1px),
    linear-gradient(120deg, rgba(8, 188, 212, 0.12), transparent 34%),
    linear-gradient(250deg, rgba(255, 159, 28, 0.1), transparent 42%),
    #030609;
  background-attachment: fixed;
  background-size: 78px 78px, 78px 78px, 100% 100%, 100% 100%, 100% 100%;
  color: var(--text);
  font-family: var(--app-font);
  font-weight: 500;
}

body,
button,
input,
select,
textarea {
  font-family: var(--app-font);
}

h1,
h2,
h3,
.brand-title,
.button,
.icon-button,
.nav-button,
.stat-card strong,
.summary-item strong,
.hee-pnl-card strong,
.hee-metric-card strong,
.calendar-week-total strong,
.calendar-cell strong {
  font-family: var(--display-font);
}

h1 {
  color: var(--cream);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.04;
}

h2 {
  color: var(--cream);
  font-size: 18px;
  font-weight: 700;
}

.app-shell {
  grid-template-columns: 264px minmax(0, 1fr);
}

.main {
  padding: 26px;
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(8, 188, 212, 0.08), transparent 34%),
    rgba(4, 8, 13, 0.86);
  border-right: 1px solid rgba(255, 252, 188, 0.11);
}

.brand {
  background:
    linear-gradient(145deg, rgba(255, 252, 188, 0.075), rgba(8, 188, 212, 0.045)),
    rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 252, 188, 0.13);
  border-radius: 24px;
  min-height: 96px;
}

.brand-logo {
  border-radius: 18px;
  height: 54px;
  width: 54px;
}

.brand-title {
  color: var(--cream);
  font-size: 18px;
  font-weight: 700;
}

.brand-subtitle {
  color: var(--accent);
  font-family: var(--display-font);
  font-size: 11px;
  font-weight: 700;
}

.nav-button,
.mobile-tab {
  background: rgba(255, 255, 255, 0.018);
  border: 1px solid rgba(255, 252, 188, 0.08);
  border-radius: 16px;
  color: #dbe7ef;
  font-weight: 700;
}

.nav-button.is-active,
.mobile-tab.is-active,
.button.primary,
.weekly-journal-main,
.segmented button.is-active,
.auth-switch button.is-active {
  background: linear-gradient(135deg, #08bcd4, #08d48c);
  border-color: rgba(255, 252, 188, 0.3);
  color: #031014;
  box-shadow: 0 16px 42px rgba(8, 188, 212, 0.22), inset 0 1px 0 rgba(255, 252, 188, 0.42);
}

.page-head,
.panel,
.stat-card,
.summary-item,
.detail-grid > div,
.qa-card,
.qa-answer-card,
.tag-card,
.saved-value-category,
.stock-account-card,
.month-kpis div,
.mentor-student-card,
.mentor-safe-note,
.restore-item,
.trade-table tbody tr,
.qa-nq-panel,
.modal,
.auth-panel,
.sync-card,
.compact-form,
.analyzer-card,
.habit-card,
.mistake-item,
.weekday-performance-card,
.dashboard-day-trade,
.hee-pnl-card,
.hee-metric-card {
  background:
    linear-gradient(145deg, rgba(255, 252, 188, 0.055), rgba(8, 188, 212, 0.026) 48%, rgba(255, 255, 255, 0.012)),
    rgba(7, 12, 18, 0.8);
  border: 1px solid rgba(255, 252, 188, 0.12);
  border-radius: 22px;
  box-shadow: inset 0 1px 0 rgba(255, 252, 188, 0.08), 0 22px 70px rgba(0, 0, 0, 0.34);
}

@supports (backdrop-filter: blur(18px)) {
  .page-head,
  .panel,
  .stat-card,
  .summary-item,
  .detail-grid > div,
  .qa-card,
  .qa-answer-card,
  .tag-card,
  .saved-value-category,
  .stock-account-card,
  .month-kpis div,
  .mentor-student-card,
  .mentor-safe-note,
  .restore-item,
  .trade-table tbody tr,
  .qa-nq-panel,
  .modal,
  .auth-panel,
  .sync-card,
  .compact-form,
  .analyzer-card,
  .habit-card,
  .mistake-item,
  .weekday-performance-card,
  .dashboard-day-trade,
  .hee-pnl-card,
  .hee-metric-card {
    backdrop-filter: blur(22px) saturate(135%);
  }
}

.page-head {
  border-radius: 30px;
  gap: 18px;
  margin-bottom: 16px;
  padding: 18px;
}

.page-head p,
.panel-head span,
.muted,
.muted-line,
.stat-card span,
.summary-item span {
  color: #9baabd;
}

.button,
.icon-button,
input,
select,
textarea {
  border-radius: 14px;
}

.button,
.icon-button {
  background:
    linear-gradient(180deg, rgba(255, 252, 188, 0.065), rgba(255, 255, 255, 0.018)),
    rgba(11, 18, 27, 0.78);
  border: 1px solid rgba(255, 252, 188, 0.13);
  color: var(--text);
  font-weight: 750;
  min-height: 42px;
}

input,
select,
textarea {
  background:
    linear-gradient(180deg, rgba(255, 252, 188, 0.032), rgba(255, 255, 255, 0.008)),
    rgba(8, 14, 21, 0.82);
  border: 1px solid rgba(255, 252, 188, 0.13);
  color: var(--text);
  font-weight: 650;
  min-height: 44px;
}

label,
.field label,
.form-field label {
  color: #9db1c8;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

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

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

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

.dashboard-analyzer-actions {
  align-items: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.dashboard-weekly-action {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-width: min(100%, 360px);
}

.dashboard-weekly-action .weekly-journal-split {
  flex: 1 1 240px;
}

.dashboard-analyzer-actions .weekly-journal-split {
  background:
    linear-gradient(135deg, rgba(8, 188, 212, 0.96), rgba(8, 212, 140, 0.92));
  border: 1px solid rgba(255, 252, 188, 0.24);
  border-radius: 16px;
  box-shadow: 0 14px 34px rgba(8, 188, 212, 0.22), inset 0 1px 0 rgba(255, 252, 188, 0.32);
  grid-template-columns: minmax(0, 1fr) 42px;
}

.dashboard-analyzer-actions .weekly-journal-main {
  background: transparent;
  color: #031014;
}

.dashboard-analyzer-actions .weekly-journal-arrow {
  background:
    linear-gradient(180deg, rgba(3, 16, 20, 0.08), rgba(3, 16, 20, 0.18)),
    rgba(3, 16, 20, 0.08);
  border-left: 1px solid rgba(3, 16, 20, 0.18);
  color: #031014;
  display: grid;
  min-width: 42px;
  place-items: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.dashboard-analyzer-actions .weekly-journal-arrow::before {
  background: rgba(255, 252, 188, 0.28);
  border-radius: 999px;
  content: "";
  height: 24px;
  left: 0;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 1px;
}

.dashboard-analyzer-actions .weekly-journal-arrow .icon {
  height: 17px;
  stroke-width: 2.6;
  width: 17px;
}

.dashboard-analyzer-actions .weekly-journal-arrow:hover {
  background:
    linear-gradient(180deg, rgba(255, 252, 188, 0.24), rgba(255, 252, 188, 0.12)),
    rgba(3, 16, 20, 0.08);
  color: #031014;
}

.dashboard-analyzer-actions .analyzer-toggle {
  align-items: center;
  align-self: flex-start;
  flex: 0 0 auto;
  height: 44px;
  justify-content: center;
  min-height: 44px;
  padding-bottom: 0;
  padding-top: 0;
}

.dashboard-analyzer-actions .weekly-journal-split,
.dashboard-analyzer-actions .weekly-journal-main,
.dashboard-analyzer-actions .weekly-journal-arrow {
  height: 44px;
  min-height: 44px;
}

.hee-dashboard-hero {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(300px, 1.16fr) repeat(2, minmax(230px, 0.82fr));
  margin-bottom: 14px;
}

.hee-pnl-card,
.hee-metric-card {
  min-width: 0;
  overflow: hidden;
  padding: 20px;
  position: relative;
}

.hee-pnl-card {
  display: grid;
  gap: 18px;
  grid-row: span 2;
  min-height: 270px;
}

.hee-pnl-card > strong {
  font-size: 52px;
  line-height: 1;
}

.hee-ring-card {
  align-items: center;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) 106px;
  min-height: 150px;
}

.hee-metric-card strong {
  color: var(--cream);
  font-size: 34px;
  line-height: 1;
}

.hee-ring {
  align-items: center;
  aspect-ratio: 1;
  --ring-track: rgba(255, 252, 188, 0.12);
  background:
    conic-gradient(var(--ring-color) 0 calc(var(--ring-value) * 1%), var(--ring-track) 0 100%),
    radial-gradient(circle at 50% 50%, rgba(8, 188, 212, 0.1), rgba(255, 255, 255, 0.025));
  border: 1px solid rgba(255, 252, 188, 0.12);
  border-radius: 50%;
  box-shadow: inset 0 0 20px rgba(255, 252, 188, 0.06), 0 0 22px color-mix(in srgb, var(--ring-color) 16%, transparent);
  display: grid;
  justify-items: center;
  padding: 10px;
  width: 106px;
}

.hee-ring > div {
  align-content: center;
  background: linear-gradient(145deg, rgba(7, 16, 24, 0.96), rgba(5, 9, 15, 0.98));
  border: 1px solid rgba(255, 252, 188, 0.1);
  border-radius: 50%;
  display: grid;
  height: 100%;
  justify-items: center;
  width: 100%;
}

.hee-ring b {
  color: var(--cream);
  font-size: 16px;
}

.hee-ring small {
  color: var(--ring-color);
  font-size: 12px;
  font-weight: 900;
}

.hee-avg-card {
  grid-column: 2 / 4;
}

.dashboard-stat-rail {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 14px;
}

.stat-card span,
.summary-item span {
  color: #91a0b4;
  font-size: 11px;
  font-weight: 850;
}

.summary-item {
  align-content: start;
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 12px 14px;
}

.summary-item span,
.summary-item strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.stat-card strong,
.summary-item strong {
  color: var(--cream);
  font-size: 24px;
  line-height: 1.05;
}

.mobile-tabbar {
  background: rgba(4, 8, 13, 0.88);
  border: 1px solid rgba(255, 252, 188, 0.13);
  border-radius: 24px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.44), inset 0 1px 0 rgba(255, 252, 188, 0.08);
}

@media (max-width: 1180px) {
  .hee-dashboard-hero {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hee-pnl-card,
  .hee-avg-card {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  .dashboard-stat-rail {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding-bottom: calc(var(--mobile-tabbar-height) + 22px + env(safe-area-inset-bottom, 0px));
  }

  .main {
    padding: 10px 10px calc(var(--mobile-tabbar-height) + 22px + env(safe-area-inset-bottom, 0px));
  }

  .sidebar {
    padding: 8px;
  }

  .brand {
    border-radius: 20px;
    min-height: 56px;
    padding: 7px;
  }

  .brand-logo {
    height: 34px;
    width: 34px;
  }

  .brand-title {
    font-size: 13px;
  }

  .brand-subtitle {
    font-size: 9px;
  }

  .mobile-top-settings {
    min-height: 38px;
    width: 38px;
  }

  .page-head {
    gap: 10px;
    margin-bottom: 10px;
    padding: 12px;
  }

  .page-head h1 {
    font-size: 22px;
  }

  .page-head p {
    font-size: 11px;
    line-height: 1.25;
  }

  input,
  select,
  textarea {
    min-height: 40px;
  }

  .hee-dashboard-hero {
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 8px;
  }

  .hee-pnl-card {
    gap: 8px;
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 0;
    padding: 12px;
  }

  .hee-pnl-card .hee-card-top {
    grid-column: 1 / -1;
  }

  .hee-pnl-card > strong {
    font-size: 34px;
  }

  .hee-pnl-card p {
    display: none;
  }

  .hee-pnl-footer {
    align-self: end;
    border-top: 0;
    display: grid;
    justify-items: end;
    padding-top: 0;
  }

  .hee-pnl-footer span {
    font-size: 10px;
  }

  .hee-pnl-footer b {
    font-size: 16px;
  }

  .hee-ring-card {
    gap: 8px;
    grid-template-columns: minmax(0, 1fr) 58px;
    min-height: 0;
    padding: 10px;
  }

  .hee-ring {
    justify-self: end;
    padding: 6px;
    width: 58px;
  }

  .hee-ring b {
    font-size: 11px;
  }

  .hee-ring small {
    font-size: 9px;
  }

  .hee-metric-card strong {
    font-size: 22px;
  }

  .hee-metric-card p {
    font-size: 10px;
    line-height: 1.25;
  }

  .hee-avg-card {
    grid-column: 1 / -1;
    min-height: 0;
    padding: 10px;
  }

  .hee-avg-track {
    height: 12px;
    padding: 2px;
  }

  .hee-avg-values b {
    font-size: 13px;
  }

  .dashboard-stat-rail {
    gap: 6px;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin-bottom: 8px;
  }

  .dashboard-stat-rail .stat-card {
    border-radius: 14px;
    min-height: 56px;
    padding: 7px;
  }

  .dashboard-stat-rail .stat-card span {
    font-size: 8px;
    line-height: 1.05;
  }

  .dashboard-stat-rail .stat-card strong {
    font-size: 14px;
    line-height: 1.1;
    overflow-wrap: anywhere;
  }

  .dashboard-grid {
    gap: 8px;
  }

  .panel {
    padding: 12px;
  }

  .equity-curve {
    min-height: 132px;
  }

  .dashboard-analyzer-shell {
    margin-top: 10px;
  }

  .dashboard-analyzer-actions {
    display: grid;
    gap: 8px;
    grid-template-columns: 1fr;
  }

  .dashboard-weekly-action,
  .dashboard-weekly-action .weekly-journal-split,
  .dashboard-analyzer-actions .analyzer-toggle {
    min-width: 0;
    width: 100%;
  }

  .weekly-journal-main {
    min-height: 42px;
  }

  .mobile-tabbar {
    border-radius: 20px;
    gap: 4px;
    min-height: 58px;
    padding: 5px;
  }

  .mobile-tab {
    border-radius: 15px;
    gap: 2px;
    min-height: 48px;
    padding: 4px 1px;
  }

  .mobile-tab .icon {
    height: 16px;
    width: 16px;
  }

  .mobile-tab span {
    font-size: 9px;
    line-height: 1;
  }
}

@media (max-width: 420px) {
  .hee-dashboard-hero {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hee-pnl-card,
  .hee-avg-card {
    grid-column: 1 / -1;
  }

  .hee-ring-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .hee-ring {
    justify-self: start;
    width: 56px;
  }
}

.hee-pnl-top {
  align-items: flex-start;
  gap: 12px;
}

.hee-pnl-top > div:first-child {
  min-width: 0;
}

.hee-dashboard-tools {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.hee-mini-action {
  border-color: rgba(8, 188, 212, 0.24);
  color: var(--cream);
  min-height: 36px;
  padding: 0 12px;
}

.hee-share-action {
  background:
    linear-gradient(135deg, rgba(8, 188, 212, 0.18), rgba(8, 212, 140, 0.1)),
    rgba(9, 18, 25, 0.84);
  border-color: rgba(8, 212, 140, 0.34);
}

.dashboard-share-modal {
  max-width: min(1040px, calc(100vw - 24px));
}

.dashboard-share-builder {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(220px, 1fr) auto;
  margin-bottom: 14px;
}

.dashboard-share-builder label {
  display: grid;
  gap: 7px;
}

.dashboard-share-meta {
  align-items: center;
  background: rgba(255, 252, 188, 0.035);
  border: 1px solid rgba(255, 252, 188, 0.1);
  border-radius: 16px;
  display: flex;
  justify-content: space-between;
  padding: 11px 13px;
}

.dashboard-share-meta span {
  color: var(--muted);
  font-family: var(--display-font);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.dashboard-share-meta strong {
  color: var(--cream);
  font-family: var(--display-font);
}

.dashboard-share-preview {
  background:
    linear-gradient(145deg, rgba(255, 252, 188, 0.05), rgba(8, 188, 212, 0.035)),
    rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 252, 188, 0.13);
  border-radius: 22px;
  display: grid;
  max-height: 62vh;
  overflow: auto;
  padding: 12px;
}

.dashboard-share-preview img {
  border-radius: 18px;
  display: block;
  height: auto;
  margin: 0 auto;
  max-width: 100%;
}

.auth-logo {
  background:
    radial-gradient(circle at 50% 36%, rgba(255, 252, 188, 0.22), transparent 56%),
    rgba(3, 6, 9, 0.72);
  box-shadow: 0 14px 38px rgba(255, 159, 28, 0.2), inset 0 1px 0 rgba(255, 252, 188, 0.22);
  object-fit: contain;
  padding: 4px;
}

.qa-nq-date {
  color: rgba(255, 252, 188, 0.58);
  display: block;
  font-family: var(--display-font);
  font-size: 12px;
  font-weight: 800;
  margin-top: 4px;
}

.equity-curve {
  background:
    radial-gradient(circle at 78% 18%, rgba(8, 188, 212, 0.16), transparent 38%),
    linear-gradient(180deg, rgba(255, 252, 188, 0.035), rgba(8, 188, 212, 0.018)),
    rgba(3, 7, 12, 0.82);
  border-color: rgba(255, 252, 188, 0.13);
  border-radius: 22px;
  display: block;
  overflow: visible;
}

.curve-area {
  fill: url(#equityAreaGradient);
}

.curve-line {
  stroke: var(--accent);
  stroke-width: 3.4;
}

.curve-line.positive {
  stroke: var(--positive);
}

.curve-terminal.positive {
  fill: var(--positive);
  stroke: rgba(3, 7, 12, 0.94);
}

.curve-line.negative {
  stroke: var(--negative);
}

.curve-terminal.negative {
  fill: var(--negative);
  stroke: rgba(3, 7, 12, 0.94);
}

.curve-terminal {
  filter: drop-shadow(0 0 10px currentColor);
  stroke-width: 3;
}

.curve-axis-label {
  fill: rgba(255, 252, 188, 0.46);
  font-family: var(--display-font);
  font-size: 11px;
  font-weight: 800;
}

.compact-settings {
  align-items: start;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(280px, 0.8fr) minmax(280px, 1fr);
}

.compact-settings .span-full,
.compact-settings > .stock-accounts-panel,
.compact-settings > .saved-values-panel,
.compact-settings > .narrative-stats-panel,
.compact-settings > .restore-panel {
  grid-column: 1 / -1;
}

.settings-stack {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.profile-settings-card {
  display: grid;
  gap: 14px;
}

.profile-field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.profile-field > span,
.profile-field > label,
.settings-export-help {
  color: #91a0b4;
  font-size: 12px;
  font-weight: 800;
}

.profile-field strong {
  color: var(--cream);
  overflow-wrap: anywhere;
}

.profile-field small,
.sync-note {
  color: #91a0b4;
}

.settings-theme-toggle,
.settings-account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.settings-theme-toggle .button {
  flex: 1 1 96px;
}

.settings-theme-toggle .button.is-active {
  background: linear-gradient(135deg, rgba(8, 188, 212, 0.95), rgba(8, 212, 140, 0.9));
  color: #031014;
}

.settings-account-actions .button {
  flex: 1 1 150px;
}

.settings-export-mini {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 0.7fr);
}

.settings-export-mini label {
  display: grid;
  gap: 7px;
}

.settings-export-help {
  border-top: 1px solid rgba(255, 252, 188, 0.1);
  line-height: 1.45;
  margin-top: 12px;
  padding-top: 12px;
}

.settings-export-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.settings-export-actions .button {
  flex: 0 0 auto;
}

.settings-export-actions span {
  color: #91a0b4;
  font-size: 12px;
  font-weight: 800;
}

@media (max-width: 760px) {
  input,
  select,
  textarea,
  .auth-form input {
    font-size: 16px;
  }

  .hee-pnl-top {
    align-items: stretch;
    grid-column: 1 / -1;
  }

  .hee-dashboard-tools {
    justify-content: stretch;
    width: 100%;
  }

  .hee-mini-action {
    flex: 1 1 0;
    justify-content: center;
    min-height: 34px;
    padding: 0 8px;
  }

  .dashboard-share-builder {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .dashboard-share-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .dashboard-share-preview {
    max-height: 58vh;
  }

  .compact-settings {
    grid-template-columns: 1fr;
  }

  .settings-export-mini {
    grid-template-columns: 1fr;
  }

  .settings-account-actions .button,
  .settings-theme-toggle .button,
  .settings-export-actions .button {
    flex: 1 1 100%;
  }
}

@media (max-width: 760px) {
  .main,
  .app-shell,
  .dashboard-grid,
  .calendar-panel,
  .calendar-grid {
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
  }

  .calendar-panel {
    border-radius: 18px;
    padding: 8px 6px;
  }

  .calendar-panel .calendar-head {
    padding: 8px 6px 10px;
  }

  .calendar-panel .calendar-head h2 {
    font-size: 16px;
    min-width: 0;
  }

  .calendar-actions {
    gap: 5px;
  }

  .calendar-actions .button {
    font-size: 12px;
    min-height: 34px;
    padding: 0 11px;
  }

  .calendar-actions .icon-button {
    min-height: 34px;
    width: 34px;
  }

  .calendar-board {
    margin-inline: 0;
    max-width: 100%;
    overflow: hidden;
    width: 100%;
  }

  .calendar-weekdays,
  .calendar-row {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    max-width: 100%;
    min-width: 0 !important;
    width: 100%;
  }

  .calendar-weekdays span {
    font-size: 9px;
    padding: 7px 4px;
  }

  .calendar-cell {
    gap: 4px;
    min-height: 58px;
    overflow: hidden;
    padding: 5px 4px;
    touch-action: pan-y;
  }

  .calendar-cell strong {
    font-size: 12px;
    line-height: 1.05;
  }

  .calendar-cell span,
  .calendar-cell small {
    font-size: 8px;
    line-height: 1.05;
  }

  .calendar-week-total {
    min-height: 32px;
    padding: 6px 8px;
  }
}

@media (max-width: 390px) {
  .calendar-panel {
    padding: 7px 4px;
  }

  .calendar-panel .calendar-head {
    padding-inline: 4px;
  }

  .calendar-actions .button {
    min-height: 32px;
    padding: 0 9px;
  }

  .calendar-actions .icon-button {
    min-height: 32px;
    width: 32px;
  }

  .calendar-board {
    max-width: 100%;
  }

  .calendar-cell {
    min-height: 54px;
    padding: 4px 3px;
  }

  .calendar-cell strong {
    font-size: 11px;
  }
}

@media (max-width: 760px) {
  .hee-pnl-card {
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding: 12px;
  }

  .hee-pnl-top {
    display: grid;
    gap: 8px;
    grid-template-columns: 1fr;
  }

  .hee-card-top small {
    text-align: left;
  }

  .hee-dashboard-tools {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hee-mini-action {
    min-width: 0;
    white-space: nowrap;
  }

  .hee-pnl-card > strong {
    font-size: clamp(30px, 10vw, 42px);
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .hee-pnl-footer {
    align-items: center;
    display: flex;
    justify-content: space-between;
    width: 100%;
  }
}

/* Final UX polish: scalable mentoring, light controls, and faster coarse-pointer taps. */
.mentor-command-grid {
  align-items: stretch;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(260px, 0.95fr) minmax(300px, 1.1fr) minmax(280px, 0.9fr);
  margin-bottom: 14px;
}

.mentor-command-card {
  align-content: start;
  display: grid;
  gap: 12px;
  min-width: 0;
}

.mentor-student-select {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.mentor-pulse-list,
.mentor-mini-trades,
.mentor-activity-list {
  display: grid;
  gap: 9px;
}

.mentor-pulse-row,
.mentor-mini-trade,
.mentor-activity-card {
  appearance: none;
  background:
    linear-gradient(145deg, rgba(255, 252, 188, 0.045), rgba(8, 188, 212, 0.024)),
    rgba(3, 8, 13, 0.54);
  border: 1px solid rgba(255, 252, 188, 0.11);
  border-radius: 16px;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  min-width: 0;
  text-align: left;
}

.qa-results-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  margin: -2px 0 12px;
}

.mentor-pulse-row {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 11px 12px;
}

.mentor-pulse-row.is-active {
  background:
    linear-gradient(135deg, rgba(8, 188, 212, 0.2), rgba(8, 212, 140, 0.12)),
    rgba(3, 8, 13, 0.68);
  border-color: rgba(8, 212, 140, 0.34);
}

.mentor-pulse-row span,
.mentor-activity-card > span,
.mentor-mini-trade {
  min-width: 0;
}

.mentor-pulse-row strong,
.mentor-pulse-row small,
.mentor-activity-card strong,
.mentor-activity-card small,
.mentor-mini-trade span,
.mentor-mini-trade strong,
.mentor-student-cell strong,
.mentor-student-cell small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mentor-pulse-row small,
.mentor-activity-card small,
.mentor-mini-trade span,
.mentor-student-cell small {
  color: var(--muted);
  font-size: 11px;
}

.mentor-pulse-row b,
.mentor-activity-card b,
.mentor-mini-trade b {
  font-family: var(--display-font);
  font-size: 13px;
}

.mentor-student-board {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  margin-bottom: 14px;
}

.mentor-student-card {
  align-content: start;
}

.mentor-student-card .mentor-kpis {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mentor-student-card .summary-item {
  min-height: 74px;
}

.mentor-mini-trade {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(86px, 0.75fr) minmax(0, 1fr) auto;
  padding: 10px 11px;
}

.mentor-activity-card {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(120px, 0.8fr) minmax(0, 1.1fr) auto;
  padding: 12px;
}

.mentor-activity-meta {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-width: 0;
}

.mentor-activity-meta em {
  color: var(--cream);
  font-style: normal;
  font-weight: 900;
}

.mentor-trades-panel .table-wrap {
  max-height: min(620px, 70vh);
  overflow: auto;
}

.mentor-student-cell {
  display: grid;
  gap: 3px;
}

button,
.button,
.icon-button,
.nav-button,
.mobile-tab,
[data-action] {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button,
.button,
.icon-button,
.nav-button,
.mobile-tab {
  user-select: none;
}

@media (pointer: coarse) {
  .button,
  .icon-button,
  .nav-button,
  .mobile-tab,
  .mentor-pulse-row,
  .mentor-mini-trade,
  .mentor-activity-card {
    transition: background-color 80ms ease, border-color 80ms ease, color 80ms ease, transform 80ms ease;
  }

  .button:active,
  .icon-button:active,
  .nav-button:active,
  .mobile-tab:active,
  .mentor-pulse-row:active,
  .mentor-mini-trade:active,
  .mentor-activity-card:active {
    transform: scale(0.985);
  }

  .mobile-tabbar {
    backdrop-filter: none;
    contain: layout paint;
  }
}

/* Account security controls */
.security-panel .panel-head span {
  color: var(--muted);
}

.security-list {
  display: grid;
  gap: 12px;
}

.security-row,
.security-factor,
.mfa-enroll-card {
  align-items: center;
  background: rgba(8, 188, 212, 0.055);
  border: 1px solid rgba(255, 252, 188, 0.12);
  border-radius: 18px;
  display: grid;
  gap: 12px;
  padding: 14px;
}

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

.security-row strong,
.mfa-enroll-card strong {
  color: var(--text);
  display: block;
  font-size: 14px;
}

.security-row span,
.mfa-enroll-card span,
.security-factor small {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 4px;
}

.security-actions,
.mfa-code-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.security-factor {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.security-factor span {
  color: var(--text);
  font-weight: 800;
}

.mfa-enroll-card {
  align-items: start;
}

.mfa-enroll-card img {
  background: #fff;
  border-radius: 16px;
  max-width: 190px;
  padding: 10px;
  width: 100%;
}

.mfa-enroll-card code {
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid rgba(255, 252, 188, 0.1);
  border-radius: 12px;
  color: var(--accent-warm, #fffcbc);
  display: block;
  font-size: 12px;
  overflow-wrap: anywhere;
  padding: 10px;
}

.mfa-code-row input {
  max-width: 160px;
}

@media (max-width: 680px) {
  .security-row,
  .security-factor {
    grid-template-columns: 1fr;
  }

  .security-actions,
  .mfa-code-row {
    justify-content: stretch;
  }

  .security-actions .button,
  .mfa-code-row .button,
  .mfa-code-row input {
    max-width: none;
    width: 100%;
  }
}

:root[data-theme="light"] .button,
:root[data-theme="light"] .icon-button,
:root[data-theme="light"] .nav-button,
:root[data-theme="light"] .mobile-tab,
:root[data-theme="light"] .mentor-pulse-row,
:root[data-theme="light"] .mentor-mini-trade,
:root[data-theme="light"] .mentor-activity-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(238, 247, 249, 0.86));
  border-color: rgba(5, 19, 29, 0.13);
  color: #071017;
}

:root[data-theme="light"] .button.ghost,
:root[data-theme="light"] .icon-button {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86), 0 10px 26px rgba(23, 45, 64, 0.08);
}

:root[data-theme="light"] .button.primary,
:root[data-theme="light"] .nav-button.is-active,
:root[data-theme="light"] .mobile-tab.is-active,
:root[data-theme="light"] .settings-theme-toggle .button.is-active {
  background: linear-gradient(135deg, #08bcd4, #08d48c);
  border-color: rgba(5, 19, 29, 0.12);
  color: #031014;
  box-shadow: 0 14px 34px rgba(8, 188, 212, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

:root[data-theme="light"] .button.danger {
  background: linear-gradient(135deg, rgba(255, 64, 94, 0.16), rgba(255, 159, 28, 0.12));
  border-color: rgba(255, 64, 94, 0.28);
  color: #9f1239;
}

:root[data-theme="light"] .mobile-tabbar {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(5, 19, 29, 0.12);
  box-shadow: 0 18px 44px rgba(23, 45, 64, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

@media (max-width: 1120px) {
  .mentor-command-grid {
    grid-template-columns: 1fr 1fr;
  }

  .mentor-library-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .mentor-command-grid,
  .mentor-student-board {
    grid-template-columns: 1fr;
  }

  .mentor-command-grid {
    gap: 10px;
  }

  .mentor-student-card .mentor-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mentor-student-head {
    align-items: stretch;
    display: grid;
    gap: 10px;
  }

  .mentor-student-head .button {
    min-height: 38px;
  }

  .mentor-mini-trade,
  .mentor-activity-card {
    grid-template-columns: 1fr auto;
  }

  .mentor-mini-trade span,
  .mentor-activity-card > span:first-child {
    grid-column: 1 / -1;
  }

  .mentor-trades-panel .table-wrap {
    max-height: none;
  }
}

/* Dashboard order polish: equity first, calendar, then monthly review. */
:root {
  --equity-blue: #7ddfff;
}

.dashboard-equity-grid {
  grid-template-columns: 1fr;
}

.dashboard-equity-panel {
  min-width: 0;
}

.dashboard-month-review {
  margin-top: 14px;
}

.curve-line,
.curve-line.positive,
.curve-line.negative {
  stroke: var(--equity-blue);
}

.curve-terminal,
.curve-terminal.positive,
.curve-terminal.negative {
  fill: var(--equity-blue);
  stroke: rgba(3, 7, 12, 0.94);
}

/* Prep history: compact saved NQ reads for the current trading week. */
.qa-nq-history-button {
  min-height: 38px;
  padding-inline: 12px;
  white-space: nowrap;
}

.nq-history-modal .modal-head p {
  color: var(--muted);
}

.nq-history-list {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.nq-history-card {
  background:
    linear-gradient(145deg, rgba(125, 223, 255, 0.055), rgba(255, 159, 28, 0.035)),
    rgba(3, 8, 13, 0.62);
  border: 1px solid rgba(255, 252, 188, 0.12);
  border-radius: 18px;
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 14px;
}

.nq-history-card.is-empty {
  opacity: 0.72;
}

.nq-history-card-head {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  min-width: 0;
}

.nq-history-card-head > span,
.nq-history-meta span,
.nq-history-signals span {
  color: var(--muted);
  font-family: var(--display-font);
  font-size: 11px;
  font-weight: 800;
}

.nq-history-card-head > div {
  align-items: center;
  display: inline-flex;
  gap: 8px;
}

.nq-history-card-head strong {
  color: var(--cream);
  font-family: var(--display-font);
}

.nq-history-card p,
.nq-history-card small {
  line-height: 1.45;
  margin: 0;
}

.nq-history-card p {
  color: var(--text);
  font-weight: 850;
}

.nq-history-card small {
  color: var(--muted);
}

.nq-history-meta,
.nq-history-signals {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.nq-history-meta span,
.nq-history-signals span {
  background: rgba(255, 252, 188, 0.06);
  border: 1px solid rgba(255, 252, 188, 0.1);
  border-radius: 999px;
  padding: 4px 8px;
}

@media (max-width: 760px) {
  .qa-nq-actions {
    align-items: stretch;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .qa-nq-history-button {
    flex: 1 1 96px;
    justify-content: center;
  }

  .nq-history-list {
    grid-template-columns: 1fr;
  }
}

/* Reliable dashboard rings: SVG strokes avoid mobile conic-gradient artifacts. */
.hee-ring {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  overflow: visible;
  padding: 0 !important;
  place-items: center;
  position: relative;
}

.hee-ring-graphic {
  filter: drop-shadow(0 0 14px color-mix(in srgb, var(--ring-color) 24%, transparent));
  height: 100%;
  inset: 0;
  overflow: visible;
  position: absolute;
  transform: rotate(-90deg);
  width: 100%;
}

.hee-ring-track,
.hee-ring-progress {
  fill: none;
  stroke-width: 10;
}

.hee-ring-track {
  stroke: rgba(255, 252, 188, 0.16);
}

.hee-ring-progress {
  stroke: var(--ring-color);
  stroke-linecap: round;
  transition: stroke-dashoffset 260ms ease;
}

.hee-ring > div {
  box-shadow: 0 0 18px rgba(3, 7, 12, 0.55), inset 0 1px 0 rgba(255, 252, 188, 0.09);
  height: 66% !important;
  position: relative;
  width: 66% !important;
  z-index: 1;
}

/* Prep badge alignment: keep NQ and status on the same visual center line. */
.qa-nq-market {
  align-items: center !important;
  box-sizing: border-box;
  display: inline-flex !important;
  flex: 0 0 auto !important;
  gap: 8px;
  min-height: 38px;
  padding: 7px 9px !important;
}

.qa-nq-market strong,
.qa-bias-pill {
  align-items: center;
  display: inline-flex;
  line-height: 1;
}

.qa-nq-market strong {
  min-height: 22px;
}

.qa-bias-pill {
  box-sizing: border-box;
  justify-content: center;
  min-height: 22px;
  padding: 0 8px !important;
}

/* Fast tap layer: keep mobile controls responsive even with the glass UI. */
button.is-fast-pressing,
.button.is-fast-pressing,
.nav-button.is-fast-pressing,
.mobile-tab.is-fast-pressing {
  transform: translate3d(0, 1px, 0) scale(0.99);
}

.nav-button,
.mobile-tab,
.button,
.icon-button,
.weekly-journal-main,
.weekly-journal-arrow,
.analyzer-toggle {
  cursor: pointer;
  touch-action: manipulation;
}

@media (pointer: coarse) {
  .nav-button,
  .mobile-tab,
  .button,
  .icon-button,
  .weekly-journal-main,
  .weekly-journal-arrow,
  .analyzer-toggle {
    transition: background-color 60ms linear, border-color 60ms linear, color 60ms linear, transform 60ms ease !important;
    will-change: transform;
  }

  .nav-button:hover,
  .mobile-tab:hover,
  .button:hover,
  .icon-button:hover,
  .weekly-journal-arrow:hover {
    box-shadow: inherit;
  }

  .mobile-tabbar,
  .dashboard-analyzer-actions .weekly-journal-split,
  .calendar-actions .button,
  .calendar-actions .icon-button {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
}

/* Performance pass: keep glass on large shells, but avoid expensive blur on repeated rows/cards. */
.stat-card,
.summary-item,
.detail-grid > div,
.tag-card,
.qa-card,
.qa-answer-card,
.saved-value-category,
.stock-account-card,
.month-kpis div,
.mentor-student-card,
.mentor-safe-note,
.restore-item,
.trade-table tbody tr,
.analyzer-card,
.habit-card,
.mistake-item,
.weekday-performance-card,
.dashboard-day-trade,
.hee-metric-card,
.nq-history-card {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  box-shadow: inset 0 1px 0 rgba(255, 252, 188, 0.06), 0 12px 32px rgba(0, 0, 0, 0.22) !important;
}

.saved-value-category,
.analyzer-card,
.habit-card,
.mistake-item,
.dashboard-day-trade,
.nq-history-card {
  contain: content;
}

.button,
.icon-button,
.nav-button,
.mobile-tab,
.weekly-journal-main,
.weekly-journal-arrow,
.analyzer-toggle {
  transition: background-color 90ms linear, border-color 90ms linear, color 90ms linear, transform 90ms ease !important;
}

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

/* Desktop scroll performance: remove the paint-heavy pieces that make mouse-wheel scrolling stutter. */
@media (pointer: fine) {
  html,
  body {
    background-attachment: scroll !important;
  }

  .page-head,
  .panel,
  .qa-nq-panel,
  .modal,
  .auth-panel,
  .sync-card,
  .compact-form,
  .hee-pnl-card,
  .hee-metric-card,
  .mobile-tabbar {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }

  .page-head,
  .panel,
  .qa-nq-panel,
  .auth-panel,
  .sync-card,
  .compact-form,
  .hee-pnl-card,
  .hee-metric-card {
    box-shadow: inset 0 1px 0 rgba(255, 252, 188, 0.06), 0 10px 28px rgba(0, 0, 0, 0.24) !important;
  }

  .hee-pnl-card::after,
  .hee-metric-card::after,
  .panel::after,
  .stat-card::after {
    display: none !important;
  }

  .curve-line,
  .hee-ring-graphic {
    filter: none !important;
  }

  .button:hover,
  .icon-button:hover,
  .nav-button:hover,
  .mobile-tab:hover {
    transform: none !important;
  }

  .panel,
  .qa-card,
  .qa-answer-card,
  .analyzer-card,
  .habit-card,
  .mistake-item,
  .mentor-student-card,
  .saved-value-category,
  .trade-table,
  .dashboard-day-trade {
    content-visibility: auto;
    contain-intrinsic-size: 1px 220px;
  }

  .trade-detail-modal {
    max-height: calc(100vh - 28px);
    overscroll-behavior: contain;
    scroll-behavior: auto;
    scrollbar-gutter: stable;
  }

  .trade-detail-modal .modal-head {
    transform: translateZ(0);
  }

  .trade-detail-modal .detail-grid > div,
  .trade-detail-modal .tag-card,
  .trade-detail-modal .qa-card,
  .trade-detail-modal .notes-view,
  .trade-detail-modal .recording-link,
  .trade-detail-modal .shot-card {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    box-shadow: none !important;
  }

  .trade-detail-modal .notes-view {
    max-height: none;
    overflow: visible;
  }
}

/* Analyzer missed metrics: keep label and value on one clean row. */
.analyzer-missed-metrics {
  gap: 10px;
}

.analyzer-missed-metrics .summary-item {
  align-items: center;
  background:
    linear-gradient(180deg, rgba(255, 252, 188, 0.04), rgba(255, 255, 255, 0.01)),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  min-height: 58px;
  padding: 12px 14px;
}

.analyzer-missed-metrics .summary-item > span,
.analyzer-missed-metrics .summary-item > strong {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  display: inline-flex;
  line-height: 1.12;
  padding: 0 !important;
}

.analyzer-missed-metrics .summary-item > span {
  color: var(--muted);
  flex: 1 1 auto;
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.analyzer-missed-metrics .summary-item > strong {
  color: var(--cream);
  flex: 0 1 56%;
  font-size: clamp(18px, 4vw, 24px);
  justify-content: flex-end;
  text-align: right;
}

@media (max-width: 430px) {
  .analyzer-missed-metrics .summary-item {
    min-height: 52px;
    padding: 10px 12px;
  }

  .analyzer-missed-metrics .summary-item > strong {
    font-size: 18px;
  }
}

/* Light theme completion layer: flip hardcoded dark glass surfaces and chips. */
:root[data-theme="light"] .page-head,
:root[data-theme="light"] .panel,
:root[data-theme="light"] .qa-nq-panel,
:root[data-theme="light"] .auth-panel,
:root[data-theme="light"] .sync-card,
:root[data-theme="light"] .compact-form,
:root[data-theme="light"] .modal,
:root[data-theme="light"] .stat-card,
:root[data-theme="light"] .summary-item,
:root[data-theme="light"] .detail-grid > div,
:root[data-theme="light"] .tag-card,
:root[data-theme="light"] .qa-card,
:root[data-theme="light"] .qa-answer-card,
:root[data-theme="light"] .saved-value-category,
:root[data-theme="light"] .stock-account-card,
:root[data-theme="light"] .month-kpis div,
:root[data-theme="light"] .mentor-student-card,
:root[data-theme="light"] .mentor-safe-note,
:root[data-theme="light"] .restore-item,
:root[data-theme="light"] .trade-table,
:root[data-theme="light"] .trade-table tbody tr,
:root[data-theme="light"] .analyzer-card,
:root[data-theme="light"] .habit-card,
:root[data-theme="light"] .mistake-item,
:root[data-theme="light"] .weekday-performance-card,
:root[data-theme="light"] .dashboard-day-trade,
:root[data-theme="light"] .hee-pnl-card,
:root[data-theme="light"] .hee-metric-card,
:root[data-theme="light"] .nq-history-card,
:root[data-theme="light"] .mini-list span,
:root[data-theme="light"] .weekday-performance div,
:root[data-theme="light"] .insight-list div,
:root[data-theme="light"] .mobile-tabbar {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(242, 250, 251, 0.86)),
    rgba(255, 255, 255, 0.9) !important;
  border-color: rgba(7, 16, 23, 0.12) !important;
  color: var(--text) !important;
}

:root[data-theme="light"] .account-filter select,
:root[data-theme="light"] .field input,
:root[data-theme="light"] .field select,
:root[data-theme="light"] .field textarea,
:root[data-theme="light"] .form-field input,
:root[data-theme="light"] .form-field select,
:root[data-theme="light"] .form-field textarea,
:root[data-theme="light"] .tag-combo input,
:root[data-theme="light"] .tag-combo select,
:root[data-theme="light"] input,
:root[data-theme="light"] select,
:root[data-theme="light"] textarea,
:root[data-theme="light"] .combo-list,
:root[data-theme="light"] .tag-combo,
:root[data-theme="light"] .news-picker input,
:root[data-theme="light"] .qa-news-picker input {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(239, 247, 248, 0.94)),
    #ffffff !important;
  border-color: rgba(7, 16, 23, 0.14) !important;
  color: #071017 !important;
}

:root[data-theme="light"] .tag-chip,
:root[data-theme="light"] .pill,
:root[data-theme="light"] .badge,
:root[data-theme="light"] .qa-filter-chip,
:root[data-theme="light"] .news-chip,
:root[data-theme="light"] .saved-value-pill,
:root[data-theme="light"] .account-badge,
:root[data-theme="light"] .market-pill,
:root[data-theme="light"] .market-badge,
:root[data-theme="light"] .narrative-badge,
:root[data-theme="light"] .narrative-result-badge,
:root[data-theme="light"] .combo-option,
:root[data-theme="light"] .qa-bias-pill,
:root[data-theme="light"] .qa-nq-market,
:root[data-theme="light"] .nq-history-meta span,
:root[data-theme="light"] .nq-history-signals span {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(235, 247, 249, 0.92)),
    #ffffff !important;
  border-color: rgba(7, 16, 23, 0.14) !important;
  color: #071017 !important;
}

:root[data-theme="light"] .button,
:root[data-theme="light"] .icon-button,
:root[data-theme="light"] .nav-button,
:root[data-theme="light"] .mobile-tab,
:root[data-theme="light"] .weekly-journal-arrow,
:root[data-theme="light"] .analyzer-toggle {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(235, 247, 249, 0.9)),
    #ffffff !important;
  border-color: rgba(7, 16, 23, 0.14) !important;
  color: #071017 !important;
}

:root[data-theme="light"] .button.primary,
:root[data-theme="light"] .mobile-tab.is-active,
:root[data-theme="light"] .nav-button.is-active,
:root[data-theme="light"] .weekly-journal-main,
:root[data-theme="light"] .segmented button.is-active,
:root[data-theme="light"] .auth-switch button.is-active {
  background: linear-gradient(135deg, #08bcd4, #08d48c) !important;
  border-color: rgba(8, 188, 212, 0.28) !important;
  color: #031014 !important;
}

:root[data-theme="light"] .muted,
:root[data-theme="light"] .muted-line,
:root[data-theme="light"] .page-head p,
:root[data-theme="light"] .panel-head span,
:root[data-theme="light"] .stat-card span,
:root[data-theme="light"] .summary-item span,
:root[data-theme="light"] .analyzer-card span,
:root[data-theme="light"] .analyzer-card small,
:root[data-theme="light"] .combo-option small,
:root[data-theme="light"] .combo-empty,
:root[data-theme="light"] label,
:root[data-theme="light"] .field label,
:root[data-theme="light"] .form-field label {
  color: #536173 !important;
}

:root[data-theme="light"] .stat-card strong,
:root[data-theme="light"] .summary-item strong,
:root[data-theme="light"] .analyzer-insight-card strong,
:root[data-theme="light"] .habit-card strong,
:root[data-theme="light"] .mini-list strong,
:root[data-theme="light"] .nq-history-card-head strong,
:root[data-theme="light"] .nq-history-card p {
  color: #071017 !important;
}

:root[data-theme="light"] .positive,
:root[data-theme="light"] strong.positive,
:root[data-theme="light"] span.positive,
:root[data-theme="light"] em.positive {
  color: var(--positive) !important;
}

:root[data-theme="light"] .negative,
:root[data-theme="light"] strong.negative,
:root[data-theme="light"] span.negative,
:root[data-theme="light"] em.negative {
  color: var(--negative) !important;
}

/* PA Empire desktop performance mode.
   PC wheel scrolling was repainting too much glass, fixed backgrounds, and large shadows.
   Keep the product look, but use solid/composited surfaces on fine-pointer devices. */
@media (pointer: fine) {
  html {
    scroll-behavior: auto !important;
  }

  body {
    background:
      radial-gradient(circle at 16% 0%, rgba(8, 188, 212, 0.12), transparent 28%),
      linear-gradient(135deg, rgba(255, 159, 28, 0.055), transparent 38%),
      #030609 !important;
    background-attachment: scroll !important;
    background-size: auto !important;
    text-rendering: optimizeSpeed !important;
  }

  :root[data-theme="light"] body {
    background:
      radial-gradient(circle at 16% 0%, rgba(8, 188, 212, 0.12), transparent 30%),
      linear-gradient(135deg, rgba(255, 159, 28, 0.12), transparent 38%),
      #eff7f8 !important;
  }

  .modal-backdrop,
  .lightbox,
  .mobile-tabbar,
  .sidebar,
  .page-head,
  .panel,
  .stat-card,
  .summary-item,
  .detail-grid > div,
  .qa-card,
  .qa-answer-card,
  .tag-card,
  .saved-value-category,
  .stock-account-card,
  .month-kpis div,
  .mentor-student-card,
  .mentor-safe-note,
  .restore-item,
  .trade-table tbody tr,
  .qa-nq-panel,
  .modal,
  .auth-panel,
  .sync-card,
  .compact-form,
  .analyzer-card,
  .habit-card,
  .mistake-item,
  .weekday-performance-card,
  .dashboard-day-trade,
  .hee-pnl-card,
  .hee-metric-card,
  .nq-history-card,
  .calendar-panel,
  .calendar-board,
  .calendar-cell,
  .calendar-week-total,
  .combo-list,
  .settings-section,
  .trade-card {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }

  .panel,
  .page-head,
  .stat-card,
  .summary-item,
  .detail-grid > div,
  .qa-card,
  .qa-answer-card,
  .tag-card,
  .saved-value-category,
  .stock-account-card,
  .month-kpis div,
  .mentor-student-card,
  .mentor-safe-note,
  .restore-item,
  .trade-table tbody tr,
  .qa-nq-panel,
  .auth-panel,
  .sync-card,
  .compact-form,
  .analyzer-card,
  .habit-card,
  .mistake-item,
  .weekday-performance-card,
  .dashboard-day-trade,
  .hee-pnl-card,
  .hee-metric-card,
  .nq-history-card,
  .calendar-panel,
  .calendar-board,
  .calendar-cell,
  .calendar-week-total,
  .settings-section,
  .trade-card {
    box-shadow: inset 0 1px 0 rgba(255, 252, 188, 0.055), 0 8px 20px rgba(0, 0, 0, 0.18) !important;
  }

  .modal,
  .trade-detail-modal {
    background:
      linear-gradient(145deg, rgba(255, 252, 188, 0.035), rgba(8, 188, 212, 0.018)),
      #071019 !important;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.34) !important;
    contain: layout paint;
    transform: none !important;
    will-change: auto !important;
  }

  .modal-backdrop,
  .lightbox {
    background: rgba(0, 0, 0, 0.68) !important;
  }

  .main,
  .modal,
  .trade-detail-modal,
  .notes-view,
  .table-wrap,
  .qa-results,
  .combo-list {
    overscroll-behavior: contain;
    scroll-behavior: auto !important;
  }

  .trade-detail-modal {
    max-height: calc(100dvh - 24px) !important;
    overflow-y: auto !important;
    scrollbar-gutter: stable;
  }

  .trade-detail-modal .notes-view {
    contain: content;
    max-height: min(52vh, 560px) !important;
    overflow: auto !important;
  }

  .hee-pnl-card::before,
  .hee-pnl-card::after,
  .hee-metric-card::before,
  .hee-metric-card::after,
  .panel::before,
  .panel::after,
  .stat-card::before,
  .stat-card::after,
  .calendar-panel::before,
  .calendar-panel::after {
    display: none !important;
  }

  .curve-line,
  .hee-ring-graphic,
  .brand-logo,
  .icon,
  svg {
    filter: none !important;
  }

  .button,
  .icon-button,
  .nav-button,
  .mobile-tab,
  .weekly-journal-main,
  .weekly-journal-arrow,
  .analyzer-toggle,
  .calendar-cell,
  .trade-table tbody tr {
    transition: background-color 70ms linear, border-color 70ms linear, color 70ms linear !important;
    will-change: auto !important;
  }

  .button:hover,
  .icon-button:hover,
  .nav-button:hover,
  .mobile-tab:hover,
  .calendar-cell:hover,
  .trade-table tbody tr:hover {
    box-shadow: inherit !important;
    transform: none !important;
  }

  :root[data-theme="light"] .modal,
  :root[data-theme="light"] .trade-detail-modal {
    background:
      linear-gradient(145deg, rgba(255, 255, 255, 0.58), rgba(218, 233, 229, 0.7)),
      #f6fbfb !important;
    box-shadow: 0 12px 28px rgba(23, 45, 64, 0.12) !important;
  }
}

/* Desktop shell guard: keep the side menu glass rail full-height. */
@media (min-width: 901px) {
  #app,
  .app-shell {
    min-height: 100vh;
  }

  .app-shell {
    align-items: stretch;
  }

  .sidebar {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    height: 100vh;
    min-height: 100vh;
    overflow: hidden auto;
    position: sticky;
    top: 0;
  }

  .desktop-nav {
    align-content: start;
    flex: 1 1 auto;
  }
}

:root[data-theme="light"] .warning,
:root[data-theme="light"] strong.warning,
:root[data-theme="light"] span.warning {
  color: var(--warning) !important;
}

.analyzer-missed-metrics .summary-item > span,
.analyzer-missed-metrics .summary-item > strong {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  display: inline-flex !important;
  line-height: 1.12;
  padding: 0 !important;
}

/* Light theme refinement: muted green-gray glass, closer to the HEE palette. */
:root[data-theme="light"] {
  --light-hee-bg: #d6e8e4;
  --light-hee-surface: rgba(136, 151, 148, 0.68);
  --light-hee-surface-strong: rgba(123, 139, 136, 0.78);
  --light-hee-input: rgba(218, 233, 229, 0.82);
}

:root[data-theme="light"] body,
:root[data-theme="light"] .main {
  background:
    radial-gradient(circle at 16% 0%, rgba(8, 188, 212, 0.18), transparent 34%),
    radial-gradient(circle at 86% 14%, rgba(255, 156, 24, 0.16), transparent 30%),
    linear-gradient(180deg, rgba(232, 246, 243, 0.96), var(--light-hee-bg)) !important;
}

:root[data-theme="light"] .page-head,
:root[data-theme="light"] .panel,
:root[data-theme="light"] .qa-nq-panel,
:root[data-theme="light"] .auth-panel,
:root[data-theme="light"] .sync-card,
:root[data-theme="light"] .compact-form,
:root[data-theme="light"] .modal,
:root[data-theme="light"] .stat-card,
:root[data-theme="light"] .summary-item,
:root[data-theme="light"] .detail-grid > div,
:root[data-theme="light"] .tag-card,
:root[data-theme="light"] .qa-card,
:root[data-theme="light"] .qa-answer-card,
:root[data-theme="light"] .saved-value-category,
:root[data-theme="light"] .month-kpis div,
:root[data-theme="light"] .mentor-student-card,
:root[data-theme="light"] .mentor-safe-note,
:root[data-theme="light"] .restore-item,
:root[data-theme="light"] .trade-table,
:root[data-theme="light"] .trade-table tbody tr,
:root[data-theme="light"] .analyzer-card,
:root[data-theme="light"] .habit-card,
:root[data-theme="light"] .mistake-item,
:root[data-theme="light"] .weekday-performance-card,
:root[data-theme="light"] .dashboard-day-trade,
:root[data-theme="light"] .hee-pnl-card,
:root[data-theme="light"] .hee-metric-card,
:root[data-theme="light"] .nq-history-card,
:root[data-theme="light"] .mini-list span,
:root[data-theme="light"] .weekday-performance div,
:root[data-theme="light"] .insight-list div {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.38), rgba(136, 151, 148, 0.54)),
    var(--light-hee-surface) !important;
  border-color: rgba(38, 58, 55, 0.22) !important;
  color: #071017 !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.42),
    0 18px 44px rgba(24, 50, 47, 0.13) !important;
}

:root[data-theme="light"] .calendar-board,
:root[data-theme="light"] .calendar-cell,
:root[data-theme="light"] .calendar-week-total {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.24), rgba(123, 139, 136, 0.58)),
    var(--light-hee-surface-strong) !important;
  border-color: rgba(38, 58, 55, 0.24) !important;
  color: #071017 !important;
}

:root[data-theme="light"] .account-filter select,
:root[data-theme="light"] .field input,
:root[data-theme="light"] .field select,
:root[data-theme="light"] .field textarea,
:root[data-theme="light"] .form-field input,
:root[data-theme="light"] .form-field select,
:root[data-theme="light"] .form-field textarea,
:root[data-theme="light"] .tag-combo input,
:root[data-theme="light"] .tag-combo select,
:root[data-theme="light"] input,
:root[data-theme="light"] select,
:root[data-theme="light"] textarea,
:root[data-theme="light"] .combo-list,
:root[data-theme="light"] .tag-combo,
:root[data-theme="light"] .news-picker input,
:root[data-theme="light"] .qa-news-picker input {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(218, 233, 229, 0.78)),
    var(--light-hee-input) !important;
  border-color: rgba(38, 58, 55, 0.2) !important;
  color: #071017 !important;
}

:root[data-theme="light"] .tag-chip,
:root[data-theme="light"] .pill,
:root[data-theme="light"] .badge,
:root[data-theme="light"] .qa-filter-chip,
:root[data-theme="light"] .news-chip,
:root[data-theme="light"] .saved-value-pill,
:root[data-theme="light"] .account-badge,
:root[data-theme="light"] .market-pill,
:root[data-theme="light"] .market-badge,
:root[data-theme="light"] .narrative-badge,
:root[data-theme="light"] .narrative-result-badge,
:root[data-theme="light"] .combo-option,
:root[data-theme="light"] .qa-bias-pill,
:root[data-theme="light"] .qa-nq-market,
:root[data-theme="light"] .nq-history-meta span,
:root[data-theme="light"] .nq-history-signals span,
:root[data-theme="light"] .button,
:root[data-theme="light"] .icon-button,
:root[data-theme="light"] .nav-button,
:root[data-theme="light"] .mobile-tab,
:root[data-theme="light"] .weekly-journal-arrow,
:root[data-theme="light"] .analyzer-toggle {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(211, 228, 224, 0.74)),
    rgba(221, 236, 233, 0.78) !important;
  border-color: rgba(38, 58, 55, 0.2) !important;
  color: #071017 !important;
}

:root[data-theme="light"] .button.primary,
:root[data-theme="light"] .mobile-tab.is-active,
:root[data-theme="light"] .nav-button.is-active,
:root[data-theme="light"] .weekly-journal-main,
:root[data-theme="light"] .segmented button.is-active,
:root[data-theme="light"] .auth-switch button.is-active {
  background: linear-gradient(135deg, #08bcd4, #08d48c) !important;
  border-color: rgba(8, 188, 212, 0.28) !important;
  color: #031014 !important;
}

:root[data-theme="light"] .positive,
:root[data-theme="light"] strong.positive,
:root[data-theme="light"] span.positive,
:root[data-theme="light"] em.positive {
  color: var(--positive) !important;
}

:root[data-theme="light"] .negative,
:root[data-theme="light"] strong.negative,
:root[data-theme="light"] span.negative,
:root[data-theme="light"] em.negative {
  color: var(--negative) !important;
}
