:root {
  --bg: #0b0f16;
  --surface: #111722;
  --surface-2: #151d2a;
  --surface-3: #1b2534;
  --input-bg: #0d121b;
  --chart-bg: #0a0f17;
  --line: #263244;
  --line-soft: #1c2736;
  --text: #d7e0ea;
  --text-strong: #f3f7fb;
  --muted: #7d8ba1;
  --brand: #2f81f7;
  --brand-dark: #1f6feb;
  --brand-contrast: #fff;
  --danger: #f85149;
  --ok: #2ea043;
  --warning: #d29922;
  --shadow: rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(47, 129, 247, 0.08), transparent 240px),
    var(--bg);
  color: var(--text);
  font-family: Inter, Tahoma, Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

.shell {
  width: min(1440px, calc(100% - 28px));
  margin: 0 auto;
  padding: 14px 0 32px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  align-items: start;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  margin-bottom: 0;
  background: rgba(11, 15, 22, 0.9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line-soft);
}

.dashboardTabs {
  position: sticky;
  top: 66px;
  z-index: 8;
  grid-column: 1;
  grid-row: 2;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px;
  background: rgba(17, 23, 34, 0.82);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 16px 40px var(--shadow);
  backdrop-filter: blur(16px);
}

.dashboardTabs button {
  width: auto;
  min-width: max-content;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: start;
}

.dashboardTabs button:hover {
  color: var(--text-strong);
  border-color: var(--line-soft);
  background: rgba(255, 255, 255, 0.03);
}

.dashboardTabs button.active {
  color: var(--brand-contrast);
  border-color: rgba(47, 129, 247, 0.55);
  background: rgba(47, 129, 247, 0.18);
}

.dashboardTabs button.hidden {
  display: none;
}

.dashboardContent {
  grid-column: 1;
  grid-row: 3;
  min-width: 0;
  display: grid;
  gap: 10px;
}

.dashboardBlock.tabHidden {
  display: none !important;
}

.loggedOut .dashboardTabs {
  display: none;
}

.loggedOut .dashboardContent {
  grid-row: 2;
}

.loggedOut .authBlock {
  grid-template-columns: minmax(0, 1fr) minmax(360px, 460px);
  max-width: 1180px;
  margin: 18px auto 0;
  align-items: center;
}

.loggedIn .authBlock {
  grid-template-columns: 1fr 1fr;
}

.loggedIn .authHero {
  display: none;
}

.authBlock {
  align-items: stretch;
}

.authHero {
  display: grid;
  gap: 18px;
  min-height: 520px;
  padding: clamp(18px, 4vw, 42px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 18% 18%, rgba(46, 160, 67, 0.16), transparent 26%),
    linear-gradient(135deg, rgba(47, 129, 247, 0.2), rgba(17, 23, 34, 0.88) 42%, rgba(17, 23, 34, 0.98)),
    var(--surface);
  box-shadow: 0 18px 54px var(--shadow);
}

.authEyebrow {
  width: max-content;
  max-width: 100%;
  padding: 6px 10px;
  border: 1px solid rgba(47, 129, 247, 0.42);
  border-radius: 999px;
  color: var(--brand-contrast);
  background: rgba(47, 129, 247, 0.14);
  font-size: 12px;
  font-weight: 800;
}

.authHero h2 {
  max-width: 720px;
  color: var(--text-strong);
  font-size: clamp(28px, 4vw, 52px);
  line-height: 1.22;
  font-weight: 850;
}

.authHero p {
  max-width: 700px;
  color: #b7c4d5;
  font-size: 15px;
  line-height: 2;
}

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

.authFeatureGrid div {
  display: grid;
  gap: 7px;
  min-height: 116px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(11, 15, 22, 0.38);
}

.authFeatureGrid b {
  color: var(--text-strong);
  font-size: 13px;
}

.authFeatureGrid span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

.authPreview {
  display: grid;
  gap: 12px;
  align-self: end;
  max-width: 520px;
  padding: 14px;
  border: 1px solid rgba(47, 129, 247, 0.28);
  border-radius: 8px;
  background: rgba(10, 15, 23, 0.7);
}

.authPreview > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.authPreview strong {
  color: var(--text-strong);
}

.authSignalRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.authMiniChart {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  align-items: end;
  gap: 8px;
  height: 82px;
}

.authMiniChart span {
  display: block;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, rgba(46, 160, 67, 0.95), rgba(47, 129, 247, 0.25));
}

