:root {
  --bg: #07111f;
  --bg-soft: #0d1930;
  --card: rgba(19, 36, 68, 0.88);
  --card-strong: #142646;
  --border: rgba(116, 151, 214, 0.22);
  --text: #f4f7ff;
  --muted: #9eacc7;
  --accent: #56a8ff;
  --green: #2ee878;
  --red: #ff4f64;
  --yellow: #ffc857;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(35, 113, 210, 0.14), transparent 25%),
    radial-gradient(circle at top left, rgba(46, 232, 120, 0.08), transparent 20%),
    var(--bg);
}

.app-shell {
  width: min(1500px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 50px;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  padding: 22px 4px 26px;
  border-bottom: 1px solid var(--border);
}

.hero h1 {
  margin: 6px 0 4px;
  font-size: clamp(2.1rem, 6vw, 4.5rem);
  line-height: .95;
  letter-spacing: -0.05em;
}

.hero p, .muted { color: var(--muted); }

.hero-status {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  color: var(--muted);
  font-size: .9rem;
}

.eyebrow {
  color: var(--accent);
  font-weight: 800;
  letter-spacing: .08em;
  font-size: .76rem;
}

.card {
  background: linear-gradient(145deg, rgba(25, 44, 81, .94), rgba(11, 24, 47, .94));
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 24px;
  backdrop-filter: blur(18px);
}

.filters {
  margin: 22px 0;
  display: flex;
  gap: 14px;
  align-items: end;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 150px;
}

label {
  color: var(--muted);
  font-size: .82rem;
  font-weight: 700;
}

select, button {
  height: 46px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #09152a;
  color: var(--text);
  padding: 0 14px;
  font: inherit;
}

button {
  background: linear-gradient(135deg, #2476d9, #3b9cff);
  border: 0;
  font-weight: 800;
  cursor: pointer;
  padding-inline: 22px;
}

button:hover { filter: brightness(1.08); }

.hidden { display: none !important; }

.status-grid, .grid {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.status-grid { grid-template-columns: repeat(4, 1fr); }
.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.four-columns { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.status-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border-radius: 18px;
}

.status-icon { font-size: 1.65rem; }
.status-card span, .metric span, .metric-card span, .comparison-value span {
  display: block;
  color: var(--muted);
  font-size: .84rem;
}

.status-card strong { font-size: 1.05rem; }

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

h2 {
  margin: 5px 0 0;
  font-size: clamp(1.25rem, 3vw, 2rem);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 900;
  letter-spacing: .04em;
  border: 1px solid transparent;
}

.badge.ok {
  color: var(--green);
  background: rgba(46, 232, 120, .11);
  border-color: rgba(46, 232, 120, .25);
}

.badge.danger {
  color: var(--red);
  background: rgba(255, 79, 100, .11);
  border-color: rgba(255, 79, 100, .25);
}

.badge.warning {
  color: var(--yellow);
  background: rgba(255, 200, 87, .11);
  border-color: rgba(255, 200, 87, .25);
}

.badge.neutral {
  color: var(--muted);
  background: rgba(158, 172, 199, .08);
  border-color: var(--border);
}

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

.metric-grid.three { grid-template-columns: repeat(3, 1fr); }
.metric-grid.four { grid-template-columns: repeat(4, 1fr); }

.metric {
  padding: 16px;
  border-radius: 16px;
  background: rgba(3, 11, 27, .52);
  border: 1px solid rgba(116, 151, 214, .10);
}

.metric strong {
  display: block;
  margin-top: 5px;
  font-size: clamp(1.15rem, 3vw, 2rem);
}

.metric-card strong {
  display: block;
  margin-top: 9px;
  font-size: clamp(1.3rem, 3vw, 2.15rem);
}

.positive { color: var(--green) !important; }
.negative { color: var(--red) !important; }
.warning-text { color: var(--yellow) !important; }

.chart-card { min-height: 390px; }
.chart-wrap {
  position: relative;
  height: 290px;
  width: 100%;
}

.donut-wrap { max-width: 420px; margin: 0 auto; }
.donut-center {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}

.donut-center strong { font-size: 2rem; }
.donut-center span { color: var(--muted); font-size: .8rem; }

.comparison-value {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 0;
  border-bottom: 1px solid rgba(116, 151, 214, .12);
}

.comparison-value strong { font-size: 1.15rem; }
.comparison-value.emphasis strong { font-size: 1.55rem; }

.detail-list > div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(116, 151, 214, .12);
}

.detail-list span { color: var(--muted); }

.empty-state {
  color: var(--muted);
  padding: 34px 0;
  text-align: center;
}

.operation-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.operation-grid .metric { min-width: 0; }

.risk-labels {
  display: flex;
  justify-content: space-between;
  margin: 24px 0 9px;
  font-weight: 800;
}

.risk-track {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 18px;
  border-radius: 999px;
  overflow: hidden;
  background: #09152a;
}

.risk-track .gain { background: linear-gradient(90deg, #167d48, var(--green)); }
.risk-track .loss { background: linear-gradient(90deg, var(--red), #8c2133); }
.risk-marker {
  position: absolute;
  top: 50%;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid #07111f;
  box-shadow: 0 0 0 2px rgba(255,255,255,.35);
  transform: translate(-50%, -50%);
  left: 50%;
  transition: left .4s ease;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #111f39;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 14px;
  padding: 14px 18px;
  z-index: 99;
}

@media (max-width: 1000px) {
  .status-grid, .four-columns { grid-template-columns: repeat(2, 1fr); }
  .two-columns { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .app-shell { width: min(100% - 20px, 1500px); padding-top: 12px; }
  .hero { align-items: flex-start; flex-direction: column; }
  .hero-status { align-items: flex-start; }
  .filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-group { min-width: 0; }
  .filters button { grid-column: 1 / -1; }
  .status-grid, .four-columns { grid-template-columns: 1fr 1fr; gap: 10px; }
  .card { padding: 18px; border-radius: 20px; }
  .metric-grid.three { grid-template-columns: repeat(3, 1fr); }
  .metric-grid.four { grid-template-columns: repeat(2, 1fr); }
  .metric { padding: 12px; }
  .operation-grid { grid-template-columns: repeat(2, 1fr); }
  .chart-card { min-height: 340px; }
  .chart-wrap { height: 250px; }
}


/* Ajustes do card Operação Atual */
.operation-grid .metric {
  min-width: 0;
  overflow: hidden;
}

.operation-grid .metric strong {
  display: block;
  width: 100%;
  font-size: clamp(.82rem, 1.35vw, 1.18rem);
  line-height: 1.25;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.operation-grid .metric strong.compact-value {
  font-size: clamp(.74rem, 1.15vw, 1rem);
  letter-spacing: -0.02em;
}

@media (max-width: 640px) {
  .operation-grid .metric strong {
    font-size: clamp(.78rem, 3.5vw, 1rem);
  }

  .operation-grid .metric strong.compact-value {
    font-size: clamp(.70rem, 3.1vw, .92rem);
  }
}
