:root {
  color-scheme: light;
  font-family: Arial, Helvetica, sans-serif;
  color: #061b54;
  background: #f4f8fd;
  --navy: #001232;
  --blue: #0061dd;
  --line: #d0ddeb;
}

* { box-sizing: border-box; }
html, body { min-width: 320px; min-height: 100%; margin: 0; }
body { background: #f4f8fd; overflow: hidden; }
button, input, select { font: inherit; }

.tp-page {
  display: grid;
  grid-template-rows: 98px 64px minmax(0, 1fr);
  min-height: 100vh;
  height: 100vh;
}

.brand-header {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  align-items: center;
  gap: 24px;
  padding: 10px 44px 10px 20px;
  background: linear-gradient(115deg, #001f4f, var(--navy));
  border-bottom: 1px solid rgba(85, 174, 255, .5);
}

.brand-left, .brand-logos { display: flex; align-items: center; }
.brand-left { min-width: 0; gap: 22px; }
.brand-logos { justify-content: flex-end; gap: 30px; }
.app-mark { width: 64px; height: 74px; flex: 0 0 auto; }
.app-title {
  margin: 0;
  color: #fff;
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1;
}
.logo-dispec { width: 76px; height: 70px; object-fit: contain; }
.logo-onera { width: 250px; height: 70px; object-fit: contain; }
.logo-eu { width: 98px; height: 64px; object-fit: cover; }

.tabs-bar {
  display: flex;
  background: linear-gradient(180deg, #0c3268, #071d47);
  color: rgba(255, 255, 255, .78);
  border-bottom: 1px solid #d9e4f1;
  overflow-x: auto;
}
.nav-tab {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  height: 64px;
  padding: 0 24px;
  border: 0;
  border-right: 1px solid rgba(106, 166, 230, .38);
  color: inherit;
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  white-space: nowrap;
}
.nav-tab.active {
  color: #fff;
  background: rgba(15, 65, 132, .78);
  box-shadow: inset 0 -4px 0 #136dff;
  font-weight: 700;
}
.nav-icon { width: 28px; font-size: 24px; text-align: center; }

.page-body { min-height: 0; overflow: hidden; }
.exercise { display: none; height: 100%; }
.exercise.active {
  display: grid;
  grid-template-columns: minmax(340px, 420px) minmax(0, 1fr);
  gap: 22px;
  min-height: 0;
  padding: 18px 22px;
}
.sidebar { min-height: 0; overflow: auto; padding-right: 2px; }
.settings-card, .results-panel {
  background: rgba(255, 255, 255, .95);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 16px 34px rgba(16, 54, 112, .08);
}
.settings-card { margin-bottom: 14px; overflow: hidden; }
.section-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px 10px;
}
.section-icon { color: #0061ff; font-size: 28px; }
.section-title { color: var(--blue); font-weight: 600; font-size: 19px; }
.settings-body { padding: 0 18px 16px; }
.field-row {
  display: grid;
  grid-template-columns: minmax(112px, 1fr) minmax(0, 238px);
  gap: 14px;
  align-items: center;
  margin-bottom: 10px;
}
.field-row label, .layer-name { font-size: 15px; font-weight: 600; }
.field-row input, .field-row select, .layer-row input {
  width: 100%;
  min-height: 38px;
  padding: 7px 10px;
  color: #061b54;
  font-weight: 600;
  border: 1px solid #9eb1c8;
  border-radius: 6px;
  background: #fff;
}
.layers-table { margin-top: 12px; }
.layer-header, .layer-row {
  display: grid;
  grid-template-columns: 44px repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-items: center;
}
.layer-header {
  margin: 8px 0;
  color: #526784;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}
.layer-row { margin-bottom: 8px; }
.model-note {
  padding: 10px 12px;
  margin: 10px 0;
  color: #415a83;
  background: #f2f7ff;
  border: 1px solid #d8e6fa;
  border-radius: 6px;
  font-size: 13px;
}
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
#exercise2 .exercise1-rays { display: none; }
.action {
  min-height: 40px;
  padding: 8px 16px;
  color: #fff;
  background: #0869e8;
  border: 0;
  border-radius: 5px;
  font-weight: 700;
  cursor: pointer;
}
.action.secondary { color: #0758ba; background: #e7f1ff; }
.action:disabled { cursor: wait; opacity: .55; }

.results-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.plot-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: #fff;
}
.result-image { display: none; width: 100%; height: 100%; object-fit: contain; }
.result-image.visible { display: block; }
.empty-chart { color: #526784; font-weight: 600; text-align: center; }
.empty-chart strong { display: block; margin-bottom: 8px; color: #0061ff; font-size: 48px; }
.status-strip {
  min-height: 68px;
  padding: 12px 16px;
  color: #526784;
  border-top: 1px solid #e2eaf3;
  font-size: 13px;
}
.status-message { color: #0a3f91; font-weight: 800; }
.status-strip.error .status-message { color: #a21d2d; }
.status-strip.busy .status-message { color: #9a5900; }
.summary { display: block; margin-top: 5px; white-space: pre-wrap; }
.spinner {
  display: none;
  width: 16px;
  height: 16px;
  margin-right: 7px;
  vertical-align: -3px;
  border: 2px solid #cfe1fa;
  border-top-color: #0869e8;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.running .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1240px) {
  body { overflow: auto; }
  .tp-page { height: auto; grid-template-rows: auto auto auto; }
  .brand-header { grid-template-columns: 1fr; padding-right: 22px; }
  .brand-logos { justify-content: flex-start; flex-wrap: wrap; }
  .page-body { overflow: visible; }
  .exercise.active { grid-template-columns: 1fr; }
  .results-panel { min-height: 720px; }
}
@media (max-width: 720px) {
  .brand-left { align-items: flex-start; flex-direction: column; }
  .brand-logos { gap: 16px; }
  .logo-onera { width: min(82vw, 250px); }
  .nav-tab { padding: 0 16px; font-size: 15px; }
  .exercise.active { padding: 12px; }
  .field-row, .layer-header, .layer-row { grid-template-columns: 1fr; text-align: left; }
}
