:root {
  --bg: #0b1117;
  --surface: #131c24;
  --surface-alt: #19242f;
  --border: #263544;
  --text: #e6edf3;
  --muted: #93a4b5;
  --green: #2ea043;
  --green-soft: rgba(46, 160, 67, 0.16);
  --amber: #d29922;
  --red: #f85149;
  --red-soft: rgba(248, 81, 73, 0.16);
  --blue: #58a6ff;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.hero {
  background: linear-gradient(135deg, #0f1c26 0%, #11261e 100%);
  border-bottom: 1px solid var(--border);
  padding: 2.2rem 0;
}

.badge {
  display: inline-block;
  background: var(--green-soft);
  color: #56d364;
  border: 1px solid rgba(86, 211, 100, 0.35);
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.hero h1 {
  font-size: 1.85rem;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--muted);
  max-width: 820px;
  font-size: 0.98rem;
}

.grid-layout {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 1.5rem;
  margin-top: 1.75rem;
  margin-bottom: 2.5rem;
}

@media (max-width: 900px) {
  .grid-layout {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.4rem;
}

.results-column {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}

h2 {
  font-size: 1.12rem;
  color: #f0f6fc;
}

.status-pill {
  font-size: 0.78rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-weight: 600;
}

.status-pill.loading {
  background: rgba(210, 153, 34, 0.18);
  color: var(--amber);
}

.status-pill.ready {
  background: var(--green-soft);
  color: #56d364;
}

.status-pill.error {
  background: var(--red-soft);
  color: var(--red);
}

.help-text {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.btn-preset {
  background: var(--surface-alt);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.5rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-preset:hover {
  border-color: var(--blue);
}

.btn-preset.active {
  background: var(--green-soft);
  border-color: var(--green);
  color: #7ee787;
  font-weight: 600;
}

.sliders-grid {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.divider-top {
  border-top: 1px solid var(--border);
  padding-top: 0.85rem;
  margin-top: 0.25rem;
}

.label-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
}

.val-tag {
  color: var(--blue);
}

.micro-note {
  color: var(--muted);
  font-size: 0.78rem;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--green);
  cursor: pointer;
}

.kpi-grid {
  display: grid;
  gap: 0.9rem;
  margin-top: 0.85rem;
}

.two-cols {
  grid-template-columns: repeat(2, 1fr);
}

.three-cols {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 560px) {
  .two-cols, .three-cols, .presets {
    grid-template-columns: 1fr;
  }
}

.kpi-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.kpi-box.highlight-green {
  border-color: rgba(46, 160, 67, 0.5);
  background: linear-gradient(180deg, rgba(46, 160, 67, 0.12), var(--surface-alt));
}

.kpi-box.alert-high {
  border-color: rgba(248, 81, 73, 0.6);
  background: linear-gradient(180deg, rgba(248, 81, 73, 0.14), var(--surface-alt));
}

.kpi-box.alert-normal {
  border-color: rgba(88, 166, 255, 0.5);
}

.kpi-label {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: #ffffff;
}

.kpi-value.small {
  font-size: 1.35rem;
}

.kpi-sub {
  font-size: 0.82rem;
  color: var(--muted);
}

.cfe-breakdown {
  margin-top: 1rem;
}

.bar-container {
  display: flex;
  height: 24px;
  border-radius: 6px;
  overflow: hidden;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.bar-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0b1117;
  transition: width 0.3s ease;
  white-space: nowrap;
  overflow: hidden;
}

.seg-basico { background: #56d364; }
.seg-intermedio { background: #e3b341; }
.seg-excedente { background: #f85149; color: #fff; }

.advice-box {
  background: var(--surface-alt);
  border-left: 3px solid var(--blue);
  padding: 0.7rem 0.9rem;
  border-radius: 0 8px 8px 0;
  font-size: 0.88rem;
  color: var(--text);
}

.green-audit-card {
  border-color: rgba(46, 160, 67, 0.45);
}

.badge-outline {
  font-size: 0.75rem;
  color: #7ee787;
  border: 1px solid rgba(126, 231, 135, 0.4);
  padding: 0.15rem 0.55rem;
  border-radius: 6px;
}

.telemetry-table {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  font-size: 0.9rem;
}

.t-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
}

.t-row strong {
  color: var(--text);
  text-align: right;
}

.divider-row {
  border-top: 1px solid var(--border);
  padding-top: 0.55rem;
  margin-top: 0.2rem;
}

.text-green {
  color: #56d364 !important;
}

.footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.footer a {
  color: var(--blue);
  text-decoration: none;
}