@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@500;600;700;800&display=swap');

:root {
  --navy: #0b1729;
  --navy2: #132238;
  --ink: #172033;
  --muted: #718096;
  --line: #e6ebf2;
  --bg: #f4f7fb;
  --card: #ffffff;
  --blue: #3563e9;
  --cyan: #13a9bf;
  --green: #16a36a;
  --red: #e35353;
  --amber: #e69b28;
  --shadow: 0 10px 35px rgba(24, 39, 75, 0.07);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "DM Sans", system-ui, sans-serif;
  background: var(--bg);
}

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

button {
  cursor: pointer;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.18em;
  font-weight: 800;
  color: #7e8da3;
  margin: 0 0 9px;
  text-transform: uppercase;
}

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

.auth-body {
  min-height: 100vh;
  background: #091426;
  overflow: hidden;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  position: relative;
  z-index: 2;
}

.auth-brand {
  padding: 11vh 8vw;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-brand .eyebrow {
  color: #5bc5db;
  margin-top: 25px;
}

.auth-brand h1 {
  font: 700 clamp(42px, 4.5vw, 68px)/1.08 "Manrope", sans-serif;
  margin: 5px 0 22px;
  letter-spacing: -0.04em;
}

.auth-brand h1 span {
  color: #4fc6db;
}

.auth-copy {
  max-width: 570px;
  font-size: 17px;
  line-height: 1.7;
  color: #9cacc0;
}

.auth-points {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 50px;
  max-width: 720px;
}

.auth-points div {
  display: flex;
  gap: 12px;
}

.auth-points i {
  font: 600 12px "Manrope", sans-serif;
  color: #4fc6db;
  border-top: 1px solid #296980;
  padding-top: 5px;
}

.auth-points span {
  display: flex;
  flex-direction: column;
}

.auth-points b {
  font-size: 13px;
}

.auth-points small {
  font-size: 11px;
  color: #73859d;
  margin-top: 4px;
  line-height: 1.4;
}

.login-card {
  background: #fff;
  margin: 6vh 5vw 6vh 0;
  border-radius: 28px;
  padding: clamp(40px, 5vw, 76px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.27);
}

.login-card h2 {
  font: 800 34px "Manrope", sans-serif;
  margin: 0 0 6px;
  letter-spacing: -0.03em;
}

.login-form {
  margin-top: 30px;
}

.login-form label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-weight: 600;
  font-size: 13px;
  color: #39465a;
}

.login-form input {
  width: 100%;
  height: 49px;
  border: 1px solid #dce3ec;
  border-radius: 10px;
  padding: 0 14px;
  outline: none;
  color: var(--ink);
  background: #fbfcfe;
}

.login-form input:focus {
  border-color: #4b72e8;
  box-shadow: 0 0 0 3px rgba(53, 99, 233, 0.07);
}

.login-form label + label {
  margin-top: 18px;
}

.btn-wide {
  width: 100%;
  height: 50px;
}

.login-form .btn {
  margin-top: 25px;
}

.secure-note {
  text-align: center;
  margin-top: 28px;
  font-size: 11px;
  color: #9aa6b5;
}

.secure-note span {
  color: #25b97b;
}

.mobile-logo {
  display: none;
}

.auth-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.3;
}

.orb-one {
  width: 500px;
  height: 500px;
  background: #075b84;
  left: -250px;
  bottom: -250px;
}

.orb-two {
  width: 300px;
  height: 300px;
  background: #173b83;
  top: -150px;
  left: 45%;
}

.alert {
  padding: 13px 16px;
  border-radius: 9px;
  font-size: 13px;
  margin: 15px 0;
}

.alert.error {
  background: #fff0f0;
  color: #b83a3a;
  border: 1px solid #ffdada;
}

.alert.success {
  background: #ebfbf3;
  color: #08784a;
  border: 1px solid #ccf4df;
}

.app-body {
  min-height: 100vh;
}

.logo-mark {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, #386bf0, #16a7c6);
  font: 800 28px "Manrope", sans-serif;
  box-shadow: 0 12px 30px rgba(19, 109, 163, 0.3);
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 246px;
  background: var(--navy);
  color: #fff;
  padding: 25px 17px;
  display: flex;
  flex-direction: column;
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: #fff;
  text-decoration: none;
  font: 600 18px "Manrope", sans-serif;
  padding: 0 9px 28px;
}

.brand b {
  color: #55c1d5;
}

.nav-label {
  font-size: 9px;
  letter-spacing: 0.18em;
  color: #53657c;
  font-weight: 800;
  margin: 17px 12px 8px;
  text-transform: uppercase;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  width: 100%;
  min-height: 43px;
  border: 0;
  background: transparent;
  color: #8999ae;
  border-radius: 9px;
  text-decoration: none;
  padding: 10px 13px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  text-align: left;
}

