/* Trade Desk runtime styles (dashboard page only) */
body.td-dark {
  --td-bg: #0B1220;
  --td-card: #111827;
  --td-ink: #E5E7EB;
  --td-muted: #94A3B8;
  --td-line: #1F2937;
  --td-blue-soft: #172554;
  --td-green-soft: #052E16;
  --td-red-soft: #3F0D1A;
  --td-amber-soft: #3A2A06;
  background: #0B1220;
}
body.td-dark [data-interaction-id] { border-color: var(--td-line); }
body.td-dark .td-chip { background-color: #1F2937; color: #CBD5E1; }

.td-click { cursor: pointer; user-select: none; }
.td-edit { cursor: text; border-bottom: 1px dashed var(--td-blue); outline: none; }
.td-edit:focus { background: var(--td-blue-soft); }

.td-chart-wrap { width: 100%; height: 100%; }
.td-chart-wrap .tradingview-widget-container,
.td-chart-wrap .tradingview-widget-container__widget { width: 100%; height: 100%; }

/* menus */
.td-menu {
  position: absolute; z-index: 9999; min-width: 230px; padding: 8px;
  background: var(--td-card, #fff); color: var(--td-ink, #0F172A);
  border: 1px solid var(--td-line, #E8ECF2); border-radius: 14px;
  box-shadow: 0 24px 48px -12px rgba(15, 23, 42, .28);
  font: 500 13px Inter, system-ui, sans-serif;
}
.td-menu h6 { margin: 4px 8px 6px; font-size: 11px; letter-spacing: .5px; text-transform: uppercase; color: var(--td-muted, #64748B); }
.td-menu label, .td-menu .td-opt { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; cursor: pointer; }
.td-menu label:hover, .td-menu .td-opt:hover { background: var(--td-blue-soft, #EAF1FF); }
.td-menu .td-opt.on { background: var(--td-blue-soft, #EAF1FF); }
.td-menu .td-opt b { flex: 1; font-weight: 600; }
.td-menu .td-opt small { color: var(--td-muted, #64748B); }

/* modal */
.td-modal-bg { position: fixed; inset: 0; z-index: 10000; background: rgba(15, 23, 42, .45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.td-modal {
  width: 100%; max-width: 460px; max-height: 90vh; overflow: auto;
  background: var(--td-card, #fff); color: var(--td-ink, #0F172A);
  border-radius: 18px; padding: 22px; font: 500 13px Inter, system-ui, sans-serif;
  box-shadow: 0 30px 60px -20px rgba(15, 23, 42, .5);
}
.td-modal h3 { margin: 0 0 4px; font-size: 17px; font-weight: 700; }
.td-modal p.td-hint { margin: 0 0 14px; color: var(--td-muted, #64748B); font-size: 12px; line-height: 1.5; }
.td-modal .td-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.td-modal label { display: block; font-size: 11px; font-weight: 600; color: var(--td-muted, #64748B); margin-bottom: 10px; }
.td-modal input, .td-modal select, .td-modal textarea {
  display: block; width: 100%; box-sizing: border-box; margin-top: 4px; padding: 9px 11px;
  border: 1px solid var(--td-line, #E8ECF2); border-radius: 10px; background: transparent;
  color: var(--td-ink, #0F172A); font: 500 13px Inter, system-ui, sans-serif;
}
.td-modal .td-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.td-btn { border: 0; border-radius: 10px; padding: 9px 14px; font: 600 13px Inter, system-ui, sans-serif; cursor: pointer; background: #F1F5F9; color: #0F172A; }
.td-btn.pri { background: var(--td-blue, #2563EB); color: #fff; }
.td-btn.red { background: var(--td-red, #E11D48); color: #fff; }

/* toast */
.td-toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 10001; max-width: 360px;
  padding: 12px 16px; border-radius: 12px; background: #0F172A; color: #fff;
  font: 500 13px Inter, system-ui, sans-serif; box-shadow: 0 16px 32px -12px rgba(0, 0, 0, .4);
  transition: opacity .3s;
}

/* journal panels */
.td-panel { font: 500 13px Inter, system-ui, sans-serif; color: var(--td-ink, #0F172A); }
.td-panel textarea {
  width: 100%; box-sizing: border-box; min-height: 260px; padding: 14px; border: 0; border-radius: 14px;
  background: #0F172A; color: #E2E8F0; font: 12.5px/19px Consolas, 'JetBrains Mono', monospace; resize: vertical;
}
.td-panel .td-bar { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.td-panel table { width: 100%; border-collapse: collapse; }
.td-panel th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--td-muted, #64748B); padding: 0 0 7px; }
.td-panel td { padding: 8px 0; border-top: 1px solid var(--td-line, #E8ECF2); }
.td-panel .td-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
.td-panel .td-kpis div { border: 1px solid var(--td-line, #E8ECF2); border-radius: 10px; padding: 8px 12px; }
.td-panel .td-kpis span { display: block; font-size: 10.5px; font-weight: 600; text-transform: uppercase; color: var(--td-muted, #64748B); }
.td-panel .td-kpis b { font-size: 16px; }
.td-panel .td-empty { color: var(--td-muted, #64748B); padding: 14px 0; }
.td-up { color: var(--td-green, #16A34A) !important; }
.td-dn { color: var(--td-red, #E11D48) !important; }
.td-hidden { display: none !important; }
