/* ============================================================
   Detailed Analysis — 1:1 with design screenshot
   ============================================================ */
.da {
  --da-card: #14171C;
  --da-line: #21262E;
  --da-soft: #16191F;
  --da-edge: #262B33;
  --da-muted: #848E9C;
  --da-white: #EAECEF;
  --da-gold: #F0B90B;
  --da-green: #0ECB81;
  --da-red: #F6465D;
  --da-grid: rgba(132, 142, 156, 0.11);
}

/* This screen has no bottom nav, so the shell's nav gutter is not needed. */
.app-content:has(> .da) { padding-bottom: 26px; }

.da .is-up { color: var(--da-green); }
.da .is-down { color: var(--da-red); }

/* ---------- Title ---------- */
.da-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 2px 0 9px;
}
.da-h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: #fff;
}
.da-share {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  font-size: 10px;
  font-weight: 500;
  color: var(--da-gold);
  white-space: nowrap;
}
.da-share svg { width: 13px; height: 13px; }

/* ---------- Bot identity ---------- */
.da-id {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}
.da-id-l {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  min-width: 0;
}
.da-id-l .crypto-avatar {
  width: 35px;
  height: 35px;
  font-size: 15px;
  flex-shrink: 0;
}
.da-id-m { min-width: 0; }
.da-id-top {
  display: flex;
  align-items: center;
  gap: 6px;
}
.da-pair {
  font-size: 11.5px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.da-badge {
  flex-shrink: 0;
  padding: 1.5px 4.5px;
  border: 1px solid rgba(240, 185, 11, 0.45);
  border-radius: 4px;
  font-size: 7.5px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--da-gold);
  white-space: nowrap;
}
.da-strategy {
  margin-top: 4px;
  font-size: 9.5px;
  line-height: 1.3;
  color: var(--da-muted);
  white-space: nowrap;
}
.da-state {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 5px;
  font-size: 7.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--da-green);
}
.da-state i {
  width: 4.5px;
  height: 4.5px;
  border-radius: 50%;
  background: currentColor;
}
.da-date {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 8px;
  background: var(--da-soft);
  border: 1px solid var(--da-edge);
  color: var(--da-white);
  font-size: 8px;
  font-weight: 500;
  white-space: nowrap;
  margin-top: 5px;
}
.da-date .i-cal { width: 11px; height: 11px; color: var(--da-gold); }
.da-date .i-cal svg { width: 11px; height: 11px; }
.da-date .i-chev { width: 10px; height: 10px; color: var(--da-muted); }
.da-date .i-chev svg { width: 10px; height: 10px; }

/* ---------- Tabs ---------- */
.da-tabs {
  display: flex;
  align-items: stretch;
  margin: 0 0 13px;
}
.da-tab {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 8px 0 0;
}
.da-tab > span {
  position: relative;
  display: block;
  padding-bottom: 9px;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.25;
  color: var(--da-muted);
  white-space: nowrap;
}
.da-tab.is-on > span {
  color: var(--da-gold);
  font-weight: 600;
}
.da-tab.is-on > span::after {
  content: '';
  position: absolute;
  left: -1px;
  right: -1px;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--da-gold);
}

/* ---------- Section headings ---------- */
.da-sec {
  margin: 0 0 6px;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--da-white);
}
.da-sec-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
}
.da-sec-row .da-sec { margin-bottom: 0; }

.da-unit {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 19px;
  padding: 0 7px;
  border-radius: 8px;
  background: var(--da-soft);
  border: 1px solid var(--da-edge);
  color: #fff;
  font-size: 8.5px;
  font-weight: 600;
  white-space: nowrap;
}
.da-unit svg { width: 9px; height: 9px; color: var(--da-muted); }

