:root {
  color-scheme: light;
  --bg: #f4f6f7;
  --surface: #ffffff;
  --surface-2: #eef2f3;
  --ink: #172026;
  --muted: #63717a;
  --line: #dce3e6;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --blue: #2563eb;
  --amber: #b45309;
  --red: #b91c1c;
  --green: #15803d;
  --shadow: 0 16px 40px rgba(17, 24, 39, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

.bot-readiness-panel {
  margin-bottom: 20px;
  max-width: 900px;
}

.bot-rule-summary {
  max-width: 900px;
  margin: 0 0 20px;
}

.bot-rule-description {
  margin: 0 0 18px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.65;
}

.bot-card-view .workspace > section:not(.bot-rule-summary):not(.bot-annotation-summary):not(.bot-readiness-panel) {
  display: none;
}

.bot-annotation-summary {
  max-width: 900px;
  margin-bottom: 20px;
}

.primary-button.disabled,
.primary-button[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.5;
}

.bot-card-view.bot-backtest-view .workspace > #historical-check {
  display: block !important;
}

.bot-card-view.bot-report-view .workspace > .report-panel,
.bot-card-view.bot-report-view .workspace > .history-panel {
  display: block !important;
}

.readiness-table-wrap {
  overflow-x: auto;
}

.readiness-table {
  width: 100%;
  border-collapse: collapse;
}

.readiness-table th,
.readiness-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.readiness-state {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
}

.readiness-state.ready { background: #e6f7f2; color: #087b68; }
.readiness-state.missing { background: #fff3dc; color: #966000; }
.readiness-state.blocked { background: #eef1f3; color: #66737d; }

.readiness-action-disabled {
  color: #98a3ab;
}

/* Conversational bot creation */
.chat-workspace {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  padding-bottom: 22px;
}

.embedded-wizard {
  overflow: hidden;
  background: #fff;
}

.embedded-wizard .wizard-shell {
  display: block;
  min-height: 100vh;
}

.embedded-wizard .sidebar,
.embedded-wizard .chat-topbar {
  display: none;
}

.embedded-wizard .chat-workspace {
  height: 100vh;
  min-height: 0;
  padding: 0;
}

.embedded-wizard .wizard-chat {
  height: 100vh;
  width: 100%;
  min-height: 0;
  max-height: 100vh;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.chat-topbar {
  width: min(900px, 100%);
  margin-right: auto;
  margin-left: auto;
}

.wizard-chat {
  position: relative;
  display: flex;
  width: min(900px, 100%);
  min-height: 0;
  flex: 1;
  flex-direction: column;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.chat-messages {
  display: flex;
  min-height: 92px;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  padding: 16px clamp(18px, 5vw, 54px) 10px;
}

.wizard-verification {
  min-height: 0;
  flex: 0 0 auto;
  margin: 0 clamp(18px, 5vw, 54px) 8px;
  overflow: hidden;
  border: 1px solid #dbe3e6;
  border-radius: 7px;
  background: #f8faf9;
}

.wizard-verification > header {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #dbe3e6;
  padding: 12px 15px;
}

.visual-rule-builder-shell {
  width: min(1180px, calc(100vw - 48px));
  height: min(760px, calc(100vh - 128px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.visual-rule-builder-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.embedded-wizard .wizard-chat:has(.visual-rule-builder-frame) {
  max-width: none;
}

.embedded-wizard .chat-messages:has(.visual-rule-builder-frame) {
  flex: 1 1 auto;
  padding: 10px;
}

.embedded-wizard .chat-message:has(.visual-rule-builder-frame) {
  display: block;
}

.embedded-wizard .chat-message:has(.visual-rule-builder-frame) .assistant-avatar {
  display: none;
}

.embedded-wizard .chat-message:has(.visual-rule-builder-frame) .message-bubble {
  max-width: none;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.wizard-verification > header div {
  display: grid;
  gap: 2px;
}

.wizard-verification > header strong {
  font-size: 14px;
}

.wizard-verification > header span {
  color: var(--muted);
  font-size: 11px;
}

.wizard-verification > header b {
  border-radius: 999px;
  background: #e5ebed;
  color: #526169;
  padding: 5px 9px;
  font-size: 11px;
}

.verification-fields {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  border-bottom: 1px solid #dbe3e6;
}

.verification-fields > div {
  display: grid;
  min-width: 0;
  gap: 4px;
  border-right: 1px solid #e1e7e9;
  padding: 10px 14px;
}

.verification-fields > div:nth-child(3),
.verification-fields > div.wide {
  border-right: 0;
}

.wizard-verification.compact [data-summary-field="context"],
.wizard-verification.compact [data-summary-field="idea"],
.wizard-verification.compact .verification-rules,
.wizard-verification.compact .verification-contexts,
.wizard-verification.compact .verification-status {
  display: none;
}

.wizard-verification.compact .verification-fields {
  border-bottom: 0;
}

.verification-fields > div.wide {
  grid-column: 1 / -1;
  border-top: 1px solid #e1e7e9;
}

.verification-fields span {
  color: #738088;
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
}

.verification-fields strong {
  overflow: hidden;
  color: #8a969d;
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.verification-fields .wide strong {
  display: -webkit-box;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.verification-fields .filled strong {
  color: #172026;
}

.verification-rules {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 10px 14px;
}

.verification-rules span {
  border: 1px solid #d5dde0;
  border-radius: 999px;
  background: #fff;
  color: #7b878e;
  padding: 5px 8px;
  font-size: 10px;
  font-weight: 700;
}

.verification-rules span.verified {
  border-color: #9bcfc1;
  background: #e8f6f1;
  color: #08735f;
}

.verification-contexts {
  display: block;
  border-top: 1px solid #e1e7e9;
  padding: 11px 14px;
}

.verification-status {
  border-top: 1px solid #dbe3e6;
  color: #64748b;
  padding: 9px 14px;
  font-size: 11px;
  font-weight: 700;
}

.verification-status.ready {
  background: #e8f6f1;
  color: #08735f;
}

.chat-message {
  display: flex;
  max-width: 78%;
  align-items: flex-start;
  gap: 10px;
}

.user-message {
  align-self: flex-end;
}

.assistant-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.message-bubble {
  min-width: 0;
  border-radius: 6px;
  background: var(--surface-2);
  padding: 13px 15px;
  line-height: 1.5;
}

.assistant-message .message-bubble {
  border: 1px solid var(--line);
  background: #fff;
}

.user-message .message-bubble {
  background: #dff3ef;
  color: #123f3b;
}

.message-bubble strong,
.message-bubble p {
  display: block;
}

.message-bubble strong + p,
.message-bubble p + p,
.message-bubble ul,
.message-bubble .chat-next {
  margin-top: 8px;
}

.message-bubble ul {
  margin-bottom: 0;
  padding-left: 20px;
}

.chat-next {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  text-decoration: none;
}

.chat-composer {
  position: relative;
  z-index: 5;
  display: grid;
  flex: 0 0 auto;
  gap: 10px;
  padding: 16px 22px 18px;
  border-top: 1px solid var(--line);
  background: #fbfcfc;
}

.composer-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 10px;
}

.composer-row textarea {
  min-height: 58px;
  max-height: 280px;
  resize: vertical;
}

.chat-send {
  min-width: 126px;
  min-height: 58px;
}

.composer-hint {
  color: var(--muted);
  font-size: 12px;
}

.composer-tools,
.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.composer-tools {
  align-items: flex-start;
}

.composer-tools > span {
  margin-right: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  padding-top: 12px;
}

.composer-tools button,
.chat-suggestions button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: #35434b;
  cursor: pointer;
  padding: 8px 11px;
  font-size: 13px;
  font-weight: 700;
}

.composer-tools button.required {
  border-color: #efaaa6;
  background: #fff0ef;
  color: #b42318;
}

.composer-tools button.complete {
  border-color: #8fcbb8;
  background: #e8f6f1;
  color: #08735f;
}

.context-open-button {
  display: flex;
  min-width: 220px;
  align-items: center;
  justify-content: center;
  gap: 16px;
  border-color: #0f766e !important;
  background: #0f766e !important;
  color: #fff !important;
  padding: 13px 18px !important;
  font-size: 15px !important;
  font-weight: 850 !important;
}

.context-open-button strong {
  color: #172026;
}

.context-open-button b {
  border-radius: 999px;
  background: #e8f6f1;
  color: #08735f;
  padding: 5px 9px;
  font-size: 11px;
}

.context-selector-block {
  display: grid;
  width: 100%;
  gap: 10px;
}

.context-selector-block span {
  margin-right: 0;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
}

.context-selected-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 8px 10px 8px 14px;
}

.selected-context-chips {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.selected-context-chips > strong {
  color: #6b7881;
  font-size: 15px;
  font-weight: 800;
}

.context-chip {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: baseline;
  border: 1px solid #b9d9d2;
  border-radius: 7px;
  background: #e8f6f1;
  color: #08735f !important;
  padding: 7px 10px;
  font-size: 13px !important;
  font-weight: 800 !important;
  line-height: 1.35;
}

.context-chip strong {
  color: #08735f;
}

.context-chip em {
  color: #52656f;
  font-style: normal;
  font-weight: 750;
}

.context-library-panel {
  position: fixed;
  z-index: 90;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  border: 0;
  border-radius: 0;
  background: #fff;
  padding: 12px 14px 14px;
  box-shadow: 0 22px 70px rgba(15, 23, 42, 0.18);
}

.context-library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid #dce5e8;
  padding-bottom: 10px;
}

.context-library-header strong {
  color: #172026;
  font-size: 24px;
  font-weight: 900;
}

.context-library-header span {
  color: #60717c !important;
  font-size: 14px !important;
  font-weight: 600 !important;
}

.context-library-header .primary-button {
  min-width: 240px;
  min-height: 46px;
  border-color: #0f766e;
  background: #0f766e;
  font-size: 15px;
  font-weight: 900;
}

.context-library-header .primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.context-library-scroll {
  min-height: 0;
  max-height: none;
  overflow: auto;
  border: 1px solid #e1e7eb;
  border-radius: 7px;
}

.context-library-table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
  background: #fff;
  font-size: 14px;
  line-height: 1.35;
}

.context-library-table th,
.context-library-table td {
  border-bottom: 1px solid #e4eaee;
  border-right: 1px solid #e4eaee;
  padding: 13px 14px;
  vertical-align: middle;
}

.context-library-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f6f9fa;
  color: #172026;
  font-size: 13px;
  font-weight: 850;
}

.context-library-table tr.selected {
  background: #eef8ff;
}

.context-library-table td:first-child,
.context-library-table th:first-child {
  width: 48px;
  text-align: center;
}

.context-library-table input[type="checkbox"] {
  width: 19px;
  height: 19px;
}

.context-order {
  width: 52px;
  color: #111827;
  font-size: 18px;
  font-weight: 850;
  text-align: center;
}

.context-name-cell {
  display: grid;
  grid-template-columns: 58px 1fr;
  align-items: center;
  gap: 14px;
  min-width: 260px;
}

.context-name-cell strong {
  display: block;
  color: #0b5bd3;
  font-size: 16px;
}

.context-name-cell small {
  display: block;
  color: #60717c;
  font-size: 14px;
  font-weight: 500;
}

.context-icon {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 1px solid #2f6df6;
  border-radius: 7px;
  color: #2f6df6;
}

.context-icon.green { border-color: #149447; color: #149447; }
.context-icon.purple { border-color: #8b3fd8; color: #8b3fd8; }
.context-icon.orange { border-color: #f15a24; color: #f15a24; }
.context-icon.teal { border-color: #0f8d87; color: #0f8d87; }
.context-icon.red { border-color: #df1f2d; color: #df1f2d; }
.context-icon.brown { border-color: #8a4315; color: #8a4315; }
.context-icon.amber { border-color: #be8500; color: #be8500; }

.context-table-scheme {
  width: 230px;
}

.context-library-table ul {
  margin: 0;
  padding-left: 16px;
}

.context-library-table li {
  margin: 4px 0;
}

.context-library-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  border-top: 1px solid #e1e7eb;
  padding-top: 10px;
}

.context-library-actions > span {
  color: #60717c !important;
  font-size: 12px !important;
  font-weight: 700 !important;
}

.context-library-actions .primary-button {
  background: #0b5bd3;
  border-color: #0b5bd3;
}

.context-library-actions .primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.context-params-form {
  display: grid;
  gap: 8px;
}

.context-params-form h3 {
  margin: 0;
  color: #172026;
  font-size: 14px;
}

.context-params-form fieldset {
  border: 1px solid #dce5e8;
  border-radius: 7px;
  background: #fbfcfd;
  padding: 10px;
}

.context-params-form legend {
  padding: 0 5px;
  color: #172026;
  font-size: 13px;
  font-weight: 850;
}

.context-param-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.context-param-grid label {
  display: grid;
  gap: 4px;
}

.context-param-grid label span {
  color: #60717c !important;
  font-size: 11px !important;
  font-weight: 750 !important;
}

.context-param-grid input,
.context-param-grid select {
  width: 100%;
  border: 1px solid #cfd8dd;
  border-radius: 6px;
  background: #fff;
  color: #172026;
  padding: 8px 9px;
  font-size: 13px;
}

.context-param-grid label.invalid input,
.context-param-grid label.invalid select {
  border-color: #dc2626;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.1);
}

.context-validation-error {
  margin: 0;
  border-left: 3px solid #dc2626;
  background: #fff1f2;
  color: #b42318;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
}

.context-modal-overlay {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.34);
  padding: 22px;
}

.context-modal {
  width: min(720px, 100%);
  max-height: min(620px, calc(100vh - 44px));
  overflow: hidden;
  border: 1px solid #d5dde0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 22px 70px rgba(15, 23, 42, 0.24);
}

.context-modal header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #e1e7e9;
  padding: 14px 16px;
}

.context-modal header div {
  display: grid;
  gap: 3px;
}

.context-modal header strong {
  font-size: 18px;
}

.context-modal header span {
  color: #60717c;
  font-size: 13px;
}

.context-modal header button {
  width: 38px;
  height: 38px;
  border: 1px solid #d5dde0;
  border-radius: 7px;
  background: #f4f6f7;
  color: #172026;
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
}

.context-modal-options {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 160px);
  overflow-y: auto;
  padding: 14px;
}

.context-modal-options button {
  display: grid;
  grid-template-columns: 116px 1fr 34px;
  align-items: center;
  gap: 12px;
  min-height: 76px;
  border: 1px solid #d5dde0;
  border-radius: 7px;
  background: #fff;
  color: #172026;
  cursor: pointer;
  padding: 10px;
  text-align: left;
}

.context-modal-options button:hover,
.context-modal-options button.selected {
  border-color: #0f766e;
  background: #e8f6f1;
}

.context-modal-options button span {
  display: grid;
  gap: 4px;
}

.context-modal-options button strong {
  font-size: 15px;
}

.context-modal-options button small {
  color: #60717c;
  font-size: 12px;
  line-height: 1.35;
}

.context-modal-options button b {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid #b7d7ce;
  border-radius: 50%;
  color: #08735f;
  font-size: 16px;
}

.context-dropdown {
  width: 100%;
  border: 1px solid #d5dde0;
  border-radius: 7px;
  background: #fff;
}

.context-dropdown summary {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
  padding: 10px 12px;
}

.context-dropdown summary::-webkit-details-marker {
  display: none;
}

.context-dropdown summary span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.context-dropdown summary strong {
  overflow: hidden;
  color: #172026;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.context-dropdown summary small {
  color: #71838c;
  font-size: 11px;
}

.context-dropdown summary b {
  flex: 0 0 auto;
  border-radius: 999px;
  background: #e8f6f1;
  color: #08735f;
  padding: 6px 9px;
  font-size: 11px;
}

.context-dropdown-panel {
  display: grid;
  gap: 10px;
  border-top: 1px solid #e1e7e9;
  padding: 10px;
}

.context-preview {
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: 12px;
  align-items: center;
  border: 1px solid #e1e7e9;
  border-radius: 7px;
  background: #f8faf9;
  padding: 10px;
}

.context-preview div:last-child {
  display: grid;
  gap: 4px;
}

.context-preview strong {
  font-size: 14px;
}

.context-preview span,
.context-preview em {
  color: #60717c;
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
}

.context-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(170px, 1fr));
  gap: 4px;
}

.context-options button {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  border: 1px solid #d5dde0;
  border-radius: 7px;
  background: #fff;
  color: #27343b;
  cursor: pointer;
  padding: 7px 9px;
  text-align: left;
}

.context-options button strong {
  display: block;
  color: #14252b;
  font-size: 13px;
}

.context-options button small {
  display: none;
  color: #64748b;
  font-size: 11px;
}

.context-options .option-scheme {
  display: block;
}

.context-options .option-copy {
  min-width: 0;
}

.context-options button b {
  min-width: 18px;
  color: #0f766e;
  font-size: 15px;
  text-align: center;
}

.context-options button.selected {
  border-color: #0f766e;
  background: #e8f6f1;
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.12);
}

.context-scheme {
  position: relative;
  width: 100%;
  min-width: 0;
  height: 46px;
  overflow: hidden;
  border-radius: 6px;
  background:
    linear-gradient(#e6edf0 1px, transparent 1px) 0 0 / 100% 19px,
    linear-gradient(90deg, #e6edf0 1px, transparent 1px) 0 0 / 37px 100%,
    #fff;
}

.context-scheme i {
  position: absolute;
  display: block;
}

.context-scheme i:nth-child(1),
.context-scheme i:nth-child(2) {
  left: 12px;
  right: 12px;
  border-top: 2px dashed #2563eb;
}

.context-scheme i:nth-child(1) {
  top: 16px;
}

.context-scheme i:nth-child(2) {
  bottom: 15px;
}

.context-scheme i:nth-child(3) {
  left: 14px;
  right: 14px;
  top: 30px;
  height: 2px;
  background: #0f766e;
  transform: rotate(-6deg);
}

.context-scheme i:nth-child(4),
.context-scheme i:nth-child(5) {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ef4444;
}

.context-scheme i:nth-child(4) {
  left: 30%;
  top: 13px;
}

.context-scheme i:nth-child(5) {
  right: 22%;
  bottom: 12px;
}

.scheme-impulse i:nth-child(1),
.scheme-impulse i:nth-child(2),
.scheme-pullback i:nth-child(1),
.scheme-pullback i:nth-child(2),
.scheme-retest i:nth-child(1),
.scheme-retest i:nth-child(2) {
  display: none;
}

.scheme-impulse i:nth-child(3) {
  left: 16px;
  right: 12px;
  top: 34px;
  height: 3px;
  background: #16a34a;
  transform: rotate(-24deg);
}

.scheme-pullback i:nth-child(3) {
  left: 10px;
  right: 12px;
  top: 28px;
  height: 3px;
  background: linear-gradient(90deg, #16a34a 0 45%, #ef4444 45% 62%, #16a34a 62%);
  transform: rotate(-14deg);
}

.scheme-level i:nth-child(1) {
  display: none;
}

.scheme-level i:nth-child(2) {
  bottom: 28px;
  border-color: #0f766e;
}

.scheme-false-breakout i:nth-child(3),
.scheme-retest i:nth-child(3) {
  left: 12px;
  right: 12px;
  top: 28px;
  height: 2px;
  background: #0f766e;
  transform: none;
}

.scheme-false-breakout i:nth-child(4) {
  left: 68%;
  top: 8px;
  width: 2px;
  height: 38px;
  border-radius: 0;
  background: #ef4444;
}

.scheme-retest i:nth-child(4) {
  left: 68%;
  top: 21px;
  width: 9px;
  height: 9px;
  background: #2563eb;
}

.scheme-volume i:nth-child(1),
.scheme-volume i:nth-child(2),
.scheme-volume i:nth-child(3) {
  bottom: 10px;
  width: 8px;
  border: 0;
  background: #8b5cf6;
}

.scheme-volume i:nth-child(1) { left: 22%; height: 16px; }
.scheme-volume i:nth-child(2) { left: 45%; height: 30px; }
.scheme-volume i:nth-child(3) { left: 68%; height: 22px; }

.scheme-volatility i:nth-child(1),
.scheme-volatility i:nth-child(2) {
  left: 10px;
  right: 10px;
  border-color: #f15a24;
}

.scheme-volatility i:nth-child(1) {
  top: 11px;
  transform: rotate(5deg);
}

.scheme-volatility i:nth-child(2) {
  bottom: 11px;
  transform: rotate(-5deg);
}

.scheme-position i:nth-child(3) {
  top: 23px;
  background: #0f8d87;
  transform: none;
}

.scheme-position i:nth-child(4) {
  left: 62%;
  top: 18px;
  background: #0f8d87;
}

.scheme-liquidity i:nth-child(1),
.scheme-liquidity i:nth-child(2) {
  display: none;
}

.scheme-liquidity i:nth-child(3) {
  top: 22px;
  background: #df1f2d;
  transform: none;
}

.scheme-liquidity i:nth-child(4) {
  left: 70%;
  top: 10px;
  width: 20px;
  height: 20px;
  background: rgba(223, 31, 45, 0.22);
  border: 2px solid #df1f2d;
}

.scheme-htf i:nth-child(1),
.scheme-htf i:nth-child(2),
.scheme-feedback i:nth-child(1),
.scheme-feedback i:nth-child(2),
.scheme-energy i:nth-child(1),
.scheme-energy i:nth-child(2) {
  display: none;
}

.scheme-htf i:nth-child(3) {
  top: 31px;
  height: 3px;
  background: #2563eb;
  transform: rotate(-18deg);
}

.scheme-feedback i:nth-child(3) {
  top: 26px;
  background: linear-gradient(90deg, #ef4444 0 35%, #f59e0b 35% 65%, #22c55e 65%);
  transform: none;
}

.scheme-energy i:nth-child(3) {
  top: 24px;
  height: 18px;
  background: linear-gradient(90deg, rgba(239,68,68,0.25), rgba(245,158,11,0.35), rgba(34,197,94,0.35));
  transform: none;
}

.context-dropdown.compact .context-preview {
  grid-template-columns: 124px 1fr;
}

.context-dropdown.compact .context-options {
  grid-template-columns: repeat(3, minmax(120px, 1fr));
}

.context-dropdown.compact .context-options button {
  grid-template-columns: 1fr auto;
}

.context-dropdown.compact .context-options .option-scheme,
.context-dropdown.compact .context-options button small {
  display: none;
}

.chart-credit-balance {
  flex: 0 0 auto;
  border: 1px solid #cfe1dd;
  border-radius: 999px;
  background: #edf8f6;
  color: #0b6b62;
  padding: 6px 9px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.bot-memory-section > p {
  margin-top: 4px;
  color: #64748b;
  font-size: 11px;
  line-height: 1.4;
}

.bot-memory-section > div {
  display: grid;
  gap: 7px;
  margin-top: 9px;
}

.bot-memory-section article {
  display: grid;
  gap: 4px;
  border: 1px solid #dce4e7;
  border-radius: 5px;
  background: #fff;
  padding: 9px;
}

.bot-memory-section article strong {
  font-size: 12px;
}

.bot-memory-section article span,
.bot-memory-section article small,
.bot-memory-section > div > span {
  color: #64748b;
  font-size: 10px;
  line-height: 1.4;
}

.composer-tools button:hover,
.chat-suggestions button:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.chat-suggestions button[data-instrument] {
  display: grid;
  min-width: 190px;
  gap: 2px;
  text-align: left;
}

.chat-suggestions button span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

@media (max-width: 760px) {
  .wizard-shell {
    display: block;
  }

  .wizard-shell .sidebar {
    display: none;
  }

  .chat-workspace {
    min-height: 100vh;
    padding: 16px 10px 10px;
  }

  .chat-topbar {
    align-items: flex-start;
  }

  .chat-topbar h1 {
    font-size: 22px;
  }

  .wizard-chat {
    min-height: calc(100vh - 96px);
  }

  .chat-messages {
    min-height: 100px;
    padding: 16px 14px 10px;
  }

  .wizard-verification {
    margin: 0 14px 14px;
  }

  .verification-fields {
    grid-template-columns: 1fr 1fr;
  }

  .verification-fields > div:nth-child(2) {
    border-right: 0;
  }

  .verification-fields > div:nth-child(3) {
    grid-column: 1 / -1;
    border-top: 1px solid #e1e7e9;
  }

  .chat-message {
    max-width: 94%;
  }

  .chat-composer {
    padding: 12px;
  }

  .composer-row {
    grid-template-columns: 1fr;
  }

  .chat-send {
    width: 100%;
  }
}

button,
input,
textarea,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  border-right: 1px solid var(--line);
  background: #162125;
  color: #f7faf9;
  padding: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-button {
  width: 100%;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.brand-button:hover,
.brand-button:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  outline: 0;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: #36c2b4;
  color: #071414;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: #b8c5c7;
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav a {
  border-radius: 6px;
  color: #d6e1e3;
  padding: 10px 12px;
  text-decoration: none;
}

.nav a.active,
.nav a:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #ffffff;
}

.risk-note {
  margin-top: auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 14px;
}

.risk-note strong,
.risk-note span {
  display: block;
}

.risk-note span {
  margin-top: 6px;
  color: #b8c5c7;
  font-size: 13px;
  line-height: 1.35;
}

.workspace {
  min-width: 0;
  padding: 30px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.2;
}

h2 {
  font-size: 18px;
  line-height: 1.25;
}

.layout {
  display: grid;
  grid-template-columns: minmax(520px, 1.35fr) minmax(300px, 0.65fr);
  gap: 20px;
  align-items: start;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.builder-panel {
  display: grid;
  gap: 18px;
  padding: 20px;
}

.result-panel {
  overflow: hidden;
}

.compact-result {
  align-self: start;
}

.result-empty {
  display: grid;
  gap: 6px;
  padding: 24px 20px;
  color: var(--muted);
}

.result-empty strong {
  color: var(--ink);
}

.result-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line);
}

.result-summary div {
  min-width: 0;
  padding: 14px 20px;
}

.result-summary div + div {
  border-left: 1px solid var(--line);
}

.result-summary span,
.result-summary strong {
  display: block;
}

.result-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.result-summary strong {
  overflow: hidden;
  margin-top: 5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-action {
  padding: 0 16px;
  text-decoration: none;
}

.result-technical {
  border-top: 1px solid var(--line);
}

.result-technical summary {
  cursor: pointer;
  padding: 14px 20px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.result-technical .output {
  min-height: 240px;
  max-height: 420px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.builder-panel .panel-header {
  margin: -20px -20px 0;
}

.panel-header p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.badge,
.status-pill {
  min-width: 78px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  padding: 6px 10px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
}

.badge.research {
  background: #e0f2fe;
  color: #075985;
}

.badge.ready {
  background: #dcfce7;
  color: var(--green);
}

.badge.error {
  background: #fee2e2;
  color: var(--red);
}

label {
  display: grid;
  gap: 8px;
}

label span {
  color: #35434b;
  font-size: 13px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfc;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

textarea {
  min-height: 132px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.13);
}

select[multiple] {
  min-height: 116px;
  padding: 6px;
}

select[multiple] option {
  padding: 7px 8px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.instrument-field {
  display: grid;
  gap: 8px;
}

.instrument-field > span {
  color: #35434b;
  font-size: 13px;
  font-weight: 700;
}

.instrument-picker {
  position: relative;
  display: grid;
  gap: 8px;
}

.selected-instruments {
  display: flex;
  min-height: 38px;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.instrument-chip {
  border: 1px solid #9bd5ce;
  border-radius: 999px;
  background: #e4f7f3;
  color: var(--accent-dark);
  cursor: pointer;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 800;
}

.instrument-chip span {
  margin-left: 4px;
  color: inherit;
}

.instrument-suggestions {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  max-height: 290px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  box-shadow: var(--shadow);
  padding: 6px;
}

.instrument-option {
  display: flex;
  width: 100%;
  justify-content: space-between;
  gap: 12px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  padding: 9px 10px;
  text-align: left;
}

.instrument-option:hover,
.instrument-option.selected {
  background: var(--surface-2);
}

.instrument-option span,
.instrument-option strong,
.instrument-option small {
  display: block;
}

.instrument-option small {
  flex: 0 0 auto;
  color: var(--muted);
}

.instrument-empty {
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
}

.template-field {
  display: grid;
  gap: 10px;
}

.template-field-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.template-field-header > span {
  color: #35434b;
  font-size: 13px;
  font-weight: 700;
}

.template-field-header small {
  color: var(--muted);
}

.template-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.template-option {
  display: grid;
  min-width: 0;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  padding: 10px 12px;
  text-align: left;
}

.template-option:hover,
.template-option:focus-visible {
  border-color: var(--accent);
  outline: 0;
}

.template-option.selected {
  border-color: var(--accent);
  background: #e8f6f3;
}

.template-option.active {
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.14);
}

.template-option strong,
.template-option span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-option span {
  color: var(--muted);
  font-size: 12px;
}

.template-preview {
  display: grid;
  gap: 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafb;
  padding: 14px;
}

.template-preview-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.template-preview-header strong,
.template-preview-header span {
  display: block;
}

.template-preview-header > div > span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.template-preview-section {
  display: grid;
  gap: 7px;
}

.template-preview-section > strong {
  font-size: 12px;
  text-transform: uppercase;
}

.template-preview-section ol {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.template-feature-list,
.template-warning-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.template-feature,
.template-warning {
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 700;
}

.template-warning.warning {
  background: #fef3c7;
  color: var(--amber);
}

.template-warning.critical {
  background: #fee2e2;
  color: var(--red);
}

.template-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.template-actions button {
  padding: 0 12px;
}

.idea-tool-group button.required-by-template {
  border-color: var(--accent);
  background: #e8f6f3;
  color: var(--accent-dark);
}

.idea-composer {
  display: grid;
  gap: 8px;
}

.idea-composer > label {
  color: #35434b;
  font-size: 13px;
  font-weight: 700;
}

.idea-toolbar {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafb;
  padding: 10px;
}

.idea-tool-group {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.idea-tool-group > span {
  width: 72px;
  flex: 0 0 72px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.idea-tool-group button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #ffffff;
  color: #35434b;
  cursor: pointer;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 750;
}

.idea-tool-group button:hover,
.idea-tool-group button:focus-visible {
  border-color: var(--accent);
  color: var(--accent-dark);
  outline: 0;
}

.idea-composer textarea {
  min-height: 190px;
}

.idea-quality {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.idea-quality-item {
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 8px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.idea-quality-item::before {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 4px;
  background: #94a3b8;
  content: "";
}

.idea-quality-item.passed::before { background: var(--green); }
.idea-quality-item.warning::before { background: var(--amber); }
.idea-quality-item.error::before { background: var(--red); }

.idea-quality-item strong,
.idea-quality-item span {
  display: block;
}

.idea-quality-item strong {
  color: var(--ink);
}

.idea-quality-item span {
  margin-top: 2px;
}

.ai-review-panel {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafb;
  padding: 12px;
}

.ai-review-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.ai-review-header strong,
.ai-review-header span {
  display: block;
}

.ai-review-header > div > span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.ai-review-button {
  width: max-content;
  padding: 0 14px;
}

.ai-review-result {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.ai-review-findings,
.ai-review-questions {
  display: grid;
  gap: 7px;
}

.ai-finding,
.ai-question {
  border-left: 3px solid #94a3b8;
  background: #ffffff;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.ai-finding.warning { border-left-color: var(--amber); }
.ai-finding.critical { border-left-color: var(--red); }
.ai-finding.info { border-left-color: var(--blue); }

.ai-finding strong,
.ai-finding span {
  display: block;
}

.ai-finding strong {
  color: var(--ink);
}

.ai-resolution-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 9px;
}

.ai-resolution-options button {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #f8fafb;
  color: var(--ink);
  cursor: pointer;
  padding: 8px 9px;
  text-align: left;
}

.ai-resolution-options button:hover,
.ai-resolution-options button:focus-visible {
  border-color: var(--accent);
  outline: 0;
}

.ai-resolution-options button span {
  color: var(--muted);
  font-size: 11px;
}

.ai-review-result > button {
  width: max-content;
  padding: 0 14px;
}

.modal {
  width: min(520px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(14, 24, 29, 0.24);
  color: var(--ink);
  padding: 0;
}

.modal::backdrop {
  background: rgba(10, 20, 24, 0.58);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  padding: 20px;
}

.modal-header p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.modal-body {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 16px 20px;
}

.modal-actions button {
  padding: 0 16px;
}

.form-message {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.form-message.ready {
  color: var(--green);
}

.form-message.error {
  color: var(--red);
}

.account-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  color: var(--muted);
  font-size: 13px;
}

.draft-secondary-actions,
.technical-panel {
  display: none;
}

.draft-created-modal {
  width: min(640px, calc(100vw - 32px));
}

.created-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.created-summary > div {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 14px;
}

.created-summary > div + div {
  border-left: 1px solid var(--line);
}

.created-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.created-summary strong {
  overflow: hidden;
  font-family: var(--mono);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.next-steps {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.next-steps ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
  color: var(--muted);
}

.auth-section {
  padding: 14px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.auth-section .action-row {
  margin-top: 10px;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font-weight: 800;
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  padding: 0 16px;
  text-decoration: none;
  font-weight: 800;
}

.secondary-button:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.disabled-link {
  pointer-events: none;
  opacity: 0.5;
}

.action-row.compact {
  border-bottom: 1px solid var(--line);
  padding: 14px 18px;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--line);
}

.metrics div {
  min-width: 0;
  padding: 16px 18px;
  border-right: 1px solid var(--line);
}

.metrics div:last-child {
  border-right: 0;
}

.metrics span,
.metrics strong {
  display: block;
}

.metrics span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.metrics strong {
  overflow: hidden;
  margin-top: 6px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.check {
  border-radius: 999px;
  background: #dcfce7;
  color: var(--green);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
}

.check.warning {
  background: #fef3c7;
  color: var(--amber);
}

.check.muted {
  background: var(--surface-2);
  color: var(--muted);
}

.tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  background: #fafbfb;
}

.tab {
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 12px 18px;
  font-weight: 800;
}

.tab.active {
  background: #ffffff;
  color: var(--accent-dark);
}

.output {
  overflow: auto;
  min-height: 410px;
  max-height: 58vh;
  margin: 0;
  background: #10191c;
  color: #d8ede9;
  padding: 18px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.review-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(360px, 1.1fr);
  gap: 20px;
  align-items: start;
  margin-bottom: 20px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 18px 20px;
}

.timeline {
  display: grid;
  gap: 10px;
  padding: 18px 20px;
}

.timeline-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.timeline-item strong,
.timeline-item span {
  display: block;
}

.timeline-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.timeline-item code {
  color: var(--muted);
  font-size: 12px;
}

.timeline-item.muted {
  color: var(--muted);
}

.review-split {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: 460px;
}

.review-checklist {
  border-right: 1px solid var(--line);
  padding: 18px 20px;
}

.review-checklist h3 {
  margin: 0 0 14px;
  font-size: 15px;
}

.checklist-item {
  border-radius: 6px;
  margin-bottom: 8px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
}

.checklist-item.passed {
  background: #dcfce7;
  color: var(--green);
}

.checklist-item.warning {
  background: #fef3c7;
  color: var(--amber);
}

.confirm-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 18px;
  padding: 14px;
}

.confirm-box strong,
.confirm-box span {
  display: block;
}

.confirm-box span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.review-output {
  max-height: none;
  min-height: 460px;
}

.report-panel {
  margin-top: 20px;
}

.trade-chart-panel {
  margin-top: 20px;
}

.chart-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 420px) 1fr;
  gap: 20px;
  align-items: end;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.chart-trade-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  min-height: 40px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.chart-trade-facts strong {
  color: var(--ink);
}

.trade-chart {
  position: relative;
  width: 100%;
  height: 480px;
  min-height: 360px;
  overflow: hidden;
}

.chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.chart-legend span {
  display: inline-flex;
  gap: 7px;
  align-items: center;
}

.legend-swatch {
  width: 16px;
  height: 3px;
  background: #4b5563;
}

.legend-swatch.entry { background: #157f62; }
.legend-swatch.stop { background: #c2413a; }
.legend-swatch.target { background: #1677a3; }
.legend-swatch.exit { background: #7146a5; }

.csv-panel {
  margin-top: 20px;
}

.dataset-panel {
  margin-top: 20px;
}

.validation-panel {
  margin-top: 20px;
}

.paper-panel {
  margin-top: 20px;
}

.history-panel {
  margin-top: 20px;
}

.history-table-wrap {
  overflow-x: auto;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.history-table th,
.history-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
  text-align: left;
  white-space: nowrap;
}

.history-table th {
  background: #fafbfb;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  cursor: pointer;
  font-weight: 800;
  padding: 0;
}

.csv-form {
  display: grid;
  gap: 16px;
  padding: 18px 20px;
}

.dataset-form {
  display: grid;
  gap: 16px;
  padding: 18px 20px;
}

.dataset-notice {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-left: 4px solid var(--amber);
  background: #fff7db;
  color: #6e4300;
}

.dataset-notice.real {
  border-left-color: #16815f;
  background: #ddf7e9;
  color: #075e43;
}

.dataset-notice span {
  font-size: 14px;
  line-height: 1.4;
}

#csvData {
  min-height: 180px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
}

.csv-actions {
  padding: 0;
}

.paper-controls {
  display: grid;
  gap: 16px;
  padding: 18px 20px;
}

@media (max-width: 760px) {
  .chart-toolbar {
    grid-template-columns: 1fr;
  }

  .trade-chart {
    height: 400px;
  }
}

.paper-progress {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 18px 20px;
}

.paper-progress span,
.paper-progress strong {
  display: block;
}

.paper-progress span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.paper-progress strong {
  margin-top: 6px;
}

.progress-track {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  margin-top: 10px;
  background: var(--surface-2);
}

.progress-track div {
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 180ms ease;
}

.report-metrics {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border-bottom: 1px solid var(--line);
}

.report-metrics div {
  min-width: 0;
  padding: 16px 18px;
  border-right: 1px solid var(--line);
}

.report-metrics div:last-child {
  border-right: 0;
}

.report-metrics span,
.report-metrics strong {
  display: block;
}

.report-metrics span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.report-metrics strong {
  margin-top: 6px;
  font-size: 18px;
}

.report-summary {
  padding: 20px;
  background: var(--surface);
}

.evaluation-card {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
  gap: 24px;
  border: 1px solid #99f6e4;
  border-left: 6px solid var(--accent);
  border-radius: 14px;
  background: #f0fdfa;
  padding: 24px;
}

.report-context-head {
  display: grid;
  grid-template-columns: minmax(180px, 0.45fr) minmax(0, 1.55fr);
  gap: 14px;
  margin-bottom: 16px;
}

.report-context-head > div {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px 15px;
}

.report-context-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.report-context-head strong {
  display: block;
  margin-top: 5px;
  font-size: 18px;
}

.report-context-head p {
  margin: 5px 0 0;
  line-height: 1.45;
}

.evaluation-card.status-no_events,
.evaluation-card.status-no_contexts,
.evaluation-card.status-insufficient_trades {
  border-color: #fde68a;
  border-left-color: #d97706;
  background: #fffbeb;
}

.evaluation-card.status-invalid_configuration,
.evaluation-card.status-execution_failed {
  border-color: #fecaca;
  border-left-color: var(--red);
  background: #fef2f2;
}

.evaluation-status {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.evaluation-card h3 {
  margin: 8px 0;
  font-size: 25px;
}

.evaluation-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.evaluation-card dl {
  display: grid;
  gap: 1px;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(15, 118, 110, 0.15);
  border-radius: 10px;
  background: rgba(15, 118, 110, 0.12);
}

.evaluation-card dl div {
  background: rgba(255, 255, 255, 0.8);
  padding: 11px 13px;
}

.evaluation-card dt,
.run-technical dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.evaluation-card dd,
.run-technical dd {
  margin: 4px 0 0;
  font-weight: 700;
}

.report-section {
  margin-top: 26px;
  border-top: 1px solid var(--line);
  padding-top: 22px;
}

.report-section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.report-section-heading span {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.report-section-heading h3 {
  margin: 4px 0 0;
  font-size: 20px;
}

.report-section-heading p {
  max-width: 460px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.pipeline-funnel {
  display: grid;
  gap: 8px;
}

.pipeline-stage {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 14px;
}

.pipeline-stage.bottleneck {
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.12);
}

.pipeline-stage.not_reached {
  background: #f8fafc;
  color: var(--muted);
}

.pipeline-index {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  background: #ccfbf1;
  color: var(--accent-dark);
  font-weight: 800;
}

.pipeline-stage.blocked .pipeline-index {
  background: #fef3c7;
  color: #92400e;
}

.pipeline-stage.not_reached .pipeline-index {
  background: #e5e7eb;
  color: #64748b;
}

.pipeline-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.pipeline-title span,
.pipeline-rate {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.pipeline-count {
  margin-top: 5px;
  font-size: 22px;
  font-weight: 800;
}

.pipeline-count small {
  color: var(--muted);
  font-size: 12px;
}

.pipeline-stage p {
  margin: 4px 0;
  color: var(--muted);
  font-size: 13px;
}

.pipeline-stage details {
  margin-top: 10px;
}

.pipeline-stage details summary,
.run-technical summary {
  color: var(--accent-dark);
  cursor: pointer;
  font-weight: 800;
}

.pipeline-stage li {
  margin-top: 5px;
}

.diagnostic-reason {
  border: 1px solid #fde68a;
  border-radius: 12px;
  background: #fffbeb;
  padding: 16px 18px;
}

.diagnostic-reason.clear {
  border-color: #a7f3d0;
  background: #f0fdf4;
}

.diagnostic-reason p {
  margin: 6px 0;
  color: var(--muted);
}

.diagnostic-reason span {
  font-size: 12px;
  font-weight: 700;
}

.strategy-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.strategy-metric {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
}

.strategy-metric > span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.strategy-metric > strong {
  display: block;
  margin-top: 8px;
  font-size: 18px;
}

.strategy-metric small,
.metric-na {
  display: block;
}

.strategy-metric small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

.metric-na {
  color: var(--muted);
  font-size: 14px;
}

.empty-explanation,
.legacy-report-notice {
  border: 1px solid #fde68a;
  border-radius: 10px;
  background: #fffbeb;
  padding: 15px 17px;
}

.empty-explanation p {
  margin: 5px 0 0;
  color: var(--muted);
}

.legacy-report-notice {
  margin-bottom: 16px;
}

.recommendations-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.recommendation-card {
  border: 1px solid #a7f3d0;
  border-radius: 12px;
  background: #f0fdf4;
  padding: 16px;
}

.recommendation-card span {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.recommendation-card strong {
  display: block;
  margin-top: 6px;
}

.recommendation-card p {
  margin: 6px 0 0;
  color: var(--muted);
}

.recommendation-card .secondary-button {
  display: inline-flex;
  margin-top: 12px;
}

.comparison-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.comparison-grid div {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px;
}

.comparison-grid span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.comparison-grid strong {
  display: block;
  margin-top: 5px;
}

.run-technical {
  margin-top: 26px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.report-conclusion {
  border: 1px solid #bae6d5;
  border-radius: 12px;
  background: #ecfdf5;
  padding: 16px 18px;
}

.report-conclusion.empty {
  border-color: #fde68a;
  background: #fffbeb;
}

.report-conclusion strong {
  font-size: 18px;
}

.report-conclusion p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.report-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 18px 0 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--line);
}

.report-facts div {
  min-width: 0;
  background: var(--surface);
  padding: 14px 16px;
}

.report-facts dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.report-facts dd {
  margin: 6px 0 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .evaluation-card {
    grid-template-columns: 1fr;
  }

  .report-context-head {
    grid-template-columns: 1fr;
  }

  .strategy-metrics,
  .comparison-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .report-facts,
  .recommendations-grid {
    grid-template-columns: 1fr;
  }
}

.warning-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding: 12px 18px;
}

.warning-label,
.inline-label {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.warning-label {
  padding: 7px 9px;
}

.inline-label {
  margin-right: 4px;
  padding: 5px 7px;
}

.warning-label.warning,
.inline-label.warning {
  background: #fef3c7;
  color: var(--amber);
}

.warning-label.critical,
.inline-label.critical {
  background: #fee2e2;
  color: var(--red);
}

.warning-label.muted,
.inline-label.muted {
  background: var(--surface-2);
  color: var(--muted);
}

.annotation-brand {
  color: inherit;
  text-decoration: none;
}

.nav a[aria-disabled="true"] {
  cursor: default;
  opacity: 0.45;
  pointer-events: none;
}

.annotation-workspace {
  padding: 24px;
}

.annotation-setup-panel {
  margin-bottom: 16px;
  padding: 18px;
}

.annotation-setup-grid {
  display: grid;
  grid-template-columns: 1.1fr 1.7fr 1.1fr 0.9fr 0.9fr 0.9fr;
  gap: 12px;
}

.annotation-setup-grid label,
.annotation-direction-field,
.annotation-note-field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.annotation-setup-grid label > span,
.annotation-direction-field > span,
.annotation-note-field > span {
  color: #34424b;
  font-size: 12px;
  font-weight: 750;
}

.annotation-setup-grid input,
.annotation-setup-grid select,
.annotation-direction-field select,
.annotation-note-field textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  padding: 10px 11px;
}

.annotation-note-field textarea {
  resize: vertical;
}

.annotation-setup-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.annotation-setup-actions .muted {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.annotation-grid {
  display: grid;
  grid-template-columns: 190px minmax(420px, 1fr) 270px;
  gap: 16px;
  align-items: start;
}

.annotation-tools-panel,
.annotation-list-panel,
.annotation-chart-panel {
  overflow: hidden;
}

.compact-panel-header {
  padding: 16px;
}

.compact-panel-header p {
  margin-top: 4px;
  font-size: 13px;
}

.annotation-tool-list {
  display: grid;
  gap: 2px;
  padding: 8px;
}

.annotation-tool {
  display: grid;
  min-height: 40px;
  grid-template-columns: 12px 1fr;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #34424b;
  cursor: pointer;
  padding: 8px;
  text-align: left;
}

.annotation-tool:hover,
.annotation-tool.active {
  border-color: #b8d8d4;
  background: #e8f5f3;
  color: #0b5f58;
}

.annotation-tool:disabled {
  cursor: default;
  opacity: 0.5;
}

.tool-swatch,
.annotation-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: #64748b;
}

.tool-swatch.balance,
.annotation-dot.balance { background: #2563eb; }
.tool-swatch.impulse,
.annotation-dot.impulse { background: #7c3aed; }
.tool-swatch.false-breakout,
.annotation-dot.false_breakout { background: #b45309; }
.tool-swatch.spring,
.annotation-dot.spring { background: #15803d; }
.tool-swatch.upthrust,
.annotation-dot.upthrust { background: #b91c1c; }
.tool-swatch.support,
.annotation-dot.support_resistance { background: #0f766e; }
.tool-swatch.entry,
.annotation-dot.entry_zone { background: #0891b2; }
.tool-swatch.stop,
.annotation-dot.stop_loss_zone { background: #dc2626; }
.tool-swatch.avoid,
.annotation-dot.avoid_entry { background: #64748b; }

.annotation-direction-field,
.annotation-note-field {
  border-top: 1px solid var(--line);
  padding: 14px;
}

.annotation-chart {
  position: relative;
  width: 100%;
  height: 600px;
  min-height: 480px;
  background: #ffffff;
}

.annotation-selection {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid #b8d8d4;
  background: #e8f5f3;
  padding: 14px 16px;
}

.annotation-selection strong,
.annotation-selection span {
  display: block;
}

.annotation-selection span {
  margin-top: 3px;
  color: #50616b;
  font-size: 13px;
}

.annotation-set-summary {
  display: grid;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  padding: 13px 16px;
}

.annotation-set-summary span {
  color: var(--muted);
  font-size: 12px;
}

.annotation-list {
  min-height: 320px;
  max-height: 480px;
  overflow-y: auto;
  padding: 8px;
}

.annotation-empty {
  color: var(--muted);
  padding: 24px 12px;
  text-align: center;
}

.annotation-list-item {
  position: relative;
  display: grid;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  padding: 10px 36px 10px 8px;
}

.annotation-list-item > div {
  display: flex;
  align-items: center;
  gap: 7px;
}

.annotation-list-item span,
.annotation-list-item small {
  color: var(--muted);
  font-size: 11px;
}

.annotation-list-item button {
  position: absolute;
  top: 8px;
  right: 5px;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 20px;
}

.annotation-list-item button:hover {
  background: #fee2e2;
  color: var(--red);
}

.annotation-finalize {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 14px;
}

.annotation-finalize span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

/* Focused chart workspace */
.chart-page {
  overflow: hidden;
  height: 100vh;
  min-height: 0;
  background: #ffffff;
}

.chart-shell {
  display: grid;
  height: 100vh;
  grid-template-rows: 56px minmax(0, 1fr);
}

.chart-toolbar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
  border-bottom: 1px solid #d8dee3;
  background: #ffffff;
  padding: 0 12px 0 8px;
}

.chart-home {
  display: grid;
  flex: 0 0 42px;
  height: 42px;
  place-items: center;
  border-radius: 6px;
  text-decoration: none;
}

.chart-home:hover {
  background: #f1f4f5;
}

.chart-home .brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 6px;
}

.symbol-control {
  display: grid;
  flex: 0 0 164px;
  gap: 1px;
  border: 0;
  border-right: 1px solid #d8dee3;
  background: transparent;
  color: #111827;
  cursor: default;
  padding: 4px 14px 4px 6px;
  text-align: left;
}

.symbol-control strong {
  font-size: 15px;
}

.symbol-control span {
  color: #6b7280;
  font-size: 11px;
}

.timeframe-control {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 100%;
  border-right: 1px solid #d8dee3;
  padding-right: 8px;
}

.timeframe-control button {
  display: grid;
  width: 38px;
  height: 34px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: #374151;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.timeframe-control button:hover {
  background: #f1f4f5;
}

.timeframe-control button.active {
  border-color: #99d5ce;
  background: #e4f5f2;
  color: #08665e;
}

.timeframe-control button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.market-mode-control {
  display: inline-flex;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid #cfd7dc;
  border-radius: 6px;
  background: #f8fafb;
}

.market-mode-control button {
  height: 34px;
  border: 0;
  background: transparent;
  color: #475569;
  cursor: pointer;
  padding: 0 12px;
  font-size: 11px;
  font-weight: 850;
}

.market-mode-control button.active {
  background: #0f766e;
  color: #fff;
}

.live-chart-status {
  flex: 0 0 auto;
  max-width: 190px;
  overflow: hidden;
  color: #08735f;
  font-size: 11px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.direction-control {
  display: flex;
  gap: 3px;
  border-right: 1px solid #d8dee3;
  padding: 0 8px;
}

.direction-control button {
  display: inline-flex;
  height: 34px;
  align-items: center;
  gap: 5px;
  border: 1px solid #cfd7dc;
  border-radius: 5px;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  padding: 0 9px;
  font-size: 10px;
  font-weight: 850;
}

.direction-control svg {
  width: 15px;
  height: 15px;
}

.direction-control button[data-direction="long"].active {
  border-color: #52b788;
  background: #e5f6ed;
  color: #08784e;
}

.direction-control button[data-direction="short"].active {
  border-color: #df7773;
  background: #feeceb;
  color: #b42318;
}

.chart-toolbar-spacer {
  flex: 1 1 auto;
}

.chart-workspace-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  color: #e9edf2;
  background: rgba(16, 20, 27, 0.92);
  text-decoration: none;
  font-size: 12px;
}

.chart-workspace-link:hover {
  border-color: #d9ff43;
  color: #d9ff43;
}

@media (max-width: 760px) {
  .chart-workspace-link span:last-child {
    display: none;
  }
}

.chart-sync-status {
  overflow: hidden;
  max-width: 220px;
  color: #64748b;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-sync-status[data-state="ready"] {
  color: #08735f;
}

.chart-sync-status[data-state="dirty"] {
  color: #a15408;
}

.chart-sync-status[data-state="error"] {
  color: #b42318;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.saved-trade-count {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  color: #08735f;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.saved-trade-count svg {
  width: 17px;
  height: 17px;
}

.setup-type-control {
  display: flex;
  flex: 0 1 155px;
  min-width: 118px;
}

.setup-type-control select {
  width: 100%;
  height: 34px;
  border: 1px solid #cfd7dc;
  border-radius: 5px;
  background: #fff;
  color: #253142;
  padding: 0 26px 0 9px;
  font-size: 12px;
  font-weight: 700;
}

.setup-type-control select.attention {
  border-color: #d97706;
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.14);
}

.rule-builder-button {
  position: absolute;
  z-index: 15;
  right: 22px;
  bottom: 22px;
  display: inline-flex;
  width: 174px;
  height: 46px;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  border: 1px solid #0f766e;
  border-radius: 6px;
  background: #0f766e;
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.22);
  color: #fff;
  padding: 0 15px;
  font-size: 13px;
  font-weight: 750;
}

.rule-builder-button:hover {
  border-color: #0b615b;
  background: #0b615b;
  color: #fff;
}

.rule-builder-button svg {
  width: 17px;
  height: 17px;
}

.project-control {
  position: relative;
  display: flex;
  height: 38px;
  flex: 0 0 230px;
  min-width: 190px;
  align-items: center;
  gap: 7px;
  border-right: 1px solid #d8dee3;
  padding-right: 8px;
}

.setup-guide {
  position: absolute;
  z-index: 12;
  top: 86px;
  left: 86px;
  display: flex;
  width: min(520px, calc(100% - 120px));
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid #f1c27d;
  border-left: 4px solid #d97706;
  border-radius: 5px;
  background: rgba(255, 251, 235, 0.97);
  box-shadow: 0 12px 30px rgba(31, 41, 55, 0.13);
  padding: 12px 13px;
  color: #5b3a0a;
}

.setup-guide[hidden] {
  display: none;
}

.setup-guide div {
  display: grid;
  gap: 3px;
}

.setup-guide strong {
  font-size: 13px;
}

.setup-guide span {
  color: #775519;
  font-size: 12px;
  line-height: 1.4;
}

.setup-guide textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid #d7b778;
  border-radius: 5px;
  background: #fff;
  padding: 9px 10px;
  color: #3f3422;
  font: inherit;
  font-size: 12px;
  line-height: 1.4;
}

.setup-guide .setup-guide-save {
  width: max-content;
  min-width: 154px;
  height: 34px;
  border: 1px solid #a85c05;
  border-radius: 5px;
  background: #a85c05;
  color: #fff;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 750;
}

.setup-guide .setup-guide-save:hover {
  background: #894b05;
}

.setup-guide > button,
.rule-builder-panel header button {
  display: inline-grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  place-items: center;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: inherit;
}

.setup-guide > button:hover,
.rule-builder-panel header button:hover {
  background: rgba(100, 116, 139, 0.12);
}

.rule-builder-backdrop {
  position: fixed;
  z-index: 80;
  inset: 0;
  background: rgba(15, 23, 42, 0.28);
}

.rule-builder-panel {
  position: fixed;
  z-index: 81;
  top: 10px;
  right: 10px;
  width: min(680px, calc(100vw - 20px));
  min-width: min(440px, calc(100vw - 20px));
  max-width: calc(100vw - 20px);
  height: calc(100vh - 20px);
  overflow: hidden;
  border: 1px solid #d8dee3;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: -18px 0 48px rgba(15, 23, 42, 0.16);
  transform: translateX(102%);
  transition: transform 180ms ease;
}

.rule-builder-resize-handle {
  position: absolute;
  z-index: 3;
  top: 0;
  bottom: 0;
  left: -5px;
  width: 11px;
  cursor: ew-resize;
  touch-action: none;
}

.rule-builder-resize-handle::after {
  position: absolute;
  top: 50%;
  left: 5px;
  width: 2px;
  height: 52px;
  border-radius: 2px;
  background: #b7c4ca;
  content: "";
  opacity: 0;
  transform: translateY(-50%);
  transition: opacity 120ms ease;
}

.rule-builder-panel:hover .rule-builder-resize-handle::after,
.rule-builder-panel.resizing .rule-builder-resize-handle::after {
  opacity: 1;
}

.rule-builder-panel.resizing {
  user-select: none;
  transition: none;
}

.rule-builder-panel.open {
  transform: translateX(0);
}

.rule-builder-panel > header {
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #d8dee3;
  background: #fff;
  padding: 14px 18px;
}

.rule-builder-panel header span {
  color: #0f766e;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.rule-builder-panel h2,
.rule-builder-panel h3 {
  margin: 0;
  color: #17212b;
}

.rule-builder-panel h2 {
  margin-top: 2px;
  font-size: 22px;
}

.rule-builder-panel h3 {
  font-size: 14px;
}

.rule-builder-body {
  display: grid;
  height: calc(100vh - 78px);
  align-content: start;
  gap: 12px;
  overflow-y: auto;
  padding: 14px;
}

.rule-builder-panel .rule-builder-status,
.rule-builder-panel .rule-chat,
.rule-builder-panel .rule-history,
.rule-builder-panel .bot-memory-section,
.rule-builder-panel .rule-evidence,
.rule-builder-panel #generateRule,
.rule-builder-panel #confirmRule,
.rule-builder-panel #rejectRule {
  display: none;
}

.rule-builder-status,
.rule-current,
.rule-chat,
.rule-history {
  border: 1px solid #d8dee3;
  border-radius: 6px;
  background: #fff;
  padding: 13px;
}

.rule-builder-status {
  display: grid;
  gap: 3px;
  border-left: 4px solid #0f766e;
}

.rule-builder-status span {
  color: #0f766e;
  font-size: 13px;
  font-weight: 800;
}

.rule-builder-status small {
  color: #64748b;
}

.rule-current,
.rule-chat,
.rule-history {
  display: grid;
  gap: 10px;
}

.rule-current textarea,
.rule-chat textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid #cfd7dc;
  border-radius: 5px;
  padding: 10px;
  color: #253142;
  font: inherit;
  line-height: 1.45;
}

.rule-evidence {
  display: grid;
  gap: 3px;
  border-left: 3px solid #94a3b8;
  background: #f8fafc;
  padding: 8px 10px;
  color: #64748b;
  font-size: 11px;
  line-height: 1.4;
}

.rule-evidence strong {
  color: #334155;
  font-size: 12px;
}

.rule-current button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid #cfd7dc;
  border-radius: 5px;
  background: #fff;
  color: #253142;
  font-weight: 750;
}

.rule-current button.primary {
  border-color: #0f766e;
  background: #0f766e;
  color: #fff;
}

.rule-current button:disabled {
  opacity: 0.5;
}

.rule-action-notice {
  margin: 0;
  border-left: 3px solid #64748b;
  background: #f1f5f7;
  padding: 8px 10px;
  color: #475569;
  font-size: 12px;
  line-height: 1.4;
}

.rule-action-notice[data-state="success"] {
  border-left-color: #0f766e;
  background: #e3f5f1;
  color: #086253;
}

.rule-action-notice[data-state="warning"] {
  border-left-color: #d97706;
  background: #fff7e6;
  color: #8a4c05;
}

.rule-action-notice[data-state="error"] {
  border-left-color: #dc2626;
  background: #fff0f0;
  color: #b42318;
}

.rule-chat-messages {
  display: grid;
  max-height: 240px;
  gap: 8px;
  overflow-y: auto;
}

.rule-message {
  max-width: 90%;
  border-radius: 6px;
  background: #eef2f4;
  padding: 9px 10px;
  color: #334155;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.rule-message.user {
  justify-self: end;
  background: #dff5f1;
}

.rule-chat-empty,
.rule-history p {
  margin: 0;
  color: #64748b;
  font-size: 12px;
}

.rule-chat form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  align-items: end;
  gap: 8px;
}

.rule-chat form button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 0;
  border-radius: 5px;
  background: #0f766e;
  color: #fff;
}

.rule-history > div {
  display: grid;
  gap: 6px;
}

.rule-history button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid #e0e6ea;
  border-radius: 4px;
  background: #fff;
  padding: 8px 9px;
  color: #334155;
}

.rule-history button span {
  color: #64748b;
  font-size: 11px;
}

.project-control > span {
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.project-control select {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  height: 34px;
  border: 1px solid #cfd7dc;
  border-radius: 5px;
  background: #ffffff;
  color: #1f2937;
  padding: 0 28px 0 9px;
  font-size: 12px;
  font-weight: 650;
}

.project-menu-button {
  display: flex;
  width: 100%;
  height: 34px;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid #b9d2d7;
  border-radius: 5px;
  background: #fff;
  color: #1f2937;
  padding: 0 8px 0 11px;
  font-size: 12px;
  font-weight: 700;
}

.project-menu-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-menu-button svg {
  width: 14px;
  flex: 0 0 14px;
}

.project-menu {
  position: absolute;
  z-index: 80;
  top: calc(100% + 4px);
  left: 0;
  width: 330px;
  max-height: min(380px, calc(100vh - 90px));
  overflow-y: auto;
  border: 1px solid #aebbc3;
  border-radius: 6px;
  background: #fff;
  padding: 4px;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.2);
}

.project-menu-search {
  position: sticky;
  z-index: 2;
  top: -4px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px;
  background: #fff;
}

.project-menu-search svg { width: 15px; color: #64748b; }
.project-menu-search input {
  width: 100%;
  min-width: 0;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  padding: 7px 8px;
  font: inherit;
}

.project-menu-section {
  padding: 8px 10px 4px;
  color: #64748b;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.project-menu-special,
.project-menu-row {
  display: flex;
  width: 100%;
  min-height: 34px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #1f2937;
  padding: 5px 6px 5px 10px;
  font-size: 12px;
  text-align: left;
}

.project-menu-special:hover,
.project-menu-row:hover,
.project-menu-row.selected {
  background: #e9f5f3;
  color: #0f6f62;
}

.project-menu-row > span {
  display: grid;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.project-menu-row > span b,
.project-menu-row > span small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-menu-row > span small {
  color: #64748b;
  font-size: 10px;
  font-weight: 500;
}

.project-menu-empty { padding: 18px 10px; color: #64748b; text-align: center; }
.project-menu-footer {
  position: sticky;
  z-index: 2;
  bottom: -4px;
  display: grid;
  border-top: 1px solid #e2e8f0;
  background: #fff;
  padding: 5px 2px 2px;
}
.project-menu-footer button {
  border: 0;
  background: transparent;
  padding: 7px 9px;
  color: #0f6f62;
  font: inherit;
  font-weight: 700;
  text-align: left;
}

.project-card-icon {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: #64748b;
}

.project-card-icon:hover {
  border-color: #9dd4cb;
  background: #fff;
  color: #0f766e;
}

.project-card-icon svg {
  width: 14px;
  height: 14px;
}

.bot-card-dialog {
  width: min(1280px, calc(100vw - 32px));
  height: min(900px, calc(100vh - 32px));
  max-width: none;
  max-height: none;
  overflow: hidden;
  border: 1px solid #cfd8dd;
  border-radius: 10px;
  background: #fff;
  padding: 0;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.25);
}

.bot-card-dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
}

.bot-card-dialog > header {
  display: flex;
  height: 58px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #d8dee3;
  padding: 0 16px;
}

.bot-card-dialog > header div {
  display: grid;
  gap: 2px;
}

.bot-card-dialog > header strong {
  color: #17212b;
  font-size: 16px;
}

.bot-card-dialog > header span {
  color: #64748b;
  font-size: 11px;
}

.bot-card-dialog > header button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: #f1f5f7;
  color: #334155;
}

.bot-card-dialog iframe {
  width: 100%;
  height: calc(100% - 58px);
  border: 0;
  background: #fff;
}

.bot-wizard-dialog {
  width: min(1240px, calc(100vw - 18px));
  height: min(900px, calc(100vh - 18px));
  max-width: none;
  max-height: none;
  overflow: hidden;
  border: 1px solid #cfd8dd;
  border-radius: 8px;
  background: #fff;
  padding: 0;
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.24);
}

.bot-wizard-dialog::backdrop {
  background: rgba(15, 23, 42, 0.48);
}

.bot-wizard-dialog[open] {
  display: grid;
  grid-template-rows: 52px minmax(0, 1fr);
}

.bot-wizard-dialog.library-mode[open] {
  width: min(1380px, calc(100vw - 8px));
  height: min(940px, calc(100vh - 8px));
  grid-template-rows: minmax(0, 1fr);
}

.bot-wizard-dialog.library-mode > header {
  display: none;
}

.bot-wizard-dialog > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #dce3e6;
  padding: 0 14px 0 18px;
}

.bot-wizard-dialog > header div {
  display: flex;
  align-items: baseline;
  gap: 9px;
}

.bot-wizard-dialog > header strong {
  font-size: 15px;
}

.bot-wizard-dialog > header span {
  color: #64748b;
  font-size: 11px;
}

.bot-wizard-dialog > header button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 5px;
  background: #eef2f3;
  color: #334155;
  cursor: pointer;
}

.bot-wizard-dialog > header button:hover {
  background: #e1e7e9;
}

.bot-wizard-dialog > header svg {
  width: 19px;
  height: 19px;
}

.bot-wizard-dialog iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}


.chart-save-button {
  display: inline-flex;
  height: 36px;
  align-items: center;
  gap: 7px;
  border: 1px solid #0f766e;
  border-radius: 6px;
  background: #0f766e;
  color: #ffffff;
  cursor: pointer;
  padding: 0 13px;
  font-size: 13px;
  font-weight: 750;
}

.chart-save-button:hover {
  background: #0b625c;
}

.chart-save-button:disabled {
  border-color: #cfd7dc;
  background: #edf1f2;
  color: #8a969e;
  cursor: not-allowed;
}

.chart-save-button svg,
.drawing-toolbar svg {
  width: 18px;
  height: 18px;
}

.chart-stage {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-columns: 52px minmax(0, 1fr);
}

.drawing-toolbar {
  position: relative;
  z-index: 15;
  display: flex;
  min-height: 0;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  border-right: 1px solid #d8dee3;
  background: #ffffff;
  padding: 8px 6px;
}

.schema-context-tools {
  display: none;
}

.schema-context-tools button {
  position: relative;
  height: 48px;
  grid-template-rows: 22px 12px;
  gap: 1px;
}

.schema-context-tools button small {
  max-width: 34px;
  overflow: hidden;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawing-toolbar button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: #334155;
  cursor: pointer;
}

.drawing-toolbar button:hover {
  background: #f1f4f5;
}

.drawing-toolbar button.active {
  border-color: #99d5ce;
  background: #e4f5f2;
  color: #0b6b62;
}

.drawing-toolbar .context-rule-toggle {
  border-color: #c9e5df;
  background: #f3fbf9;
  color: #0b6b62;
  font-size: 20px;
  font-weight: 500;
}

.drawing-toolbar .context-rule-toggle.has-required {
  border-color: #99d5ce;
  background: #e4f5f2;
  color: #08735f;
}

.drawing-toolbar .context-rule-toggle.complete {
  border-color: #8fd0b2;
  background: #e7f7ef;
  color: #08784e;
}

.drawing-toolbar .context-rule-toggle.active {
  border-color: #0f766e;
  background: #0f766e;
  color: #ffffff;
}

.context-rule-toggle span {
  transform: translateY(-1px);
}

.context-rule-panel {
  position: absolute;
  z-index: 30;
  top: 18px;
  left: 12px;
  display: none;
  width: 292px;
  max-height: calc(100% - 36px);
  overflow: hidden;
  border: 1px solid #d8e2e5;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.16);
}

.context-rule-panel.open {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.context-rule-panel header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid #e1e8eb;
  padding: 12px 12px 10px;
}

.context-rule-panel header div {
  display: grid;
  gap: 3px;
}

.context-rule-panel header strong {
  color: #172026;
  font-size: 14px;
  font-weight: 900;
}

.context-rule-panel header span {
  color: #60717c;
  font-size: 11px;
  font-weight: 650;
}

.context-rule-panel header button {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 0;
  border-radius: 5px;
  background: #eef2f3;
  color: #334155;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

#contextRuleList {
  display: grid;
  gap: 7px;
  min-height: 0;
  overflow: auto;
  padding: 10px;
}

.context-rule-item {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 3px 8px;
  align-items: center;
  border: 1px solid #d8e2e5;
  border-radius: 7px;
  background: #ffffff;
  color: #172026;
  cursor: pointer;
  padding: 9px 10px;
  text-align: left;
}

.context-rule-item span {
  grid-row: span 2;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 5px;
  background: #fff0ef;
  color: #c93632;
  font-size: 12px;
  font-weight: 900;
}

.context-rule-item strong {
  color: #172026;
  font-size: 13px;
  font-weight: 900;
}

.context-rule-item small {
  color: #60717c;
  font-size: 11px;
  font-weight: 650;
}

.context-rule-item.complete {
  border-color: #a7d9c1;
  background: #f2fbf6;
}

.context-rule-item.complete span {
  background: #dff5e9;
  color: #08784e;
}

.rule-markup-flow {
  display: grid;
  gap: 18px;
  border: 0;
  border-radius: 0;
  background: #ffffff;
  padding: 0;
}

.rule-markup-head {
  display: grid;
  gap: 4px;
}

.rule-markup-head h3 {
  margin: 0;
  color: #172026;
  font-size: 16px;
  font-weight: 900;
}

.rule-markup-head span {
  display: block;
  margin-top: 3px;
  color: #60717c;
  font-size: 12px;
  font-weight: 650;
}

.rule-markup-head button {
  min-height: 40px;
  white-space: nowrap;
}

.rule-markup-list {
  display: grid;
  gap: 0;
  border-top: 1px solid #e2e8ee;
}

.rule-markup-item {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  align-items: start;
  gap: 10px 14px;
  min-height: 76px;
  border: 0;
  border-bottom: 1px solid #e2e8ee;
  border-radius: 0;
  background: #ffffff;
  color: #172026;
  cursor: pointer;
  padding: 16px 2px;
  text-align: left;
}

.rule-markup-item:hover {
  border-color: #99d5ce;
  background: #f4fbfa;
}

.rule-markup-item:disabled,
.rule-markup-item.premium-disabled {
  background: #f7f9fa;
  color: #8a98a2;
  cursor: not-allowed;
  opacity: 0.62;
}

.rule-markup-item:disabled:hover,
.rule-markup-item.premium-disabled:hover {
  border-color: #e2e8ee;
  background: #f7f9fa;
}

.rule-markup-item span {
  display: grid;
  grid-row: span 2;
  width: 66px;
  height: 54px;
  place-items: center;
  border: 2px solid #d13b37;
  border-radius: 9px;
  background: #ffffff;
  color: #c93632;
  font-size: 15px;
  font-weight: 900;
}

.rule-markup-item strong {
  font-size: 14px;
  font-weight: 900;
}

.rule-markup-item small {
  min-width: 0;
  color: #60717c;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.5;
  white-space: normal;
}

.rule-markup-item.complete {
  background: #ffffff;
}

.rule-markup-item.complete span {
  border-color: #16803f;
  background: #ffffff;
  color: #16803f;
}

.rule-markup-item.premium-disabled span {
  border-color: #cbd5dc;
  color: #7d8a94;
}

.rule-markup-item.premium-disabled.complete span {
  border-color: #9bb8b0;
  color: #6d8c84;
}

.rule-markup-direction {
  cursor: default;
}

.rule-direction-readonly {
  background: #f2faf8;
}

.rule-direction-readonly .rule-direction-value {
  display: inline-flex;
  min-width: 76px;
  align-items: center;
  justify-content: center;
  border-color: #8fcfc7;
  background: #e4f6f2;
  color: #08784e;
}

.rule-current[hidden] {
  display: none;
}

.rule-current {
  border-color: #dce5e8;
  border-radius: 8px;
  background: #f8fbfb;
}

.rule-current textarea[readonly] {
  min-height: 190px;
  resize: vertical;
  background: #ffffff;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.rule-current.context-only > h3,
.rule-current.context-only > textarea {
  display: none;
}

.rule-current.context-only {
  gap: 10px;
  padding-top: 14px;
}

@media (max-width: 640px) {
  .rule-builder-panel {
    right: 5px;
    width: calc(100vw - 10px) !important;
    min-width: 0;
    max-width: calc(100vw - 10px);
  }

  .rule-builder-resize-handle {
    display: none;
  }
}

.rule-current #saveRuleMarkup {
  border-color: #2563eb;
  background: #2563eb;
  color: #ffffff;
  font-size: 16px;
}

.rule-current #saveRuleMarkup:disabled {
  border-color: #cfd7dc;
  background: #edf1f2;
  color: #8a969e;
}

.rule-card-result {
  display: grid;
  gap: 10px;
}

.rule-card-result[hidden] {
  display: none;
}

.rule-card-success {
  border-left: 4px solid #0f766e;
  border-radius: 6px;
  background: #e3f5f1;
  padding: 10px 12px;
  color: #086253;
  font-weight: 800;
}

.rule-passport-card {
  display: grid;
  gap: 12px;
  border: 1px solid #cfe0dd;
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
}

.rule-passport-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.rule-passport-card small {
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.rule-passport-card h3 {
  margin-top: 3px;
  color: #17212b;
  font-size: 18px;
}

.rule-passport-card header > span {
  white-space: nowrap;
  border-radius: 999px;
  background: #e9f7f3;
  padding: 7px 10px;
  color: #087060;
  font-size: 12px;
  font-weight: 850;
}

.rule-passport-card header > span.waiting {
  background: #fff7df;
  color: #a15c00;
}

.rule-passport-card header > span.ready {
  background: #e9f7f3;
  color: #087060;
}

.rule-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: #60717c;
  font-size: 12px;
  font-weight: 750;
}

.rule-card-meta span {
  border-right: 1px solid #dce5e8;
  padding-right: 8px;
}

.rule-card-meta span:last-child {
  border-right: 0;
  padding-right: 0;
}

.rule-card-contexts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rule-card-contexts span {
  border: 1px solid #b8e2d6;
  border-radius: 999px;
  background: #f0fbf8;
  padding: 5px 8px;
  color: #087060;
  font-size: 12px;
  font-weight: 800;
}

.rule-card-contexts span.missing {
  border-color: #e4b56c;
  background: #fff7df;
  color: #a15c00;
}

.rule-card-last {
  display: grid;
  gap: 4px;
  border-top: 1px solid #edf2f4;
  border-bottom: 1px solid #edf2f4;
  padding: 10px 0;
}

.rule-card-last strong {
  color: #17212b;
  font-size: 13px;
}

.rule-card-last span {
  color: #60717c;
  font-size: 12px;
  line-height: 1.35;
}

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

.rule-card-actions button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.context-rule-empty {
  margin: 0;
  color: #60717c;
  font-size: 12px;
  line-height: 1.45;
}

.drawing-toolbar button[data-tool="clear"]:hover {
  background: #feeceb;
  color: #b42318;
}

.drawing-toolbar .required-drawing-tool {
  position: relative;
  height: 48px;
  grid-template-rows: 22px 12px;
  gap: 1px;
}

.drawing-toolbar .required-drawing-tool small {
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0;
  line-height: 1;
}

.drawing-toolbar .required-drawing-tool.incomplete {
  border-color: #f1b9b7;
  background: #fff0ef;
  color: #c93632;
}

.drawing-toolbar .required-drawing-tool.incomplete:hover,
.drawing-toolbar .required-drawing-tool.incomplete.active {
  border-color: #df7773;
  background: #ffe2e0;
  color: #a92522;
}

.drawing-toolbar .required-drawing-tool.complete {
  border-color: #8fd0b2;
  background: #e7f7ef;
  color: #08784e;
}

.drawing-toolbar .required-drawing-tool.complete:hover,
.drawing-toolbar .required-drawing-tool.complete.active {
  border-color: #48aa79;
  background: #d3f0e1;
  color: #05623f;
}

.drawing-toolbar .required-drawing-tool:disabled {
  border-color: #d7dde1;
  background: #f1f4f5;
  color: #9aa5ad;
  cursor: not-allowed;
  opacity: 0.72;
}

.setup-type-control select:disabled {
  background: #f1f4f5;
  color: #9aa5ad;
  cursor: not-allowed;
}

.drawing-divider {
  width: 26px;
  height: 1px;
  margin: 2px 0;
  background: #d8dee3;
}

.chart-canvas-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #ffffff;
}

.chart-instrument-line {
  position: absolute;
  z-index: 8;
  top: 8px;
  left: 14px;
  display: grid;
  max-width: calc(100% - 110px);
  gap: 4px;
  pointer-events: none;
}

.chart-instrument-line strong {
  color: #1f2937;
  font-size: 16px;
  font-weight: 650;
}

.chart-instrument-line span {
  overflow: hidden;
  color: #15806f;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-instrument-line span[data-direction="down"] {
  color: #d74743;
}

.chart-attribution {
  position: absolute;
  z-index: 9;
  top: 49px;
  left: 14px;
  width: max-content;
  color: #94a3b8;
  font-size: 9px;
  font-weight: 500;
  line-height: 1;
  pointer-events: auto;
  text-decoration: none;
}

.chart-attribution:hover {
  color: #64748b;
  text-decoration: underline;
}

.full-chart {
  width: 100%;
  height: 100%;
  min-height: 420px;
}

.drawing-layer {
  position: absolute;
  z-index: 9;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.drawing-layer.drawing-active {
  cursor: crosshair;
  pointer-events: auto;
}

.drawing-layer .balance-hit,
.drawing-layer [data-drawing-id] {
  pointer-events: stroke;
}

.drawing-layer:not(.drawing-active) .balance-hit {
  pointer-events: all;
}

.drawing-layer:not(.drawing-active) [data-drawing-id] {
  pointer-events: stroke;
}

.drawing-hint {
  position: absolute;
  z-index: 12;
  top: 58px;
  left: 14px;
  max-width: min(420px, calc(100% - 120px));
  border: 1px solid #cdd5da;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.94);
  color: #334155;
  padding: 7px 10px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
  font-size: 12px;
  pointer-events: none;
}

.rule-card-next {
  margin: 0;
  color: #536978;
  line-height: 1.45;
}

.rule-current.balance-save-only {
  border: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.rule-current.balance-save-only > :not(#saveRuleMarkup) {
  display: none !important;
}

.rule-current.balance-save-only #saveRuleMarkup {
  width: 100%;
  margin: 0;
}

.chart-toast {
  position: absolute;
  z-index: 30;
  top: 18px;
  left: 50%;
  max-width: min(560px, calc(100% - 160px));
  transform: translate(-50%, -12px);
  border: 1px solid #99d5cb;
  border-radius: 8px;
  background: #e7f7f3;
  color: #0f6f62;
  padding: 11px 16px;
  box-shadow: 0 10px 28px rgba(15, 118, 110, 0.18);
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.chart-toast.visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

.trade-checklist {
  position: absolute;
  z-index: 11;
  top: 58px;
  right: 14px;
  width: 230px;
  max-height: calc(100% - 150px);
  overflow-y: auto;
  border: 1px solid #cfd8dd;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1);
  padding: 11px;
  color: #334155;
}

.trade-checklist[hidden] {
  display: none;
}

.trade-checklist header {
  display: grid;
  gap: 2px;
  border-bottom: 1px solid #e2e8ec;
  padding-bottom: 8px;
}

.trade-checklist header strong {
  color: #17212b;
  font-size: 13px;
}

.trade-checklist header span,
.trade-checklist > small {
  color: #64748b;
  font-size: 10px;
  line-height: 1.35;
}

.trade-checklist-group {
  display: grid;
  gap: 5px;
  padding: 9px 0 4px;
}

.trade-checklist-group b {
  font-size: 11px;
  text-transform: uppercase;
}

.trade-checklist-group > div {
  display: grid;
  gap: 3px;
}

.checklist-row {
  display: grid;
  grid-template-columns: 16px 1fr;
  align-items: center;
  color: #64748b;
  font-size: 11px;
}

.checklist-row.complete {
  color: #08735f;
  font-weight: 750;
}

.checklist-row.recommended:not(.complete) {
  color: #a15408;
}

.checklist-empty {
  color: #94a3b8;
  font-size: 11px;
}

.rule-match-banner {
  position: absolute;
  z-index: 16;
  right: 22px;
  bottom: 82px;
  display: grid;
  width: min(480px, calc(100% - 110px));
  grid-template-columns: minmax(0, 1fr) 30px;
  gap: 3px 10px;
  border: 1px solid #d7b778;
  border-left: 4px solid #d97706;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.16);
  padding: 11px 12px;
}

.rule-match-banner[hidden] {
  display: none;
}

.rule-match-banner strong,
.rule-match-banner span {
  grid-column: 1;
}

.rule-match-banner strong {
  color: #9a5405;
  font-size: 13px;
}

.rule-match-banner span {
  color: #475569;
  font-size: 11px;
  line-height: 1.4;
}

.rule-match-banner button {
  grid-column: 2;
  grid-row: 1 / 3;
  width: 30px;
  height: 30px;
  border: 0;
  background: transparent;
}

.rule-match-banner[data-state="matches_rule"] {
  border-color: #72b99b;
  border-left-color: #0f766e;
}

.rule-match-banner[data-state="matches_rule"] strong {
  color: #08735f;
}

.rule-match-banner[data-state="does_not_match"] {
  border-color: #efaaa6;
  border-left-color: #dc2626;
}

.rule-match-banner[data-state="does_not_match"] strong {
  color: #b42318;
}

.price-editor {
  position: absolute;
  z-index: 14;
  top: 58px;
  left: 14px;
  display: grid;
  width: min(560px, calc(100% - 90px));
  grid-template-columns: minmax(160px, 1fr) minmax(180px, 210px) 88px;
  align-items: center;
  gap: 10px;
  border: 1px solid #cdd5da;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.97);
  padding: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.price-editor > div {
  display: grid;
  gap: 2px;
}

.price-editor strong {
  font-size: 13px;
}

.price-editor span {
  color: #64748b;
  font-size: 10px;
}

.price-editor input {
  width: 100%;
  height: 34px;
  border: 1px solid #cfd7dc;
  border-radius: 5px;
  padding: 0 9px;
}

.price-editor.invalid {
  border-color: #dc2626;
  box-shadow: 0 8px 24px rgba(220, 38, 38, 0.14);
}

.price-editor input[aria-invalid="true"] {
  border-color: #dc2626;
  outline: 2px solid rgba(220, 38, 38, 0.12);
}

.price-editor button {
  height: 34px;
  border: 1px solid #0f766e;
  border-radius: 5px;
  background: #0f766e;
  color: #ffffff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
}

.balance-editor {
  position: absolute;
  z-index: 14;
  top: 58px;
  left: 14px;
  display: grid;
  width: min(780px, calc(100% - 90px));
  grid-template-columns: auto repeat(4, minmax(120px, 1fr)) repeat(2, 96px);
  align-items: end;
  gap: 8px;
  border: 1px solid #b9c8d3;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.97);
  padding: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.balance-editor[hidden],
.price-editor[hidden] {
  display: none;
}

.balance-editor > strong {
  align-self: center;
  font-size: 12px;
}

.balance-editor label {
  display: grid;
  gap: 3px;
}

.balance-editor label span {
  color: #64748b;
  font-size: 9px;
  font-weight: 700;
}

.balance-editor input,
.balance-editor button {
  width: 100%;
  height: 34px;
  border-radius: 5px;
}

.balance-editor input[aria-invalid="true"] {
  border-color: #dc2626;
  outline: 2px solid rgba(220, 38, 38, 0.14);
}

.balance-editor-error {
  grid-column: 2 / -1;
  color: #b42318;
  font-size: 11px;
  font-weight: 750;
}

.balance-editor input {
  min-width: 0;
  border: 1px solid #cfd7dc;
  padding: 0 8px;
}

.balance-editor button {
  border: 1px solid #2563eb;
  background: #2563eb;
  color: #ffffff;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}

.balance-editor button.danger {
  border-color: #dc2626;
  background: #ffffff;
  color: #b42318;
}

@media (max-width: 720px) {
  .chart-shell {
    grid-template-rows: 52px minmax(0, 1fr);
  }

  .chart-toolbar {
    overflow-x: auto;
    padding-right: 8px;
  }

  .chart-home {
    flex-basis: 38px;
  }

  .symbol-control {
    flex-basis: 118px;
  }

  .symbol-control span,
  .chart-sync-status {
    display: none;
  }

  .timeframe-control button {
    width: 34px;
  }

  .chart-save-button span {
    display: none;
  }

  .bot-wizard-dialog {
    width: calc(100vw - 12px);
    height: calc(100vh - 12px);
  }

  .project-control > span {
    display: none;
  }

  .project-control {
    flex: 0 0 150px;
    min-width: 150px;
    border-right: 0;
    padding-right: 0;
  }

  .project-control select {
    width: 150px;
  }

  .project-menu {
    width: min(320px, calc(100vw - 18px));
  }


  .saved-trade-count span {
    display: none;
  }

  .rule-builder-button {
    right: 14px;
    bottom: 14px;
    width: 48px;
    height: 48px;
    padding: 0;
    justify-content: center;
  }

  .rule-builder-button span {
    display: none;
  }

  .chart-save-button {
    width: 36px;
    flex: 0 0 36px;
    justify-content: center;
    padding: 0;
  }

  .chart-stage {
    grid-template-columns: 46px minmax(0, 1fr);
  }

  .drawing-toolbar button {
    width: 34px;
    height: 36px;
  }

  .drawing-toolbar .required-drawing-tool {
    height: 46px;
  }

  .chart-instrument-line {
    max-width: calc(100% - 70px);
  }

  .chart-instrument-line strong {
    font-size: 14px;
  }

  .price-editor {
    width: calc(100% - 28px);
    grid-template-columns: 1fr 88px;
  }

  .price-editor > div {
    grid-column: 1 / -1;
  }

  .balance-editor {
    width: calc(100% - 28px);
    grid-template-columns: 1fr 1fr;
  }

  .balance-editor > strong,
  .balance-editor button,
  .balance-editor-error {
    grid-column: 1 / -1;
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .layout,
  .review-grid,
  .review-split,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .review-checklist {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .topbar,
  .panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .report-metrics {
    grid-template-columns: 1fr;
  }

  .idea-quality {
    grid-template-columns: 1fr;
  }

  .ai-resolution-options {
    grid-template-columns: 1fr;
  }

  .template-picker {
    grid-template-columns: 1fr;
  }

  .paper-progress {
    grid-template-columns: 1fr;
  }

  .annotation-setup-grid,
  .annotation-grid {
    grid-template-columns: 1fr;
  }

  .annotation-setup-actions,
  .annotation-selection {
    align-items: stretch;
    flex-direction: column;
  }

  .annotation-setup-actions .muted {
    white-space: normal;
  }

  .annotation-chart {
    height: 480px;
  }

  .annotation-page .sidebar {
    gap: 12px;
    padding: 14px 16px;
  }

  .annotation-page .nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .annotation-page .nav a {
    overflow: hidden;
    padding: 9px 8px;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .annotation-page .nav a[aria-disabled="true"],
  .annotation-page .risk-note {
    display: none;
  }

  .annotation-workspace {
    padding: 20px 16px;
  }

  .metrics div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .report-metrics div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}
.verification-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #f4f7f7;
}

.verification-panel {
  width: min(520px, 100%);
  padding: 40px;
  border: 1px solid #d6e0e2;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(18, 39, 44, 0.12);
}

.verification-panel h1 { font-size: 32px; margin: 18px 0 10px; }
.verification-panel p { color: #60717c; margin-bottom: 24px; }
.verification-panel .primary-button { display: inline-flex; text-decoration: none; }

/* MVP context chooser */
.context-library-header > div {
  display: grid;
  gap: 6px;
}

.context-library-scroll {
  display: grid;
  align-content: start;
  gap: 18px;
  border: 0;
  padding: 8px 4px 0;
}

.context-library-scroll > h2,
.future-contexts h2 {
  margin: 0;
  color: #172026;
  font-size: 17px;
}

.mvp-context-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.mvp-context-card {
  position: relative;
  display: grid;
  grid-template-rows: auto auto minmax(118px, auto) auto;
  gap: 14px;
  min-height: 390px;
  border: 2px solid #d9e3e7;
  border-radius: 14px;
  background: #fff;
  padding: 22px;
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.mvp-context-card:hover {
  border-color: #82b9af;
  box-shadow: 0 12px 28px rgba(15, 118, 110, 0.11);
  transform: translateY(-1px);
}

.mvp-context-card.selected {
  border-color: #0f8a77;
  box-shadow: 0 0 0 3px rgba(15, 138, 119, 0.12);
}

.mvp-context-card > input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.mvp-context-radio {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 22px;
  height: 22px;
  border: 2px solid #9aacb5;
  border-radius: 50%;
  background: #fff;
}

.mvp-context-card.selected .mvp-context-radio {
  border: 6px solid #0f8a77;
}

.mvp-context-copy {
  padding-right: 32px;
}

.mvp-context-copy strong {
  color: #172026;
  font-size: 23px;
  font-weight: 900;
}

.mvp-context-copy p {
  min-height: 48px;
  margin: 7px 0 0;
  color: #52656f;
  font-size: 14px;
  line-height: 1.5;
}

.mvp-context-scheme {
  display: grid;
  min-height: 118px;
  overflow: hidden;
  place-items: center;
  border: 1px solid #dce7ea;
  border-radius: 10px;
  background:
    linear-gradient(#e9eff1 1px, transparent 1px),
    linear-gradient(90deg, #e9eff1 1px, transparent 1px),
    #fbfdfd;
  background-size: 34px 28px;
}

.mvp-context-scheme .context-scheme {
  position: relative;
  width: 90%;
  height: 94px;
}

.scheme-candles {
  position: absolute;
  inset: 14px 10% 12px;
  display: flex;
  align-items: center;
  justify-content: space-around;
}

.scheme-candles b {
  position: relative;
  z-index: 2;
  width: 9px;
  height: 25px;
  border-radius: 1px;
  background: #159886;
}

.scheme-candles b::before {
  position: absolute;
  top: -10px;
  bottom: -10px;
  left: 4px;
  width: 1px;
  background: inherit;
  content: "";
}

.scheme-candles b:nth-child(2),
.scheme-candles b:nth-child(5) {
  height: 18px;
  background: #e45756;
}

.scheme-impulse .scheme-candles b:nth-child(1) { transform: translateY(22px); }
.scheme-impulse .scheme-candles b:nth-child(2) { transform: translateY(15px); }
.scheme-impulse .scheme-candles b:nth-child(3) { transform: translateY(8px); }
.scheme-impulse .scheme-candles b:nth-child(4) { transform: translateY(0); }
.scheme-impulse .scheme-candles b:nth-child(5) { transform: translateY(-9px); }
.scheme-impulse .scheme-candles b:nth-child(6) { transform: translateY(-18px); }

.mvp-context-fields {
  border-top: 1px solid #e4ebee;
  padding-top: 12px;
}

.mvp-context-fields b {
  color: #34454e;
  font-size: 13px;
}

.mvp-context-fields ul {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 9px 0 0;
  padding: 0;
  list-style: none;
}

.mvp-context-fields li {
  color: #60717c;
  font-size: 13px;
}

.mvp-context-fields li::before {
  margin-right: 6px;
  color: #0f8a77;
  content: "✓";
  font-weight: 900;
}

.future-contexts {
  display: grid;
  gap: 10px;
}

.future-contexts > div {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.future-context-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 54px;
  border: 1px dashed #cad5da;
  border-radius: 9px;
  background: #f6f8f9;
  padding: 12px 14px;
  color: #7b8b93;
  cursor: not-allowed;
}

.future-context-card span {
  border-radius: 999px;
  background: #e7ecef;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 850;
}

.context-library-actions {
  position: sticky;
  bottom: 0;
  z-index: 3;
  justify-content: flex-end;
  margin: 0 -4px;
  background: rgba(255, 255, 255, 0.96);
  padding: 14px 4px 2px;
}

@media (max-width: 980px) {
  .mvp-context-grid {
    grid-template-columns: 1fr;
  }

  .mvp-context-card {
    min-height: 0;
  }

  .future-contexts > div {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.trade-lineage-dialog {
  width: min(760px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 32px));
  padding: 0;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  background: #fff;
  color: #17212b;
}
.trade-lineage-dialog::backdrop { background: rgba(15, 23, 42, .48); }
.trade-lineage-dialog > header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid #dbe4ec;
}
.trade-lineage-dialog > header div { display: grid; gap: 3px; }
.trade-lineage-dialog > header span { color: #64748b; font-size: 12px; }
.trade-lineage-dialog > header button { border: 0; background: transparent; cursor: pointer; }
#tradeLineageBody { display: grid; gap: 12px; padding: 18px; overflow: auto; }
#tradeLineageBody section {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px;
  overflow: hidden; border: 1px solid #dbe4ec; border-radius: 10px; background: #dbe4ec;
}
#tradeLineageBody section > div { display: grid; gap: 5px; padding: 12px; background: #fff; }
#tradeLineageBody small { color: #64748b; }