.nav-item span {
  width: 20px;
  text-align: center;
  font-size: 17px;
}

.nav-item:hover,
.nav-item.active {
  color: #fff;
  background: #172941;
}

.nav-item.active {
  box-shadow: inset 3px 0 #4bc0d5;
}

.sidebar-foot {
  margin-top: auto;
  border-top: 1px solid #1c2d43;
  padding: 18px 7px 0;
  display: grid;
  grid-template-columns: 36px 1fr 28px;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 35px;
  height: 35px;
  border-radius: 10px;
  background: #244260;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #63c7da;
}

.sidebar-foot b {
  font-size: 12px;
  display: block;
}

.sidebar-foot small {
  font-size: 10px;
  color: #71829a;
}

.sidebar-foot button {
  border: 0;
  background: none;
  color: #75869b;
  font-size: 18px;
}

.app-content {
  margin-left: 246px;
  min-height: 100vh;
}

.topbar {
  height: 72px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.market-clock {
  display: flex;
  align-items: center;
  gap: 11px;
}

.market-clock b {
  font-size: 13px;
  display: block;
}

.market-clock small {
  font-size: 10px;
  color: #8794a6;
}

.pulse-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #28b77b;
  box-shadow: 0 0 0 5px rgba(40, 183, 123, 0.09);
}

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

.connection-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 8px 11px;
  border-radius: 20px;
  background: #eafaf2;
  color: #168457;
}

.connection-pill.offline {
  background: #f3f5f8;
  color: #8793a4;
}

.connection-pill i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #21ad70;
  display: inline-block;
  margin-right: 5px;
}

.connection-pill.offline i {
  background: #a9b2bf;
}

.workspace {
  padding: 31px 34px 60px;
  max-width: 1600px;
  margin: auto;
}

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

.page-title h1 {
  font: 800 27px "Manrope", sans-serif;
  letter-spacing: -0.03em;
  margin: 0 0 4px;
}

.page-title > div > p:last-child {
  font-size: 13px;
  color: #8491a3;
  margin: 0;
  max-width: 72ch;
}

.strategy-status {
  display: flex;
  align-items: center;
  gap: 11px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 15px;
  box-shadow: var(--shadow);
}

.strategy-status > span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #aab4c1;
}

.strategy-status > span.running {
  background: #23b979;
  box-shadow: 0 0 0 5px rgba(35, 185, 121, 0.09);
}

.strategy-status small {
  font-size: 8px;
  color: #93a0af;
  font-weight: 800;
  letter-spacing: 0.12em;
  display: block;
  text-transform: uppercase;
}

.strategy-status b,
#databasePath {
  font-size: 12px;
  text-transform: none;
  word-break: break-all;
}

.index-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 17px;
}

.index-card,
.content-card,
.setting-card,
.runtime-card,
.session-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: var(--shadow);
}

.index-card {
  min-height: 130px;
  padding: 23px;
  display: grid;
  grid-template-columns: 48px 1fr 86px;
  gap: 16px;
  align-items: center;
  overflow: hidden;
}

.card-icon {
  width: 45px;
  height: 45px;
  border-radius: 12px;
  background: #e9f0ff;
  color: #3867e8;
  display: grid;
  place-items: center;
  font: 800 18px "Manrope", sans-serif;
}

.index-card small {
  font-size: 9px;
  letter-spacing: 0.14em;
  color: #8a97a8;
  font-weight: 800;
  display: block;
  text-transform: uppercase;
}

.index-card strong {
  font: 700 25px "Manrope", sans-serif;
  display: block;
  margin: 4px 0;
}

.index-card span {
  font-size: 10px;
  color: #94a0af;
}

.sparkline {
  height: 38px;
  display: flex;
  gap: 4px;
  align-items: flex-end;
}

.sparkline i {
  width: 8px;
  background: #dce7ff;
  border-radius: 3px 3px 0 0;
}