.da-toggle {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 8px;
  background: #101317;
  border: 1px solid var(--da-line);
}
.da-toggle button {
  min-width: 30px;
  height: 15px;
  padding: 0 6px;
  border-radius: 6px;
  font-size: 8.5px;
  font-weight: 600;
  color: var(--da-muted);
  white-space: nowrap;
}
.da-toggle button.is-on {
  color: var(--da-gold);
  border: 1px solid rgba(240, 185, 11, 0.55);
  background: rgba(240, 185, 11, 0.06);
}

/* ---------- Key Performance Metrics ---------- */
.da-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
}
.da-kpi {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 9px 7px 8px;
  background: var(--da-card);
  border: 1px solid var(--da-line);
  border-radius: 8px;
}
.da-kpi .k {
  font-size: 7px;
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--da-muted);
  white-space: nowrap;
}
.da-kpi .v {
  margin-top: 5px;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: #fff;
  white-space: nowrap;
}
.da-kpi .s {
  margin-top: 3px;
  font-size: 7.5px;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
}

/* ---------- Chart panels ---------- */
.da-panel {
  background: var(--da-card);
  border: 1px solid var(--da-line);
  border-radius: 10px;
}

/* shared gridline + tick label */
.da-gl {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 1px solid var(--da-grid);
}
.da-gl > span {
  position: absolute;
  top: 0;
  transform: translateY(-50%);
  font-size: 8px;
  font-weight: 400;
  line-height: 1;
  color: var(--da-muted);
  white-space: nowrap;
}

/* ---------- Equity curve ---------- */
.da-eq {
  position: relative;
  height: 117px;
  margin-top: 7px;
  overflow: hidden;
}
.da-eq-c {
  width: 100%;
  height: 117px;
}
.da-eq-ax {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.da-eq-ax .da-gl {
  left: 34px;
  right: 14px;
}
.da-eq-ax .da-gl > span {
  right: 100%;
  margin-right: 9px;
}
.da-eq-x {
  position: absolute;
  left: 18px;
  right: 2px;
  top: 101px;
  display: flex;
  pointer-events: none;
}
.da-eq-x span {
  flex: 1;
  text-align: center;
  font-size: 8px;
  line-height: 1.3;
  color: var(--da-muted);
  white-space: nowrap;
}

.da-tip {
  position: absolute;
  right: 3px;
  top: 44px;
  display: flex;
  flex-direction: column;
  padding: 6px 8px 7px;
  border-radius: 6px;
  background: rgba(20, 22, 27, 0.96);
  border: 1px solid #2B2F36;
  pointer-events: none;
}
.da-tip .d {
  font-size: 8px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--da-white);
  white-space: nowrap;
}
.da-tip .k {
  margin-top: 3px;
  font-size: 7.5px;
  line-height: 1.3;
  color: var(--da-muted);
}
.da-tip .v {
  margin-top: 2px;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--da-gold);
  white-space: nowrap;
}

/* ---------- Daily P&L bars ---------- */
.da-bars {
  position: relative;
  height: 109px;
  margin-top: 2px;
}
.da-bars-plot {
  position: absolute;
  left: 27px;
  right: 7px;
  top: 16px;
  height: 80px;
}
.da-bars-plot .da-gl > span {
  right: 100%;
  margin-right: 3px;
}
.da-cols {
  position: absolute;
  inset: 0;
  display: flex;
}
.da-col {
  position: relative;
  flex: 1;
  min-width: 0;
}
.da-bar {
  position: absolute;
  left: 27.5%;
  width: 45%;
  border-radius: 1px;
}
.da-bar.up { background: var(--da-green); }
.da-bar.down { background: var(--da-red); }
.da-bval {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 8px;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
}
.da-bval.up { color: var(--da-white); }
.da-bval.down { color: var(--da-red); }
.da-bars-x {
  position: absolute;
  left: 27px;
  right: 7px;
  top: 100px;
  display: flex;
}
.da-bars-x span {
  flex: 1;
  text-align: center;
  font-size: 8px;
  line-height: 1.3;
  color: var(--da-muted);
  white-space: nowrap;
}

