@font-face {
  font-family: "Unageo";
  src: url("../fonts/Unageo-Regular.ttf") format("truetype");
  font-weight: 400;
}

@font-face {
  font-family: "Unageo";
  src: url("../fonts/Unageo-Bold.ttf") format("truetype");
  font-weight: 700;
}

@font-face {
  font-family: "Rubik";
  src: url("../fonts/Rubik-Regular.ttf") format("truetype");
  font-weight: 400;
}

@font-face {
  font-family: "Rubik";
  src: url("../fonts/Rubik-Medium.ttf") format("truetype");
  font-weight: 500;
}

:root {
  --text: #2d2d2d;
  --muted: #66727e;
  --main: #44bcd6;
  --main-strong: #249db7;
  --accent: #932580;
  --blue: #4494d8;
  --green: #24a66a;
  --amber: #d89a1d;
  --red: #c94f4f;
  --line: #d9e7ed;
  --surface: #ffffff;
  --surface-soft: #f4fbfd;
  --page: #eef7fa;
  --shadow: 0 18px 44px rgba(45, 45, 45, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  color: var(--text);
  background: var(--page);
}

body {
  margin: 0;
  font-family: "Rubik", Arial, sans-serif;
  color: var(--text);
  background:
    linear-gradient(rgba(238, 247, 250, 0.92), rgba(238, 247, 250, 0.92)),
    url("../img/pattern.png") top right / 420px auto no-repeat;
}

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

button,
select {
  cursor: pointer;
}

.app-shell {
  width: min(1520px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 96px;
  padding: 18px 20px;
  border: 1px solid rgba(68, 188, 214, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 280px;
  gap: 18px;
}

.brand > div {
  min-width: 0;
}

.brand-logo {
  width: 176px;
  height: auto;
  flex: 0 0 auto;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--main-strong);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Unageo", "Rubik", Arial, sans-serif;
  letter-spacing: 0;
}

h1 {
  font-size: 1.85rem;
  line-height: 1.08;
  overflow-wrap: anywhere;
}

h2 {
  font-size: 1.8rem;
  line-height: 1.12;
}

h3 {
  font-size: 1.05rem;
  line-height: 1.2;
}

.top-controls {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.builder-entry,
.command-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--text);
  background: #fff;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.builder-entry {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}

.command-button {
  color: var(--main-strong);
}

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

.file-command {
  position: relative;
  overflow: hidden;
}

.file-command input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.select-field {
  display: grid;
  gap: 6px;
  min-width: 210px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
}

.select-field select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 36px 0 12px;
  color: var(--text);
  background: #fff;
}

.period-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(86px, 1fr));
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.period-control button {
  min-width: 0;
  border: 0;
  border-right: 1px solid var(--line);
  padding: 0 14px;
  color: var(--muted);
  background: transparent;
  font-weight: 500;
  white-space: nowrap;
}

.period-control button:last-child {
  border-right: 0;
}

.period-control button.is-active {
  color: #fff;
  background: var(--accent);
}

.workspace {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}

.scenario-panel {
  display: grid;
  gap: 14px;
  position: sticky;
  top: 18px;
}

.scenario-list {
  display: grid;
  gap: 10px;
}

.scenario-button {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  min-height: 86px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 28px rgba(45, 45, 45, 0.05);
  text-align: left;
}

.scenario-button img {
  width: 34px;
  height: 34px;
  padding: 7px;
  border-radius: 8px;
  background: rgba(68, 188, 214, 0.13);
}

.scenario-button strong,
.scenario-button span {
  display: block;
}

.scenario-button strong {
  margin-bottom: 4px;
  font-size: 0.95rem;
}

.scenario-button span {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.3;
}

.scenario-button.is-active {
  border-color: rgba(147, 37, 128, 0.45);
  box-shadow: inset 4px 0 0 var(--accent), 0 14px 34px rgba(147, 37, 128, 0.1);
}

.presentation-rail {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid rgba(68, 148, 216, 0.28);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(45, 45, 45, 0.05);
}

.presentation-rail span {
  display: block;
  color: var(--main-strong);
  font-size: 0.78rem;
  font-weight: 500;
}

.presentation-rail strong {
  display: block;
  margin-top: 4px;
  font-family: "Unageo", "Rubik", Arial, sans-serif;
  font-size: 1.1rem;
}

.presentation-rail p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.dashboard-stage {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.hero-band {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  min-height: 130px;
  padding: 22px;
  border-radius: 8px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(45, 45, 45, 0.72), rgba(36, 157, 183, 0.88)),
    url("../img/pattern.png") center / 520px auto;
  box-shadow: var(--shadow);
}

.hero-band .eyebrow {
  color: rgba(255, 255, 255, 0.8);
}

.hero-band p {
  margin: 8px 0 0;
  max-width: 700px;
  color: rgba(255, 255, 255, 0.84);
  line-height: 1.45;
}

.status-stack {
  display: grid;
  justify-items: end;
  gap: 8px;
  min-width: 170px;
}

.status-stack span,
.panel-heading > span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  padding: 0 12px;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric-card {
  display: grid;
  min-height: 136px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 30px rgba(45, 45, 45, 0.05);
}

.metric-card span {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.28;
}

.metric-card strong {
  display: block;
  margin: 10px 0 6px;
  font-family: "Unageo", "Rubik", Arial, sans-serif;
  font-size: 1.75rem;
  line-height: 1.05;
}

