/* ============================================
   AbayEdgeCapital - Standalone dashboard CSS
   No Tailwind required - everything styled here
   ============================================ */

:root {
  --primary: #000000;
  --primary-muted: #0f172a;
  --accent: #0a5368;
  --accent-light: #1ab2e7;
  --accent-dark: #2f6a7b;
  --white: #ffffff;
  --green: #059669;
  --red: #dc2626;
  --sidebar-bg: #0a5368;
  --radius: 10px;
  --radius-lg: 12px;
  --shadow: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-card: 0 4px 20px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
  --shadow-elevated: 0 25px 50px -12px rgba(0,0,0,0.15);
}

* { box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  background: #e2e8f0;
  color: #1e293b;
  margin: 0;
  min-height: 100vh;
}

/* ---- Layout (app shell) ---- */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: linear-gradient(160deg, #f1f5f9 0%, #e2e8f0 50%, #cbd5e1 100%);
}

.app-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, #0d3d4d 100%);
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 24px rgba(0,0,0,0.12);
}

.sidebar-brand {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.15);
}
.sidebar-brand a {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.02em;
}
.sidebar-brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}
.sidebar-brand-logo {
  width: 148px;
  height: auto;
  display: block;
}

.app-sidebar nav {
  padding: 0.75rem;
  flex: 1;
  overflow-y: auto;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  margin-bottom: 2px;
  font-size: 0.95rem;
  color: rgba(255,255,255,0.88);
  text-decoration: none;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.sidebar-link:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}
.sidebar-link.active {
  background: var(--accent-light);
  color: #fff;
  font-weight: 600;
}
.sidebar-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.9;
}

.app-shell > div:last-child {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.app-header {
  height: 56px;
  flex-shrink: 0;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 2rem 0 1rem;
  gap: 0.875rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  padding: 0 0.5rem 0 0;
}
.header-nav.header-nav-single {
  flex-direction: row;
  align-items: baseline;
  gap: 0.5rem;
  overflow: hidden;
}
.header-nav-title {
  font-size: 1.06rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.header-nav-subtitle {
  font-size: 0.86rem;
  font-weight: 600;
  color: #64748b;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Page header is now shown in the top bar (avoid duplicate title/subtitle on pages) */
.page-header {
  display: none;
}
.header-nav-link {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #64748b;
  text-decoration: none;
  border-radius: 8px;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.header-nav-link:hover {
  color: var(--accent);
  background: rgba(10, 82, 104, 0.08);
}
.header-nav-link.active {
  color: var(--accent);
  font-weight: 600;
  background: rgba(10, 82, 104, 0.12);
}

.app-header h1 {
  font-size: 1rem;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-header .user-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: #64748b;
}
.app-header .role-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  font-weight: 600;
}
.app-header .role-badge.admin {
  background: var(--accent);
  color: #fff;
}
.app-header .role-badge.user {
  background: #e2e8f0;
  color: var(--accent-dark);
}
.app-header .role-badge.manager {
  background: #dbeafe;
  color: #1e40af;
}
.app-header .role-badge.trader {
  background: #e2e8f0;
  color: #475569;
}

.sidebar-add-trade {
  padding: 0.75rem 1rem;
  border-top: 1px solid rgba(255,255,255,0.15);
  margin-top: auto;
}
.sidebar-account-balance {
  padding: 0.9rem 1rem;
  border-top: 1px solid rgba(255,255,255,0.15);
  text-align: left;
  margin: 0.75rem 1rem 0.75rem 1rem;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 8px 22px rgba(0,0,0,0.10);
}
.sidebar-account-balance-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(10, 83, 104, 0.85);
  text-transform: none;
  letter-spacing: 0;
  margin-top: 0.25rem;
}
.sidebar-account-balance-value {
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.app-shell[data-theme="dark"] .sidebar-account-balance-label {
  color: rgba(10, 83, 104, 0.85);
}
.app-shell[data-theme="dark"] .sidebar-account-balance-value {
  color: var(--accent);
}
.btn-add-trade-sidebar {
  display: block;
  text-align: center;
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent-light);
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.2s;
}
.btn-add-trade-sidebar:hover {
  background: rgba(255,255,255,0.25);
  color: #fff;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  flex-shrink: 0;
  margin-left: auto;
  margin-right: 2.6rem;
  padding-left: 0.35rem;
  justify-content: flex-start;
}
.btn-add-trade-header {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
}
.btn-add-trade-header:hover { background: rgba(10, 82, 104, 0.1); color: var(--accent-dark); }
.btn-theme-toggle {
  width: 2rem; height: 2rem; padding: 0;
  border: 1px solid #e2e8f0; border-radius: 8px; background: #fff;
  font-size: 1.1rem; cursor: pointer;
}

.app-header #btn-logout {
  background: none;
  border: none;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  padding: 0.25rem 0;
}
.app-header #btn-logout:hover { color: var(--accent-dark); text-decoration: underline; }

/* Role badge (header + tables) */
.role-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  font-weight: 600;
  display: inline-block;
}
.role-badge.admin {
  background: var(--accent);
  color: #fff;
}
.role-badge.user {
  background: #e2e8f0;
  color: var(--accent-dark);
}
.role-badge.manager {
  background: #dbeafe;
  color: #1e40af;
}
.role-badge.trader {
  background: #94a3b8;
  color: #fff;
}

.app-shell main {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 1.25rem;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}
/* Hide scrollbar on all pages (content still scrolls) */
.app-shell main {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.app-shell main::-webkit-scrollbar {
  display: none;
}
@media (min-width: 1024px) {
  .app-shell main { padding: 1.5rem 2rem; }
}

/* ---- Page content (grid & spacing) ---- */
.page-content { }
.page-header {
  margin-bottom: 1.5rem;
}
.page-header .page-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 0.35rem 0;
}
.page-content .page-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 0.25rem 0;
}
.page-header .page-subtitle,
.page-content .page-subtitle {
  font-size: 0.9rem;
  color: #64748b;
  margin: 0;
  line-height: 1.4;
}
.page-content .page-subtitle { margin: 0 0 1.25rem 0; }

.actions-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.actions-row .page-title { margin: 0; }

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}
.filter-row label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #64748b;
  margin-bottom: 0.25rem;
}
.filter-row input,
.filter-row select {
  padding: 0.4rem 0.6rem;
  font-size: 0.875rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  min-width: 100px;
}
.filter-row input:focus,
.filter-row select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(10, 82, 104, 0.15);
}
.app-shell[data-theme="dark"] .filter-row input,
.app-shell[data-theme="dark"] .filter-row select { background: #1e293b; border-color: #475569; color: #f1f5f9; }

.stat-block {
  background: linear-gradient(135deg, #fff 0%, #f8fafc 100%);
  border: 1px solid rgba(10, 83, 104, 0.12);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  box-shadow: 0 2px 12px rgba(10, 83, 104, 0.06);
}
.app-shell[data-theme="dark"] .stat-block { background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%); border-color: rgba(148, 163, 184, 0.2); }

.loading-msg {
  text-align: center;
  padding: 2rem;
  color: #64748b;
  font-size: 0.95rem;
}
.page-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 12px;
  padding: 1.5rem;
  color: #991b1b;
  max-width: 32rem;
}
.page-error .hint { font-size: 0.875rem; color: #b91c1c; margin-top: 0.75rem; opacity: 0.9; }
.page-error .btn-retry { margin-top: 1rem; }
.app-shell[data-theme="dark"] .page-error { background: #450a0a; border-color: #7f1d1d; color: #fecaca; }

/* Spacing between sections – consistent across all pages (calc-cards, Key Metrics, charts, etc.) */
.space-y-6 > * + * { margin-top: 2rem; }
.space-y-4 > * + * { margin-top: 1.25rem; }
.space-y-8 > * + * { margin-top: 2.5rem; }

/* ---- Cards (shadows, rounded corners, spacing per spec) ---- */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(226, 232, 240, 0.8);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}
.card:hover {
  box-shadow: 0 6px 24px rgba(0,0,0,0.1), 0 3px 10px rgba(0,0,0,0.05);
}
.card.p-4 { padding: 1rem 1.25rem; }
.card.p-5 { padding: 1.25rem 1.5rem; }

/* Modal (e.g. user edit) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}
.modal-content {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
  width: 100%;
  max-height: 90vh;
  overflow: auto;
}
.app-shell[data-theme="dark"] .modal-content { background: #1e293b; border: 1px solid #334155; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e2e8f0;
}
.app-shell[data-theme="dark"] .modal-header { border-color: #334155; }
.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
  padding: 0.25rem;
}
.modal-close:hover { color: #0f172a; }
.app-shell[data-theme="dark"] .modal-close:hover { color: #f1f5f9; }
.modal-body { padding: 1.25rem; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid #e2e8f0;
}
.app-shell[data-theme="dark"] .modal-footer { border-color: #334155; }

.card.card-elevated {
  box-shadow: var(--shadow-elevated);
  border-radius: 16px;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary);
  margin: 0 0 1rem 0;
}

.stat-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
}

/* ---- Metrics grid (responsive: grid-cols-1 md:grid-cols-2 lg:grid-cols-3 per spec) ---- */
.metrics-grid {
  display: grid;
  row-gap: 1.25rem;
  column-gap: 1.25rem;
  grid-template-columns: 1fr;
}
@media (min-width: 768px) { .metrics-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .metrics-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1280px) { .metrics-grid { grid-template-columns: repeat(6, 1fr); } }

.metrics-grid-4 {
  display: grid;
  row-gap: 1.25rem;
  column-gap: 1.25rem;
  grid-template-columns: 1fr;
}
@media (min-width: 768px) { .metrics-grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .metrics-grid-4 { grid-template-columns: repeat(4, 1fr); } }

.metrics-grid-5 {
  display: grid;
  row-gap: 1.25rem;
  column-gap: 1.25rem;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) { .metrics-grid-5 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .metrics-grid-5 { grid-template-columns: repeat(5, 1fr); } }

/* Admin: user/account selector cards (2 columns) */
.admin-two-col-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 768px) {
  .admin-two-col-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Admin: 3-card top row (calendar/user/account) */
.admin-three-col-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 1024px) {
  .admin-three-col-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Admin (Journal + Trades): scope row full width inside .actions-row */
.journal-admin-scope-actions > .journal-admin-top-row,
.journal-admin-scope-actions > .trades-admin-top-row {
  width: 100%;
  margin-bottom: 0;
}

/* Journal (admin): user + account + export in one row */
.journal-admin-top-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 1rem;
  align-items: start;
}
.journal-admin-top-row--two {
  grid-template-columns: 1fr auto;
}
/* Taller User / Account scope cards (admin Journal + Trades) */
.journal-admin-top-row .admin-page-scope-card.page-account-scope-card,
.trades-admin-top-row .admin-page-scope-card.page-account-scope-card {
  padding-top: 1.05rem;
  padding-bottom: 1.05rem;
  min-height: 3.45rem;
  box-sizing: border-box;
}
@media (max-width: 900px) {
  .journal-admin-top-row,
  .journal-admin-top-row--two,
  .trades-admin-top-row,
  .trades-admin-top-row--two-cols {
    grid-template-columns: 1fr;
  }
}

/* ---- Dashboard Analytics (10 charts) ---- */
.dashboard-analytics { padding-bottom: 2rem; }

.dashboard-settings-metrics-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1.25rem 1.25rem;
  margin-bottom: 1.75rem;
}
.dashboard-settings-metrics-row .account-settings-module {
  flex: 0 0 auto;
  width: 380px;
  max-width: 380px;
  margin-bottom: 0 !important;
}
.dashboard-add-trade-below-settings {
  width: 380px;
  max-width: 380px;
}
.dashboard-add-trade-below-settings .metric-card.metric-add-trade {
  width: 100%;
}
.dashboard-below-metrics-row {
  display: flex;
  gap: 1.25rem;
  align-items: stretch;
}
.dashboard-quote-between {
  flex: 1;
  min-width: 0;
}
.dashboard-quote-between .metric-card.metric-quote {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0;
  padding: 0.38rem 0.7rem;
}
.dashboard-settings-metrics-row .analytics-metrics-bar {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: stretch;
  gap: 0.75rem 1rem;
}
.dashboard-settings-metrics-row .analytics-metrics-bar .metric-card {
  min-width: 150px;
  padding: 1rem 1.35rem;
}
.dashboard-settings-metrics-row .analytics-metrics-bar .metric-card .metric-value {
  font-size: 1.35rem;
}
.dashboard-settings-metrics-row .analytics-metrics-bar .metric-card .metric-label {
  font-size: 0.72rem;
}
@media (max-width: 767px) {
  .dashboard-settings-metrics-row .analytics-metrics-bar { margin-top: 0; }
}
@media (max-width: 879px) {
  .dashboard-settings-metrics-row .account-settings-module {
    width: 100%;
    max-width: 480px;
  }
  .dashboard-add-trade-below-settings {
    width: 100%;
    max-width: 480px;
  }
  .dashboard-below-metrics-row {
    flex-direction: column;
  }
}

.dashboard-pos-calc-wrap {
  margin-bottom: 1.5rem;
  max-width: 380px;
}

