:root{
  --body-bg:#111015;
  --body-bg-alt:#17161c;
  --window-bg:#1f1e25;
  --window-inner:#24232c;
  --border-light:#5f5d68;
  --border-mid:#3a3942;
  --border-dark:#05040a;
  --text-main:#f4f3f8;
  --text-muted:#b8b6c3;
  --accent-blue:#6ea4ff;
  --accent-blue-soft:#324368;
  --accent-yellow:#ffd95a;
  --accent-yellow-soft:#4b3e14;
  --radius:3px;
  --mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono",monospace;
}

*{box-sizing:border-box}
html,body{height:100%}

body{
  margin:0;
  background:
    linear-gradient(90deg,#14141a 0,#14141a 1px,#17171f 1px,#17171f 2px),
    linear-gradient(0deg,#14141a 0,#14141a 1px,#17171f 1px,#17171f 2px);
  background-size:4px 4px;
  color:var(--text-main);
  font:13px/1.5 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI","Lucida Grande","Helvetica",Arial,sans-serif;
}

/* top bar */

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:4px 10px;
  background:linear-gradient(180deg,#21202a,#15141c);
  border-bottom:1px solid var(--border-dark);
  box-shadow:0 1px 0 var(--border-light);
  position:sticky;
  top:0;
  z-index:10;
}

.brand{
  font-weight:700;
  letter-spacing:.18em;
  text-transform:none;
  font-size:11px;
  color:var(--accent-yellow);
  text-shadow:0 0 4px rgba(0,0,0,.8);
}

.conn{
  display:flex;
  gap:6px;
  align-items:center;
}

.badge{
  font-size:11px;
  padding:2px 8px;
  border-radius:var(--radius);
  border-top:1px solid var(--border-light);
  border-left:1px solid var(--border-light);
  border-right:1px solid var(--border-dark);
  border-bottom:1px solid var(--border-dark);
  background:#252530;
  color:var(--text-muted);
}

/* layout */

.shell{
  display:grid;
  grid-template-columns:minmax(0,1.5fr) minmax(320px,0.9fr);
  gap:12px;
  padding:12px;
  max-width:1200px;
  margin:8px auto 16px;
}

@media (max-width:1100px){
  .shell{grid-template-columns:1fr}
  .console{position:relative;top:auto;height:auto}
}

/* windows */

.workspace,
.console{
  background:var(--window-bg);
  border-radius:0;
  border-top:1px solid var(--border-light);
  border-left:1px solid var(--border-light);
  border-right:1px solid var(--border-dark);
  border-bottom:1px solid var(--border-dark);
  box-shadow:0 0 0 1px var(--border-mid);
}

/* tab strip */

.tabs{
  display:flex;
  flex-wrap:wrap;
  gap:4px;
  padding:4px;
  background:#23222b;
  border-bottom:1px solid var(--border-mid);
}

.tab{
  border-radius:0;
  border-top:1px solid var(--border-light);
  border-left:1px solid var(--border-light);
  border-right:1px solid var(--border-dark);
  border-bottom:1px solid var(--border-dark);
  background:#2b2a35;
  color:var(--text-muted);
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.12em;
  padding:4px 10px;
  cursor:pointer;
}

.tab:hover{
  background:#343340;
}

.tab.active{
  background:#111015;
  color:var(--accent-yellow);
}

/* panels */

.panel{
  display:none;
  padding:8px;
}

.panel.active{
  display:block;
}

/* parameter header */

.gridhead{
  display:grid;
  gap:6px;
  padding:8px;
  background:var(--window-inner);
  border-radius:0;
  border-top:1px solid var(--border-light);
  border-left:1px solid var(--border-light);
  border-right:1px solid var(--border-mid);
  border-bottom:1px solid var(--border-mid);
}

.row{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:6px 8px;
}

label{
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.1em;
  color:var(--text-muted);
}

/* inputs + buttons */

input,
select,
button{
  font-family:inherit;
  font-size:12px;
  border-radius:0;
  border-top:1px solid var(--border-light);
  border-left:1px solid var(--border-light);
  border-right:1px solid var(--border-dark);
  border-bottom:1px solid var(--border-dark);
  background:#111015;
  color:var(--text-main);
  padding:4px 6px;
}

input::placeholder{
  color:#7e7c8a;
}

input[type="number"]{
  width:80px;
}

select{
  min-height:26px;
  background:#181720;
}

button{
  cursor:pointer;
  text-transform:uppercase;
  letter-spacing:.1em;
  font-size:10px;
  background:#25242f;
}

button.icon{
  padding:3px 6px;
  min-width:auto;
}

button.ghost{
  background:#1b1b24;
}

button.pri{
  background:var(--accent-yellow-soft);
  border-top-color:#fff1a5;
  border-left-color:#fff1a5;
  border-right-color:#2d2510;
  border-bottom-color:#2d2510;
  color:#fffbe0;
}

button:hover{
  background:#30303a;
}

button.pri:hover{
  background:#5c4a19;
}

button:disabled{
  opacity:.55;
  cursor:not-allowed;
}

/* focus */

input:focus-visible,
select:focus-visible,
button:focus-visible{
  outline:1px solid var(--accent-blue);
  outline-offset:0;
}

/* console */

.console{
  position:sticky;
  top:40px;
  height:calc(100vh - 70px);
  display:flex;
  flex-direction:column;
  padding:6px 6px 8px;
  background:#191821;
}

.conntop{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:4px;
}

.legend{
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.12em;
  color:var(--text-muted);
}

/* log */

.log{
  flex:1;
  background:#050409;
  border-radius:0;
  border-top:1px solid var(--border-light);
  border-left:1px solid var(--border-light);
  border-right:1px solid var(--border-dark);
  border-bottom:1px solid var(--border-dark);
  padding:6px;
  font-size:11px;
  line-height:1.4;
  color:#f1f0ff;
  overflow:auto;
}

/* command row */

.cmdrow{
  display:flex;
  gap:6px;
  margin-top:6px;
}

.cmdrow input{
  flex:1;
}

.mono{
  font-family:var(--mono);
}

.foot{
  margin-top:4px;
  font-size:10px;
  color:var(--text-muted);
}

/* tables */

.table-wrap{
  margin-top:6px;
  border-radius:0;
  border-top:1px solid var(--border-light);
  border-left:1px solid var(--border-light);
  border-right:1px solid var(--border-dark);
  border-bottom:1px solid var(--border-dark);
  background:#111015;
  overflow:auto;
}

table{
  border-collapse:collapse;
  width:100%;
}

thead{
  background:#292835;
}

th,td{
  padding:4px 6px;
  white-space:nowrap;
  text-align:left;
  border-bottom:1px solid #32313c;
}

th{
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.08em;
  color:var(--text-muted);
}

td{
  font-size:12px;
}

tbody tr:nth-child(2n){
  background:#181722;
}

tbody tr:nth-child(2n+1){
  background:#13131d;
}

tbody tr:hover td{
  background:#2b3249;
}

/* live range */

#tab-live input[type="range"]{
  -webkit-appearance:none;
  width:240px;
  height:4px;
  background:#3b3a45;
  border-radius:2px;
}

#tab-live input[type="range"]::-webkit-slider-thumb{
  -webkit-appearance:none;
  width:14px;
  height:14px;
  border-radius:0;
  background:#f5f5ff;
  border-top:1px solid var(--border-light);
  border-left:1px solid var(--border-light);
  border-right:1px solid var(--border-dark);
  border-bottom:1px solid var(--border-dark);
  margin-top:-5px;
}

#tab-live input[type="range"]::-moz-range-track{
  height:4px;
  background:#3b3a45;
  border-radius:2px;
}

#tab-live input[type="range"]::-moz-range-thumb{
  width:14px;
  height:14px;
  border-radius:0;
  background:#f5f5ff;
  border-top:1px solid var(--border-light);
  border-left:1px solid var(--border-light);
  border-right:1px solid var(--border-dark);
  border-bottom:1px solid var(--border-dark);
}

/* toggles */

.toggle{
  display:inline-flex;
  gap:6px;
  align-items:center;
}

.toggle input{
  width:14px;
  height:14px;
}

input[type="checkbox"]{
  accent-color:var(--accent-blue);
}

/* scrollbars */

::-webkit-scrollbar{
  width:10px;
  height:10px;
}

::-webkit-scrollbar-track{
  background:#181720;
}

::-webkit-scrollbar-thumb{
  background:#3d3c48;
  border-radius:0;
  border:1px solid #23222c;
}

/* headings */

h4{
  margin:8px 6px 4px;
  font-size:11px;
  font-weight:600;
}

/* hide NRPN master row but keep IDs alive for JS */

.nrpn-master{
  display:none;
}


