:root {
  --bg: #f3f8ff;
  --panel: #ffffff;
  --ink: #12263a;
  --muted: #5a6f86;
  --line: #d4deea;
  --brand: #00629b;
  --brand-soft: #d9ecff;
  --accent: #ff8b00;
  --ok: #0e7a4a;
  --warning: #b56a00;
  --shadow: 0 12px 28px rgba(9, 37, 66, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
  background:
    radial-gradient(circle at 8% 12%, #d6eafc 0%, transparent 25%),
    radial-gradient(circle at 90% 4%, #fff1d9 0%, transparent 24%),
    linear-gradient(170deg, #f9fcff 0%, var(--bg) 100%);
}

.topbar {
  width: min(1220px, 94%);
  margin: 18px auto 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(145deg, #0070b3, #00558a);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

.brand h1 {
  margin: 0;
  font-size: 30px;
  letter-spacing: -0.2px;
}

.brand p {
  margin: 3px 0 0;
  color: var(--muted);
}

.topbar-metrics {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.metric-chip {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  min-width: 150px;
  box-shadow: var(--shadow);
}

.metric-chip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric-chip strong {
  font-size: 13px;
}

.workspace {
  width: min(1220px, 94%);
  margin: 0 auto 32px;
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 16px;
}

.sidebar {
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(4px);
  align-self: start;
}

.sidebar-header {
  margin-bottom: 10px;
}

.sidebar-title {
  margin: 0;
  font-size: 20px;
}

.sidebar-subtitle {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.product-nav {
  display: grid;
  gap: 8px;
}

.product-button {
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition: 0.16s ease;
}

.product-button:hover {
  border-color: #b9ccdf;
  transform: translateY(-1px);
}

.product-button.active {
  background: var(--brand-soft);
  border-color: #89b8e4;
  color: #043f67;
}

.product-button small {
  display: block;
  margin-top: 4px;
  color: #5b7390;
  font-size: 12px;
}

.demo-panel {
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(5px);
}

.hidden {
  display: none;
}

.demo-header {
  border-bottom: 1px solid #e5edf6;
  padding-bottom: 10px;
}

.demo-category-badge {
  display: inline-flex;
  margin: 0;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e7f2ff;
  color: #015385;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.demo-header h2 {
  margin: 6px 0 3px;
}

.demo-status {
  margin: 0;
  color: var(--ok);
  font-weight: 700;
  font-size: 14px;
}

.tabs {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}

.tab-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 9px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
}

.tab-button.active {
  border-color: #8ab8e0;
  background: var(--brand-soft);
  color: #004e80;
}

.tab-panel {
  margin-top: 14px;
}

.demo-objective {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #d9e5f3;
  border-radius: 10px;
  background: #f8fcff;
  color: #375473;
}

.two-col {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.guidance-card,
.info-box {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}

.guidance-card h3,
.info-box h3 {
  margin: 0 0 7px;
  font-size: 16px;
}

.guidance-card ul,
.info-box ul {
  margin: 0;
  padding-left: 18px;
}

.box-list {
  margin: 0;
}

.kpi-title {
  margin: 12px 0 8px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.kpi-card {
  background: #f8fbff;
  border: 1px solid #cbdff1;
  border-radius: 12px;
  padding: 10px 12px;
}

.kpi-card h4 {
  margin: 0 0 8px;
}

.kpi-card p {
  margin: 2px 0;
}

.runtime-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 10px;
}

.simulator,
.output-panel {
  border: 1px solid #e4d6ba;
  border-radius: 12px;
  background: #fffaf0;
  padding: 12px;
}

.output-panel {
  background: #f8fcff;
  border-color: #d5e5f4;
}

.simulator h3,
.output-panel h3 {
  margin: 0;
}

.simulator-note,
.output-note {
  margin: 5px 0 10px;
  color: #6f5625;
  font-size: 14px;
}

.output-note {
  color: #4d6a86;
}

.simulator label {
  display: block;
  margin: 8px 0 5px;
  font-weight: 700;
  font-size: 14px;
}

.simulator select,
.simulator input,
.simulator textarea {
  width: 100%;
  border: 1px solid #ccb88b;
  border-radius: 10px;
  padding: 9px 10px;
  font: inherit;
}

.prompt-chips {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  border: 1px solid #e3cda2;
  background: #fff;
  color: #845200;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.fraud-explain-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.fraud-explain-card {
  border: 1px solid #ead8b6;
  border-radius: 10px;
  background: #fffdf8;
  padding: 10px;
}

.fraud-explain-card h4 {
  margin: 0 0 6px;
  font-size: 14px;
  color: #67460e;
}

.fraud-explain-card ul {
  margin: 0;
  padding-left: 18px;
}

.story-cards {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.story-card {
  border: 1px solid #e3cda2;
  background: #fff;
  color: #5c3f04;
  border-radius: 12px;
  padding: 10px;
  cursor: pointer;
  text-align: left;
  transition: 0.16s ease;
}

.story-card:hover {
  transform: translateY(-1px);
  border-color: #d8b779;
}

.story-card.active {
  border-color: #d8ab58;
  background: #fff6e6;
  box-shadow: inset 0 0 0 1px #f3d49a;
}

.story-card strong {
  display: block;
  font-size: 14px;
}

.story-card span {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  color: #7b5d26;
}

.story-metrics {
  margin-top: 10px;
}

.story-metric-card {
  border: 1px solid #ead9ba;
  border-radius: 10px;
  background: #fffef9;
  padding: 10px;
}

.story-metric-card h4 {
  margin: 0 0 8px;
  font-size: 14px;
  color: #66470b;
}

.table-hint {
  margin: 0 0 8px;
  color: #7c6538;
  font-size: 12px;
}

.fraud-fields-guide {
  margin-top: 10px;
  border: 1px solid #e3d4b4;
  border-radius: 10px;
  background: #fffdf7;
  padding: 10px;
}

.fraud-fields-guide h4 {
  margin: 0 0 6px;
  color: #64470f;
  font-size: 14px;
}

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

.fraud-fields-grid p {
  margin: 0;
  font-size: 13px;
  color: #5f4b26;
}

.fraud-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.fraud-table th,
.fraud-table td {
  border: 1px solid #e6d6b6;
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}

.fraud-table thead th {
  background: #fff5df;
  color: #66490f;
}

.table-input {
  width: 100%;
  border: 1px solid #d5c29f;
  border-radius: 6px;
  padding: 5px 6px;
  font: inherit;
  font-size: 12px;
  background: #fff;
  color: #3f2d06;
}

.table-input-number {
  min-width: 74px;
}

.scenario-context {
  margin-bottom: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.scenario-tag {
  border: 1px solid #d8c8a6;
  background: #fff8eb;
  color: #6d4f17;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
}

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

.story-kpi {
  border: 1px solid #eadfcd;
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.story-kpi span {
  display: block;
  color: #7a6440;
  font-size: 12px;
}

.story-kpi strong {
  display: block;
  margin-top: 2px;
  color: #3a2a09;
  font-size: 14px;
}

.story-kpi em {
  display: block;
  margin-top: 3px;
  font-style: normal;
  color: #7a623b;
  font-size: 12px;
}

.story-explainer {
  margin-top: 10px;
  border: 1px solid #e2d6bf;
  border-radius: 10px;
  background: #fffdf7;
  padding: 10px;
}

.story-explainer h4 {
  margin: 0 0 6px;
  color: #65460d;
  font-size: 14px;
}

.story-explainer ul {
  margin: 0;
  padding-left: 18px;
}

.advanced-panel {
  margin-top: 10px;
  border: 1px solid #dfcda8;
  border-radius: 10px;
  background: #fff;
  padding: 8px 10px;
}

.advanced-panel summary {
  cursor: pointer;
  font-weight: 700;
  color: #7a4f07;
}

.advanced-body {
  margin-top: 8px;
}

.field-help {
  display: inline-flex;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
  background: #e8f2ff;
  color: #0d4f83;
  font-size: 11px;
  border: 1px solid #b9d2ea;
}

.button-row {
  margin-top: 10px;
}

.run-button {
  border: 1px solid #2f6db6;
  color: #1d4b8a;
  background: #fff;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 800;
  cursor: pointer;
}

.run-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.run-button-clear {
  border-color: #b2c6da;
  color: #3f5f7c;
}

.triage-output {
  min-height: 220px;
}

.result-card {
  background: #fff;
  border: 1px solid #d7e6f4;
  border-radius: 12px;
  padding: 12px;
}

.result-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.result-chip {
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
}

.result-chip.route-n1 {
  background: #e5f6ec;
  color: #0f6b43;
  border-color: #bde7cb;
}

.result-chip.route-n2 {
  background: #ffe9e9;
  color: #a23232;
  border-color: #f0bbbb;
}

.result-chip.prio-alta {
  background: #ffe1e1;
  color: #9f2929;
  border-color: #efb0b0;
}

.result-chip.prio-media {
  background: #fff1d9;
  color: #985f00;
  border-color: #efcc87;
}

.result-chip.prio-baixa {
  background: #e5f5ff;
  color: #0b5e90;
  border-color: #bbe0f7;
}

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

.result-block {
  background: #f9fcff;
  border: 1px solid #dbe8f5;
  border-radius: 10px;
  padding: 8px 9px;
}

.result-block h4 {
  margin: 0 0 4px;
  font-size: 13px;
  color: #305370;
}

.result-block p {
  margin: 0;
  font-size: 14px;
}

.result-block ul {
  margin: 0;
  padding-left: 18px;
}

.empty-runtime {
  margin: 0;
  background: #fff;
  border: 1px dashed #c2d5e8;
  border-radius: 10px;
  padding: 12px;
  color: #53708b;
}

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

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

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

@media (max-width: 760px) {
  .two-col,
  .fraud-explain-grid,
  .fraud-fields-grid,
  .result-grid,
  .story-metric-grid {
    grid-template-columns: 1fr;
  }
}