.sparkline i:nth-child(1) { height: 20%; }
.sparkline i:nth-child(2) { height: 42%; }
.sparkline i:nth-child(3) { height: 31%; }
.sparkline i:nth-child(4) { height: 63%; }
.sparkline i:nth-child(5) { height: 48%; }
.sparkline i:nth-child(6) { height: 80%; }
.sparkline i:nth-child(7) { height: 69%; background: #6185ea; }

.content-card {
  margin-top: 17px;
}

.control-card {
  margin-top: 17px;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  gap: 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: var(--shadow);
}

.control-copy {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
}

.control-icon {
  width: 42px;
  height: 42px;
  background: #eef3ff;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #426ae1;
  font-size: 20px;
}

.control-copy h3 {
  font: 700 15px "Manrope", sans-serif;
  margin: 0 0 4px;
}

.control-copy p {
  font-size: 11px;
  color: #8a96a6;
  margin: 0;
}

.mode-select {
  display: flex;
  background: #f0f3f7;
  border-radius: 8px;
  padding: 3px;
}

.mode-select button {
  border: 0;
  background: none;
  height: 32px;
  padding: 0 14px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #8793a2;
}

.mode-select button.active {
  background: #fff;
  color: #315bdc;
  box-shadow: 0 2px 8px rgba(25, 45, 78, 0.09);
}

.control-buttons {
  display: flex;
  gap: 8px;
}

.section-head {
  padding: 19px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.section-head h3 {
  font: 700 15px "Manrope", sans-serif;
  margin: 0 0 4px;
}

.section-head p {
  font-size: 11px;
  color: #8a96a6;
  margin: 0;
}

.count-badge {
  font-size: 10px;
  color: #728196;
  background: #f2f5f8;
  border-radius: 15px;
  padding: 6px 10px;
  white-space: nowrap;
}

.tabs {
  height: 55px;
  display: flex;
  align-items: flex-end;
  padding: 0 21px;
  border-bottom: 1px solid var(--line);
  gap: 25px;
}

.tabs button {
  height: 55px;
  border: 0;
  background: none;
  font-size: 12px;
  color: #8290a2;
  font-weight: 700;
  border-bottom: 2px solid transparent;
}

.tabs button.active {
  color: #315de0;
  border-color: #3563e9;
}

.tabs em {
  font-style: normal;
  font-size: 9px;
  background: #eff2f6;
  border-radius: 10px;
  padding: 3px 6px;
  margin-left: 4px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.settings-grid,
.runtime-grid,
.session-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  padding: 18px 22px 22px;
}

.settings-grid-full {
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
}

.setting-card,
.runtime-card,
.session-card {
  padding: 18px;
}

.card-topline {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}

.chip,
.status-chip,
.side-chip {
  font-size: 9px;
  font-weight: 800;
  border-radius: 12px;
  padding: 4px 7px;
  text-transform: uppercase;
}

.chip {
  background: #eef2f7;
  color: #5d6b7e;
}

.chip.good {
  background: #e9f9f1;
  color: #148054;
}

.chip.bad {
  background: #fff0f0;
  color: #c74444;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  font-weight: 600;
  font-size: 13px;
  color: #39465a;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #dce3ec;
  border-radius: 10px;
  padding: 0 14px;
  outline: none;
  color: var(--ink);
  background: #fbfcfe;
}

input,
select {
  height: 42px;
}

textarea {
  min-height: 78px;
  padding-top: 12px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #4b72e8;
  box-shadow: 0 0 0 3px rgba(53, 99, 233, 0.07);
}

.btn,
.save-button {
  height: 42px;
  border-radius: 9px;
  border: 0;
  padding: 0 18px;
  font-weight: 700;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: 0.2s;
}

.btn:hover,
.save-button:hover {
  transform: translateY(-1px);
}

.btn-primary,
.save-button {
  background: linear-gradient(135deg, #3968eb, #3156d2);
  color: #fff;
  box-shadow: 0 8px 22px rgba(53, 99, 233, 0.16);
}

.btn-ghost {
  background: #fff;
  border: 1px solid #dfe5ed;
  color: #465368;
}

.btn-dark {
  background: #e9edf3;
  color: #243249;
}

.actions {
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.action-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.meta {
  color: #8a96a6;
  font-size: 11px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 23, 41, 0.58);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}

.modal-backdrop.open {
  display: flex;
}

.modal-open {
  overflow: hidden;
}

.modal-card {
  width: min(760px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 30px 90px rgba(10, 23, 41, 0.22);
  padding: 24px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.modal-head h3 {
  margin: 0 0 6px;
  font: 800 24px "Manrope", sans-serif;
  letter-spacing: -0.03em;
}

.modal-copy {
  margin: 0;
  color: #718096;
  font-size: 13px;
  line-height: 1.5;
}

.modal-close {
  border: 0;
  background: #eef2f7;
  color: #405067;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
}

.modal-form-card {
  padding: 0;
  border: 0;
  box-shadow: none;
}

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

table,
.data-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
}

th {
  height: 42px;
  background: #fafbfd;
  color: #8b98a8;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: left;
  padding: 0 22px;
}

td {
  border-top: 1px solid #edf0f4;
  padding: 16px 22px;
  color: #4b586b;
  vertical-align: top;
}

td b {
  color: #1c293d;
}

.mono {
  font-family: "SFMono-Regular", "IBM Plex Mono", Consolas, monospace;
  word-break: break-word;
}

.pnl-positive {
  color: var(--green) !important;
  font-weight: 700;
}

.pnl-negative {
  color: var(--red) !important;
  font-weight: 700;
}

.logs-panel {
  padding: 5px 22px 15px;
}

.log-item {
  display: grid;
  grid-template-columns: 120px 70px 1fr;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #edf0f4;
  font-size: 11px;
}

.log-head {
  display: contents;
}

.log-time {
  color: #98a3b0;
}

.log-level {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #25835d;
  text-transform: uppercase;
}

.log-message {
  margin: 0;
  color: #4e5c6f;
  white-space: pre-wrap;
  word-break: break-word;
}

.session-card .mono {
  font-size: 11px;
  color: #40506a;
}

.status-line {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 200;
  width: 310px;
  background: #142238;
  color: #fff;
  padding: 14px 16px;
  border-radius: 10px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.18);
  font-size: 12px;
  border-left: 4px solid #27b879;
}

.status-chip.complete,
.status-chip.open {
  background: #e9f9f1;
  color: #148054;
}

.status-chip.rejected,
.status-chip.cancelled,
.status-chip.error {
  background: #fff0f0;
  color: #c74444;
}

.status-chip.triggerpending,
.status-chip.pending {
  background: #fff6e8;
  color: #ba7c15;
}

.side-chip.buy {
  color: #177f58;
  background: #e8f8f0;
}

.side-chip.sell {
  color: #cf4444;
  background: #fff0f0;
}

.log-details {
  display: block;
  color: #8592a3;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 900px;
}

.toast {
  width: 310px;
  background: #142238;
  color: #fff;
  padding: 14px 16px;
  border-radius: 10px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.18);
  font-size: 12px;
  animation: slidein 0.25s;
}

.toast.error {
  border-left: 4px solid #ed5959;
}

.toast.success {
  border-left: 4px solid #27b879;
}

@keyframes slidein {
  from {
    transform: translateX(20px);
    opacity: 0;
  }
}

.menu-toggle {
  display: none;
  border: 0;
  background: none;
  font-size: 20px;
}

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

  .control-card {
    flex-wrap: wrap;
  }

  .control-copy {
    min-width: 50%;
  }

  .mode-select {
    order: 2;
  }

  .modal-card {
    width: min(720px, 100%);
  }
}

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

  .auth-brand {
    display: none;
  }

  .login-card {
    min-height: calc(100vh - 36px);
    margin: 0;
    border-radius: 20px;
    padding: 34px 26px;
  }

  .mobile-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font: 700 17px "Manrope", sans-serif;
    margin-bottom: 45px;
  }

  .mobile-logo .logo-mark {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    font-size: 18px;
  }

  .sidebar {
    position: static;
    width: auto;
    inset: auto;
  }

  .app-content {
    margin: 0;
  }

  .topbar {
    padding: 0 15px;
    height: 64px;
  }

  .market-clock {
    display: none;
  }

  .menu-toggle {
    display: block;
  }

  .workspace {
    padding: 21px 14px 45px;
  }

  .page-title {
    flex-direction: column;
    align-items: flex-start;
  }

  .index-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .index-card {
    grid-template-columns: 36px 1fr;
    min-height: 105px;
    padding: 15px;
    gap: 10px;
  }

  .control-card {
    padding: 16px;
  }

  .control-copy {
    width: 100%;
    flex-basis: 100%;
  }

  .mode-select {
    order: 2;
    width: 100%;
    justify-content: stretch;
  }

  .mode-select button {
    flex: 1;
  }

  .control-buttons {
    order: 3;
    flex: 1;
    width: 100%;
    flex-wrap: wrap;
  }

  .control-buttons .btn {
    flex: 1;
    padding: 0 10px;
  }

  .modal-backdrop {
    padding: 14px;
  }

  .modal-card {
    max-height: calc(100vh - 28px);
    padding: 18px;
    border-radius: 18px;
  }

  .modal-head {
    gap: 12px;
  }

  .modal-head h3 {
    font-size: 21px;
  }

  .index-card .sparkline {
    display: none;
  }

  .settings-grid,
  .runtime-grid,
  .session-grid {
    grid-template-columns: 1fr;
    padding: 16px;
  }

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

  .tabs {
    overflow-x: auto;
    gap: 18px;
  }

  th,
  td {
    padding-left: 14px;
    padding-right: 14px;
    white-space: nowrap;
  }

  .log-item {
    grid-template-columns: 1fr;
  }

  .status-line {
    width: calc(100vw - 30px);
    right: 15px;
    bottom: 15px;
  }
}
