/* Match the main app's shared font stack and neutral/emerald surfaces. */
.bot-site {
  --bot-bg: #111827;
  --bot-surface: #030712;
  --bot-border: #374151;
  --bot-muted: #9ca3af;
  --bot-sidebar-width: 224px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: var(--bot-bg);
  color: #f9fafb;
  color-scheme: dark;
  font-family: var(--font-sans, ui-sans-serif, system-ui, sans-serif);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0;
}
.bot-site *, .bot-site *::before, .bot-site *::after { box-sizing: border-box; letter-spacing: 0; }
.bot-shell {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: var(--bot-sidebar-width);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  padding: 24px 12px 16px;
  border-right: 1px solid var(--bot-border);
  background: var(--bot-surface);
  overflow-y: auto;
}
.bot-brand { display: inline-flex; align-items: center; gap: 10px; color: #f9fafb; text-decoration: none; font-size: 20px; font-weight: 800; line-height: 1.3; }
.bot-brand img { object-fit: contain; flex: 0 0 28px; }
.bot-brand > span:not(.bot-brand-name), .bot-brand small { display: block; color: #6ee7b7; font-size: 12px; font-weight: 600; }
.bot-shell .bot-brand { padding: 0 8px 24px; border-bottom: 1px solid var(--bot-border); }
.bot-shell nav { display: flex; flex-direction: column; gap: 6px; margin-top: 24px; }
.bot-shell nav a, .bot-shell button {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #d1d5db;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.bot-shell svg, .bot-shell [data-lucide] { width: 20px; height: 20px; flex: 0 0 20px; }
.bot-shell nav a:hover, .bot-shell button:hover { background: #1f2937; color: #f9fafb; }
.bot-shell nav [aria-current="page"] { background: #062d28; border-color: #10b981; color: #a7f3d0; }
.bot-shell form { margin-top: auto; padding-top: 24px; }
.bot-shell button { width: 100%; }
.bot-page, .bot-site .user-trader { width: 100%; max-width: 1280px; margin: 0 auto; padding: 28px 32px; color: #e5e7eb; flex-shrink: 0; }
.bot-shell ~ .bot-page, .bot-shell ~ .user-trader, .bot-shell ~ .bot-footer { width: calc(100% - var(--bot-sidebar-width)); max-width: none; margin-left: var(--bot-sidebar-width); }
.bot-page h1, .bot-site .user-trader h1 { font-size: 36px; line-height: 1.2; font-weight: 800; color: #f9fafb; margin: 0; overflow-wrap: anywhere; }
.bot-page > h1 { padding-bottom: 24px; border-bottom: 1px solid var(--bot-border); }
.bot-page h2, .bot-site .user-trader h2 { font-size: 20px; line-height: 1.4; font-weight: 800; color: #f9fafb; margin: 0 0 16px; }
.bot-page h3 { font-size: 16px; font-weight: 700; }
.bot-page p, .bot-site .user-trader p { font-size: 14px; line-height: 1.6; color: var(--bot-muted); overflow-wrap: anywhere; }
.bot-page p { margin: 12px 0; }
.bot-page a:not(.bot-button), .bot-site .user-trader a:not(.trader-button) { color: #6ee7b7; }
.bot-section { border-top: 1px solid var(--bot-border); padding: 24px 0; }
.bot-page > h1 + .bot-section { border-top: 0; }
.bot-section-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.bot-narrow { max-width: 560px; }
.bot-page label, .bot-site .user-trader label { display: block; min-width: 0; font-size: 14px; font-weight: 600; color: #d1d5db; margin: 16px 0; }
.bot-page input:not([type="checkbox"]):not([type="hidden"]), .bot-page select,
.bot-site .user-trader input:not([type="checkbox"]):not([type="hidden"]), .bot-site .user-trader select {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid #4b5563;
  border-radius: 6px;
  background: var(--bot-surface);
  color: #f9fafb;
  font: inherit;
  font-weight: 400;
}
.bot-site input[type="checkbox"] { flex-shrink: 0; width: 18px; height: 18px; accent-color: #10b981; }
.bot-page .bot-check, .bot-site .user-trader .check { display: flex; align-items: flex-start; gap: 10px; font-weight: 400; }
.bot-fields, .bot-site .trader-fields { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0 20px; }
.bot-fields label { min-width: 0; }
.bot-button, .bot-icon, .bot-page .settings-primary-button, .bot-page .settings-secondary-button, .bot-site .trader-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  max-width: 100%;
  padding: 10px 14px;
  border-radius: 6px;
  border: 1px solid #10b981;
  background: #059669;
  color: #fff !important;
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  white-space: normal;
  text-align: center;
}
.bot-button.secondary, .bot-icon, .bot-page .settings-secondary-button, .bot-site .trader-button.secondary { border-color: #4b5563; background: var(--bot-bg); color: #d1d5db !important; }
.bot-site :is(.bot-button, .trader-button):not(:disabled):hover { background: #047857; }
.bot-site :is(.bot-button.secondary, .trader-button.secondary, .bot-icon, .settings-secondary-button):not(:disabled):hover { background: #1f2937; border-color: #6b7280; }
.bot-button svg, .bot-icon svg, .bot-page button svg, .bot-site .trader-button svg,
.bot-site .trader-button [data-lucide] { width: 18px; height: 18px; flex: 0 0 18px; }
.bot-icon { width: 44px; padding: 10px; }
.bot-site button:disabled { opacity: .5; cursor: not-allowed; }
.bot-site :focus-visible { outline: 2px solid #34d399; outline-offset: 3px; }
.bot-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0; }
.bot-connection { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--bot-border); padding: 16px 0; }
.bot-connection-info { min-width: 0; }
.bot-connection .bot-actions { flex-shrink: 0; }
.bot-connection-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); align-items: end; gap: 20px; margin-top: 24px; }
/* Keep provider selection available when its separate credential form is hidden for OAuth. */
.bot-connection-form { display: contents; }
.bot-connection-grid label { margin: 0; }
.bot-connection-submit { min-width: 0; display: flex; align-items: center; min-height: 44px; }
.bot-auth { max-width: 540px; padding-top: 48px; }
.bot-auth .bot-brand { flex-wrap: wrap; }
.bot-auth h1 { margin-top: 32px; border: 0; padding: 0; }
.bot-auth-links { display: flex; flex-wrap: wrap; gap: 24px; margin-top: 24px; font-size: 14px; }
/* Auto margin fills short pages without taking the footer out of document flow. */
.bot-footer { width: 100%; max-width: 1280px; margin: auto auto 0; padding: 24px 32px; border-top: 1px solid var(--bot-border); display: flex; flex-wrap: wrap; flex-shrink: 0; align-items: center; gap: 16px; color: var(--bot-muted); font-size: 13px; }
.bot-footer a { color: #d1d5db; }
.bot-footer p { flex-basis: 100%; margin: 0; line-height: 1.6; }
.bot-site [hidden] { display: none !important; }
.bot-page #emailDeliverySettings { border: 0; padding: 0; }
.bot-page #tradingEmailPreferences label { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--bot-border); }
.bot-page .sms-alert-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.bot-page .sms-choice { display: flex; align-items: flex-start; gap: 12px; }
.bot-page #smsNotificationSettings { padding: 0; }
.bot-page .email-activity-scroll { overflow-x: auto; }
.bot-page table th, .bot-page table td { padding: 12px; }
.bot-page table th { color: var(--bot-muted); font-size: 12px; text-transform: uppercase; }
.bot-page table td { border-bottom: 1px solid var(--bot-border); }

/* Keep dashboard overrides on the bot host, with no changes to the trading script. */
.bot-site .user-trader .trader-heading { align-items: center; gap: 20px; padding-bottom: 24px; margin-bottom: 0; border-bottom: 1px solid var(--bot-border); }
.bot-site .trader-heading > div { min-width: 0; }
.bot-site .trader-heading p { margin-top: 8px; }
.trader-heading-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.bot-site #traderPlan { margin: 0; padding: 18px 0; }
.bot-site #traderMessage { margin-top: 20px; }
.bot-site .trader-status { gap: 0; border: 1px solid var(--bot-border); border-radius: 8px; background: var(--bot-surface); grid-template-columns: repeat(4,minmax(0,1fr)); }
.bot-site .trader-status > div { padding: 20px; background: none; border: 0; border-right: 1px solid var(--bot-border); border-radius: 0; min-width: 0; }
.bot-site .trader-status > div:last-child { border-right: 0; }
.bot-site .trader-status span { color: var(--bot-muted); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.bot-site .trader-status strong { color: #f9fafb; font-size: 18px; line-height: 1.4; font-weight: 700; font-variant-numeric: tabular-nums; }
.bot-site .trader-grid { grid-template-columns: minmax(0,1.25fr) minmax(0,1fr); gap: 32px; }
.bot-site .trader-grid > * { min-width: 0; }
.bot-site .trader-card { background: none; border: 0; border-top: 1px solid var(--bot-border); border-radius: 0; padding: 24px 0; margin: 0; min-width: 0; }
.bot-site .user-trader fieldset { border-color: var(--bot-border); }
.bot-site .user-trader legend { color: #d1d5db; font-weight: 700; }
.bot-site .user-trader .trader-note { font-size: 13px; }
.bot-site .user-trader table { font-size: 14px; border-collapse: collapse; }
.bot-site .user-trader th, .bot-site .user-trader td { padding: 12px 10px; border-color: var(--bot-border); }
.bot-site .user-trader th { color: var(--bot-muted); font-size: 12px; text-transform: uppercase; font-weight: 700; background: var(--bot-surface); }
.bot-site .user-trader td { font-variant-numeric: tabular-nums; }
.bot-site .user-trader .position-card { border-color: var(--bot-border); }
.bot-site .user-trader .position-card input { max-width: 160px; margin: 0; }
.bot-site .trader-actions { border-top: 1px solid var(--bot-border); padding-top: 20px; }
@media (max-width: 1200px) {
  .bot-connection-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .bot-site .trader-grid { grid-template-columns: minmax(0,1fr); }
  .bot-site .user-trader .trader-heading { align-items: flex-start; flex-direction: column; }
  .bot-site .trader-status { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .bot-site .trader-status > div:nth-child(2) { border-right: 0; }
  .bot-site .trader-status > div:nth-child(-n+2) { border-bottom: 1px solid var(--bot-border); }
}
@media (max-width: 900px) {
  .bot-shell { position: static; width: auto; padding: 16px; border-right: 0; border-bottom: 1px solid var(--bot-border); }
  .bot-shell .bot-brand { padding: 0; border: 0; }
  .bot-shell nav { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; margin-top: 20px; }
  .bot-shell nav a { flex-direction: column; justify-content: center; gap: 6px; padding: 8px 4px; font-size: 13px; }
  .bot-shell form { padding-top: 12px; }
  .bot-shell button { width: auto; }
  .bot-shell ~ .bot-page, .bot-shell ~ .user-trader, .bot-shell ~ .bot-footer { width: 100%; margin-left: 0; }
  .bot-page, .bot-site .user-trader, .bot-footer { padding-left: 20px; padding-right: 20px; }
}
@media (max-width: 600px) {
  .bot-connection-grid { grid-template-columns: minmax(0,1fr); }
  .bot-fields, .bot-site .trader-fields { grid-template-columns: minmax(0,1fr); gap: 0; }
  .bot-connection { align-items: flex-start; flex-direction: column; }
  .bot-connection .bot-actions { margin: 0; }
  .bot-site .trader-status > div { padding: 14px; }
  .bot-site .trader-heading-actions, .bot-site .trader-heading-actions .trader-button { width: 100%; }
}
