/* Final PA Empire presentation layer. Keep this stylesheet loaded last. */
:root {
  --app-font: ui-monospace, "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --display-font: var(--app-font);
  --pae-bg: #070c14;
  --pae-sidebar: #09111c;
  --pae-surface: #0d1622;
  --pae-surface-raised: #111d2b;
  --pae-surface-soft: #09131f;
  --pae-line: #203246;
  --pae-line-soft: #172638;
  --pae-text: #f1f5f8;
  --pae-muted: #8d9bad;
}

body,
button,
input,
select,
textarea {
  letter-spacing: 0 !important;
}

body,
.main,
.app-shell,
.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,
.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,
.settings-section,
.trade-card,
.calendar-panel,
.calendar-board,
.calendar-cell,
.calendar-week-total,
.trade-table,
.modal,
.trade-detail-modal,
.lightbox-content,
.qa-nq-analysis,
.qa-nq-signal,
.qa-nq-recent-item,
.qa-nq-calendar-events,
.qa-nq-calendar-event {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  background-image: none !important;
  box-shadow: none !important;
  filter: none !important;
  text-shadow: none !important;
}

body,
.main,
.app-shell {
  background: var(--pae-bg) !important;
}

.sidebar {
  background: var(--pae-sidebar) !important;
}

.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,
.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,
.settings-section,
.trade-card,
.calendar-panel,
.calendar-board,
.calendar-cell,
.calendar-week-total,
.modal,
.trade-detail-modal,
.lightbox-content,
.qa-nq-analysis,
.qa-nq-signal,
.qa-nq-recent-item,
.qa-nq-calendar-events,
.qa-nq-calendar-event {
  background: var(--pae-surface) !important;
  border-color: var(--pae-line) !important;
  border-radius: var(--pae-radius) !important;
}

:root[data-theme="light"] body,
:root[data-theme="light"] .main,
:root[data-theme="light"] .app-shell {
  background: var(--pae-bg) !important;
}

:root[data-theme="light"] .sidebar {
  background: var(--pae-sidebar) !important;
}

:root[data-theme="light"] .page-head,
:root[data-theme="light"] .panel,
:root[data-theme="light"] .stat-card,
:root[data-theme="light"] .summary-item,
:root[data-theme="light"] .detail-grid > div,
:root[data-theme="light"] .qa-card,
:root[data-theme="light"] .qa-answer-card,
:root[data-theme="light"] .tag-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"] .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"] .hee-pnl-card,
:root[data-theme="light"] .hee-metric-card,
:root[data-theme="light"] .calendar-panel,
:root[data-theme="light"] .calendar-board,
:root[data-theme="light"] .calendar-cell,
:root[data-theme="light"] .calendar-week-total,
:root[data-theme="light"] .qa-nq-panel,
:root[data-theme="light"] .modal,
:root[data-theme="light"] .trade-detail-modal,
:root[data-theme="light"] .settings-section,
:root[data-theme="light"] .trade-card,
:root[data-theme="light"] .qa-nq-analysis,
:root[data-theme="light"] .qa-nq-signal,
:root[data-theme="light"] .qa-nq-recent-item,
:root[data-theme="light"] .qa-nq-calendar-events,
:root[data-theme="light"] .qa-nq-calendar-event {
  background: var(--pae-surface) !important;
  border-color: var(--pae-line) !important;
  color: var(--pae-text) !important;
}

:root[data-theme="light"] input,
:root[data-theme="light"] select,
:root[data-theme="light"] textarea,
:root[data-theme="light"] .tag-combo,
:root[data-theme="light"] .combo-list,
: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 {
  background: var(--pae-surface-raised) !important;
  background-image: none !important;
  border-color: var(--pae-line) !important;
  box-shadow: none !important;
  color: var(--pae-text) !important;
}

