:root{
  --bg:#0b0d10;
  --panel:#11151b;
  --card:#141a22;
  --muted:#9aa6b2;
  --text:#e7edf4;
  --line:#223041;
  --accent:#e61c2a;
  --good:#2ecc71;
  --warn:#f1c40f;
  --bad:#e74c3c;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --radius: 14px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  background: radial-gradient(1000px 500px at 20% 0%, rgba(230,28,42,.22), transparent 60%),
              radial-gradient(800px 500px at 90% 10%, rgba(255,64,80,.10), transparent 60%),
              var(--bg);
  color:var(--text);
}

.topbar{
  position:sticky; top:0; z-index:50;
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:14px 18px;
  background: rgba(10,12,15,.75);
  border-bottom:1px solid rgba(255,255,255,.06);
  backdrop-filter: blur(10px);
}

.brand{display:flex; align-items:center; gap:12px}
.logo{height:34px; width:auto; display:block}
.brand-title{font-weight:800; letter-spacing:.2px}
.brand-sub{font-size:12px; color:var(--muted); margin-top:2px}

.status-pill{
  display:flex; align-items:center; gap:8px;
  padding:8px 10px;
  background: rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.08);
  border-radius:999px;
  font-size:13px;
  color:var(--muted);
}
.dot{width:10px; height:10px; border-radius:999px; background:var(--good); box-shadow:0 0 0 3px rgba(46,204,113,.12)}

.layout{
  display:grid;
  grid-template-columns: 1.2fr .8fr;
  gap:18px;
  padding:18px;
}

.panel{display:flex; flex-direction:column; gap:14px}

.hero{
  display:flex;
  gap:16px;
  align-items:center;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  border:1px solid rgba(255,255,255,.08);
  border-radius: var(--radius);
  padding:14px;
  box-shadow: var(--shadow);
}
.hero-img{
  width:160px;
  max-width:40vw;
  height:auto;
  border-radius: 12px;
  background: rgba(0,0,0,.25);
  border:1px solid rgba(255,255,255,.08);
}
.hero-copy h1{margin:0 0 6px 0; font-size:20px}
.hero-copy p{margin:0; color:var(--muted); line-height:1.4}

.card{
  background: var(--card);
  border:1px solid rgba(255,255,255,.08);
  border-radius: var(--radius);
  padding:14px;
  box-shadow: var(--shadow);
}

label{
  display:block;
  font-size:12px;
  color:var(--muted);
  margin:10px 0 6px;
}

input, select{
  width:100%;
  padding:10px 10px;
  border-radius: 12px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.25);
  color: var(--text);
  outline:none;
}
input:focus, select:focus{
  border-color: rgba(230,28,42,.55);
  box-shadow: 0 0 0 3px rgba(230,28,42,.12);
}

.hint{font-size:12px; color:var(--muted); margin-top:6px}

.row{display:flex; gap:8px; align-items:center}
.unit{color:var(--muted); font-size:12px}
.sep{color:var(--muted)}

.grid2{display:grid; grid-template-columns: 1fr 1fr; gap:12px}
.grid3{display:grid; grid-template-columns: 1fr 1fr 1fr; gap:12px}

.roll-picker{display:flex; gap:10px}
.roll-btn{
  flex:1;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  padding:12px;
  border-radius: 14px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.18);
  color:var(--text);
  cursor:pointer;
  transition: transform .05s ease, background .2s ease, border-color .2s ease;
}
.roll-btn:hover{transform: translateY(-1px)}
.roll-btn.active{
  border-color: rgba(230,28,42,.70);
  background: rgba(230,28,42,.18);
}
.roll-icon{width:28px; height:28px; object-fit:contain; filter: drop-shadow(0 4px 8px rgba(0,0,0,.35))}

.actions{display:flex; gap:10px}
.btn{
  appearance:none;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color:var(--text);
  padding:10px 12px;
  border-radius: 12px;
  cursor:pointer;
  font-weight:800;
}
.btn:hover{border-color: rgba(255,255,255,.20)}
.btn.primary{
  border-color: rgba(230,28,42,.70);
  background: linear-gradient(180deg, rgba(230,28,42,.95), rgba(230,28,42,.70));
}
.btn.secondary{background: rgba(0,0,0,.20)}

.preview-card{padding:12px}
.preview-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:10px;
}
.preview-title{font-weight:900}
.preview-tools{display:flex; gap:8px}

#previewFrame{
  width:100%;
  height: 560px;
  border:1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  background: rgba(0,0,0,.35);
}

.history-card{padding:12px}
.history-head{
  display:flex; justify-content:space-between; align-items:center;
  margin-bottom:10px;
}
.history-title{font-weight:900}
.history-tools{display:flex; gap:8px}
.history-list{display:flex; flex-direction:column; gap:10px}
.history-item{
  display:flex; justify-content:space-between; gap:12px;
  padding:10px;
  border-radius: 12px;
  border:1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.18);
}
.history-title-line{font-weight:800}
.history-meta{font-size:12px; color:var(--muted); margin-top:4px}
.history-actions{display:flex; gap:8px; align-items:center}
.history-empty{color:var(--muted)}

@media (max-width: 980px){
  .layout{grid-template-columns: 1fr}
  .hero{flex-direction:column; align-items:flex-start}
  #previewFrame{height:420px}

  .grid3{grid-template-columns:1fr}
  .grid2{grid-template-columns:1fr}
  .actions{flex-direction:column}
  .btn{width:100%}
  .roll-picker{flex-direction:column}
}

/* --- FIX: Tom Select breedte in flex/grid layouts --- */
.ts-wrapper {
  width: 100% !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
}

.ts-control {
  width: 100% !important;
  box-sizing: border-box;
}

/* Zorg dat de SKU row correct uitrekt */
.row {
  align-items: stretch;
}

.row > .ts-wrapper {
  flex: 1 1 auto;
}