/* ---------- Two-up rows ---------- */
.da-two {
  display: grid;
  grid-template-columns: 0.472fr 0.528fr;
  gap: 4px;
  margin-top: 4px;
  align-items: stretch;
}
.da-card { padding: 9px; }
.da-ct {
  margin: 0;
  font-size: 9.5px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: #fff;
  white-space: nowrap;
}

/* ---------- Trade distribution ---------- */
.da-dist {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 12px;
}
.da-donut {
  width: 71px;
  height: 71px;
  flex-shrink: 0;
}
.da-legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding-top: 1px;
}
.da-leg {
  display: grid;
  grid-template-columns: 5px minmax(0, 1fr);
  column-gap: 5px;
}
.da-leg i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  margin-top: 3px;
}
.da-leg .n,
.da-leg .a {
  grid-column: 2;
  font-size: 8px;
  line-height: 1.35;
  white-space: nowrap;
}
.da-leg .n { color: var(--da-white); }
.da-leg .a { margin-top: 2px; color: var(--da-muted); }

/* ---------- Profit by hour ---------- */
.da-hour {
  position: relative;
  height: 88px;
  margin-top: 8px;
  overflow: hidden;
}
.da-hour-plot {
  position: absolute;
  left: 5px;
  right: 25px;
  top: 7px;
  height: 67px;
}
.da-hour-plot .da-gl > span {
  left: 100%;
  margin-left: 9px;
}
.da-hbars {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  gap: 2.4px;
}
.da-hbars i {
  flex: 1;
  min-width: 0;
  background: var(--da-gold);
}
.da-hour-x {
  position: absolute;
  left: 5px;
  right: 25px;
  top: 79px;
  height: 11px;
}
.da-hour-x span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  font-size: 8px;
  line-height: 1.3;
  color: var(--da-muted);
}

/* ---------- Top winning / losing trades ---------- */
.da-top { padding: 9px 9px 8px; }
.da-ct-win,
.da-ct-loss {
  display: flex;
  align-items: center;
}
.da-ct-win::before,
.da-ct-loss::before {
  content: '';
  width: 2px;
  height: 12px;
  border-radius: 1px;
  margin-right: 7px;
  flex-shrink: 0;
}
.da-ct-win::before { background: var(--da-green); }
.da-ct-loss::before { background: var(--da-red); }

.da-trow {
  display: grid;
  grid-template-columns: 8px minmax(0, auto) minmax(0, 1fr) auto;
  align-items: baseline;
  column-gap: 5px;
  margin-top: 9px;
  font-size: 7.5px;
  line-height: 1.3;
  white-space: nowrap;
}
.da-trow .i { color: var(--da-muted); }
.da-trow .d { color: var(--da-white); }
.da-trow .p { color: var(--da-muted); }
.da-trow .a {
  font-weight: 600;
  text-align: right;
}

/* ---------- Actions ---------- */
.da-actions {
  display: grid;
  grid-template-columns: 0.469fr 0.531fr;
  gap: 7px;
  margin-top: 10px;
}
.da-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 32px;
  border-radius: 9px;
  background: var(--da-card);
  border: 1px solid var(--da-line);
  color: var(--da-white);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.da-btn svg { width: 13px; height: 13px; }
.da-btn.is-gold {
  background: var(--da-gold);
  border-color: var(--da-gold);
  color: #0B0E11;
  font-weight: 700;
}
.da-btn:active { opacity: 0.9; }

@media (max-width: 408px) {
  .da-kpi { padding: 9px 6px 8px; }
  .da-kpi .k { font-size: 7px; }
  .da-kpi .v { font-size: 11px; }
  .da-tab > span { font-size: 9.5px; }
  .da-donut { width: 64px; height: 64px; }
  .da-hour-plot, .da-hour-x { right: 23px; }
}