@media (max-width: 760px) {
  .trade-table tbody {
    gap: 8px !important;
  }

  .trade-table tbody tr:not(:has(.selection-cell)) {
    align-items: center;
    display: grid !important;
    gap: 3px 10px !important;
    grid-template-columns: auto minmax(0, 1fr) 68px 36px !important;
    grid-template-rows: auto 42px !important;
    min-height: 0 !important;
    padding: 12px !important;
  }

  .trade-table tbody tr:not(:has(.selection-cell)) .market-cell,
  .trade-table tbody tr:not(:has(.selection-cell)) .account-cell,
  .trade-table tbody tr:not(:has(.selection-cell)) .entry-cell,
  .trade-table tbody tr:not(:has(.selection-cell)) .narrative-cell,
  .trade-table tbody tr:not(:has(.selection-cell)) .news-cell {
    display: none !important;
  }

  .trade-table tbody tr:not(:has(.selection-cell)) .symbol-cell {
    align-items: center;
    display: flex !important;
    grid-column: 1 !important;
    grid-row: 1 !important;
  }

  .trade-table tbody tr:not(:has(.selection-cell)) .outcome-cell {
    grid-column: 2 !important;
    grid-row: 2 !important;
    justify-self: start;
  }

  .trade-table tbody tr:not(:has(.selection-cell)) .opened-cell {
    color: var(--pae-muted) !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    grid-column: 2 / 5 !important;
    grid-row: 1 !important;
    justify-self: end !important;
    line-height: 1.25 !important;
  }

  .trade-table tbody tr:not(:has(.selection-cell)) .pnl-cell {
    font-size: 15px !important;
    font-weight: 700 !important;
    grid-column: 1 !important;
    grid-row: 2 !important;
    line-height: 1.2 !important;
  }

  .trade-table tbody tr:not(:has(.selection-cell)) .actions-cell {
    align-self: center !important;
    grid-column: 4 !important;
    grid-row: 2 !important;
    justify-content: flex-end !important;
  }

  .trade-table tbody tr:not(:has(.selection-cell)) .actions-cell .icon-button {
    min-height: 36px !important;
    min-width: 36px !important;
  }

  .trade-table tbody tr:not(:has(.selection-cell)) .preview-cell {
    align-self: stretch !important;
    display: block !important;
    grid-column: 3 !important;
    grid-row: 2 !important;
  }

  .trade-table tbody tr:not(:has(.selection-cell)) td[data-label]::before {
    display: none !important;
  }

  .trade-table tbody tr:not(:has(.selection-cell)) .symbol-chip,
  .trade-table tbody tr:not(:has(.selection-cell)) .outcome-badge {
    font-size: 14px !important;
    line-height: 1 !important;
  }

  .trade-table tbody tr:not(:has(.selection-cell)) .symbol-chip {
    background: transparent !important;
    border: 0 !important;
    color: var(--pae-text) !important;
    font-size: 18px !important;
    padding: 0 !important;
  }
}

.trade-preview-thumb {
  appearance: none;
  background: var(--pae-surface-soft);
  border: 1px solid var(--pae-line);
  border-radius: 6px;
  cursor: pointer;
  display: block;
  height: 42px;
  overflow: hidden;
  padding: 0;
  width: 68px;
}

.trade-preview-thumb > span,
.trade-preview-thumb img {
  display: block;
  height: 100%;
  width: 100%;
}

.trade-preview-thumb img {
  object-fit: cover;
  object-position: center;
  transform: scale(1.12);
}

.trade-preview-thumb .trade-thumb-missing {
  background: var(--pae-surface-soft);
}

.trade-preview-thumb .trade-thumb-missing::after {
  color: var(--pae-muted);
  content: "-";
  display: grid;
  height: 100%;
  place-items: center;
}

.calendar-cell {
  position: relative !important;
}

.calendar-cell.has-photo-toggle {
  padding-right: 46% !important;
}

.calendar-cell-thumb {
  border-radius: 6px !important;
  bottom: 8px !important;
  height: auto !important;
  position: absolute !important;
  right: 8px !important;
  top: 8px !important;
  width: 38% !important;
}

.calendar-photos-toggle.is-active {
  background: color-mix(in srgb, var(--accent) 22%, transparent) !important;
  border-color: var(--accent) !important;
  color: var(--accent) !important;
}