.metric-card small {
  color: var(--main-strong);
  font-size: 0.78rem;
  line-height: 1.35;
}

.metric-card[data-level="good"] small {
  color: var(--green);
}

.metric-card[data-level="warn"] small {
  color: var(--amber);
}

.metric-card[data-level="risk"] small {
  color: var(--red);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.panel {
  display: grid;
  gap: 16px;
  min-width: 0;
  min-height: 360px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(45, 45, 45, 0.055);
}

.panel-wide {
  grid-column: span 1;
}

.panel-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  min-height: 48px;
}

.panel-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.38;
}

.panel-heading > span {
  border-color: rgba(68, 188, 214, 0.28);
  color: var(--main-strong);
  background: rgba(68, 188, 214, 0.11);
}

.chart-box {
  position: relative;
  width: 100%;
  height: 276px;
  min-height: 276px;
}

.chart-box-large {
  height: 316px;
  min-height: 316px;
}

.chart-box canvas {
  width: 100% !important;
  height: 100% !important;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 0.84rem;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  background: var(--surface-soft);
  font-weight: 500;
}

td {
  color: var(--text);
}

tr:last-child td {
  border-bottom: 0;
}

.table-number {
  font-weight: 500;
}

.delta {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 0.76rem;
  font-weight: 500;
}

.delta.good {
  color: #116b43;
  background: rgba(36, 166, 106, 0.13);
}

.delta.warn {
  color: #8a5e10;
  background: rgba(216, 154, 29, 0.15);
}

.delta.risk {
  color: #963737;
  background: rgba(201, 79, 79, 0.14);
}

.action-list {
  display: grid;
  gap: 10px;
}

.action-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 70px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.action-item strong {
  display: block;
  margin-bottom: 5px;
  font-size: 0.88rem;
  line-height: 1.25;
}

.action-item span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.3;
}

.action-item b {
  color: var(--accent);
  font-family: "Unageo", "Rubik", Arial, sans-serif;
  font-size: 1.05rem;
  white-space: nowrap;
}

.builder-workspace {
  display: grid;
  grid-template-columns: minmax(360px, 420px) minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}

.builder-sidebar {
  display: grid;
  gap: 14px;
  max-height: calc(100vh - 138px);
  overflow: auto;
  padding-right: 2px;
}

.builder-section {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 28px rgba(45, 45, 45, 0.05);
}

.builder-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.builder-section-heading h2 {
  font-size: 1.08rem;
}

.builder-section-heading span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  color: var(--main-strong);
  background: rgba(68, 188, 214, 0.12);
  font-size: 0.76rem;
  font-weight: 500;
  white-space: nowrap;
}

.builder-field {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
}

.builder-field input,
.builder-field textarea,
.builder-field select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  color: var(--text);
  background: #fff;
}

.builder-field input,
.builder-field select {
  min-height: 40px;
}

.builder-field textarea {
  resize: vertical;
  line-height: 1.35;
}

.builder-two {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.builder-repeat {
  display: grid;
  gap: 10px;
}

.builder-repeat-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr);
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.builder-repeat-item .wide-field {
  grid-column: 1 / -1;
}

.builder-repeat-actions {
  display: flex;
  align-items: end;
  gap: 8px;
}

.icon-command {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(68, 188, 214, 0.35);
  border-radius: 8px;
  color: var(--main-strong);
  background: rgba(68, 188, 214, 0.12);
  font-weight: 700;
}

.icon-command.danger {
  color: var(--red);
  border-color: rgba(201, 79, 79, 0.26);
  background: rgba(201, 79, 79, 0.1);
}

.builder-preview {
  min-width: 0;
}

@media (min-width: 1180px) {
  .dashboard-grid .panel-wide:first-child {
    grid-column: 1 / span 1;
  }
}

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

  .builder-workspace {
    grid-template-columns: 1fr;
  }

  .builder-sidebar {
    max-height: none;
    overflow: visible;
  }

  .scenario-panel {
    position: static;
  }

  .scenario-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 820px) {
  .app-shell {
    padding: 14px;
  }

  .topbar,
  .hero-band {
    align-items: stretch;
    flex-direction: column;
  }

  .brand {
    display: grid;
    grid-template-columns: 1fr;
    min-width: 0;
    width: 100%;
  }

  .brand-logo {
    width: 142px;
  }

  h1 {
    font-size: 1.45rem;
  }

  h2 {
    font-size: 1.45rem;
  }

  .top-controls,
  .select-field,
  .period-control {
    width: 100%;
  }

  .builder-entry,
  .command-button {
    flex: 1 1 140px;
  }

  .period-control {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .period-control button {
    padding: 0 8px;
    font-size: 0.84rem;
  }

  .scenario-list,
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .status-stack {
    justify-items: start;
  }

  .panel {
    min-height: 330px;
    padding: 15px;
  }

  .panel-heading {
    display: grid;
  }

  .chart-box,
  .chart-box-large {
    height: 250px;
    min-height: 250px;
  }

  .metric-card {
    min-height: 118px;
  }
}

@media (max-width: 460px) {
  .builder-two,
  .builder-repeat-item {
    grid-template-columns: 1fr;
  }

  .scenario-button {
    min-height: 78px;
  }

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