.dashboard-calc-charts-row {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 1.25rem;
  margin-top: 0.5rem;
  margin-bottom: 1rem;
}
.dashboard-calc-charts-row .dashboard-pos-calc-wrap {
  flex: 0 0 auto;
  width: 380px;
  max-width: 100%;
  margin-bottom: 0;
  align-self: stretch;
}
.dashboard-calc-charts-row .dashboard-charts-wrap {
  flex: 1;
  min-width: 280px;
  max-width: 100%;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  align-content: start;
  align-self: stretch;
}
.dashboard-quote-between {
  width: 100%;
}
.dashboard-calc-charts-row .dashboard-charts-wrap .chart-wrap {
  height: 145px;
  min-height: 145px;
}
.dashboard-calc-charts-row .dashboard-charts-wrap .chart-card {
  background: #fff;
  border: 1px solid rgba(10, 83, 104, 0.08);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(10, 83, 104, 0.12), 0 2px 12px rgba(0,0,0,0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.dashboard-calc-charts-row .dashboard-charts-wrap .chart-card:hover {
  box-shadow: 0 12px 40px rgba(10, 83, 104, 0.15), 0 4px 16px rgba(0,0,0,0.08);
}
.dashboard-calc-charts-row .dashboard-charts-wrap .chart-card .chart-title {
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 700;
}
.dashboard-calc-charts-row .dashboard-charts-wrap .chart-card .chart-subtitle {
  color: var(--accent-dark);
  font-size: 0.7rem;
}
.dashboard-calc-charts-row .dashboard-charts-wrap .chart-card .chart-empty {
  color: #64748b;
}
.app-shell[data-theme="dark"] .dashboard-calc-charts-row .dashboard-charts-wrap .chart-card {
  background: #1e293b;
  border-color: rgba(148, 163, 184, 0.15);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.app-shell[data-theme="dark"] .dashboard-calc-charts-row .dashboard-charts-wrap .chart-card:hover {
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}
.app-shell[data-theme="dark"] .dashboard-calc-charts-row .dashboard-charts-wrap .chart-card .chart-title {
  color: var(--accent-light);
}
.app-shell[data-theme="dark"] .dashboard-calc-charts-row .dashboard-charts-wrap .chart-card .chart-subtitle {
  color: #94a3b8;
}
.app-shell[data-theme="dark"] .dashboard-calc-charts-row .dashboard-charts-wrap .chart-card .chart-empty {
  color: #94a3b8;
}

@media (max-width: 879px) {
  .dashboard-calc-charts-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .dashboard-calc-charts-row .dashboard-pos-calc-wrap {
    width: 100%;
    max-width: 380px;
  }
  .dashboard-calc-charts-row .dashboard-charts-wrap {
    grid-template-columns: 1fr;
  }
}
@media (min-width: 640px) and (max-width: 879px) {
  .dashboard-calc-charts-row .dashboard-charts-wrap {
    grid-template-columns: repeat(2, 1fr);
  }
}

.account-settings-module { margin-bottom: 2rem !important; }

.analytics-metrics-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  margin-top: 0.5rem;
}
.analytics-metrics-bar .metric-card {
  flex: 1 1 180px;
  min-width: 180px;
}
.metric-card {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  min-width: 140px;
  box-shadow: 0 4px 20px rgba(10, 83, 104, 0.25);
}
.metric-card.metric-quote {
  flex: 0 0 auto;
  width: fit-content;
  min-width: 0;
  max-width: 100%;
  margin-top: 0.9rem;
  padding: 0.75rem 0.9rem;
  background: linear-gradient(135deg, rgba(255,255,255,0.92) 0%, rgba(255,255,255,0.82) 100%);
  border-color: rgba(255,255,255,0.35);
}
.metric-card.metric-quote .metric-label {
  color: var(--accent);
}
.app-shell[data-theme="dark"] .metric-card.metric-quote .metric-label {
  color: rgba(255, 255, 255, 0.92);
}
.metric-card.metric-cashflow {
  flex: 0 0 auto;
  width: fit-content;
  min-width: 0;
  padding: 0.75rem 0.9rem;
}
.metric-card.metric-cashflow .metric-label {
  width: 100%;
  text-align: center;
}
.metric-card.metric-cashflow .metric-quote-text {
  display: block;
  margin-top: 0.25rem;
}
.metric-card.metric-cashflow .btn-secondary.btn-sm {
  font-weight: 700;
}
.metric-card.metric-quote .metric-quote-text {
  font-size: 0.99rem;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: -0.01em;
  text-shadow: none;
  color: var(--accent);
}
.dashboard-quote-between .metric-card.metric-quote .metric-quote-text {
  text-align: center;
  margin: 0;
}
.metric-card.metric-quote.metric-cashflow .metric-quote-text {
  font-size: 0.88rem;
  line-height: 1.4;
}
.metric-card.metric-add-trade {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 180px;
  margin-left: 0.25rem;
  margin-top: 0.9rem;
  padding: 0.38rem 0.7rem;
  background: linear-gradient(135deg, rgba(255,255,255,0.92) 0%, rgba(255,255,255,0.82) 100%);
  border-color: rgba(255,255,255,0.35);
  box-shadow: 0 4px 20px rgba(10, 83, 104, 0.14);
}
.metric-card.metric-add-trade .metric-add-trade-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  white-space: nowrap;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--accent);
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
}
.metric-card.metric-add-trade .metric-add-trade-btn:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}
.app-shell[data-theme="dark"] .metric-card.metric-quote .metric-quote-text {
  color: #ffffff !important;
}
.metric-card .metric-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 0.25rem;
}
.metric-card .metric-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.metric-card .metric-value.metric-value-positive { color: #86efac !important; }
.metric-card .metric-value.metric-value-negative { color: #fca5a5 !important; }
.metric-card .metric-value.text-green { color: #86efac; }
.metric-card .metric-value.text-red { color: #fca5a5; }
.app-shell[data-theme="dark"] .metric-card {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  border-color: rgba(255, 255, 255, 0.15);
}
.app-shell[data-theme="dark"] .metric-card .metric-label { color: rgba(255, 255, 255, 0.85); }
.app-shell[data-theme="dark"] .metric-card .metric-value { color: #fff; }
.app-shell[data-theme="dark"] .metric-card .metric-value.metric-value-positive { color: #86efac !important; }
.app-shell[data-theme="dark"] .metric-card .metric-value.metric-value-negative { color: #fca5a5 !important; }
.app-shell[data-theme="dark"] .metric-card .metric-value.text-green { color: #86efac; }
.app-shell[data-theme="dark"] .metric-card .metric-value.text-red { color: #fca5a5; }
.app-shell[data-theme="dark"] .metric-card.metric-add-trade .metric-add-trade-btn {
  color: #ffffff;
}
.app-shell[data-theme="dark"] .metric-card.metric-add-trade .metric-add-trade-btn:hover {
  color: var(--accent-light);
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 9999px;
  object-fit: cover;
  border: 1px solid rgba(148,163,184,0.35);
  margin-right: 0.35rem;
}
.app-shell[data-theme="dark"] .user-avatar {
  border-color: rgba(226,232,240,0.25);
}

.settings-avatar-preview {
  width: 96px;
  height: 96px;
  border-radius: 9999px;
  object-fit: cover;
  border: 1px solid rgba(148, 163, 184, 0.35);
  flex-shrink: 0;
}
.app-shell[data-theme="dark"] .settings-avatar-preview {
  border-color: rgba(226, 232, 240, 0.25);
}

.charts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
@media (min-width: 768px) {
  .charts-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1200px) {
  .charts-grid { grid-template-columns: repeat(3, 1fr); }
}
.chart-card-dark {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  transition: box-shadow 0.2s, transform 0.2s;
}
.chart-card-dark:hover {
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}
.chart-card-dark .chart-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #e2e8f0;
  margin: 0 0 0.2rem 0;
}
.chart-card-dark .chart-subtitle {
  font-size: 0.7rem;
  color: #94a3b8;
  margin: 0 0 0.75rem 0;
}
.chart-wrap {
  position: relative;
  min-height: 200px;
  height: 220px;
}
.chart-wrap-pie {
  min-height: 180px;
  height: 200px;
}
.chart-wrap canvas { width: 100% !important; height: 100% !important; }
.chart-wrap .chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: #64748b;
}

/* Account settings module on dashboard */
.account-settings-module { max-width: 480px; }
.account-settings-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
}
.account-settings-form .form-row.inline {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.account-settings-form .form-row.inline label { font-size: 0.75rem; font-weight: 600; color: #64748b; }
.app-shell[data-theme="dark"] .account-settings-form .form-row.inline label {
  color: rgba(255, 255, 255, 0.9) !important;
}
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8125rem; }

/* 4-chart grid with brand colors */
.charts-grid-4 { grid-template-columns: 1fr; }
@media (min-width: 768px) { .charts-grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .charts-grid-4 { grid-template-columns: repeat(4, 1fr); } }

/* Dashboard: 4 charts in 2 rows x 2 columns only */
.charts-grid-2x2 { grid-template-columns: 1fr; }
@media (min-width: 640px) { .charts-grid-2x2 { grid-template-columns: repeat(2, 1fr); } }

.chart-card-brand {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  box-shadow: 0 4px 20px rgba(10, 83, 104, 0.25);
}
.chart-card-brand .chart-title { color: #fff; font-size: 0.9rem; font-weight: 700; }
.chart-card-brand .chart-subtitle { color: rgba(255, 255, 255, 0.85); font-size: 0.7rem; }
.chart-card-brand .chart-empty { color: rgba(255, 255, 255, 0.8); }
.app-shell[data-theme="dark"] .chart-card-brand {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  border-color: rgba(255, 255, 255, 0.15);
}
.app-shell[data-theme="dark"] .chart-card-brand .chart-title { color: #fff; }
.app-shell[data-theme="dark"] .chart-card-brand .chart-subtitle { color: rgba(255, 255, 255, 0.85); }

/* Charts: 2 rows x 3 columns grid */
.charts-grid-2x3 {
  display: grid;
  row-gap: 1.5rem;
  column-gap: 1.75rem;
  grid-template-columns: 1fr;
}
@media (min-width: 768px) {
  .charts-grid-2x3 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1100px) {
  .charts-grid-2x3 { grid-template-columns: repeat(3, 1fr); }
}

/* Charts: 6 columns in one row */
.charts-grid-6 {
  display: grid;
  row-gap: 1.25rem;
  column-gap: 1rem;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .charts-grid-6 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
  .charts-grid-6 { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1280px) {
  .charts-grid-6 { grid-template-columns: repeat(6, 1fr); }
}
.charts-grid-6 .chart-card-elevated {
  padding: 0.75rem 1rem;
  min-height: 0;
}
.charts-grid-6 .chart-card-title { font-size: 0.875rem; }
.charts-grid-6 .chart-card-subtitle { font-size: 0.7rem; margin-bottom: 0.5rem; }
.charts-grid-6 .chart-fixed { min-height: 140px; max-height: 180px; }
.charts-grid-6 .chart-card-doughnut .winloss-chart-container,
.charts-grid-6 .chart-card-pie .winloss-chart-container {
  width: 120px;
  height: 120px;
  margin: 0 auto;
}
.charts-grid-6 .winloss-center { font-size: 0.8125rem; }
.charts-grid-6 .winloss-center .winloss-rate { font-size: 1.25rem; }
.charts-grid-6 .winloss-legend { flex-direction: column; gap: 0.25rem; }
.charts-grid-6 .winloss-legend-item { font-size: 0.75rem; }

.chart-card-elevated {
  background: var(--white);
  border-radius: 14px;
  padding: 1rem 1.25rem;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.15);
  border: 1px solid rgba(10, 83, 104, 0.08);
  overflow: hidden;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.chart-card-elevated:hover {
  box-shadow: 0 20px 40px -12px rgba(10, 83, 104, 0.2);
}
.chart-card-elevated::before {
  content: '';
  display: block;
  height: 3px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-light) 100%);
  margin: -1rem -1.25rem 0.75rem -1.25rem;
}
.chart-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 0.2rem 0;
  letter-spacing: -0.02em;
}
.chart-card-subtitle {
  font-size: 0.75rem;
  color: #64748b;
  margin: 0 0 0.75rem 0;
  letter-spacing: 0.02em;
}
.app-shell[data-theme="dark"] .chart-card-subtitle { color: #94a3b8; }
.chart-fixed {
  min-height: 180px;
  max-height: 220px;
  position: relative;
}
.chart-fixed canvas { width: 100% !important; height: 100% !important; }
.chart-card-doughnut .winloss-wrap {
  padding: 0.5rem 0 0 0;
}
.chart-card-doughnut .winloss-chart-container {
  width: 160px;
  height: 160px;
  margin: 0 auto;
}
@media (min-width: 768px) {
  .chart-card-doughnut .winloss-chart-container {
    width: 180px;
    height: 180px;
  }
}

/* Charts: two columns - Performance (left) | Wins vs Losses (right) - legacy */
.charts-two-col {
  display: grid;
  row-gap: 1.75rem;
  column-gap: 1.75rem;
  grid-template-columns: 1fr;
}
@media (min-width: 900px) {
  .charts-two-col { grid-template-columns: 1fr 1fr; }
}
.charts-two-col .chart-card { min-width: 0; }
.charts-stack {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.chart-block { flex: 1; min-height: 0; }
.chart-block-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #334155;
  margin: 0 0 0.75rem 0;
}
.app-shell[data-theme="dark"] .chart-block-title { color: #94a3b8; }
.chart-container-sm { min-height: 180px; }
.chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 0.9rem;
  margin: 0;
}
.chart-card-winloss { display: flex; flex-direction: column; }
.winloss-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  padding: 0.5rem 0;
}
.winloss-chart-container {
  position: relative;
  width: 220px;
  height: 220px;
  flex-shrink: 0;
}
.winloss-chart-container canvas { width: 100% !important; height: 100% !important; }
.winloss-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.winloss-rate {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.winloss-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  margin-top: 0.15rem;
}
.app-shell[data-theme="dark"] .winloss-label { color: #94a3b8; }
.winloss-legend {
  display: flex;
  gap: 1.5rem;
  font-size: 0.9rem;
  color: #334155;
}
.app-shell[data-theme="dark"] .winloss-legend { color: #cbd5e1; }
.winloss-legend-item { display: flex; align-items: center; gap: 0.5rem; }
.winloss-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.winloss-dot-wins { background: linear-gradient(135deg, #059669 0%, #047857 100%); }
.winloss-dot-losses { background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%); }

/* Dashboard calculator cards - premium look */
.calc-cards {
  display: grid;
  row-gap: 1.75rem;
  column-gap: 1.75rem;
  grid-template-columns: 1fr;
}
@media (min-width: 768px) { .calc-cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .calc-cards { grid-template-columns: repeat(4, 1fr); } }

/* Calculators page: 6 cards in 2 rows of 3 */
.calc-cards-2rows {
  grid-template-columns: 1fr;
}
@media (min-width: 768px) {
  .calc-cards-2rows { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .calc-cards-2rows { grid-template-columns: repeat(3, 1fr); }
}
.calc-card {
  background: #fff;
  border-radius: 16px;
  padding: 0;
  box-shadow: 0 8px 32px rgba(10, 83, 104, 0.12), 0 2px 12px rgba(0,0,0,0.06);
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(10, 83, 104, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.calc-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(10, 83, 104, 0.15), 0 4px 16px rgba(0,0,0,0.08);
}
.calc-card-inner {
  padding: 1.5rem 1.75rem;
}
.calc-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.calc-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
}
.calc-card-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
  letter-spacing: -0.02em;
  line-height: 1.3;
}
.calc-card-desc {
  font-size: 0.8125rem;
  color: #64748b;
  margin: 0.25rem 0 0 0;
  line-height: 1.45;
}
.app-shell[data-theme="dark"] .calc-card-desc { color: #94a3b8; }
.calc-card-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.25rem;
  align-items: flex-end;
  margin-bottom: 1.25rem;
}
.calc-card-fields--grid-2x3 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto auto auto;
  gap: 1rem 1.25rem;
  align-items: end;
}
.calc-card-fields--grid-2x3 .calc-card-field--full {
  grid-column: 1 / -1;
}
.calc-card-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.calc-card-field label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}
.app-shell[data-theme="dark"] .calc-card-field label { color: #94a3b8; }
.calc-card-field .input-field {
  min-width: 110px;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
}
.calc-card-result-wrap {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  border: 1px solid rgba(10, 83, 104, 0.1);
}
.app-shell[data-theme="dark"] .calc-card-result-wrap {
  background: linear-gradient(135deg, rgba(10, 83, 104, 0.25) 0%, rgba(26, 178, 231, 0.12) 100%);
  border-color: rgba(26, 178, 231, 0.2);
}
.calc-card-result {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.calc-card-result-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  margin-top: 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.app-shell[data-theme="dark"] .calc-card-result-label { color: #94a3b8; }

.calc-pos-results {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.app-shell[data-theme="dark"] .calc-pos-results { border-top-color: rgba(255,255,255,0.1); }
.calc-pos-result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8125rem;
}
.calc-pos-label { color: #64748b; font-weight: 500; }
.app-shell[data-theme="dark"] .calc-pos-label { color: #94a3b8; }
.calc-pos-value { font-weight: 600; color: #0f172a; }
.app-shell[data-theme="dark"] .calc-pos-value { color: #e2e8f0; }

/* Dark theme for calc cards */
.app-shell[data-theme="dark"] .calc-card {
  background: #1e293b;
  border-color: rgba(148, 163, 184, 0.15);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.app-shell[data-theme="dark"] .calc-card:hover {
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}
.app-shell[data-theme="dark"] .calc-card-title { color: #e2e8f0; }
.app-shell[data-theme="dark"] .calc-card-result { color: var(--accent-light); }

/* Live rates widget */
.live-rates-card {
  background: linear-gradient(145deg, #fff 0%, #f8fafc 100%);
  border: 1px solid rgba(10, 83, 104, 0.1);
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 4px 14px rgba(10, 83, 104, 0.05);
}
.app-shell[data-theme="dark"] .live-rates-card {
  background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
  border-color: rgba(148, 163, 184, 0.15);
}
.live-rates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.75rem 1.25rem;
  margin-top: 0.75rem;
}
.live-rate-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.5rem 0.75rem;
  background: rgba(255,255,255,0.6);
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}
.app-shell[data-theme="dark"] .live-rate-item {
  background: rgba(30, 41, 59, 0.6);
  border-color: #334155;
}
.live-rate-pair { font-size: 0.75rem; font-weight: 700; color: #475569; }
.app-shell[data-theme="dark"] .live-rate-pair { color: #94a3b8; }
.live-rate-value { font-size: 1rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--primary); }
.live-rates-loading, .live-rates-error { font-size: 0.85rem; color: #64748b; margin-top: 0.5rem; }
.app-shell[data-theme="dark"] .live-rates-loading,
.app-shell[data-theme="dark"] .live-rates-error { color: #94a3b8; }

/* ---- Buttons ---- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff !important;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-dark) 100%);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(10,82,104,0.35);
  transition: box-shadow 0.2s;
}
.btn-primary:hover {
  box-shadow: 0 6px 16px rgba(10,82,104,0.45);
}

.btn-secondary {
  display: inline-block;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #475569;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-secondary:hover {
  background: #f8fafc;
  border-color: var(--accent);
  color: var(--accent);
}

/* ---- Form rows (strategy form, etc.) ---- */
.form-row {
  margin-bottom: 1rem;
}
.form-row label { display: block; margin-bottom: 0.25rem; }
.form-row label { font-size: 0.8125rem; font-weight: 600; color: #475569; }
.app-shell[data-theme="dark"] .form-row label { color: #94a3b8; }

/* Trade form sections */
.trade-form-card {
  background: #fff;
  border-radius: 14px;
  border: 1px solid rgba(10, 83, 104, 0.1);
  box-shadow: 0 4px 20px rgba(10, 83, 104, 0.06);
  overflow: hidden;
}
.app-shell[data-theme="dark"] .trade-form-card {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
/* Tighter vertical rhythm on add/edit trade (title → fields → Positions). */
.trade-form-card .form-section {
  padding: 0.875rem 1.25rem;
}
.trade-form-card .form-section:first-of-type {
  padding-top: 1.125rem;
  padding-bottom: 0.625rem;
  border-bottom: none; /* avoid double line with Positions nested card */
}
.trade-form-card .form-section.form-section--positions {
  padding-top: 0.625rem;
}
.trade-form-card .form-section.form-section--no-bottom-divider {
  border-bottom: none;
}
.trade-positions-nested-card {
  padding: 0.5rem 0.65rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  background: #fff;
}
.app-shell[data-theme="dark"] .trade-positions-nested-card {
  border-color: #334155;
  background: #1e293b;
}
.form-section {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #f1f5f9;
}
.app-shell[data-theme="dark"] .form-section { border-color: #334155; }
.form-section:last-of-type { border-bottom: none; }
/* Trade add/edit: back link + page title on one row */
.trade-form-page-head {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  width: 100%;
}
.trade-form-back-link {
  flex-shrink: 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  line-height: 1.25;
}
.trade-form-back-link:hover {
  text-decoration: underline;
}
.trade-form-page-head .trade-form-page-title {
  margin: 0;
  padding: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
  flex: 1;
  min-width: 0;
}
.app-shell[data-theme="dark"] .trade-form-page-head .trade-form-page-title {
  color: #fff;
}

.form-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin: 0 0 1rem 0;
  padding-bottom: 0.5rem;
}
.trade-positions-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 0.35rem;
  flex-wrap: wrap;
}
.trade-positions-card-head .trade-positions-card-title {
  margin: 0;
  padding-bottom: 0;
  flex: 0 0 auto;
}
.trade-positions-summary {
  font-size: 0.8125rem;
  color: #64748b;
  text-align: right;
  line-height: 1.35;
  max-width: min(100%, 22rem);
  margin-left: auto;
}
.trade-positions-summary[hidden] {
  display: none !important;
}
.app-shell[data-theme="dark"] .trade-positions-summary {
  color: #94a3b8;
}
.trade-positions-add-row {
  margin-top: 0.5rem;
}
.trade-positions-table .trade-pos-index-col {
  width: 4.5rem;
  min-width: 4.5rem;
  text-align: center;
}
.trade-positions-table .trade-pos-index-cell {
  text-align: center;
  vertical-align: middle;
}
.trade-positions-table .pos-position-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #64748b;
  font-variant-numeric: tabular-nums;
}
.app-shell[data-theme="dark"] .trade-positions-table .pos-position-label {
  color: #94a3b8;
}
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.25rem;
}
@media (max-width: 640px) { .form-grid-2 { grid-template-columns: 1fr; } }
.form-grid-2 .form-row { margin-bottom: 0; }
.form-grid-2 .form-row-full { grid-column: 1 / -1; }

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem 1.25rem;
}
@media (max-width: 768px) { .form-grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .form-grid-3 { grid-template-columns: 1fr; } }
.form-grid-3 .form-row { margin-bottom: 0; }
.form-grid-3 .form-row-full { grid-column: 1 / -1; }

.form-grid-5 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem 1.25rem;
}
@media (max-width: 1200px) { .form-grid-5 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px) { .form-grid-5 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .form-grid-5 { grid-template-columns: 1fr; } }
.form-grid-5 .form-row { margin-bottom: 0; }
.form-grid-5 .form-row-full { grid-column: 1 / -1; }

.form-grid-6 {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1rem 1.25rem;
}
@media (max-width: 1200px) { .form-grid-6 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px) { .form-grid-6 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .form-grid-6 { grid-template-columns: 1fr; } }
.form-grid-6 .form-row { margin-bottom: 0; }
.form-grid-6 .form-row-full { grid-column: 1 / -1; }

.form-grid-7 {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1rem 1.25rem;
}
@media (max-width: 1400px) { .form-grid-7 { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 900px) { .form-grid-7 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .form-grid-7 { grid-template-columns: 1fr; } }
.form-grid-7 .form-row { margin-bottom: 0; }
.form-grid-7 .form-row-full { grid-column: 1 / -1; }

/* Trade summary strip — setup letter (A+–C) in result row */
.trade-auto-chip-value--setup-grade {
  font-size: 1rem;
  font-weight: 700;
}
.trade-auto-chip--setup-aplus .trade-auto-chip-value--setup-grade {
  color: #059669;
}
.trade-auto-chip--setup-a .trade-auto-chip-value--setup-grade {
  color: #0d9488;
}
.trade-auto-chip--setup-b .trade-auto-chip-value--setup-grade {
  color: #64748b;
}
.trade-auto-chip--setup-c .trade-auto-chip-value--setup-grade {
  color: #dc2626;
}
.app-shell[data-theme="dark"] .trade-auto-chip--setup-aplus .trade-auto-chip-value--setup-grade {
  color: #4ade80;
}
.app-shell[data-theme="dark"] .trade-auto-chip--setup-a .trade-auto-chip-value--setup-grade {
  color: #2dd4bf;
}
.app-shell[data-theme="dark"] .trade-auto-chip--setup-b .trade-auto-chip-value--setup-grade {
  color: #94a3b8;
}
.app-shell[data-theme="dark"] .trade-auto-chip--setup-c .trade-auto-chip-value--setup-grade {
  color: #f87171;
}

.form-grid-8 {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 1rem 1.25rem;
}
@media (max-width: 1400px) { .form-grid-8 { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 900px) { .form-grid-8 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .form-grid-8 { grid-template-columns: 1fr; } }
.form-grid-8 .form-row { margin-bottom: 0; }
.form-grid-8 .form-row-full { grid-column: 1 / -1; }

/* Add Trade — live totals: one horizontal row of columns (scroll on narrow viewports) */
.trade-auto-strip {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0.65rem 0.85rem;
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 0.75rem;
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.04), rgba(15, 23, 42, 0.02));
  border: 1px solid rgba(15, 23, 42, 0.08);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}
.app-shell[data-theme="dark"] .trade-auto-strip {
  background: linear-gradient(145deg, rgba(148, 163, 184, 0.08), rgba(148, 163, 184, 0.03));
  border-color: rgba(148, 163, 184, 0.15);
}
.trade-auto-strip.trade-auto-strip--empty {
  display: none;
}
.trade-auto-chip {
  flex: 0 0 auto;
  min-width: 5.5rem;
  padding: 0.45rem 0.65rem;
  border-radius: 0.5rem;
  background: var(--card-bg, #fff);
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.app-shell[data-theme="dark"] .trade-auto-chip {
  background: rgba(30, 41, 59, 0.6);
  border-color: rgba(148, 163, 184, 0.12);
}
.trade-auto-chip-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted, #64748b);
  margin-bottom: 0.2rem;
}
.trade-auto-chip-label--title {
  text-transform: none;
  letter-spacing: 0.01em;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text, #0f172a);
}
.app-shell[data-theme="dark"] .trade-auto-chip-label--title {
  color: #e2e8f0;
}
.trade-auto-chip-value {
  font-size: 0.95rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text, #0f172a);
  line-height: 1.25;
}
.app-shell[data-theme="dark"] .trade-auto-chip-value {
  color: #f1f5f9;
}
.trade-auto-chip-value--accent {
  color: var(--accent, #2563eb);
}
.trade-auto-chip-value--muted {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted, #64748b);
}
/* Trade summary — status and P/L are separate chips; colours follow outcome; both hug content */
.trade-auto-chip--result-pnl {
  min-width: 0;
  width: max-content;
  max-width: min(100%, 20rem);
  padding: 0.45rem 0.55rem;
}
.trade-auto-chip--result-pnl .trade-auto-chip-value--pnl-only {
  white-space: nowrap;
}
/* Setup grade — same footprint as P&L (USD) chip */
.trade-auto-chip--setup-grade {
  min-width: 0;
  width: max-content;
  max-width: min(100%, 20rem);
  padding: 0.45rem 0.55rem;
}
.trade-auto-chip--setup-grade .trade-auto-chip-value--setup-grade {
  white-space: nowrap;
}
/* R:R (1:2 style) — same compact footprint as setup / status chips */
.trade-auto-chip--rr {
  min-width: 0;
  width: max-content;
  max-width: min(100%, 10rem);
  padding: 0.45rem 0.55rem;
}
.trade-auto-chip--rr .trade-auto-chip-value--rr {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}
.trade-auto-chip--rr.trade-auto-chip--wide {
  min-width: 0;
  max-width: min(100%, 10rem);
}
.trade-auto-chip--rr.trade-auto-chip--wide .trade-auto-chip-value {
  font-size: 0.82rem;
  line-height: 1.2;
  white-space: nowrap;
}
/* Trade result only: hug label + status text (Win / Loss / Open / …) — avoid extra horizontal stretch */
.trade-auto-chip--result-status {
  min-width: 0;
  width: max-content;
  max-width: min(100%, 14rem);
  padding: 0.45rem 0.55rem;
}
.trade-auto-chip--result-status .trade-auto-chip-value--status-only {
  white-space: nowrap;
}
.trade-auto-chip-value--status-only {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
}
.trade-auto-chip-value--pnl-only {
  font-size: 0.95rem;
  font-weight: 600;
}
.trade-auto-chip--outcome-open .trade-auto-chip-value--status-only,
.trade-auto-chip--outcome-open .trade-auto-chip-value--pnl-only {
  color: #0369a1;
}
.app-shell[data-theme="dark"] .trade-auto-chip--outcome-open .trade-auto-chip-value--status-only,
.app-shell[data-theme="dark"] .trade-auto-chip--outcome-open .trade-auto-chip-value--pnl-only {
  color: #38bdf8;
}
.trade-auto-chip--outcome-win .trade-auto-chip-value--status-only,
.trade-auto-chip--outcome-win .trade-auto-chip-value--pnl-only {
  color: var(--green);
}
.trade-auto-chip--outcome-loss .trade-auto-chip-value--status-only,
.trade-auto-chip--outcome-loss .trade-auto-chip-value--pnl-only {
  color: var(--red);
}
.trade-auto-chip--outcome-be .trade-auto-chip-value--status-only,
.trade-auto-chip--outcome-be .trade-auto-chip-value--pnl-only {
  color: #b45309;
}
.app-shell[data-theme="dark"] .trade-auto-chip--outcome-be .trade-auto-chip-value--status-only,
.app-shell[data-theme="dark"] .trade-auto-chip--outcome-be .trade-auto-chip-value--pnl-only {
  color: #fbbf24;
}
/* Wider column for multiple TPs in one line — strip still scrolls horizontally if needed */
.trade-auto-chip--wide {
  flex: 0 0 auto;
  min-width: 12rem;
  max-width: 36rem;
}
.trade-auto-chip--wide .trade-auto-chip-value {
  font-size: 0.82rem;
  line-height: 1.35;
  white-space: normal;
  word-break: break-word;
}

/* Take profit — multiple legs: TP1 · TP2 · TP3 on one row */
.trade-auto-chip-tp-stack {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: baseline;
  gap: 0.65rem 1rem;
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}
.trade-auto-tp-row {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  flex: 0 0 auto;
  white-space: nowrap;
}
.trade-auto-tp-leg {
  flex: 0 0 auto;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted, #64748b);
}
.trade-auto-tp-price {
  font-weight: 600;
  font-size: 0.95rem;
  color: inherit;
}
.app-shell[data-theme="dark"] .trade-auto-tp-leg {
  color: #94a3b8;
}

.confluence-checkboxes.confluence-5x2 {
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem 1rem;
}
@media (max-width: 768px) {
  .confluence-checkboxes.confluence-5x2 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 480px) {
  .confluence-checkboxes.confluence-5x2 { grid-template-columns: 1fr; }
}

.confluence-checkboxes.confluence-3col {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(5, auto);
  grid-auto-flow: column;
  gap: 0.5rem 1rem;
}
@media (max-width: 768px) {
  .confluence-checkboxes.confluence-3col {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: none;
    grid-auto-flow: row;
  }
}
@media (max-width: 480px) {
  .confluence-checkboxes.confluence-3col { grid-template-columns: 1fr; }
}

/* Confluence page & tickable checkboxes */
.confluence-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem 1.5rem;
}
.confluence-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: #f8fafc;
  border-radius: 8px;
  font-size: 0.9rem;
}
.app-shell[data-theme="dark"] .confluence-item { background: #1e293b; }
.confluence-checkbox { font-size: 1rem; color: var(--accent); }
.confluence-checkboxes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.5rem 1rem;
}

/* Multi-select dropdown (used for Confluence) */
.multi-select {
  position: relative;
}
.multi-select__summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}
.multi-select__summary::-webkit-details-marker { display: none; }
.multi-select__panel {
  position: absolute;
  z-index: 50;
  left: 0;
  right: 0;
  margin-top: 0.4rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.10);
  padding: 0.75rem 0.9rem;
  max-height: 320px;
  overflow: auto;
}
.app-shell[data-theme="dark"] .multi-select__panel {
  background: #0b1220;
  border-color: rgba(148, 163, 184, 0.25);
}

.trade-form-structure-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.75rem 1rem;
  align-items: start;
}
@media (max-width: 1024px) { .trade-form-structure-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) { .trade-form-structure-grid { grid-template-columns: 1fr; } }
.trade-form-structure-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.trade-form-structure-group .structure-tf-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
}
.trade-form-structure-group .structure-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.trade-form-structure-group .structure-options-stacked {
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 0.25rem;
}
.trade-form-structure-group .structure-options label {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8125rem;
  cursor: pointer;
}
.app-shell[data-theme="dark"] .trade-form-structure-group .structure-tf-label { color: #94a3b8; }

.trade-reason-block {
  margin-top: 1rem;
}
.trade-reason-block .form-section-title {
  margin-bottom: 0.5rem;
}
.trade-reason-note.input-field {
  min-height: 56px;
  resize: vertical;
}

.confluence-checkboxes label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  padding: 0.4rem 0;
}
.app-shell[data-theme="dark"] .confluence-checkboxes label { color: #94a3b8; }
.confluence-checkboxes input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Items grid – 3 columns for setups & trades */
.items-grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
@media (min-width: 640px) {
  .items-grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .items-grid-3 { grid-template-columns: repeat(3, 1fr); }
}

.item-card {
  background: #fff;
  border-radius: 14px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
}
.item-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(10, 83, 104, 0.12), 0 4px 12px rgba(0,0,0,0.08);
}
.app-shell[data-theme="dark"] .item-card {
  background: #1e293b;
  border-color: rgba(148, 163, 184, 0.2);
}
.app-shell[data-theme="dark"] .item-card:hover {
  box-shadow: 0 12px 28px rgba(0,0,0,0.35);
}

.item-card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.item-card-header .item-card-pair { flex: 1; min-width: 0; }
.app-shell[data-theme="dark"] .item-card-header { border-color: #334155; }
.item-card-pair {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
}
.item-card-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.item-card-badge.buy { background: rgba(5, 150, 105, 0.15); color: #059669; }
.item-card-badge.sell { background: rgba(220, 38, 38, 0.15); color: #dc2626; }
.item-card-badge.win { background: rgba(5, 150, 105, 0.2); color: #059669; }
.item-card-badge.loss { background: rgba(220, 38, 38, 0.2); color: #dc2626; }

.item-card-body {
  padding: 1rem 1.25rem;
  flex: 1;
}
.item-card-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.8125rem;
  padding: 0.35rem 0;
  gap: 0.5rem;
}
.item-card-row:not(:last-child) { border-bottom: 1px solid #f8fafc; }
.app-shell[data-theme="dark"] .item-card-row:not(:last-child) { border-color: #334155; }
.item-card-label { color: #64748b; font-weight: 500; }
.app-shell[data-theme="dark"] .item-card-label { color: #94a3b8; }
.item-card-value { font-weight: 600; color: var(--primary); font-variant-numeric: tabular-nums; }
.item-card-value.positive { color: #059669; }
.item-card-value.negative { color: #dc2626; }

.item-card-thumb {
  width: 100%;
  height: 100px;
  object-fit: cover;
  background: #f1f5f9;
}
.app-shell[data-theme="dark"] .item-card-thumb { background: #334155; }

.item-card-footer {
  padding: 0.75rem 1.25rem;
  background: #f8fafc;
  border-top: 1px solid #f1f5f9;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.app-shell[data-theme="dark"] .item-card-footer {
  background: #0f172a;
  border-color: #334155;
}
.item-card-footer a,
.item-card-footer button {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.2rem 0;
}
.item-card-footer a:hover,
.item-card-footer button:hover { text-decoration: underline; }
.item-card-footer button.btn-delete-item { color: #dc2626; }
.item-card-footer .item-card-divider {
  width: 1px;
  height: 1em;
  background: #cbd5e1;
  margin: 0 0.15rem;
}
.app-shell[data-theme="dark"] .item-card-footer .item-card-divider { background: #475569; }

/* Detail view – 3 columns for setup/trade View page */
.detail-view-wrapper {
  max-width: 1100px;
}
.detail-view-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem 1.5rem;
}
@media (max-width: 768px) {
  .detail-view-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .detail-view-grid { grid-template-columns: 1fr; }
}
.detail-view-grid > div {
  padding: 0.5rem 0.75rem;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #f1f5f9;
}
.app-shell[data-theme="dark"] .detail-view-grid > div {
  background: #0f172a;
  border-color: #334155;
}
.detail-view-grid dt { color: #64748b; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 0.25rem; }
.detail-view-grid dd { font-weight: 600; margin: 0; font-size: 0.9375rem; }
.app-shell[data-theme="dark"] .detail-view-grid dt { color: #94a3b8; }

.form-row-two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
@media (max-width: 640px) { .form-row-two-cols { grid-template-columns: 1fr; } }
.form-row-two-cols .stat-label { display: block; margin-bottom: 0.25rem; font-size: 0.8125rem; font-weight: 600; color: #475569; }

.input-field {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.9375rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  box-sizing: border-box;
}
.input-field:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(10, 82, 104, 0.15);
}
textarea.input-field {
  min-height: 80px;
  resize: vertical;
}
.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}
.form-message {
  margin-top: 0.75rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  border-radius: 6px;
}
.form-message--hidden { display: none; }
.form-message--error { background: #fef2f2; color: #991b1b; }
.form-message--success { background: #f0fdf4; color: #166534; }
.btn-danger {
  padding: 0.4rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #b91c1c;
  background: #fff;
  border: 1px solid #fecaca;
  border-radius: 8px;
  cursor: pointer;
}
.btn-danger:hover { background: #fef2f2; border-color: #b91c1c; }

/* ---- Strategy list ---- */
.strategy-list { display: flex; flex-direction: column; gap: 0; }
.strategy-item {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 0.9rem;
  margin-bottom: 0.6rem;
  border: 1px solid #f1efe2;
  background: #faf9f4;
  border-radius: 10px;
}
.strategy-item:last-child { margin-bottom: 0; }
.strategy-item-main { flex: 1; min-width: 0; }
.strategy-item-name { display: block; font-size: 1rem; color: var(--primary); margin-bottom: 0.25rem; }
.strategy-item-meta { font-size: 0.75rem; color: #64748b; }
.strategy-item-desc { font-size: 0.875rem; color: #475569; margin: 0.5rem 0 0 0; line-height: 1.4; }
.strategy-item-confluence { margin-top: 0.4rem; line-height: 1.35; }
.strategy-item-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }

/* ---- CTA (Add first trade) ---- */
.cta-empty {
  text-align: center;
  padding: 2.5rem 1.5rem;
  background: linear-gradient(135deg, #f0fdf9 0%, #ccfbf1 100%);
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}
.cta-empty h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 0.5rem 0;
}
.cta-empty p {
  font-size: 0.95rem;
  color: #64748b;
  margin: 0 0 1.25rem 0;
}
.cta-empty .btn-primary { font-size: 1rem; padding: 0.75rem 1.5rem; }

/* ---- Tables (professional data tables) ---- */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.app-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9rem;
  min-width: 800px;
}
.app-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
}
.app-table th {
  text-align: left;
  padding: 1rem 1.25rem;
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #475569;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}
.app-table th:first-child { border-top-left-radius: 12px; padding-left: 1.5rem; }
.app-table th:last-child { border-top-right-radius: 12px; padding-right: 1.5rem; }
.app-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
  vertical-align: middle;
}
.app-table td:first-child { padding-left: 1.5rem; }
.app-table td:last-child { padding-right: 1.5rem; }
.app-table tbody tr {
  transition: background 0.15s ease;
}
/* Zebra stripes + hover per spec */
.app-table tbody tr:nth-child(odd) { background: #fff; }
.app-table tbody tr:nth-child(even) { background: #f8fafc; }
.app-table tbody tr:hover { background: #ecfdf5 !important; }
.app-table tbody tr:last-child td { border-bottom: none; }
.app-table tbody tr:last-child td:first-child { border-bottom-left-radius: 12px; }
.app-table tbody tr:last-child td:last-child { border-bottom-right-radius: 12px; }
.app-table .cell-numeric {
  font-variant-numeric: tabular-nums;
  text-align: right;
  font-weight: 500;
}
.app-table .cell-actions {
  white-space: nowrap;
}
.app-table .cell-actions a,
.app-table .cell-actions button {
  font-size: 0.8125rem;
  font-weight: 600;
  margin-right: 0.5rem;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  transition: background 0.15s;
}
.app-table .cell-actions a:hover {
  background: rgba(10, 82, 104, 0.1);
}
.app-table .cell-actions a:last-child,
.app-table .cell-actions button:last-child { margin-right: 0; }

/* Trades list: tighter gaps between View / Journal / Duplicate / Edit / Delete */
.app-table.trades-list-table .cell-actions a,
.app-table.trades-list-table .cell-actions button {
  margin-right: 0.25rem;
  padding: 0.2rem 0.35rem;
}
.app-table.trades-list-table .cell-actions a:last-child,
.app-table.trades-list-table .cell-actions button:last-child {
  margin-right: 0;
}

/* Trades list: same horizontal padding every column; body text starts under header (left + top) */
.app-table.trades-list-table th,
.app-table.trades-list-table td {
  padding: 1rem 0.65rem;
  text-align: left;
  vertical-align: top;
}
.app-table.trades-list-table thead th {
  font-size: 0.8125rem;
}
.app-table.trades-list-table th:first-child,
.app-table.trades-list-table td:first-child {
  padding-left: 1.45rem;
}
.app-table.trades-list-table .cell-numeric {
  text-align: left;
}

/* Paginated lists (trades, journal trade picker) */
.list-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
}
.list-pagination-meta {
  font-size: 0.875rem;
  color: #64748b;
}
.list-pagination-meta-only {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
}
.list-pagination-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}
.list-pagination-current {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary, #0f172a);
  padding: 0 0.25rem;
}
.list-pagination .list-pagination-disabled,
.list-pagination-disabled {
  opacity: 0.45;
  pointer-events: none;
  cursor: default;
}

/* Empty state for tables */
.table-empty {
  padding: 3rem 1.5rem;
  text-align: center;
  color: #64748b;
  font-size: 0.9375rem;
}
.table-empty p { margin: 0 0 0.5rem 0; }
.table-empty p + a { margin-top: 0.75rem; display: inline-block; }

/* Error state (e.g. failed to fetch) */
.page-error {
  padding: 2rem 1.5rem;
  text-align: center;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  color: #991b1b;
}
.page-error p { margin: 0 0 1rem 0; font-weight: 500; }
.page-error .hint { font-size: 0.875rem; color: #b91c1c; margin-bottom: 1rem; }
.page-error .btn-retry {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
}
.page-error .btn-retry:hover { background: var(--accent-dark); }

/* ---- Badges (rounded, colored: green wins, red losses per spec) ---- */
.badge-win {
  display: inline-block;
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  background: var(--green);
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.badge-loss {
  display: inline-block;
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  background: var(--red);
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.badge-be, .badge-breakeven {
  display: inline-block;
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  background: #64748b;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge-in_progress {
  display: inline-block;
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* Trades list: pair + small branded tag below (e.g. 3 Positions) */
.trade-pair-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.22rem;
  line-height: 1.2;
}
.trade-pos-count-tag {
  display: inline-block;
  font-size: 0.5625rem;
  font-weight: 500;
  color: #fff;
  background: var(--accent);
  padding: 0.1rem 0.38rem;
  border-radius: 9999px;
  text-transform: none;
  letter-spacing: 0.01em;
  line-height: 1.15;
  max-width: 100%;
}

/* ---- Form ---- */
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}
.filter-row label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}
.filter-row input,
.filter-row select {
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  min-width: 120px;
  background: #fff;
}
.filter-row input:focus,
.filter-row select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(10,82,104,0.15);
}
.filter-row .btn-secondary { flex-shrink: 0; }

/* ---- Actions row ---- */
.actions-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.actions-row .btn-primary { margin-left: auto; }

/* Trades: top actions row (3 columns) */
.trades-top-actions {
  width: 100%;
  display: flex;
  gap: 0.6rem;
  align-items: stretch;
  flex-wrap: wrap;
}
.trades-right-actions {
  margin-left: auto;
  display: flex;
  flex-direction: row;
  gap: 0.45rem;
  align-items: center;
  align-self: center;
  flex-shrink: 0;
}
/* Admin Trades: same grid as admin Journal (user | account | actions one row) */
.trades-admin-top-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 1rem;
  align-items: start;
}
.trades-admin-top-row--two-cols {
  grid-template-columns: 1fr auto;
}
.trades-admin-selector-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}
.trades-top-btn {
  justify-self: start;
  min-width: 132px;
  text-align: center;
}
.trades-top-actions .trades-top-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1rem;
}
/* Match Journal user Account column: minmax(220px, 320px) */
.trades-top-account-card {
  flex: 0 1 320px;
  width: 100%;
  min-width: 220px;
  max-width: 320px;
  padding: 0.75rem 0.85rem;
  box-sizing: border-box;
}
.trades-top-filters-card {
  flex: 0 0 auto;
  width: fit-content;
  min-width: 380px;
  padding: 0.75rem 0.85rem;
}

/* Admin Trades: filter fields span the Filters card (same idea as admin Journal) */
.trades-admin-filters-card {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.trades-admin-filters-card .filter-row {
  width: 100%;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin-bottom: 0;
}
.trades-admin-filters-card .filter-row > div {
  flex: 1 1 140px;
  min-width: 0;
}
.trades-admin-filters-card .filter-row .btn-primary {
  flex-shrink: 0;
}
@media (max-width: 900px) {
  .trades-top-filters-card {
    min-width: 100%;
  }
}
.journal-export-right {
  margin-left: auto;
}
/* Journal (user): account + export on one row */
.journal-top-actions {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: start;
}
.journal-top-actions-left {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(220px, 320px) auto;
  gap: 0.75rem;
  align-items: stretch;
}
.journal-filters-card {
  width: fit-content;
  min-width: 0;
  padding: 0.75rem 0.85rem;
}
.journal-filters-card .filter-row {
  margin-bottom: 0;
}

/* Admin Journal: filters bar full width of page content */
.journal-admin-filters-wrap {
  width: 100%;
  margin-bottom: 1.25rem;
}
.journal-admin-filters-wrap .journal-filters-card {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.journal-admin-filters-wrap .journal-filters-card .filter-row {
  width: 100%;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
}
.journal-admin-filters-wrap .journal-filters-card .filter-row > div {
  flex: 1 1 140px;
  min-width: 0;
}

/* Dashboard: keep Account Settings title on one line */
.account-settings-head-title {
  white-space: nowrap;
}
.account-settings-head-actions .btn-secondary.btn-sm {
  padding: 0.35rem 0.55rem;
  font-size: 0.75rem;
  line-height: 1.1;
  white-space: nowrap;
}
.journal-top-account-card {
  padding: 0.75rem 0.85rem;
}
@media (max-width: 900px) {
  .journal-top-actions {
    grid-template-columns: 1fr;
  }
  .journal-top-actions-left {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 900px) {
  .trades-top-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .trades-right-actions {
    margin-left: 0;
    width: 100%;
  }
  .trades-top-btn {
    width: 100%;
  }
  .journal-export-right {
    margin-left: 0;
    width: 100%;
  }
}

/* ---- Chart container ---- */
.chart-container {
  min-height: 220px;
  position: relative;
}
.chart-container canvas { width: 100% !important; height: 100% !important; }

/* ---- Text colors ---- */
.text-primary { color: var(--primary) !important; }
.text-green-600 { color: var(--green) !important; }
.text-red-600 { color: var(--red) !important; }
.text-gray-600 { color: #475569 !important; }
.app-shell[data-theme="dark"] .text-gray-600 { color: #ffffff !important; }
.text-gray-700 { color: #334155 !important; }
.app-shell[data-theme="dark"] .text-gray-700 { color: #e2e8f0 !important; }
.text-accent { color: var(--accent) !important; }
a.text-accent:hover { text-decoration: underline; }
.app-shell[data-theme="dark"] .app-table .cell-actions a.text-accent {
  color: #f1f5f9 !important;
}
.app-shell[data-theme="dark"] .app-table .cell-actions a.text-accent:hover {
  color: var(--accent-light) !important;
}
.app-shell[data-theme="dark"] .btn-user-account.text-primary,
.app-shell[data-theme="dark"] button.btn-user-account.text-primary {
  color: #000000 !important;
}
.btn-delete-trade {
  background: none;
  border: none;
  color: var(--red);
  cursor: pointer;
  font-size: inherit;
  font-weight: 600;
  padding: 0;
}
.btn-delete-trade:hover { text-decoration: underline; }

/* ---- Pre-login welcome splash ---- */
.welcome-splash {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  box-sizing: border-box;
  background: linear-gradient(160deg, var(--accent) 0%, #0d3d4d 45%, #062530 100%);
  color: #fff;
  text-align: center;
  animation: welcome-splash-in 0.55s ease-out;
}
.welcome-splash__mark {
  width: 56px;
  height: 56px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  margin-bottom: 1.75rem;
  letter-spacing: 0.02em;
}
.welcome-splash__title {
  font-size: clamp(1.65rem, 4.5vw, 2.35rem);
  font-weight: 700;
  margin: 0 0 1rem 0;
  letter-spacing: -0.02em;
  line-height: 1.2;
  max-width: 22rem;
}
.welcome-splash__tagline {
  font-size: clamp(0.95rem, 2.6vw, 1.15rem);
  color: rgba(255, 255, 255, 0.9);
  max-width: 26rem;
  line-height: 1.55;
  margin: 0;
  font-weight: 500;
}
@keyframes welcome-splash-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---- Login page (white card; gradient on brand strip + buttons) ---- */
.login-page {
  --login-grad-a: #3a6c87;
  --login-grad-b: #53969e;
  --login-gradient: linear-gradient(165deg, var(--login-grad-a) 0%, var(--login-grad-b) 100%);
  --login-gradient-soft: linear-gradient(165deg, #426f8a 0%, #5c9aad 100%);
  min-height: 100vh;
  min-height: 100dvh;
  background: linear-gradient(180deg, #e8f2f6 0%, #eff6f9 45%, #ddeef4 100%);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: calc(clamp(1rem, 2.8vh + 0.5rem, 2.2rem) + 1.75rem + env(safe-area-inset-top, 0px));
  padding-bottom: calc(clamp(1.25rem, 4vh, 2.25rem) + env(safe-area-inset-bottom, 0px));
  padding-left: max(clamp(1rem, 3.5vw, 1.5rem), env(safe-area-inset-left, 0px));
  padding-right: max(clamp(1rem, 3.5vw, 1.5rem), env(safe-area-inset-right, 0px));
  box-sizing: border-box;
  overflow-x: hidden;
}
@media (max-height: 720px) {
  .login-page {
    padding-top: calc(0.55rem + 1.25rem + env(safe-area-inset-top, 0px));
    padding-bottom: calc(0.9rem + env(safe-area-inset-bottom, 0px));
  }
  .login-page__layout {
    gap: 0.85rem;
  }
  .login-page__masthead-tagline {
    margin-top: 0.5rem;
  }
}
@media (min-width: 768px) {
  .login-page {
    padding-top: calc(clamp(1.15rem, 2.5vh + 0.35rem, 2rem) + 1.75rem + env(safe-area-inset-top, 0px));
  }
}
.login-page__layout {
  width: 100%;
  max-width: min(100%, 24.5rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(1.08rem, 3.2vw, 1.55rem);
  flex-shrink: 0;
}
.login-page__masthead {
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.login-page__masthead-brand {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.login-page__masthead-wordmark {
  margin: 0;
  padding: 0;
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: clamp(2.05rem, 9.5vw, 3.05rem);
  font-weight: 800;
  letter-spacing: -0.072em;
  line-height: 1;
  text-rendering: optimizeLegibility;
}
.login-page__masthead-abay {
  color: #2a4a5b;
}
.login-page__masthead-edge {
  color: #1a8aad;
}
@supports (-webkit-background-clip: text) or (background-clip: text) {
  .login-page__masthead-abay {
    background-image: linear-gradient(
      165deg,
      #1a3544 0%,
      #2d4f63 28%,
      var(--login-grad-a) 72%,
      #4a7f96 100%
    );
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
  }
  .login-page__masthead-edge {
    background-image: linear-gradient(
      165deg,
      var(--login-grad-a) 0%,
      var(--login-grad-b) 38%,
      #42b4d8 72%,
      #7dd3fc 100%
    );
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
  }
}
.login-page__masthead-tagline {
  margin: clamp(0.6rem, 2.2vw, 0.9rem) 0 0 0;
  max-width: 22rem;
  padding: 0 0.25rem;
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: clamp(0.8125rem, 2.6vw, 0.9375rem);
  font-weight: 400;
  line-height: 1.45;
  color: #547286;
}
.login-page__form-card {
  width: 100%;
  background: #fff;
  border: 1px solid rgba(58, 108, 135, 0.14);
  border-radius: clamp(1.125rem, 3.5vw, 1.5rem);
  box-shadow:
    0 2px 4px rgba(15, 23, 42, 0.04),
    0 12px 28px -8px rgba(58, 108, 135, 0.22),
    0 28px 64px -20px rgba(15, 37, 55, 0.18);
  padding: 0;
  overflow: hidden;
}
.login-page__card-brand {
  background: var(--login-gradient);
  padding: clamp(0.85rem, 2.8vw, 1.25rem) clamp(1.25rem, 4vw, 2rem);
  text-align: center;
  flex-shrink: 0;
}
.login-page__card-title {
  margin: 0;
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.32em;
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: clamp(1.28rem, 4.2vw, 1.72rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.08;
  color: #fff;
  text-rendering: optimizeLegibility;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.22),
    0 0.08em 0.2em rgba(0, 0, 0, 0.14);
}
.login-page__card-title-chunk {
  font-weight: 800;
  letter-spacing: -0.055em;
}
.login-page__card-title-chunk--cap {
  letter-spacing: -0.03em;
  color: rgba(255, 255, 255, 0.92);
}
.login-page__card-body {
  padding: clamp(1.05rem, 3.5vw, 1.6rem) clamp(1.25rem, 4.5vw, 2rem)
    clamp(1rem, 2.75vw, 1.35rem);
  background: #fff;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.login-page__tabs {
  display: flex;
  gap: 0.35rem;
  padding: 0.3rem 0.35rem;
  margin: 0 0 clamp(0.95rem, 2.5vw, 1.2rem) 0;
  list-style: none;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 0.875rem;
}
.login-page__tabs li {
  flex: 1;
  min-width: 0;
}
.login-page__tab {
  width: 100%;
  min-height: 2.5rem;
  padding: 0.55rem 0.6rem;
  font-size: clamp(0.8125rem, 2.8vw, 0.875rem);
  font-weight: 700;
  color: #64748b;
  background: transparent;
  border: none;
  border-radius: 0.65rem;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}
.login-page__tab:hover {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.9);
}
.login-page__tab--active {
  color: #fff;
  background: var(--login-gradient);
  box-shadow:
    0 2px 10px rgba(58, 108, 135, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.login-page__tab:focus-visible {
  outline: 2px solid var(--login-grad-a);
  outline-offset: 2px;
}
.login-page__form {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}
.login-page__field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.login-page__field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.85rem 1rem;
  align-items: start;
}
.login-page__field--inline {
  min-width: 0;
}
@media (max-width: 360px) {
  .login-page__field-row {
    grid-template-columns: 1fr;
    gap: 0.95rem;
  }
}
.login-page__label {
  font-size: clamp(0.75rem, 2.5vw, 0.8125rem);
  font-weight: 700;
  color: #334155;
  letter-spacing: 0.01em;
}
.login-page__hint {
  font-size: 0.75rem;
  color: #94a3b8;
  margin: 0;
  line-height: 1.35;
}
.login-page__card-title--sub {
  justify-content: center;
}
.login-page__card-body--solo {
  padding-top: 0.35rem;
}
.login-page__lead {
  font-size: clamp(0.8125rem, 2.5vw, 0.875rem);
  color: #64748b;
  margin: 0 0 0.85rem;
  line-height: 1.45;
}
.login-page__lead--warn {
  color: #9a3412;
}
.login-page__forgot {
  margin: -0.35rem 0 0;
  text-align: right;
}
.login-page__forgot-link {
  font-size: clamp(0.75rem, 2.4vw, 0.8125rem);
  font-weight: 600;
  color: var(--login-grad-a, #3a6c87);
  text-decoration: none;
}
.login-page__forgot-link:hover {
  text-decoration: underline;
}
.login-page__back {
  margin: 0.85rem 0 0;
  text-align: center;
}
.login-page__input {
  width: 100%;
  padding: clamp(0.65rem, 2.2vw, 0.75rem) 1rem;
  font-size: clamp(0.875rem, 2.8vw, 0.9375rem);
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  background: #fafafa;
  box-sizing: border-box;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.login-page__input:hover {
  border-color: #cbd5e1;
}
.login-page__input:focus {
  outline: none;
  border-color: var(--login-grad-a);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(58, 108, 135, 0.2);
}
.login-page__password-wrap {
  position: relative;
  width: 100%;
}
.login-page__input--password {
  padding-right: 2.75rem;
}
.login-page__password-toggle {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border: none;
  border-radius: 0.5rem;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.login-page__password-toggle:hover {
  color: #334155;
  background: rgba(148, 163, 184, 0.18);
}
.login-page__password-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--login-grad-a);
}
.login-page__password-toggle-icon {
  display: block;
  flex-shrink: 0;
}
.login-page__password-toggle-icon--when-shown {
  display: none;
}
.login-page__password-toggle--revealed .login-page__password-toggle-icon--when-masked {
  display: none;
}
.login-page__password-toggle--revealed .login-page__password-toggle-icon--when-shown {
  display: block;
}
.login-page__submit {
  width: 100%;
  padding: clamp(0.72rem, 2.2vw, 0.82rem) 1rem;
  font-size: clamp(0.875rem, 2.8vw, 0.9375rem);
  font-weight: 700;
  color: #fff;
  background: var(--login-gradient);
  border: none;
  border-radius: 0.75rem;
  cursor: pointer;
  margin-top: 0.2rem;
  box-shadow:
    0 4px 16px rgba(58, 108, 135, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}
.login-page__submit:hover {
  filter: brightness(1.06);
  background: var(--login-gradient-soft);
  box-shadow:
    0 6px 22px rgba(58, 108, 135, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.login-page__submit:active {
  transform: translateY(1px);
}
.login-page__submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}
.login-page__submit--secondary {
  background: var(--login-gradient);
  box-shadow:
    0 4px 16px rgba(58, 108, 135, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.login-page__submit--secondary:hover {
  filter: brightness(1.06);
  background: var(--login-gradient-soft);
}
.login-page__card-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  row-gap: 0.35rem;
  margin-top: clamp(0.85rem, 2.25vw, 1.15rem);
  padding-top: clamp(0.75rem, 2vw, 1rem);
  border-top: 1px solid #e2e8f0;
}
.login-page__card-footer-prefix {
  font-size: clamp(0.8125rem, 2.5vw, 0.875rem);
  font-weight: 400;
  color: #64748b;
  letter-spacing: normal;
  line-height: 1;
}
.login-page__card-footer-logo {
  width: auto;
  height: 36px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}
.login-page__message {
  margin-top: 0.75rem;
  padding: 0.55rem 0.75rem;
  font-size: clamp(0.75rem, 2.5vw, 0.8125rem);
  border-radius: 0.65rem;
  line-height: 1.4;
}
.login-page__message--error {
  color: #991b1b;
  background: #fef2f2;
  border: 1px solid #fecaca;
}
.login-page__message--success {
  color: #047857;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
}
.login-page__message[hidden] {
  display: none !important;
}
@media (max-width: 420px) {
  .login-page__masthead-wordmark {
    font-size: clamp(1.78rem, 8.8vw, 2.45rem);
  }
  .login-page__input,
  .login-page__submit {
    font-size: 1rem;
  }
  .login-page__card-title {
    font-size: clamp(1.12rem, 4.5vw, 1.42rem);
    gap: 0.28em;
  }
  .login-page__tabs {
    gap: 0.25rem;
    padding: 0.28rem 0.3rem;
  }
  .login-page__tab {
    min-height: 2.4rem;
    padding: 0.5rem 0.45rem;
  }
  .login-page__card-footer-logo {
    height: 28px;
  }
}

@media (min-width: 480px) {
  .login-page__layout {
    max-width: min(100%, 26rem);
  }
}

/* ---- Loading ---- */
.loading-msg {
  text-align: center;
  padding: 3rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
}

/* ---- Dark theme (brand colors: dark green/teal) ---- */
.app-shell[data-theme="dark"] {
  --primary: #e2e8f0;
  --bg: #0f172a;
  --accent: #0a5368;
  --accent-light: #1ab2e7;
  --accent-dark: #2f6a7b;
  --green: #4ade80;
  --red: #f87171;
  background: #0f172a;
  color: #e2e8f0;
}
body:has(.app-shell[data-theme="dark"]) { background: #0f172a; color: #e2e8f0; }
.app-shell[data-theme="dark"] main { background: #0f172a; color: #e2e8f0; }
.app-shell[data-theme="dark"] .app-sidebar { background: linear-gradient(180deg, #0a5368 0%, #062530 100%); }
.app-shell[data-theme="dark"] .app-header { background: #0d3d4d; border-color: rgba(10, 83, 104, 0.5); }
.app-shell[data-theme="dark"] .header-nav-link { color: #94a3b8; }
.app-shell[data-theme="dark"] .header-nav-link:hover { color: var(--accent-light); background: rgba(10, 83, 104, 0.25); }
.app-shell[data-theme="dark"] .header-nav-link.active { color: var(--accent-light); background: rgba(10, 83, 104, 0.35); }
.app-shell[data-theme="dark"] .app-header h1 { color: #fff; }
.app-shell[data-theme="dark"] .header-nav-title { color: #ffffff; }
.app-shell[data-theme="dark"] .header-nav-subtitle { color: rgba(226, 232, 240, 0.85); }
.app-shell[data-theme="dark"] .card { background: #1e293b; border-color: #334155; color: #e2e8f0; }
.app-shell[data-theme="dark"] .chart-card-elevated {
  background: #1e293b;
  border-color: rgba(148, 163, 184, 0.15);
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.4);
}
.app-shell[data-theme="dark"] .chart-card-elevated:hover {
  box-shadow: 0 20px 40px -12px rgba(0,0,0,0.5);
}
.app-shell[data-theme="dark"] .chart-card-title { color: #fff; }
.app-shell[data-theme="dark"] .table-wrapper { background: #1e293b; border-color: #334155; }
.app-shell[data-theme="dark"] .app-table th { background: #334155; color: #e2e8f0; border-color: #475569; }
.app-shell[data-theme="dark"] .app-table td { color: #e2e8f0; border-color: #334155; }
.app-shell[data-theme="dark"] .app-table tbody tr:nth-child(odd) { background: #1e293b; }
.app-shell[data-theme="dark"] .app-table tbody tr:nth-child(even) { background: #334155; }
.app-shell[data-theme="dark"] .app-table tbody tr:hover { background: #475569 !important; }
.app-shell[data-theme="dark"] .trade-thumb { border-color: #475569; }
.app-shell[data-theme="dark"] .section-title { color: #fff; }
.app-shell[data-theme="dark"] .stat-label { color: #94a3b8; }
.app-shell[data-theme="dark"] .stat-value { color: #fff; }
.app-shell[data-theme="dark"] .input-field,
.app-shell[data-theme="dark"] .filter-row input,
.app-shell[data-theme="dark"] .filter-row select {
  background: #334155; border-color: #475569; color: #e2e8f0;
}
.app-shell[data-theme="dark"] .btn-secondary { background: #334155; border-color: #475569; color: #e2e8f0; }
.app-shell[data-theme="dark"] .btn-secondary:hover { background: #475569; border-color: var(--accent); color: var(--accent-light); }
.app-shell[data-theme="dark"] .btn-theme-toggle { background: #334155; border-color: #475569; color: #fff; }
.app-shell[data-theme="dark"] .strategy-item { border-color: #334155; }
.app-shell[data-theme="dark"] .strategy-item-name { color: #fff; }
.app-shell[data-theme="dark"] .strategy-item-desc { color: #94a3b8; }
.app-shell[data-theme="dark"] .cta-empty { background: #1e293b; border-color: #475569; }
.app-shell[data-theme="dark"] .cta-empty h3 { color: #fff; }
.app-shell[data-theme="dark"] .cta-empty p { color: #94a3b8; }
.app-shell[data-theme="dark"] .page-header .page-title,
.app-shell[data-theme="dark"] .page-content .page-title { color: #fff; }
.app-shell[data-theme="dark"] .page-header .page-subtitle,
.app-shell[data-theme="dark"] .page-content .page-subtitle { color: #cbd5e1; }
.app-shell[data-theme="dark"] .loading-msg { color: #e2e8f0; }
.app-shell[data-theme="dark"] .app-header .user-info span:not(.role-badge) { color: #e2e8f0; }
.app-shell[data-theme="dark"] .app-header .role-badge.admin {
  background: var(--accent);
  color: #fff;
}
.app-shell[data-theme="dark"] .app-header .role-badge.trader,
.app-shell[data-theme="dark"] .app-header .role-badge.user {
  background: #e2e8f0;
  color: #0f172a;
}
.app-shell[data-theme="dark"] .app-header .role-badge.manager {
  background: #bfdbfe;
  color: #0f172a;
}
.app-shell[data-theme="dark"] .filter-row label { color: #94a3b8; }
.app-shell[data-theme="dark"] main h1,
.app-shell[data-theme="dark"] main h2,
.app-shell[data-theme="dark"] main h3,
.app-shell[data-theme="dark"] main p { color: #e2e8f0; }
.app-shell[data-theme="dark"] main .page-title { color: #fff; }
.app-shell[data-theme="dark"] main .page-subtitle { color: #cbd5e1; }
.app-shell[data-theme="dark"] #sidebar-toggle { background: #334155 !important; color: #fff !important; }
.app-shell[data-theme="dark"] .btn-add-trade-header { color: #ffffff; }
.app-shell[data-theme="dark"] .btn-add-trade-header:hover { background: rgba(10, 83, 104, 0.3); color: var(--accent-light); }
.app-shell[data-theme="dark"] #btn-logout { color: var(--accent-light); }
.app-shell[data-theme="dark"] #btn-logout:hover { color: #fff; }

/* ---- The Edge page (rules, strategies, docs) ---- */
.edge-page { max-width: 1200px; }
.edge-hero {
  background: linear-gradient(135deg, rgba(10, 83, 104, 0.08) 0%, rgba(10, 83, 104, 0.03) 100%);
  border: 1px solid rgba(10, 83, 104, 0.2);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
}
.edge-hero-text {
  margin: 0;
  font-size: 0.95rem;
  color: #475569;
  font-weight: 500;
  text-align: center;
}
.app-shell[data-theme="dark"] .edge-hero { background: linear-gradient(135deg, rgba(10, 83, 104, 0.15) 0%, rgba(10, 83, 104, 0.05) 100%); border-color: rgba(10, 83, 104, 0.3); }
.app-shell[data-theme="dark"] .edge-hero-text { color: #94a3b8; }

.edge-accordion {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 768px) {
  .edge-accordion { grid-template-columns: 1fr 1fr; }
}
.edge-category {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.edge-category--collapsed .edge-category-chevron { transform: rotate(-90deg); }
.app-shell[data-theme="dark"] .edge-category { background: #1e293b; border-color: #334155; }

.edge-category-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: #f8fafc;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  color: #0f172a;
  text-align: left;
  transition: background 0.15s;
}
.edge-category-toggle:hover { background: #f1f5f9; }
.app-shell[data-theme="dark"] .edge-category-toggle { background: #334155; color: #e2e8f0; }
.app-shell[data-theme="dark"] .edge-category-toggle:hover { background: #475569; }

.edge-category-icon {
  flex-shrink: 0;
  color: var(--accent);
}
.edge-category-title { flex: 1; }
.edge-category-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  background: #e2e8f0;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
}
.app-shell[data-theme="dark"] .edge-category-badge { background: #475569; color: #94a3b8; }
.edge-category-chevron {
  flex-shrink: 0;
  color: #64748b;
  transition: transform 0.2s;
}

.edge-category-content {
  border-top: 1px solid #e2e8f0;
  padding: 0.5rem;
}
.app-shell[data-theme="dark"] .edge-category-content { border-color: #334155; }

.edge-item {
  border-radius: 8px;
  margin-bottom: 0.25rem;
  overflow: hidden;
}
.edge-item:last-child { margin-bottom: 0; }
.edge-item-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  color: #334155;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.edge-item-toggle:hover { background: rgba(10, 83, 104, 0.06); color: var(--accent); }
.edge-item--open .edge-item-toggle { background: rgba(10, 83, 104, 0.08); color: var(--accent); }
.app-shell[data-theme="dark"] .edge-item-toggle { color: #cbd5e1; }
.app-shell[data-theme="dark"] .edge-item-toggle:hover,
.app-shell[data-theme="dark"] .edge-item--open .edge-item-toggle { background: rgba(10, 83, 104, 0.15); color: var(--accent-light); }

.edge-item-title { flex: 1; }
.edge-item-chevron {
  flex-shrink: 0;
  color: #94a3b8;
  transition: transform 0.2s;
}
.edge-item--open .edge-item-chevron { transform: rotate(180deg); }

.edge-item-content[hidden] { display: none; }
.edge-item-body {
  padding: 1rem 1.25rem 1rem 2.5rem;
  font-size: 0.9rem;
  line-height: 1.6;
  color: #475569;
  border-top: 1px solid #f1f5f9;
}
.app-shell[data-theme="dark"] .edge-item-body { color: #94a3b8; border-color: #334155; }

/* Trade form: hide native "No file chosen" beside the button; status shown in .trade-file-hint below */
input[type="file"].trade-screenshot-input {
  color: transparent;
}
input[type="file"].trade-screenshot-input::file-selector-button {
  color: #334155;
}
input[type="file"].trade-screenshot-input::-webkit-file-upload-button {
  color: #334155;
}
.app-shell[data-theme="dark"] input[type="file"].trade-screenshot-input::file-selector-button,
.app-shell[data-theme="dark"] input[type="file"].trade-screenshot-input::-webkit-file-upload-button {
  color: #e2e8f0;
}
.trade-file-hint {
  font-size: 0.8125rem;
  color: #64748b;
  margin: 0.35rem 0 0 0;
  line-height: 1.35;
  word-break: break-word;
}
.app-shell[data-theme="dark"] .trade-file-hint {
  color: #94a3b8;
}

/* ---- Trade screenshot thumbnail ---- */
.trade-thumb {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  display: block;
}
.app-shell[data-theme="dark"] .trade-thumb { border-color: #475569; }

/* ---- Journal page (A4-sized) ---- */
.journal-page { max-width: 100%; }
.journal-form-a4 { padding: 0.5rem 0; }
.journal-a4-card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 1rem 1.25rem;
  max-width: 210mm;
  margin: 0 auto;
  font-size: 0.875rem;
}
.journal-form-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.journal-title-row {
  text-align: center;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e2e8f0;
}
.journal-main-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin: 0 0 0.15rem 0;
}
.journal-motto {
  font-size: 0.8rem;
  font-style: italic;
  color: #64748b;
  margin: 0;
}
.journal-form .journal-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin-bottom: 0.6rem;
}
.journal-form .journal-row-top { margin-bottom: 0.5rem; }
.journal-field {
  flex: 1;
  min-width: 80px;
}
.journal-field label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.2rem;
}
.journal-field input[readonly],
.journal-field input[type="text"],
.journal-field input[type="number"] {
  width: 100%;
  padding: 0.35rem 0.5rem;
  font-size: 0.8rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #f8fafc;
}
.journal-field input:not([readonly]) {
  background: #fff;
}
.journal-section {
  margin-top: 0.75rem;
  padding-top: 0.6rem;
  border-top: 1px solid #f1f5f9;
}
.journal-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 0.4rem 0;
  padding: 0.25rem 0;
  background: #f1f5f9;
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
}
.journal-form textarea {
  width: 100%;
  padding: 0.4rem 0.5rem;
  font-size: 0.8rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  resize: vertical;
  min-height: 2.5rem;
}
.journal-structure-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.journal-tf-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.journal-tf-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: #64748b;
}
.journal-check-inline {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  cursor: pointer;
  margin: 0;
}
.journal-emotional-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
}
.journal-notes-box {
  margin-top: 0.5rem;
  border: none;
  outline: none;
  box-shadow: none;
  background: transparent;
}
.journal-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.journal-radio-row {
  display: flex;
  gap: 1rem;
}
.journal-radio-row label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  font-size: 0.8rem;
  text-transform: none;
}
.journal-stars {
  display: flex;
  gap: 0.2rem;
}
.journal-star {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: #fbbf24;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.journal-star:hover { opacity: 0.8; }
.journal-form-actions {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 0.5rem;
}
.journal-trade-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.journal-trade-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  font-size: 0.9rem;
  transition: background 0.15s, border-color 0.15s;
}
.journal-trade-item:hover {
  background: #f1f5f9;
  border-color: var(--accent);
}
.journal-trade-item.journaled { border-left: 3px solid var(--accent); }
.journal-trade-date { min-width: 90px; color: #64748b; }
.journal-trade-pair { font-weight: 600; min-width: 80px; }
.app-shell[data-theme="dark"] .journal-trade-pair { color: #000 !important; }
.journal-trade-direction.buy { color: var(--green); }
.journal-trade-direction.sell { color: var(--red); }
.journal-trade-result { font-size: 0.75rem; }
.journal-trade-result.win { color: var(--green); }
.journal-trade-result.loss { color: var(--red); }
.journal-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.2rem 0.4rem;
  background: var(--accent);
  color: #fff;
  border-radius: 4px;
  margin-left: auto;
}
@media (max-width: 640px) {
  .journal-structure-grid { grid-template-columns: 1fr 1fr; }
  .journal-two-col { grid-template-columns: 1fr; }
}

@media (max-width: 1023px) {
  .app-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.2s;
  }
  .app-sidebar.open { transform: translateX(0); }
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 40;
    display: none;
  }
  .sidebar-backdrop.show { display: block; }
  .lg-only-hidden { display: inline-block !important; }
}
@media (min-width: 1024px) {
  .lg-only-hidden { display: none !important; }
}

/* ---- Profit Calendar ---- */
/* .profit-calendar-container gap must match .profit-calendar-filter-row so the top bar aligns with Month View */
.profit-calendar-container {
  display: flex;
  align-items: flex-start;
  margin-bottom: 1.25rem;
  gap: 2.75rem;
}

.profit-calendar-left {
  flex: 1;
  min-width: 520px;
}

.profit-calendar-right {
  width: 360px;
  flex: 0 0 auto;
}

.profit-calendar-topbar .btn-secondary { flex-shrink: 0; }

/* Calendar top bar: month nav (left) | total trades this month (flush right in card) */
.profit-calendar-topbar-inner {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  width: 100%;
  min-height: 0;
  min-width: 0;
  height: 100%;
  padding-right: 0.25rem;
}
.profit-calendar-topbar-nav {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  flex-wrap: nowrap;
  min-width: 0;
  flex: 0 1 auto;
}
.profit-calendar-starting-capital {
  justify-self: center;
  text-align: center;
  font-weight: 700;
  font-size: 0.875rem;
  white-space: nowrap;
  min-width: 0;
  /* Extra space after month nav / before account card column */
  margin-left: 2.25rem;
  padding-left: 0.75rem;
}
.profit-calendar-total-trades-month {
  flex: 0 0 auto;
  margin-left: auto;
  font-weight: 700;
  font-size: 0.875rem;
  text-align: right;
  white-space: nowrap;
  padding-right: 0.35rem;
}
.profit-calendar-total-trades-month .text-primary {
  font-weight: 800;
}
@media (max-width: 900px) {
  .profit-calendar-topbar-inner {
    flex-direction: column;
    justify-content: center;
    text-align: center;
    padding-right: 0;
  }
  .profit-calendar-topbar-nav {
    flex-wrap: wrap;
    justify-content: center;
  }
  .profit-calendar-starting-capital {
    margin-left: 0;
    padding-left: 0;
  }
  .profit-calendar-total-trades-month {
    margin-left: 0;
    text-align: center;
    padding-right: 0;
  }
}

/* Same gap + right column width as .profit-calendar-container (Month View | Evaluation) */
.profit-calendar-filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 2.75rem;
  align-items: stretch;
  margin-bottom: 1.25rem;
}
.profit-calendar-account-card { max-width: none; }

/* Make the two top cards match height */
.profit-calendar-filter-row .profit-calendar-topbar,
.profit-calendar-filter-row .profit-calendar-account-card {
  height: 100%;
}

.profit-calendar-filter-row .profit-calendar-account-card .profit-calendar-account-scope-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
}

/* Calendar: Account label left, dropdown right */
.profit-calendar-account-scope-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: nowrap;
  width: 100%;
  max-width: 100%;
}
.profit-calendar-account-scope-row .input-field {
  flex: 0 1 auto;
  min-width: 180px;
  max-width: 260px;
}

@media (max-width: 900px) {
  .profit-calendar-filter-row {
    grid-template-columns: 1fr;
  }
}

.profit-calendar-grid-dow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

/* ---- Settings (two-column layout) ---- */
.settings-wrap { max-width: 1200px; margin-left: auto; margin-right: auto; }
.settings-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}
.settings-password-security-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: stretch;
}
.settings-security-stack {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  height: 100%;
}
.settings-security-stack > .card-settings:last-child {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
@media (max-width: 900px) {
  .settings-two-col { grid-template-columns: 1fr; }
  .settings-password-security-row { grid-template-columns: 1fr; }
}

/* Users: Add user form (2x2 inputs) */
.add-user-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem 1rem;
}
@media (max-width: 900px) {
  .add-user-grid { grid-template-columns: 1fr; }
}

/* ---- Portfolio ---- */
.portfolio-overview-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: stretch;
}
.portfolio-overview-chart .portfolio-chart-wrap {
  min-height: 240px;
}
/* Desktop: All Accounts Overview card matches Equity Curve card height */
@media (min-width: 1024px) {
  .portfolio-overview-stack {
    height: 100%;
    min-height: 0;
  }
  .portfolio-overview-stack > .portfolio-overview {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  .portfolio-overview-chart {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
  }
  .portfolio-overview-chart .portfolio-chart-wrap {
    flex: 1 1 auto;
    min-height: 240px;
    height: 0;
  }
}
@media (max-width: 1023px) {
  .portfolio-overview-row { grid-template-columns: 1fr; }
}
.portfolio-overview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.portfolio-accounts-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}
.portfolio-acct-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem 1rem;
  margin-top: 0.75rem;
}
@media (max-width: 1023px) {
  .portfolio-overview-grid { grid-template-columns: repeat(2, 1fr); }
  .portfolio-accounts-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .portfolio-overview-grid { grid-template-columns: 1fr; }
  .portfolio-accounts-grid { grid-template-columns: 1fr; }
  .portfolio-acct-grid { grid-template-columns: 1fr; }
}

/* ---- Insights ---- */
.insights-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
.insights-grid .portfolio-overview-grid .stat-block {
  border-color: #f1efe2;
  background: #faf9f4;
  box-shadow: 0 1px 6px rgba(30, 41, 59, 0.05);
}
.app-shell[data-theme="dark"] .insights-grid .portfolio-overview-grid .stat-block {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-color: rgba(148, 163, 184, 0.22);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}
.app-shell[data-theme="dark"] .insights-grid .portfolio-overview-grid .stat-block .stat-label {
  color: #94a3b8;
}
.app-shell[data-theme="dark"] .insights-grid .portfolio-overview-grid .stat-block .stat-value {
  color: #f8fafc;
}
.app-shell[data-theme="dark"] .insights-grid .portfolio-overview-grid .stat-block .text-gray-600 {
  color: #94a3b8 !important;
}
.insights-two-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
.strategy-two-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
.strategy-three-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 1024px) {
  .insights-two-col {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
  .strategy-two-col {
    grid-template-columns: minmax(540px, 1.2fr) minmax(420px, 1fr);
    align-items: start;
  }
  /* Strategies page: two equal columns (create | list) */
  .strategy-page-two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 1.25rem;
  }
  .strategy-page-top-row {
    align-items: stretch;
  }
  .strategy-three-col {
    grid-template-columns: minmax(420px, 1.25fr) minmax(300px, 1fr) minmax(300px, 1fr);
    align-items: start;
  }
}
.table-wrapper--compact {
  overflow-x: hidden;
}
.table-wrapper--in-card {
  border: none;
  box-shadow: none;
  background: transparent;
}
.table-wrapper--in-card .app-table th:first-child { padding-left: 0.9rem; }
.table-wrapper--in-card .app-table th:last-child { padding-right: 0.9rem; }
.table-wrapper--in-card .app-table td:first-child { padding-left: 0.9rem; }
.table-wrapper--in-card .app-table td:last-child { padding-right: 0.9rem; }
.compact-analysis-table {
  table-layout: fixed;
  min-width: 0;
  width: 100%;
  font-size: 0.82rem;
}
.compact-analysis-table th,
.compact-analysis-table td {
  padding-left: 0.55rem;
  padding-right: 0.55rem;
}
.compact-analysis-table td:first-child,
.compact-analysis-table th:first-child {
  white-space: normal;
  word-break: break-word;
}

/* ---- Notes ---- */
.notes-page .notes-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}
.notes-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 1024px) {
  .notes-layout {
    grid-template-columns: minmax(560px, 1.6fr) minmax(280px, 0.8fr);
    align-items: start;
  }
}
.notes-layout-col-left {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}
.strategy-layout-col-left {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
}

/* Strategies page: ensure top-row cards match height */
@media (min-width: 1024px) {
  .strategy-page-top-row > .strategy-layout-col-left {
    height: 100%;
  }
  .strategy-page-top-row .strategy-page-note-form {
    height: 100%;
    display: flex;
    flex-direction: column;
  }
  .strategy-page-top-row .strategy-add-note-card {
    height: 100%;
    display: flex;
    flex-direction: column;
  }
  .strategy-page-top-row .strategy-add-note-card .notes-form {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  .strategy-page-top-row .strategy-add-note-card .notes-form .form-actions {
    margin-top: auto;
  }
}

/* Strategies (admin): keep the User scope card aligned to left column width */
.strategy-admin-scope-row {
  width: 100%;
  margin-bottom: 1.25rem;
}
@media (min-width: 1024px) {
  .strategy-admin-scope-row {
    max-width: calc((100% - 1.25rem) / 2);
  }
}
.strategy-create-card,
.strategy-add-note-card {
  height: 100%;
  overflow: visible;
}
.strategy-create-card .strategy-form {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.strategy-create-card #strategy-description {
  min-height: 140px;
}
.strategy-create-card .form-actions {
  margin-top: auto;
  padding-top: 0.75rem;
  padding-bottom: 1.6rem;
  margin-bottom: 0.5rem;
  position: relative;
  top: -8px;
}
.strategy-saved-strategy-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.strategy-saved-strategy-card .strategy-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding-right: 0.25rem;
}
.strategy-page-note-form .notes-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}
.strategy-page-note-form #strategy-note-content {
  min-height: 140px;
}
.strategy-page-notes-categories {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  min-width: 0;
}
@media (min-width: 1024px) {
  .strategy-page-notes-categories {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
}
.notes-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
.notes-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.notes-page #note-content {
  min-height: 320px;
}
.note-item {
  border: 1px solid #f1efe2;
  border-radius: 10px;
  background: #faf9f4;
  padding: 0.75rem;
  display: flex;
  gap: 0.6rem;
  justify-content: space-between;
  align-items: flex-start;
}
.note-item-head {
  min-width: 0;
}
.note-item-title {
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.2rem;
  word-break: break-word;
}
.note-item-date {
  font-size: 0.78rem;
  color: #64748b;
}
.note-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
@media (max-width: 700px) {
  .note-item {
    flex-direction: column;
  }
  .note-item-actions {
    width: 100%;
  }
}

/* ---- Tracker ---- */
.tracker-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

.tracker-admin-scope-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
.tracker-admin-scope-row .tracker-admin-scope-card {
  min-width: 0;
}

.tracker-insights-top-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  align-items: stretch;
}
.tracker-insights-right-stack {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
}
.tracker-insights-emotion-card,
.tracker-insights-mini-card {
  min-width: 0;
}

/* Narrow scope selector cards (Account/User pickers) */
.scope-card-narrow {
  width: 100%;
  max-width: 520px;
  margin-right: auto;
}
.scope-card-narrow--tracker {
  max-width: 520px;
}
.scope-card-narrow--insights {
  max-width: 520px;
}
@media (max-width: 900px) {
  .scope-card-narrow { max-width: none; }
}
@media (min-width: 1024px) {
  /* Match one column of .tracker-grid (3 columns + 2 gaps) */
  .scope-card-narrow--tracker {
    max-width: calc((100% - 2.5rem) / 3);
  }
  /* Match one column of the Insights 2-col summary row (2 columns + 1 gap) */
  .scope-card-narrow--insights {
    max-width: calc((100% - 1.25rem) / 2);
  }
}

/* Tracker: Account label left, dropdown right inside the scope card */
.tracker-account-scope-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.tracker-account-scope-card .tracker-account-scope-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: nowrap;
  width: 100%;
  max-width: 100%;
}
.tracker-account-scope-card .tracker-account-scope-row .input-field {
  flex: 0 1 auto;
  min-width: 180px;
  max-width: 260px;
}

/* Insights: Account label left, dropdown right (same pattern as Tracker scope card) */
/* Account scope: label left, dropdown right (Insights, Trades, Journal) */
.insights-account-scope-card,
.page-account-scope-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.insights-account-scope-card .insights-account-scope-row,
.page-account-scope-card .page-account-scope-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: nowrap;
  width: 100%;
  max-width: 100%;
}
.insights-account-scope-card .insights-account-scope-row .input-field,
.page-account-scope-card .page-account-scope-row .input-field {
  flex: 0 1 auto;
  min-width: 180px;
  max-width: 260px;
}

/* Admin scope: same row as user Account card (label + select, compact padding) */
.admin-page-scope-card.page-account-scope-card {
  padding: 0.75rem 0.85rem;
}
.admin-page-scope-card .page-account-scope-row > .stat-label {
  font-weight: 800;
  letter-spacing: 0.04em;
}

/* Journal (admin): user + account + filters + export one row, equal card heights */
.journal-admin-filters-row {
  display: grid;
  gap: 0.75rem;
  align-items: stretch;
  margin-bottom: 1.25rem;
}
.journal-admin-filters-row--three-scopes {
  grid-template-columns: minmax(200px, 280px) minmax(200px, 280px) minmax(280px, 1fr) auto;
}
.journal-admin-filters-row--two-scopes {
  grid-template-columns: minmax(200px, 280px) minmax(280px, 1fr) auto;
}
.journal-admin-filters-row .journal-filters-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
}
@media (max-width: 1100px) {
  .journal-admin-filters-row--three-scopes,
  .journal-admin-filters-row--two-scopes {
    grid-template-columns: 1fr;
  }
  .journal-admin-filters-row .journal-export-right {
    justify-content: flex-start;
  }
}

/* Profit calendar (admin): top row matches trader filter row; Month View | Evaluation use same container as trader */
.profit-calendar-filter-row .profit-calendar-admin-top-row {
  min-height: 0;
  height: 100%;
  align-self: stretch;
}
.profit-calendar-filter-row .profit-calendar-admin-account-cell {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  height: 100%;
  align-self: stretch;
}
.profit-calendar-filter-row .profit-calendar-admin-account-cell > .card {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}
.profit-calendar-admin-top-row {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 1rem;
  width: 100%;
}
.profit-calendar-admin-top-row .profit-calendar-topbar {
  flex: 1 1 280px;
  min-width: 0;
}
/* Admin calendar only: compact “Total trades this month” copy */
.profit-calendar-admin-top-row .profit-calendar-total-trades-month {
  font-size: 0.65rem;
  font-weight: 600;
  line-height: 1.25;
}
.profit-calendar-admin-top-row .profit-calendar-total-trades-month .text-primary {
  font-size: inherit;
  font-weight: 700;
}
.profit-calendar-admin-top-row .profit-calendar-admin-user-card {
  flex: 0 1 360px;
  min-width: min(100%, 220px);
  max-width: 380px;
}
@media (max-width: 900px) {
  .profit-calendar-admin-top-row .profit-calendar-admin-user-card {
    flex: 1 1 100%;
    max-width: none;
  }
}

/* Portfolio (admin): user scope only as wide as overview column */
.portfolio-overview-stack {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
}

/* Tracker (admin): user + account stack in grid with summary cards */
.tracker-admin-scope-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 0;
  height: 100%;
}
.tracker-grid--admin-scopes .tracker-admin-scope-stack .admin-page-scope-card {
  flex: 1 1 auto;
  min-height: 0;
}
@media (max-width: 1023px) {
  .tracker-grid--admin-scopes {
    grid-template-columns: 1fr !important;
  }
}
.tracker-grid--admin-scopes .tracker-admin-cost-span {
  grid-column: 1 / -1;
}

@media (min-width: 1024px) {
  .tracker-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .tracker-full-width {
    grid-column: 1 / -1;
  }

  .tracker-insights-top-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .tracker-admin-scope-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .tracker-admin-scope-row .tracker-admin-scope-card--user {
    grid-column: 1 / 2;
  }
  .tracker-admin-scope-row .tracker-admin-scope-card--account {
    grid-column: 2 / 3;
  }
}

.tracker-mini-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}
@media (max-width: 640px) {
  .tracker-mini-grid {
    grid-template-columns: 1fr;
  }
}

.tracker-pips-subhead {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  margin: 0 0 0.5rem;
}
.tracker-pips-two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  align-items: start;
}
.tracker-pips-col { min-width: 0; }
.tracker-pips-stack {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}
.tracker-pips-stack .stat-value {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
}
@media (max-width: 640px) {
  .tracker-pips-two-col { grid-template-columns: 1fr; }
}

/* Tracker: force 4 columns for cost card */
.tracker-cost-grid {
  grid-template-columns: repeat(2, 1fr) !important;
}
.tracker-cost-grid .stat-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.portfolio-overview .stat-block,
.tracker-summary-card .stat-block {
  background: linear-gradient(135deg, #fff 0%, #f8fafc 100%);
  border: 1px solid rgba(10, 83, 104, 0.12);
  box-shadow: 0 2px 12px rgba(10, 83, 104, 0.06);
}
@media (max-width: 1023px) {
  .tracker-cost-grid { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 640px) {
  .tracker-cost-grid { grid-template-columns: 1fr !important; }
}

.profit-calendar-dow {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-light);
}

.profit-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem;
}

.profit-calendar-day {
  border: 1px solid rgba(10, 83, 104, 0.25);
  border-radius: 12px;
  padding: 0.45rem 0.5rem;
  min-height: 86px;
  background: rgba(10, 83, 104, 0.04);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.profit-calendar-out {
  background: transparent;
  border-style: dashed;
  opacity: 0.55;
}

.profit-day-number {
  font-weight: 800;
  color: var(--accent);
  font-size: 0.85rem;
}

.profit-trade-count {
  font-size: 0.75rem;
  font-weight: 700;
  color: #0f172a;
}

.profit-amount {
  font-size: 0.85rem;
  font-weight: 900;
  margin-top: auto;
  letter-spacing: -0.01em;
  color: #0f172a;
}

.profit-no-trades {
  margin-top: auto;
  font-size: 0.75rem;
  font-weight: 700;
  color: #64748b;
}

.profit-day-win {
  background: rgba(74, 222, 128, 0.22);
  border-color: rgba(5, 150, 105, 0.45);
}
.profit-day-win .profit-trade-count { color: #0f172a; }
.profit-day-win .profit-amount { color: var(--green); }

.profit-day-loss {
  background: rgba(248, 113, 113, 0.2);
  border-color: rgba(220, 38, 38, 0.42);
}
.profit-day-loss .profit-trade-count { color: #0f172a; }
.profit-day-loss .profit-amount { color: var(--red); }

.profit-day-flat {
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.3);
}
.profit-day-flat .profit-trade-count { color: #334155; }
.profit-day-flat .profit-amount { color: #475569; }

.profit-eval-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1rem;
}

.profit-eval-item {
  padding: 0.6rem 0.7rem;
  border-radius: 12px;
  background: linear-gradient(135deg, #fff 0%, #f8fafc 100%);
  border: 1px solid rgba(10, 83, 104, 0.12);
  box-shadow: 0 2px 12px rgba(10, 83, 104, 0.06);
}

.profit-eval-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: rgba(100, 116, 139, 0.95);
}

.profit-eval-value {
  font-size: 0.95rem;
  font-weight: 900;
  margin-top: 0.25rem;
}

.profit-eval .profit-eval-item .text-primary,
.profit-eval .profit-eval-item .text-green-600,
.profit-eval .profit-eval-item .text-red-600 {
  font-weight: 900;
}

/* Dark theme overrides */
.app-shell[data-theme="dark"] .profit-calendar-day {
  background: rgba(148, 163, 184, 0.08);
  border-color: rgba(148, 163, 184, 0.18);
}

.app-shell[data-theme="dark"] .profit-day-number {
  color: var(--accent-light);
}

.app-shell[data-theme="dark"] .profit-no-trades {
  color: #94a3b8;
}

.app-shell[data-theme="dark"] .profit-trade-count {
  color: rgba(241, 245, 249, 0.92);
}
.app-shell[data-theme="dark"] .profit-amount {
  color: #f1f5f9;
}
.app-shell[data-theme="dark"] .profit-day-win .profit-trade-count {
  color: rgba(240, 253, 244, 0.95);
}
.app-shell[data-theme="dark"] .profit-day-win .profit-amount {
  color: #86efac;
}
.app-shell[data-theme="dark"] .profit-day-loss .profit-trade-count {
  color: rgba(254, 242, 242, 0.95);
}
.app-shell[data-theme="dark"] .profit-day-loss .profit-amount {
  color: #fca5a5;
}
.app-shell[data-theme="dark"] .profit-day-flat .profit-trade-count,
.app-shell[data-theme="dark"] .profit-day-flat .profit-amount {
  color: #cbd5e1;
}

.app-shell[data-theme="dark"] .profit-eval-item {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-color: rgba(148, 163, 184, 0.2);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

.app-shell[data-theme="dark"] .profit-eval-label {
  color: rgba(226, 232, 240, 0.85);
}

@media (max-width: 1023px) {
  .profit-calendar-container { flex-direction: column; }
  .profit-calendar-left { min-width: auto; }
  .profit-calendar-right { width: 100%; }
}

/* ---- Mobile + Tablet responsive hardening (desktop unchanged) ---- */
@media (max-width: 1023px) {
  main {
    padding: 1rem;
  }

  .app-header {
    padding: 0 0.75rem;
    gap: 0.5rem;
  }

  .header-actions {
    gap: 0.45rem;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-right: 2rem;
  }

  .header-nav-subtitle {
    display: none;
  }

  .page-content {
    padding-left: 0.25rem;
    padding-right: 0.25rem;
  }

  .table-wrapper {
    overflow-x: auto;
  }

  .app-table {
    min-width: 760px;
  }

  .filter-row > div {
    flex: 1 1 160px;
  }

  .filter-row input,
  .filter-row select,
  .input-field {
    width: 100%;
    min-width: 0 !important;
  }

  .trades-top-account-card {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
  }

  .page-account-scope-card .page-account-scope-row .input-field {
    min-width: 0;
  }

  .admin-two-col-cards,
  .admin-three-col-cards {
    grid-template-columns: 1fr !important;
  }

  .dashboard-settings-metrics-row {
    flex-direction: column;
    gap: 1rem;
  }

  .dashboard-settings-metrics-row .account-settings-module {
    width: 100%;
    max-width: 100%;
  }

  .dashboard-settings-metrics-row .analytics-metrics-bar {
    width: 100%;
  }

  .dashboard-settings-metrics-row .analytics-metrics-bar .metric-card {
    flex: 1 1 calc(50% - 0.5rem);
    min-width: 140px;
  }

  .journal-trade-item {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .journal-trade-date,
  .journal-trade-pair {
    min-width: 0;
  }

  .profit-calendar-left {
    overflow-x: auto;
  }

  .profit-calendar-grid-dow,
  .profit-calendar-grid {
    min-width: 700px;
  }

  .profit-eval-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767px) {
  .app-header .user-info span:first-child {
    display: none;
  }

  .btn-add-trade-header {
    display: none;
  }

  .dashboard-settings-metrics-row .analytics-metrics-bar .metric-card {
    flex: 1 1 100%;
    min-width: 100%;
  }

  .journal-form-actions,
  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .journal-form-actions .btn-primary,
  .journal-form-actions .btn-secondary,
  .form-actions .btn-primary,
  .form-actions .btn-secondary {
    width: 100%;
    justify-content: center;
  }
}