/* Match the day/week PNL numbers to the same bold, bright treatment as the
   Avg Win / Avg Loss stat cards and the hero Net P&L figure - they share the
   same --positive/--negative color already, they were just thin/small next
   to those. Scoped to desktop widths so the cramped mobile calendar sizing
   (set elsewhere for small screens) is left alone. */
@media (min-width: 761px) {
  .calendar-cell > span.positive,
  .calendar-cell > span.negative,
  .calendar-week-total > strong {
    font-size: 17px !important;
    font-weight: 800 !important;
  }
}

.trade-preview-empty {
  color: var(--pae-muted);
}

.trade-detail-date-compact {
  display: none;
}

.trade-detail-heading {
  min-width: 0;
}

.hee-avg-card {
  align-content: center;
  display: grid;
  gap: 8px;
}

.hee-avg-card > strong {
  display: block;
  margin: 0 !important;
  text-align: left;
}

.hee-pnl-insight {
  color: var(--pae-muted);
  font-size: 12px;
  line-height: 1.4;
  margin: 0 0 10px !important;
}

.trade-detail-heading h2 {
  align-items: center;
  display: flex;
  gap: 6px;
  margin: 0;
}

@media (max-width: 760px) {
  .hee-pnl-card .hee-pnl-insight {
    display: block !important;
    font-size: 10px;
    line-height: 1.3;
    margin: 0 0 8px !important;
  }

  #modal-root .trade-detail-modal .modal-head {
    align-items: center !important;
    display: grid !important;
    gap: 5px !important;
    grid-template-areas: "title date controls";
    grid-template-columns: auto minmax(0, 1fr) auto !important;
    margin-bottom: 8px !important;
    min-height: 44px;
    padding: 7px 9px !important;
  }

  #modal-root .trade-detail-modal .trade-detail-heading {
    display: contents;
  }

  #modal-root .trade-detail-modal .trade-detail-heading h2 {
    align-items: center;
    display: flex;
    flex: 0 0 auto;
    font-size: 15px !important;
    gap: 3px;
    grid-area: title;
    line-height: 1;
    margin: 0 !important;
    min-width: 0;
    white-space: nowrap;
  }

  #modal-root .trade-detail-modal .trade-detail-heading h2 .outcome-badge,
  #modal-root .trade-detail-modal .trade-detail-heading h2 .market-badge {
    font-size: 9px !important;
    line-height: 1 !important;
    padding: 3px 4px !important;
  }

  #modal-root .trade-detail-modal .trade-detail-heading p {
    color: var(--pae-muted) !important;
    font-size: 10.5px !important;
    grid-area: date;
    line-height: 1.1;
    margin: 0 !important;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .trade-detail-date-full {
    display: none;
  }

  .trade-detail-date-compact {
    display: inline;
  }

  #modal-root .trade-detail-modal .modal-head .button-row,
  #modal-root .trade-detail-modal .modal-head .modal-actions {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 2px !important;
    grid-area: controls;
    grid-template-columns: none !important;
    justify-self: end !important;
    width: auto !important;
  }

  #modal-root .trade-detail-modal .modal-head .button-row .button,
  #modal-root .trade-detail-modal .modal-head .button-row .icon-button,
  #modal-root .trade-detail-modal .modal-head .modal-actions .button,
  #modal-root .trade-detail-modal .modal-head .modal-actions .icon-button {
    border-radius: 8px !important;
    height: 30px !important;
    min-height: 30px !important;
    min-width: 30px !important;
    padding: 0 6px !important;
    width: 30px !important;
  }

  #modal-root .trade-detail-modal .modal-head .icon,
  #modal-root .trade-detail-modal .modal-head svg {
    height: 14px !important;
    width: 14px !important;
  }

  .trade-edit-label {
    display: none;
  }
}
/* Keep dense trade rows flat; legacy hover/card rules were still repainting shadows. */
.trade-table tbody tr,
.trade-table tbody tr:hover,
:root[data-theme="light"] .trade-table tbody tr,
:root[data-theme="light"] .trade-table tbody tr:hover {
  background-image: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Hovering/tapping a trade row used to swap in a different background and
   border color (several older rules across the theme files set these
   directly, not just the gradient/shadow layers above), which read as an
   unwanted color flash and cost a repaint on every pointer move. Pin both
   states to the same flat colors so hovering a row is a visual no-op. */
.trade-table tbody tr,
.trade-table tbody tr:hover {
  background-color: var(--pae-surface-soft) !important;
  border-color: var(--pae-line) !important;
  transition: none !important;
}

/* A visible, layout-stable marker for the actual current trading day. */
.calendar-cell.is-today {
  border-color: var(--pae-primary) !important;
  outline: 2px solid var(--pae-primary) !important;
  outline-offset: -2px !important;
}

.calendar-cell.is-today strong {
  color: var(--pae-primary) !important;
}

/* Share-card preview stays inside the viewport; the exported PNG remains 1440px. */
#modal-root .dashboard-share-modal {
  align-self: center !important;
  display: flex !important;
  flex-direction: column !important;
  height: auto !important;
  max-height: calc(100dvh - 20px) !important;
  max-width: min(720px, calc(100vw - 20px)) !important;
  overflow: hidden !important;
  padding: 14px !important;
  width: 100% !important;
}

