/* NovaCore 6.1.75 — Aspect-Ratio / Full-Width Hotfix
   Ziel: Unterseiten nutzen die verfügbare Arbeitsfläche vollständig, bleiben bei
   1366×768 bis 4K lesbar und erzeugen keine schmalen Inseln mit leerer Restfläche. */
:root{
  --nc-page-gap:clamp(10px,.85vw,16px);
  --nc-page-pad:clamp(10px,1vw,18px);
  --nc-card-pad:clamp(11px,.85vw,16px);
  --nc-copy-xs:clamp(9px,.66vw,11px);
  --nc-copy-sm:clamp(10px,.75vw,12px);
  --nc-copy-md:clamp(12px,.9vw,14px);
  --nc-title-md:clamp(18px,1.45vw,25px);
}

/* Arbeitsfläche folgt immer der tatsächlichen Sidebar-Breite. */
body:not([data-nc-page="home"]) .main{
  width:calc(100vw - var(--nc-main-nav-w))!important;
  max-width:none!important;
  margin-left:var(--nc-main-nav-w)!important;
  padding:var(--nc-page-gap) var(--nc-page-pad) 34px!important;
  overflow-x:hidden!important;
}
.app-page:not(#homePage),
.app-page:not(#homePage).nc-subpage-master{
  width:100%!important;
  max-width:none!important;
  min-width:0!important;
  margin:0!important;
  grid-template-columns:minmax(0,1fr)!important;
  gap:var(--nc-page-gap)!important;
  align-content:start!important;
}
.app-page:not(#homePage)>*{min-width:0!important;max-width:100%!important}
.app-page:not(#homePage)>.page-header{min-height:clamp(88px,10vh,118px)!important;padding:clamp(13px,1.1vw,20px)!important}
.app-page:not(#homePage)>.page-header .page-header-copy h1{font-size:var(--nc-title-md)!important}
.app-page:not(#homePage)>.page-header .page-header-copy p{font-size:var(--nc-copy-sm)!important;max-width:min(1080px,78vw)!important}
.app-page:not(#homePage)>.page-header .eyebrow{font-size:var(--nc-copy-xs)!important}
.app-page:not(#homePage) .panel,
.app-page:not(#homePage) .factory-content-panel,
.app-page:not(#homePage) .pp-standalone-section{min-width:0!important}

/* Lesbarkeit: 6.1.74 war auf 1536×864 teilweise zu klein skaliert. */
.app-page:not(#homePage) table{font-size:var(--nc-copy-sm)!important}
.app-page:not(#homePage) thead th{height:36px!important;font-size:var(--nc-copy-xs)!important;padding:0 clamp(8px,.7vw,12px)!important}
.app-page:not(#homePage) tbody td{padding:clamp(8px,.65vw,12px)!important;font-size:var(--nc-copy-sm)!important}
.app-page:not(#homePage) .btn,
.app-page:not(#homePage) button:not(.close):not(.erp-nav-button):not(.erp-brand):not(.nc-main-nav-toggle){font-size:var(--nc-copy-sm)!important}
.app-page:not(#homePage) input,
.app-page:not(#homePage) select,
.app-page:not(#homePage) textarea{font-size:var(--nc-copy-sm)!important}

/* KPI-/Kartenraster skaliert mit der real verfügbaren Breite statt festen Spalten. */
.app-page:not(#homePage) .premium-strip,
#storagePage .storage-company-cards,
#companyProfitPage .production-profit-company-cards,
#businessCenterPage .business-metrics{
  grid-template-columns:repeat(auto-fit,minmax(min(230px,100%),1fr))!important;
}
#companyProfitPage .pp-standalone-kpis,
.factory-intake-kpis{
  grid-template-columns:repeat(auto-fit,minmax(min(190px,100%),1fr))!important;
}
#vapiFunctionsPage .vapi-workspace-grid,
#vapiFunctionsPage .embedded-bridge-grid{
  grid-template-columns:repeat(auto-fit,minmax(min(420px,100%),1fr))!important;
}

/* REZEPTE: Auswahl nutzt nun die volle Seitenbreite. Im Screenshot 6.1.74 war
   dieser Block auf ~250 px zusammengedrückt und ließ >70% der Seite leer. */
#recipesPage .recipe-hub-layout{
  display:grid!important;
  grid-template-columns:minmax(0,1fr)!important;
  gap:var(--nc-page-gap)!important;
  width:100%!important;
}
#recipesPage .recipe-hub-selector,
#recipesPage .recipe-hub-workspace{width:100%!important;padding:var(--nc-card-pad)!important}
#recipesPage .recipe-hub-selector-head{
  display:flex!important;align-items:center!important;justify-content:space-between!important;gap:18px!important;margin-bottom:var(--nc-page-gap)!important
}
#recipesPage .recipe-hub-selector-head h2{font-size:clamp(16px,1.2vw,21px)!important;margin:0 0 5px!important}
#recipesPage .recipe-hub-selector-head p{font-size:var(--nc-copy-sm)!important;line-height:1.45!important;max-width:760px!important}
#recipesPage .recipe-hub-selector-head .manual-badge{font-size:var(--nc-copy-xs)!important;white-space:nowrap!important}
#recipesPage .recipe-hub-options{
  display:grid!important;
  grid-template-columns:repeat(3,minmax(0,1fr))!important;
  gap:var(--nc-page-gap)!important;
  margin-top:0!important;
}
#recipesPage .recipe-hub-option{
  width:100%!important;min-width:0!important;min-height:clamp(92px,11vh,118px)!important;
  padding:clamp(12px,1vw,18px)!important;gap:clamp(10px,.9vw,16px)!important
}
#recipesPage .recipe-hub-option-icon{width:clamp(44px,3.4vw,58px)!important;height:clamp(44px,3.4vw,58px)!important;font-size:clamp(22px,1.8vw,28px)!important}
#recipesPage .recipe-hub-option-copy strong{font-size:clamp(13px,1vw,17px)!important}
#recipesPage .recipe-hub-option-copy span{font-size:var(--nc-copy-sm)!important;line-height:1.4!important}
#recipesPage .recipe-hub-workspace{overflow:visible!important}
#recipesPage .recipe-hub-tabs{padding:10px 12px!important}
#recipesPage .recipe-hub-content{padding:var(--nc-card-pad)!important;max-height:none!important}
#recipesPage .sawmill-recipe-grid{grid-template-columns:repeat(auto-fit,minmax(min(300px,100%),1fr))!important;gap:var(--nc-page-gap)!important}
#recipesPage .sawmill-recipe-card{padding:var(--nc-card-pad)!important}

/* IMPORT: exakt an Hauptseitenleiste koppeln; keine zweite vertikale Navigation,
   kein horizontal abgeschnittener Inhalt und kein Seitenstart außerhalb des Viewports. */
#importPage{width:100%!important;min-width:0!important;overflow:visible!important}
#importPage .import-layout{display:block!important;width:100%!important;max-width:100%!important;min-width:0!important}
#importPage .import-layout>.content{width:100%!important;max-width:100%!important;min-width:0!important}
#importPage .import-sidebar{display:none!important}
#importPage .controls-panel{width:100%!important;max-width:100%!important}
#importPage #importResults{width:100%!important;max-width:100%!important;min-width:0!important}
#importPage .import-company-section{width:100%!important;max-width:100%!important;min-width:0!important}
#importPage .import-reminder-panel{width:100%!important}

/* EINLAGERUNGS-SYSTEM: Vollumfang der 6.1.50-Funktion bleibt sichtbar und skaliert
   auf das aktuelle Fenster. Keine abgeschnittenen Preis-/Sheets-/Historienbereiche. */
#storagePage .factory-intake-shell{display:grid!important;gap:var(--nc-page-gap)!important;width:100%!important;min-width:0!important}
#storagePage .factory-intake-grid{
  display:grid!important;
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
  gap:var(--nc-page-gap)!important
}
#storagePage .factory-intake-card{padding:var(--nc-card-pad)!important;min-width:0!important}
#storagePage .factory-intake-head h3{font-size:clamp(14px,1.05vw,18px)!important}
#storagePage .factory-intake-head p{font-size:var(--nc-copy-sm)!important;line-height:1.5!important}
#storagePage .factory-intake-price-row{
  grid-template-columns:minmax(0,1fr) minmax(120px,180px) 82px!important;
  padding:clamp(9px,.7vw,13px)!important
}
#storagePage .factory-intake-price-row strong{font-size:var(--nc-copy-md)!important}
#storagePage .factory-intake-price-row small,
#storagePage .factory-intake-price-row em{font-size:var(--nc-copy-xs)!important}
#storagePage .factory-intake-config{grid-template-columns:minmax(100px,130px) minmax(0,1fr)!important}
#storagePage .factory-intake-config span,
#storagePage .factory-intake-config code,
#storagePage .factory-intake-push small,
#storagePage .factory-intake-token,
#storagePage .factory-intake-note{font-size:var(--nc-copy-xs)!important}
#storagePage .factory-intake-table-wrap{width:100%!important;max-width:100%!important;overflow:auto!important}
#storagePage .factory-intake-table{min-width:900px!important}
#storagePage .factory-intake-table th{font-size:var(--nc-copy-xs)!important}
#storagePage .factory-intake-table td{font-size:var(--nc-copy-sm)!important}

/* Produktions-/Firmenbereiche dürfen nie eine künstliche Mindestbreite in den
   Hauptbereich drücken. */
#storagePage .factory-company-bar{grid-template-columns:minmax(220px,.8fr) minmax(0,2fr)!important}
#storagePage .factory-section-nav{min-width:0!important;overflow-x:auto!important;overscroll-behavior-inline:contain!important}
#storagePage .factory-content,#companyProfitPage .production-profit-content{min-width:0!important;width:100%!important}

/* ERP/Unternehmenszentrale: falls interne NovaCore-Seiten geöffnet sind, ebenfalls
   fensterfüllend. Die RPITS-Live-Webansicht wird nativ separat auf dieselbe Sidebar-
   Einrückung gesetzt. */
#businessCenterPage .erp-workspace{width:100%!important;max-width:none!important;margin:0!important;padding:var(--nc-page-gap)!important}
#businessCenterPage .erp-content{width:100%!important;min-width:0!important}

/* Höhe ist genauso wichtig wie Breite: bei typischen 864/900 px keine künstlich
   übergroßen Abstände. */
@media (max-height:900px){
  body:not([data-nc-page="home"]) .main{padding-top:8px!important;padding-bottom:24px!important}
  .app-page:not(#homePage)>.page-header{min-height:78px!important;padding:11px 14px!important}
  #recipesPage .recipe-hub-option{min-height:82px!important}
}

@media (max-width:1180px){
  #recipesPage .recipe-hub-options{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  #storagePage .factory-intake-grid{grid-template-columns:1fr!important}
  #storagePage .factory-company-bar{grid-template-columns:1fr!important}
}
@media (max-width:820px){
  #recipesPage .recipe-hub-options{grid-template-columns:1fr!important}
  #recipesPage .recipe-hub-selector-head{align-items:flex-start!important;flex-direction:column!important}
  #storagePage .factory-intake-price-row{grid-template-columns:1fr!important}
  #storagePage .factory-intake-config{grid-template-columns:1fr!important}
}
