* {
  box-sizing: border-box;
}

/* Базовые цвета:
   - тёмная левая панель и общий фон: #3A3A3A
   - светлые элементы и правая часть: #D9D9D9 */
body {
  margin: 0;
  padding: 0;
  font-family: "PT Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #3a3a3a;
  color: #d9d9d9;
  height: 100vh;
  overflow: hidden;
}

/* Основной лейаут (десктоп — две колонки) */
.main-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* Левая панель ~38% — тёмная */
.controls-panel {
  position: relative; /* added for absolute badge placement */
  flex: 1;
  max-width: 40vw;
  background: #3a3a3a;
  padding: 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  border-right: 1px solid #d9d9d9;
}

/* Заголовок IFC-IDS-REPORT */
.controls-panel h1 {
  margin: 0;
  text-align: center;
  font-size: 28px;
  letter-spacing: 2px;
  font-weight: 700;
  color: #d9d9d9;
}

/* Блоки панели */
.panel-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Последний блок (Результат) растягиваем на всю оставшуюся высоту */
.controls-panel .panel-section:nth-last-of-type(2) {
  /* предпоследний, т.к. последний теперь contacts */
  flex: 1;
  min-height: 0;
}

.panel-section h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: #d9d9d9;
}

/* Ряды по умолчанию */
.row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Формат + кнопка в одну строку (десктоп/планшет) */
.row.row-inline {
  flex-direction: row;
  align-items: stretch;
  gap: 8px;
}

.row.row-inline select {
  flex: 2;
}

.row.row-inline button {
  flex: 1;
}

label {
  font-size: 13px;
  color: #d9d9d9;
}

/* Кнопки — светлые */
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 0;
  border: 1px solid #d9d9d9;
  background: #d9d9d9;
  color: #3a3a3a;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  width: 100%;
  transition: background 0.15s ease, color 0.15s ease;
}

button:hover:not(:disabled) {
  background: #3a3a3a;
  color: #d9d9d9;
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Селект формата — светлый, с явной стрелкой */
select {
  width: 100%;
  padding: 10px 36px 10px 10px;
  border-radius: 0;
  border: 1px solid #d9d9d9;
  background:
    #d9d9d9
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%233A3A3A' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E")
    no-repeat right 10px center;
  color: #3a3a3a;
  font-size: 13px;
  appearance: none;
}

/* Файловые инпуты */
input[type="file"] {
  width: 100%;
  padding: 9px 10px;
  border-radius: 0;
  border: 1px solid #d9d9d9;
  background: #3a3a3a;
  color: #d9d9d9;
  font-size: 13px;
}

/* Лог — без рамки, на всю высоту секции */
pre#output {
  margin: 0;
  margin-top: 4px;
  padding: 8px;
  background: #3a3a3a;
  border: none;
  color: #d9d9d9;
  font-size: 11px;
  line-height: 1.4;
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow: auto;
}

/* Контакты внизу левого блока */
.contacts {
  display: flex;
  justify-content: space-between; /* place logo left, badge right */
  align-items: center;
  font-size: 11px;
  color: #d9d9d9;
  padding-top: 8px;
  margin-top: auto;     /* push contacts to the bottom of controls-panel */
  width: 100%;
  align-self: stretch;
}

/* ensure the left link and badge do not shrink */
.contacts > a,
.contacts > .made-in {
  flex: 0 0 auto;
}

/* made-in sizing (unchanged except keep non-shrinking) */
.made-in {
  position: static;
  /* width: 32px;
  height: 32px; */
  /* pointer-events: none; */
}
.made-in svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Правая область — светлая */
.report-area {
  flex: 1.618;
  background: #d9d9d9;
  padding: 24px;
}

/* Iframe отчёта без рамки */
#report-frame {
  width: 100%;
  height: 100%;
  border: none;
  background: #d9d9d9;
}

/* ===== Адаптивные лэйауты ===== */

/* Планшеты */
@media (max-width: 1024px) {
  .controls-panel {
    max-width: 45vw;
    padding: 24px 16px;
  }

  .report-area {
    padding: 16px;
  }
}

/* Мобильные устройства */
@media (max-width: 768px) {
  body {
    height: auto;
    overflow: auto;
  }

  .main-layout {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
  }

  .controls-panel {
    flex: none;
    max-width: 100%;
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #d9d9d9;
    padding: 20px 16px;
    gap: 16px;
  }

  .controls-panel h1 {
    font-size: 22px;
    letter-spacing: 1px;
  }

  .panel-section {
    gap: 8px;
  }

  .row {
    gap: 4px;
  }

  .row.row-inline {
    flex-direction: column;
  }

  .report-area {
    flex: none;
    width: 100%;
    padding: 12px 0 0 0;
    background: #3a3a3a;
  }

  #report-frame {
    width: 100%;
    height: calc(100vh - 260px);
    max-height: 600px;
    border: none;
    background: #d9d9d9;
  }
}

/* Очень маленькие экраны */
@media (max-width: 480px) {
  .controls-panel {
    padding: 16px 12px;
  }

  button {
    font-size: 12px;
    padding: 9px 12px;
  }

  select,
  input[type="file"] {
    font-size: 12px;
    padding: 8px 32px 8px 8px;
  }

  #report-frame {
    height: calc(100vh - 240px);
  }
}

.contacts a {
  color: #d9d9d9;
}