#modal-root .dashboard-share-modal .modal-head {
  flex: 0 0 auto;
  margin: 0 0 10px !important;
  padding: 0 2px 10px !important;
}

#modal-root .dashboard-share-modal .modal-head h2 {
  font-size: 19px !important;
  line-height: 1.1 !important;
  margin: 0 0 3px !important;
}

#modal-root .dashboard-share-modal .modal-head p {
  font-size: 12px !important;
  margin: 0 !important;
}

#modal-root .dashboard-share-preview {
  align-items: center !important;
  align-self: center !important;
  aspect-ratio: 1 / 1 !important;
  background: #030a12 !important;
  border-color: rgba(125, 223, 255, 0.16) !important;
  border-radius: 8px !important;
  display: flex !important;
  flex: 0 1 auto !important;
  height: auto !important;
  justify-content: center !important;
  max-height: calc(100dvh - 142px) !important;
  max-width: 100% !important;
  min-height: 0 !important;
  overflow: hidden !important;
  padding: 8px !important;
  width: min(100%, calc(100dvh - 142px)) !important;
}

#modal-root .dashboard-share-preview img {
  border-radius: 6px !important;
  height: 100% !important;
  max-height: 100% !important;
  max-width: 100% !important;
  object-fit: contain !important;
  width: 100% !important;
}

#modal-root .dashboard-share-footer {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
  justify-content: space-between;
  min-height: 46px;
  padding-top: 10px;
}

#modal-root .dashboard-share-footer .weekly-journal-status {
  flex: 1 1 auto;
  margin: 0 !important;
  min-width: 0;
}

#modal-root .dashboard-share-footer .weekly-journal-status:empty {
  display: none;
}

#modal-root .dashboard-share-footer .modal-actions {
  display: flex !important;
  flex: 0 0 auto;
  gap: 8px !important;
  margin: 0 !important;
  padding: 0 !important;
}

#modal-root .dashboard-share-footer .button {
  min-height: 38px !important;
}

@media (max-width: 560px) {
  #modal-root .dashboard-share-modal {
    height: auto !important;
    max-height: calc(100dvh - 8px) !important;
    max-width: calc(100vw - 8px) !important;
    padding: 10px !important;
  }

  #modal-root .dashboard-share-footer {
    align-items: stretch;
    flex-direction: column;
    gap: 5px;
  }

  #modal-root .dashboard-share-footer .modal-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }
}

/* Weekly mentor plan: one cloud-synced source for mentor, students, and email. */
.weekly-market-plan {
  background: #0b1521 !important;
  border-color: #23405a !important;
  margin-top: 12px;
  padding: 16px !important;
}

.weekly-plan-head,
.weekly-plan-actions,
.weekly-plan-field-label {
  align-items: center;
  display: flex;
}

.weekly-plan-head {
  gap: 14px;
  justify-content: space-between;
}

.weekly-plan-head h2 {
  margin: 0;
}

