/* CBOE веб — десктопный стиль, близкий к оригиналу (светлый, зелёный акцент) */
* { box-sizing: border-box; }
body {
  margin: 0; font-family: "Segoe UI", Arial, sans-serif; font-size: 13px;
  color: #1a1a1a; background: #f0f0f0;
}
header.topbar {
  display: flex; align-items: center; gap: 16px;
  background: #fff; border-bottom: 1px solid #d0d0d0; padding: 4px 14px;
}
header.topbar .title { font-weight: 600; }
header.topbar .meta { margin-left: auto; color: #666; font-size: 12px; }
nav.tabs { display: flex; gap: 2px; background: #e6e6e6; padding: 0 10px; }
nav.tabs a {
  padding: 5px 14px; text-decoration: none; color: #333;
  background: #dcdcdc; border: 1px solid #c4c4c4; border-bottom: none;
  border-radius: 4px 4px 0 0;
}
nav.tabs a.active { background: #fff; font-weight: 600; }

.brand {
  background: #111; padding: 8px 20px; line-height: 0;
}
.brand img { height: 64px; display: block; }

main { padding: 8px 12px; }

/* Калькулятор: 10 блоков, 4 колонки, всё в один экран (~900px высота) */
.calc {
  display: grid; gap: 6px;
  grid-template-columns: 265px 255px 290px 330px;
  grid-template-areas:
    "b1 b2  b3  b4"
    "b5 b6  b9  b4"
    "b5 b7  b9  b10"
    "b5 b8  b9  b10"
    "b5 b8  b9  b10";
  align-items: start;
}
.calc .b1  { grid-area: b1; }
.calc .b2  { grid-area: b2; }
.calc .b3  { grid-area: b3; }
.calc .b4  { grid-area: b4; }
.calc .b5  { grid-area: b5; }
.calc .b6  { grid-area: b6; }
.calc .b7  { grid-area: b7; }
.calc .b8  { grid-area: b8; }
.calc .b9  { grid-area: b9; }
.calc .b10 { grid-area: b10; }

/* компактность — всё в один экран */
.calc fieldset { padding: 4px 8px; min-width: 0; overflow: hidden; }
.calc legend { font-size: 11px; padding: 0 3px; }
.calc table.cut th, .calc table.cut td { padding: 1px 4px; }
.calc #summary p { margin: 2px 0; }

/* выравнивание полей */
.calc * { box-sizing: border-box; }
.calc .row { display: flex; align-items: center; margin: 3px 0; gap: 5px; }
.calc .row > label { color: #444; flex: 0 0 95px; font-size: 12px; }
.calc .row > input,
.calc .row > select { flex: 0 0 auto; width: 114px; min-width: 0; margin-left: auto; font-size: 12px; }
.calc .row > label:has(input) { flex: 0 0 auto; display: inline-flex; align-items: center; font-size: 12px; }
.calc .row > label > input { flex: 0 0 auto; width: auto; min-width: 0; margin: 0 4px 0 0; }

/* блок 9 (сводка) */
.calc table.cut.summary { font-size: 11px; }
.calc table.cut.summary td { text-align: left; }
.calc table.cut.summary td.pk { color: #555; white-space: nowrap; }
.calc .b9 #summary { max-height: 400px; overflow: auto; }

/* блок 10 (бланки) */
.calc table.blanks { border-collapse: collapse; margin-top: 3px; }
.calc table.blanks td { padding: 2px 5px 2px 0; vertical-align: middle; }
.calc table.blanks td:first-child { color: #444; white-space: nowrap; font-size: 12px; }
.calc table.blanks button { padding: 2px 8px; min-width: 58px; font-size: 12px; }
.calc .b10 button.primary { padding: 5px 10px; font-size: 12px; }
fieldset {
  border: 1px solid #b8b8b8; border-radius: 4px; background: #fafafa;
  padding: 8px 10px; margin: 0;
}
fieldset legend { font-weight: 600; padding: 0 4px; color: #2a2a2a; }
.row { display: flex; align-items: center; gap: 6px; margin: 4px 0; }
.row label { min-width: 120px; color: #444; }
input[type=text], input[type=number], select {
  padding: 3px 5px; border: 1px solid #aab; border-radius: 3px;
  font-size: 13px; background: #fff;
}
input[type=number], input[type=text] { width: 90px; }
select { min-width: 110px; }
button {
  padding: 5px 12px; border: 1px solid #888; border-radius: 3px;
  background: #e8e8e8; cursor: pointer; font-size: 13px;
}
button:hover { background: #dcdcdc; }
button.primary { background: #111111; color: #fff; border-color: #333333; }
button.primary:hover { background: #2a2a2a; }

/* Пошаговая блокировка (как GroupBox.Enabled = False в оригинале) */
fieldset.locked {
  opacity: 0.45;
  pointer-events: none;
  filter: grayscale(0.3);
  position: relative;
}
fieldset.locked::after {
  content: '';
  position: absolute; inset: 0;
  cursor: not-allowed;
  border-radius: 4px;
}
/* Кнопка ДАЛЕЕ в блоках — компактная */
.calc .step-btn { margin-top: 6px; }
.calc .step-btn button { padding: 4px 12px; font-size: 12px; }

/* Генератор УП */
.up-layout { display: grid; grid-template-columns: 640px 1fr; gap: 14px; }
.nc-output { display: flex; flex-direction: column; gap: 8px; }
.nc-tabs { display: flex; gap: 4px; }
.nc-tabs button.active { background: #fff; font-weight: 600; border-bottom: 2px solid #111111; }
textarea.nc {
  width: 100%; height: 600px; font-family: "Consolas", monospace; font-size: 12px;
  border: 1px solid #aaa; border-radius: 3px; white-space: pre; overflow: auto;
}
.hw-lists { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.hw-lists fieldset { max-height: 240px; overflow:auto; }
table.cut { border-collapse: collapse; width: 100%; margin-top: 6px; }
table.cut th, table.cut td { border: 1px solid #ccc; padding: 3px 6px; text-align: center; }
table.cut th { background: #eee; }
.muted { color: #777; }
.filename { font-family: monospace; color: #2a6; }

/* Редактор справочников (База) */
.baza-tabs { display: flex; gap: 4px; margin-bottom: 10px; }
.baza-tabs a { padding: 6px 14px; background: #e0e0e0; border: 1px solid #c0c0c0;
  border-radius: 4px; text-decoration: none; color: #333; }
.baza-tabs a.active { background: #111111; color: #fff; border-color: #333333; }
.baza-body { display: grid; grid-template-columns: 360px 1fr; gap: 16px; align-items: start; }
.baza-list table.cut td { font-size: 12px; }
.baza-edit { border: 1px solid #ccc; border-radius: 5px; padding: 12px; background: #fafafa; }
.baza-edit h3 { margin: 0 0 10px; font-size: 14px; }
.baza-edit .row { display: flex; gap: 8px; margin: 5px 0; align-items: flex-start; }
.baza-edit .row label { flex: 0 0 150px; color: #444; font-size: 12px; padding-top: 4px; }
.baza-edit input[type=text] { flex: 1 1 auto; width: auto; }
.baza-edit textarea.gcode { flex: 1 1 auto; font-family: Consolas, monospace; font-size: 11px;
  white-space: pre; }