.authMiniChart span:nth-child(1) { height: 38%; }
.authMiniChart span:nth-child(2) { height: 56%; }
.authMiniChart span:nth-child(3) { height: 44%; background: linear-gradient(180deg, rgba(248, 81, 73, 0.92), rgba(248, 81, 73, 0.18)); }
.authMiniChart span:nth-child(4) { height: 72%; }
.authMiniChart span:nth-child(5) { height: 64%; }
.authMiniChart span:nth-child(6) { height: 88%; }

.authCard {
  display: grid;
  gap: 12px;
  max-width: 540px;
  width: 100%;
  justify-self: stretch;
}

.authIntro {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid rgba(47, 129, 247, 0.32);
  border-radius: 8px;
  background: rgba(47, 129, 247, 0.08);
}

.authIntro b {
  color: var(--text-strong);
  font-size: 16px;
}

.authIntro span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.passwordField {
  position: relative;
  display: block;
}

.passwordField input {
  padding-inline-end: 48px;
}

.passwordToggle {
  position: absolute;
  top: 50%;
  inset-inline-end: 6px;
  width: 34px;
  height: 28px;
  min-height: 0;
  transform: translateY(-50%);
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.passwordToggle:hover {
  color: var(--text-strong);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.passwordToggle.active {
  color: var(--brand);
  border-color: rgba(47, 129, 247, 0.45);
  background: rgba(47, 129, 247, 0.12);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  color: var(--text-strong);
  font-size: 22px;
  line-height: 1.25;
  font-weight: 800;
}

h1::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-left: 10px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 18px rgba(46, 160, 67, 0.8);
}

h2 {
  color: var(--text-strong);
  font-size: 15px;
  font-weight: 750;
}

p,
.hint {
  color: var(--muted);
  font-size: 12px;
  margin-top: 5px;
}

.grid {
  display: grid;
  gap: 12px;
}

.two {
  grid-template-columns: 1fr 1fr;
}

.panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0.01)), var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 16px 40px var(--shadow);
}

.panelHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

input,
select {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--text-strong);
  padding: 0 11px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(47, 129, 247, 0.16);
}

form {
  display: grid;
  gap: 12px;
}

.tools,
.adminTools {
  display: grid;
  grid-template-columns: 1fr 1fr 150px 130px;
  gap: 10px;
  align-items: end;
}

.adminTools {
  grid-template-columns: 1fr 150px 110px 150px;
  margin-bottom: 12px;
}

.reportTools {
  display: grid;
  grid-template-columns: 1fr 150px 140px;
  gap: 10px;
  align-items: end;
}

.assistantTools {
  display: grid;
  grid-template-columns: 1fr 150px 120px;
  gap: 10px;
  align-items: end;
}

.revenueGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.revenueCard {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.customizePanel {
  box-shadow: none;
}

.customizeBody {
  display: grid;
  gap: 12px;
}

.customizeTools {
  display: grid;
  grid-template-columns: 160px;
  gap: 10px;
  align-items: end;
}

.layoutList {
  display: grid;
  gap: 8px;
}

.layoutItem {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  padding: 8px;
}

.layoutItem span {
  color: var(--text-strong);
  font-size: 13px;
}

.layoutItem div {
  display: flex;
  gap: 6px;
}

.layoutItem button {
  width: 38px;
  padding: 0;
}

button {
  height: 38px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

button:active {
  transform: translateY(1px);
}

.primary {
  background: var(--brand);
  color: var(--brand-contrast);
  font-weight: 750;
}

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

.ghost {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
  padding: 0 14px;
}

.ghost:hover {
  border-color: var(--brand);
  color: var(--text-strong);
}

.livePriceStrip {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 8px;
  margin: 10px 0;
}

.livePriceStrip span {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: rgba(47, 129, 247, 0.08);
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.livePriceStrip b {
  color: var(--text-strong);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #0d121b;
}

.segmented button {
  height: 34px;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  padding: 0 14px;
}

.segmented button.active {
  background: var(--brand);
  color: #fff;
}

.result,
.empty {
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    var(--input-bg);
  background-size: 28px 28px;
  color: var(--text);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 14px;
  min-height: 126px;
  white-space: pre-wrap;
  direction: ltr;
  text-align: left;
  overflow: auto;
}

.empty {
  direction: rtl;
  text-align: right;
  background: var(--surface-2);
  color: var(--muted);
}

.reportBox {
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.summaryGrid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.summaryGrid div {
  min-height: 70px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 10px;
  display: grid;
  align-content: center;
  gap: 5px;
}

.summaryGrid span {
  color: var(--muted);
  font-size: 11px;
}

.summaryGrid b {
  color: var(--text-strong);
  direction: ltr;
  text-align: left;
  font-size: 18px;
}

.reportSummary {
  background: rgba(47, 129, 247, 0.08);
  border: 1px solid rgba(47, 129, 247, 0.25);
  border-radius: 8px;
  padding: 12px;
  margin: 0 0 12px;
  color: var(--text);
}

.assistantResultBox {
  display: grid;
  gap: 12px;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.assistantAnswer {
  padding: 12px;
  border: 1px solid rgba(46, 160, 67, 0.28);
  border-radius: 8px;
  background: rgba(46, 160, 67, 0.1);
  color: var(--text-strong);
  font-weight: 750;
  line-height: 1.9;
}

.assistantDisclaimer {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.tradeTools {
  display: grid;
  grid-template-columns: 140px 1fr 120px 120px 110px 130px 120px 120px;
  gap: 10px;
  align-items: end;
}

.tradePlanBox {
  display: grid;
  gap: 12px;
}

.tradeStatus,
.monitorBox,
.tradeRules,
.exchangeStandard {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--input-bg);
  padding: 10px;
}

.tradeStatus b,
.monitorBox b,
.tradeRules b,
.exchangeStandard b {
  color: var(--text-strong);
}

.tradeStatus.long {
  border-color: rgba(46, 160, 67, 0.38);
}

.tradeStatus.short,
.monitorBox.danger {
  border-color: rgba(248, 81, 73, 0.42);
}

.tradeStatus.wait,
.monitorBox.warning {
  border-color: rgba(210, 153, 34, 0.42);
}

.tradeGrid {
  display: grid;
  grid-template-columns: repeat(6, minmax(110px, 1fr));
  gap: 8px;
}

.tradeGrid div {
  display: grid;
  gap: 4px;
  min-height: 56px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  padding: 8px;
}

.tradeGrid span,
.monitorBox span,
.monitorBox small,
.exchangeStandard span,
.tradeRules p {
  color: var(--muted);
  font-size: 12px;
}

.tradeGrid b {
  color: var(--text-strong);
  font-size: 14px;
}

.tableWrap {
  overflow-x: auto;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
  background: var(--input-bg);
}

th,
td {
  border-bottom: 1px solid var(--line-soft);
  padding: 10px;
  text-align: right;
  font-size: 12px;
}

th {
  position: sticky;
  top: 0;
  color: var(--muted);
  background: var(--surface-2);
  font-weight: 750;
}

tr:hover td {
  background: rgba(47, 129, 247, 0.045);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 750;
}

.badge.admin,
.badge.active,
.badge.long {
  color: var(--ok);
  border-color: rgba(46, 160, 67, 0.35);
  background: rgba(46, 160, 67, 0.12);
}

.badge.short,
.badge.error {
  color: var(--danger);
  border-color: rgba(248, 81, 73, 0.35);
  background: rgba(248, 81, 73, 0.12);
}

.badge.wait,
.badge.no_data {
  color: var(--warning);
  border-color: rgba(210, 153, 34, 0.35);
  background: rgba(210, 153, 34, 0.12);
}

.toast {
  position: fixed;
  left: 20px;
  bottom: 20px;
  max-width: min(420px, calc(100% - 40px));
  background: #0d121b;
  color: var(--text-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: 0 18px 44px var(--shadow);
}

.symbolSuggestBox {
  position: absolute;
  z-index: 1000;
  max-height: 320px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  box-shadow: 0 18px 44px var(--shadow);
}

.symbolSuggestItem {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  padding: 8px 10px;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  text-align: right;
}

.symbolSuggestItem:hover,
.symbolSuggestItem.active {
  background: var(--surface-3);
  border-color: var(--line);
}

.symbolSuggestItem span {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.symbolSuggestItem b {
  color: var(--text-strong);
  font-size: 13px;
}

.symbolSuggestItem small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.symbolSuggestItem em {
  align-self: center;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 2px 7px;
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}

.hidden {
  display: none !important;
}

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

@media (max-width: 900px) {
  .shell {
    width: min(100% - 20px, 1440px);
    padding-top: 8px;
    grid-template-columns: 1fr !important;
  }

  html[dir="rtl"] .dashboardTabs,
  html[dir="ltr"] .dashboardTabs {
    grid-column: 1;
    grid-row: 2;
    position: sticky;
    top: 0;
    display: flex;
    overflow-x: auto;
  }

  html[dir="rtl"] .dashboardContent,
  html[dir="ltr"] .dashboardContent {
    grid-column: 1;
    grid-row: 3;
  }

  .dashboardTabs button {
    width: auto;
    min-width: max-content;
  }

  .topbar,
  .panelHeader {
    align-items: flex-start;
    flex-direction: column;
  }

  .two,
  .tools,
  .adminTools,
  .reportTools,
  .assistantTools,
  .summaryGrid {
    grid-template-columns: 1fr;
  }
}