.weekly-plan-head small,
.weekly-plan-field-label small,
.weekly-plan-shared-label,
.weekly-plan-empty {
  color: var(--pae-muted);
  font-size: 11px;
}

.weekly-plan-actions {
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-end;
}

.weekly-plan-actions .button,
.weekly-plan-actions .icon-button {
  min-height: 36px;
}

.weekly-plan-days {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-top: 14px;
}

.weekly-plan-day {
  align-items: center;
  background: #09121d;
  border: 1px solid var(--pae-line);
  border-radius: 6px;
  color: var(--pae-muted);
  cursor: pointer;
  display: flex;
  gap: 7px;
  justify-content: center;
  min-height: 38px;
  padding: 6px 8px;
}

.weekly-plan-day.active {
  background: #10283a;
  border-color: #08bcd4;
  color: #f8fbff;
}

.weekly-plan-day span {
  color: #08bcd4;
  font-size: 11px;
}

.weekly-plan-content {
  border-top: 1px solid var(--pae-line-soft);
  margin-top: 12px;
  padding-top: 12px;
}

.weekly-plan-field-label {
  gap: 8px;
  justify-content: space-between;
  margin-bottom: 7px;
}

.weekly-plan-field-label > span,
.weekly-plan-form-grid label,
.weekly-plan-read-grid span {
  color: var(--pae-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.weekly-plan-news-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.weekly-plan-news-chip {
  align-items: baseline;
  background: #101b28;
  border: 1px solid #26384a;
  border-radius: 5px;
  display: inline-flex;
  gap: 7px;
  max-width: 100%;
  padding: 6px 8px;
}

.weekly-plan-news-chip b {
  overflow-wrap: anywhere;
}

.weekly-plan-news-chip small {
  color: var(--pae-muted);
  flex: 0 0 auto;
  font-size: 10px;
}

.weekly-plan-form-grid,
.weekly-plan-read-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 12px;
}

.weekly-plan-form-grid label {
  display: grid;
  gap: 6px;
}

.weekly-plan-form-grid textarea,
.weekly-plan-form-grid select {
  background: #08111b !important;
  border-color: #26394c !important;
  border-radius: 6px !important;
  color: var(--pae-text) !important;
  font-size: 16px;
  min-height: 42px;
}

.weekly-plan-form-grid textarea {
  line-height: 1.45;
  min-height: 78px;
  resize: vertical;
}

.weekly-plan-narrative {
  grid-column: 1 / -1;
}

.weekly-plan-read-grid > div {
  border-top: 1px solid var(--pae-line-soft);
  min-width: 0;
  padding-top: 9px;
}

.weekly-plan-read-grid p {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.weekly-plan-notice {
  color: #08bcd4;
  font-size: 12px;
  margin-top: 10px;
}

:root[data-theme="light"] .weekly-market-plan,
:root[data-theme="light"] .weekly-plan-day,
:root[data-theme="light"] .weekly-plan-form-grid textarea,
:root[data-theme="light"] .weekly-plan-form-grid select,
:root[data-theme="light"] .weekly-plan-news-chip {
  background: #ffffff !important;
  border-color: #b9ccd8 !important;
  color: #071017 !important;
}

:root[data-theme="light"] .weekly-plan-day.active {
  background: #dff8fb !important;
  border-color: #08bcd4 !important;
}

@media (max-width: 720px) {
  .weekly-market-plan {
    padding: 12px !important;
  }

  .weekly-plan-head {
    align-items: flex-start;
  }

  .weekly-plan-actions {
    display: grid;
    grid-template-columns: 36px 1fr;
  }

  .weekly-plan-actions .primary {
    grid-column: 1 / -1;
  }

  .weekly-plan-days {
    gap: 4px;
  }

  .weekly-plan-day {
    flex-direction: column;
    gap: 0;
    min-height: 42px;
    padding: 4px;
  }

  .weekly-plan-form-grid,
  .weekly-plan-read-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .weekly-plan-narrative {
    grid-column: auto;
  }

  .weekly-plan-news-chip {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
    width: 100%;
  }
}
