:root{
  --bg: #0b0f17;
  --card: rgba(255,255,255,0.06);
  --card2: rgba(255,255,255,0.08);
  --border: rgba(255,255,255,0.12);
  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.62);
  --bad: rgba(255,120,120,0.92);
  --good: rgba(140,255,180,0.92);
  --shadow: 0 10px 40px rgba(0,0,0,0.35);
}

*{ box-sizing: border-box; }
html,body{ 
  height:100%;
  overflow-x: hidden;
}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
  background: radial-gradient(1200px 900px at 20% 10%, rgba(120,170,255,0.14), transparent 60%),
              radial-gradient(900px 700px at 90% 15%, rgba(140,255,200,0.10), transparent 55%),
              var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.app{
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 16px 16px;
}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 16px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.04));
  border-radius: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  backdrop-filter: blur(10px);
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}

.brand{ display:flex; align-items:center; gap: 12px; }
.logo{
  width: 34px; height: 34px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(120,170,255,0.9), rgba(140,255,200,0.9));
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}
.title{ font-weight: 650; letter-spacing: 0.2px; }
.subtitle{ font-size: 12px; color: var(--muted); margin-top: 2px; }

.status{
  font-size: 12px;
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
}

.grid{
  display:grid;
  grid-template-columns: 340px 1fr;
  grid-template-rows: auto auto;
  gap: 12px;
  max-width: 1400px;
  margin: 0 auto;
}

.controls{
  grid-row: 1 / 3;
}

.charts-container{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  grid-row: 1 / 2;
}

.chart{
  display: flex;
  flex-direction: column;
}

.chart canvas{
  max-height: 180px;
  height: 180px !important;
}

.card{
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.04));
  box-shadow: var(--shadow);
  padding: 12px;
  backdrop-filter: blur(10px);
}

.card-title{
  font-weight: 650;
  margin-bottom: 8px;
  letter-spacing: 0.2px;
  font-size: 14px;
}

.controls .control{
  padding: 8px 0;
  border-bottom: 1px dashed rgba(255,255,255,0.12);
}
.controls .control:last-child{ border-bottom: none; }

.label-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  margin-bottom: 8px;
}
label{ color: var(--muted); font-size: 12px; }

input[type="range"]{ width: 100%; }
.num{
  width: 120px;
  padding: 7px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.18);
  color: var(--text);
  outline: none;
}

.hint{
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

.errors{
  margin-top: 10px;
  font-size: 12px;
  color: var(--bad);
  white-space: pre-line;
  min-height: 18px;
}

.notes{
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
  line-height: 1.35;
}

.table-wrap{ 
  overflow:auto; 
  border-radius: 12px; 
  border: 1px solid rgba(255,255,255,0.08);
  max-height: 240px;
}
.tbl{
  width: 100%;
  border-collapse: collapse;
  min-width: 840px;
}
.tbl th, .tbl td{
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
}
.tbl th{
  text-align: left;
  color: rgba(255,255,255,0.72);
  font-weight: 650;
  background: rgba(255,255,255,0.04);
  position: sticky;
  top: 0;
}

.tbl tbody tr:hover{ background: rgba(255,255,255,0.03); }

.badge{
  display:inline-flex;
  align-items:center;
  gap: 8px;
}
.pill{
  width: 8px; height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.55);
}

.mblock{
  margin-top: 10px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.12);
}
.mrow{
  display:flex;
  flex-wrap:wrap;
  gap: 12px;
  align-items:center;
}
.mitem{
  display:flex;
  gap: 8px;
  align-items:baseline;
}
.mkey{ font-size: 12px; color: var(--muted); }
.mval{ font-size: 12px; font-weight: 650; }
.mnotes{
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  white-space: pre-line;
}

.chart-foot{
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.3;
}

.footer{
  margin-top: 12px;
  font-size: 11px;
  color: var(--muted);
  padding: 8px 2px;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 980px){
  .grid{ 
    grid-template-columns: 1fr; 
    grid-template-rows: auto;
  }
  .controls{ grid-row: auto; }
  .charts-container{ 
    grid-row: auto;
    grid-template-columns: 1fr;
  }
  .results{ grid-column: 1; grid-row: auto; }
  .num{ width: 110px; }
  .topbar{ max-width: 100%; }
  .app{ max-width: 100%; }
  .grid{ max-width: 100%; }
  .footer{ max-width: 100%; }
}
