html, body { height: 100%; overflow: hidden; }
body { display: flex; flex-direction: column; }

.nosac-page-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.55rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--navy-800);
  flex-shrink: 0;
}
.nosac-ph-left  { display: flex; align-items: center; gap: 0.75rem; }
.nosac-ph-right { display: flex; align-items: center; gap: 0.75rem; }
.nosac-ph-center {
  flex: 1; display: flex; align-items: center; gap: 0.5rem;
  padding: 0 2rem; min-width: 0;
}
.nosac-ph-center label {
  font-size: 0.78rem; color: var(--text-dim); font-family: var(--font-mono);
  white-space: nowrap; flex-shrink: 0;
}
.nosac-ph-center input {
  flex: 1; min-width: 0;
  background: transparent; border: none; border-bottom: 1px solid var(--border);
  color: var(--text); font-size: 0.85rem; font-family: var(--font-mono);
  padding: 0.1rem 0.25rem; outline: none; transition: border-color 0.15s;
}
.nosac-ph-center input:focus { border-bottom-color: var(--accent); }

@media (max-width: 900px) {
  html, body { height: auto; overflow-x: hidden; overflow-y: auto; }
  body { display: block; }
  .nosac-title-text { display: none; }
  /* Result strip: grid → flex da core.css flex-wrap radi */
  .result-strip { display: flex !important; }
  /* Grafovi ispod tablice */
  #tab-section > div,
  #tab-buck    > div,
  #tab-ltb     > div { flex-direction: column !important; height: auto !important; }
  #tab-section > div > div,
  #tab-buck    > div > div,
  #tab-ltb     > div > div { flex: none !important; width: 100% !important; }
  #tab-section > div > div:last-child,
  #tab-buck    > div > div:last-child,
  #tab-ltb     > div > div:last-child {
    height: 200px; border-left: none !important;
    border-top: 1px solid var(--border);
  }
}

@media (max-width: 768px) {
  .nosac-page-header {
    display: grid;
    grid-template-areas: "left right" "center center";
    grid-template-columns: auto 1fr;
    align-items: center;
    padding: 0.4rem 0.75rem;
    gap: 0.3rem 0.5rem;
  }
  .nosac-ph-left   { grid-area: left;  gap: 0.5rem; }
  .nosac-ph-right  { grid-area: right; justify-self: end; gap: 0.25rem !important; }
  .nosac-ph-center {
    grid-area: center; flex: unset;
    padding: 0.2rem 0 0; border-top: 1px solid var(--border);
  }
}

/* EC3 ima 6 dugih tab naziva — 2-po-redu (50%) bolje od 3-po-redu */
@media (max-width: 600px) {
  .tab-btn { flex: 0 0 50% !important; }
}
/* Na 320px mono + letter-spacing = overflow; dopusti wrap unutar buttona */
@media (max-width: 400px) {
  .tab-btn { white-space: normal !important; line-height: 1.15; text-align: center; min-height: 2rem; }
}

/* Drawings row: 4 columns */
.drawings-row { grid-template-columns: 1fr 1fr 1fr 1fr; }

/* Result strip */
.result-strip {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 0; border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

/* Drawings row ostaje mala; tab-content popunjava ostatak */
.drawings-row { flex: 0 0 auto; }
.tab-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  max-height: none;
  scrollbar-width: none;
}
.tab-content::-webkit-scrollbar { display: none; }
/* column direction → result-table-wrap se rastegne na punu širinu (cross-axis stretch) */
.tab-content.active {
  flex-shrink: 1;
  flex-direction: column;
}

.check-ok  { color: #43a047; font-weight: 600; }
.check-err { color: #e53935; font-weight: 600; }
.badge-class1 { background: rgba(67,160,71,0.25);  color: #43a047; padding: 0 0.35rem; border-radius: 3px; }
.badge-class2 { background: rgba(76,175,80,0.15);  color: #66bb6a; padding: 0 0.35rem; border-radius: 3px; }
.badge-class3 { background: rgba(255,160,0,0.2);   color: #ffa000; padding: 0 0.35rem; border-radius: 3px; }
.badge-class4 { background: rgba(229,57,53,0.2);   color: #e53935; padding: 0 0.35rem; border-radius: 3px; }

/* Širi lijevi panel za 30% */
@media (min-width: 901px) {
  .module-layout-2col { grid-template-columns: 390px 1fr; }
}

/* Rubni uvjeti — BC toggle */
.bc-row { display:flex; justify-content:space-between; align-items:flex-end; gap:0.5rem; }
.bc-group { display:flex; flex-direction:column; gap:0.2rem; }
.bc-group-label { font-size:0.73rem; color:var(--text-dim); }
.bc-toggle { display:flex; gap:2px; }
.bc-btn {
  padding:0.22rem 0.55rem; font-size:0.78rem; cursor:pointer;
  background:var(--navy-900); border:1px solid var(--border);
  color:var(--text-dim); border-radius:var(--radius-sm);
  font-family:var(--font-mono); transition:background 0.15s, color 0.15s;
}
.bc-btn.active { background:var(--blueprint); color:#fff; border-color:var(--blueprint); }
.bc-hint { font-size:0.73rem; color:var(--text-dim); font-family:var(--font-mono); margin-top:0.3rem; }

/* form-row-2col select — core.css stilizira samo input, ne select */
.form-row-2col select {
  width: 100%; box-sizing: border-box;
  padding: 0.4rem 0.45rem;
  background: var(--navy-900); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: var(--font-mono); font-size: 0.88rem; cursor: pointer;
}
.form-row-2col select:focus { outline: none; border-color: var(--blueprint); }

/* 3-stupčani form red */
.form-row-3col {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem; margin-bottom: 0.55rem;
}
.form-row-3col label { display: block; font-size: 0.82rem; color: var(--text-dim); margin-bottom: 0.2rem; }
.form-row-3col input, .form-row-3col select {
  width: 100%; box-sizing: border-box;
  padding: 0.35rem 0.4rem; background: var(--navy-900);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-family: var(--font-mono); font-size: 0.82rem;
}
.form-row-3col input:focus, .form-row-3col select:focus {
  outline: none; border-color: var(--blueprint);
}
