.rvlab-host{
  width:100%;
  color:var(--rv-text,#EAF8FF);
}

.rvlab-host [hidden],
.rvlab-shell [hidden],
.rvlab-modal-backdrop[hidden]{
  display:none !important;
}

.rvlab-shell{
  --radius-xl:32px;
  --radius-lg:26px;
  --radius-md:18px;
  --radius-sm:14px;
  --shadow-lg:0 20px 60px rgba(0,0,0,.28);
  --shadow-md:0 12px 32px rgba(0,0,0,.22);

  position:relative;
  overflow:hidden;
  border-radius:var(--radius-xl);
  border:1px solid rgba(110,207,240,.12);
  box-shadow:var(--shadow-lg);
  color:var(--rv-text);
  font-family:Inter,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  background:
    radial-gradient(circle at top left, rgba(110,207,240,.12), transparent 26%),
    radial-gradient(circle at top right, rgba(20,129,192,.16), transparent 24%),
    linear-gradient(145deg, rgba(4,12,24,.98), rgba(7,20,35,.98));
}

.rvlab-header{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:24px;
  padding:28px 30px 22px;
  border-bottom:1px solid rgba(110,207,240,.12);
  background:linear-gradient(180deg, rgba(7,33,59,.8), rgba(4,12,24,0));
}

.rvlab-kicker{
  margin:0 0 8px;
  font-size:11px;
  letter-spacing:.24em;
  text-transform:uppercase;
  color:var(--rv-cyan);
  font-weight:700;
}

.rvlab-header h2{
  margin:0;
  font-family:Orbitron,Inter,sans-serif;
  font-size:clamp(1.55rem,2vw,2.2rem);
  line-height:1.08;
}

.rvlab-subtitle{
  margin:10px 0 0;
  max-width:860px;
  color:var(--rv-text-soft);
  font-size:.98rem;
  line-height:1.45;
}

.rvlab-tabs{
  display:flex;
  gap:10px;
  padding:8px;
  border-radius:999px;
  border:1px solid rgba(110,207,240,.12);
  background:rgba(8,22,38,.88);
}

.rvlab-tab{
  border:0;
  border-radius:999px;
  background:transparent;
  color:var(--rv-text-soft);
  padding:10px 18px;
  cursor:pointer;
  font-weight:700;
  transition:background .18s ease,color .18s ease,box-shadow .18s ease,transform .18s ease;
}

.rvlab-tab:hover,
.rvlab-tab.is-active{
  color:var(--rv-text);
  background:linear-gradient(135deg, rgba(110,207,240,.2), rgba(20,129,192,.28));
  box-shadow:
    inset 0 0 0 1px rgba(110,207,240,.18),
    0 10px 20px rgba(20,129,192,.16);
}

.rvlab-panel{
  padding:26px;
}

.rvlab-grid{
  display:grid;
  grid-template-columns:minmax(360px,480px) minmax(0,1fr);
  gap:20px;
  align-items:start;
}

.rvlab-stack{
  display:grid;
  gap:18px;
}

.rvlab-card,
.rvlab-note{
  border-radius:var(--radius-lg);
  border:1px solid rgba(110,207,240,.1);
  box-shadow:var(--shadow-lg);
  background:linear-gradient(180deg, rgba(10,26,45,.96), rgba(5,15,28,.98));
}

.rvlab-card{
  padding:18px 18px 20px;
}

.rvlab-note{
  padding:18px 20px;
  border-style:dashed;
  color:var(--rv-text-soft);
  line-height:1.55;
}

.rvlab-card--setup{
  position:sticky;
  top:14px;
}

.rvlab-card-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px 14px;
  margin-bottom:14px;
  flex-wrap:wrap;
}

.rvlab-card-head h3,
.rvlab-card-head h4{
  margin:0;
  font-family:Orbitron,Inter,sans-serif;
  font-size:1rem;
  letter-spacing:.03em;
  line-height:1.3;
}

.rvlab-card-head--sub{
  margin-top:18px;
  padding-top:18px;
  border-top:1px solid rgba(110,207,240,.08);
}

.rvlab-inline-help{
  flex:1 1 100%;
  margin-top:-4px;
  color:var(--rv-text-soft);
  font-size:.75rem;
  line-height:1.45;
}

.rvlab-form,
.rvlab-form-grid,
.rvlab-field{
  display:grid;
  gap:12px;
}

.rvlab-form-grid--2{
  grid-template-columns:repeat(2,minmax(0,1fr));
}

.rvlab-field > span,
.rvlab-mini-field > span,
.rvlab-range-wrap label{
  color:var(--rv-text-soft);
  font-size:.84rem;
  font-weight:700;
}

.rvlab-label-row{
  display:inline-flex;
  align-items:center;
  gap:6px;
  flex-wrap:nowrap;
  min-width:0;
}

.rvlab-help-icon{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:18px;
  height:18px;
  border-radius:999px;
  border:1px solid rgba(110,207,240,.22);
  background:rgba(110,207,240,.08);
  color:var(--rv-text-soft);
  font-size:.72rem;
  font-weight:800;
  line-height:1;
  cursor:help;
  flex:0 0 auto;
}

.rvlab-input-wrap{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}

.rvlab-input-wrap small{
  white-space:nowrap;
  color:var(--rv-text-soft);
  font-size:.74rem;
}

.rvlab-input,
.rvlab-shell select,
.rvlab-shell input{
  width:100%;
  min-width:0;
  border-radius:14px;
  border:1px solid rgba(110,207,240,.15);
  background:rgba(8,21,37,.86);
  color:var(--rv-text);
  padding:12px 14px;
  font-size:.94rem;
  outline:none;
  transition:border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.rvlab-input:focus,
.rvlab-shell select:focus,
.rvlab-shell input:focus{
  border-color:rgba(110,207,240,.34);
  box-shadow:0 0 0 3px rgba(110,207,240,.1);
}

.rvlab-shell input[type="number"]{
  appearance:auto;
  -moz-appearance:auto;
  color-scheme:dark;
}

.rvlab-shell input[type="number"]::-webkit-outer-spin-button,
.rvlab-shell input[type="number"]::-webkit-inner-spin-button{
  opacity:0;
  transition:opacity .15s ease;
}

.rvlab-shell input[type="number"]:hover::-webkit-outer-spin-button,
.rvlab-shell input[type="number"]:hover::-webkit-inner-spin-button,
.rvlab-shell input[type="number"]:focus::-webkit-outer-spin-button,
.rvlab-shell input[type="number"]:focus::-webkit-inner-spin-button{
  opacity:1;
}

.rvlab-input-wrap.is-unit-inside{
  position:relative;
}

.rvlab-input.has-unit-inside{
  padding-right:42px;
}

.rvlab-input-unit-inside{
  position:absolute;
  right:12px;
  top:50%;
  transform:translateY(-50%);
  color:var(--rv-text-soft);
  font-size:.78rem;
  font-weight:700;
  pointer-events:none;
}

.rvlab-range-wrap{
  display:grid;
  gap:10px;
  margin-top:8px;
}

.rvlab-range-wrap output{
  justify-self:start;
  padding:8px 12px;
  border-radius:999px;
  border:1px solid rgba(110,207,240,.12);
  background:rgba(110,207,240,.1);
  font-size:.82rem;
}

.rvlab-button-row{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top:12px;
}

.rvlab-btn,
.rvlab-chip-btn,
.rvlab-mini-btn{
  border:0;
  cursor:pointer;
  transition:transform .16s ease, box-shadow .16s ease, opacity .16s ease, background .16s ease;
}

.rvlab-btn:hover,
.rvlab-chip-btn:hover,
.rvlab-mini-btn:hover{
  transform:translateY(-1px);
}

.rvlab-btn{
  border-radius:16px;
  padding:12px 18px;
  font-weight:800;
  color:#061321;
  background:linear-gradient(135deg, var(--rv-cyan), #9fe9ff);
  box-shadow:0 14px 34px rgba(110,207,240,.26);
}

.rvlab-chip-btn,
.rvlab-mini-btn{
  padding:10px 12px;
  border-radius:14px;
  color:var(--rv-text);
  background:rgba(14,36,62,.92);
  border:1px solid rgba(110,207,240,.12);
}

.rvlab-mini-btn.is-danger{
  border-color:rgba(255,107,107,.22);
  color:#ffd7d7;
}

.rvlab-hero-stats{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:12px;
}

.rvlab-hero-card{
  display:grid;
  gap:8px;
  padding:16px;
  min-width:0;
  border-radius:var(--radius-md);
  border:1px solid rgba(110,207,240,.1);
  background:linear-gradient(180deg, rgba(11,32,54,.98), rgba(8,21,36,.98));
}

.rvlab-hero-card small{
  color:var(--rv-text-soft);
  text-transform:uppercase;
  letter-spacing:.08em;
  font-size:.72rem;
  font-weight:700;
}

.rvlab-hero-card strong{
  display:block;
  min-width:0;
  white-space:nowrap;
  line-height:1.04;
  color:#fff;
  font-size:clamp(1.02rem,1.55vw,1.52rem);
}

.rvlab-hero-card--compact strong{
  font-size:clamp(.92rem,1.28vw,1.18rem);
}

.rvlab-hero-card--tiny strong{
  font-size:clamp(.82rem,1.05vw,.98rem);
}

.rvlab-hero-card span{
  color:var(--rv-text-soft);
  font-size:.82rem;
  line-height:1.45;
}

.rvlab-canvas{
  display:block;
  width:100%;
  height:390px;
  min-height:390px;
  border-radius:18px;
  border:1px solid rgba(110,207,240,.08);
  background:linear-gradient(180deg, rgba(6,17,29,.92), rgba(4,9,16,.98));
}

.rvlab-canvas--hist{
  height:300px;
  min-height:300px;
}

.rvlab-split-card{
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr);
  gap:18px;
}

.rvlab-kv-list{
  display:grid;
  gap:10px;
}

.rvlab-kv-row{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:14px;
  padding:11px 14px;
  border-radius:14px;
  border:1px solid rgba(110,207,240,.06);
  background:rgba(7,18,31,.74);
}

.rvlab-kv-row > span{
  color:var(--rv-text-soft);
  font-size:.89rem;
  line-height:1.35;
}

.rvlab-kv-row strong{
  min-width:0;
  color:#fff;
  text-align:right;
  font-size:clamp(.82rem,1.05vw,.96rem);
  white-space:nowrap;
}

.rvlab-dual{
  display:grid;
  gap:3px;
  justify-items:end;
  min-width:0;
}

.rvlab-dual > span,
.rvlab-dual > small{
  min-width:0;
  white-space:nowrap;
}

.rvlab-dual small{
  color:var(--rv-text-soft);
  font-size:clamp(.72rem,1vw,.8rem);
}

.rvlab-range-inline{
  display:inline-flex;
  align-items:center;
  gap:6px;
  flex-wrap:nowrap;
  white-space:nowrap;
  min-width:0;
  max-width:100%;
}

.rvlab-negative{ color:#ff7a7a !important; }
.rvlab-positive{ color:#8cf0a6 !important; }
.rvlab-arrow{ color:var(--rv-text-soft); }

.rvlab-table{
  width:100%;
  border-collapse:collapse;
  font-size:.9rem;
}

.rvlab-table th,
.rvlab-table td{
  padding:10px 10px;
  border-bottom:1px solid rgba(110,207,240,.08);
  text-align:left;
  vertical-align:top;
}

.rvlab-table th{
  color:var(--rv-text-soft);
  font-size:.77rem;
  text-transform:uppercase;
  letter-spacing:.08em;
}

.rvlab-table td{
  color:#fff;
}

.rvlab-whatif-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:12px;
}

.rvlab-whatif-card{
  display:grid;
  gap:7px;
  padding:16px;
  border-radius:18px;
  border:1px solid rgba(110,207,240,.1);
  background:linear-gradient(180deg, rgba(10,22,38,.95), rgba(5,13,22,.98));
}

.rvlab-whatif-card.is-highlight{
  border-color:rgba(255,209,102,.36);
  box-shadow:inset 0 0 0 1px rgba(255,209,102,.16);
}

.rvlab-whatif-card small,
.rvlab-whatif-card span{
  color:var(--rv-text-soft);
}

.rvlab-whatif-card strong{
  color:#fff;
  font-size:1.28rem;
  line-height:1.1;
}

.rvlab-help-block{
  margin:10px 0 0;
  color:var(--rv-text-soft);
  line-height:1.5;
}

.rvlab-plan-list{
  display:grid;
  gap:16px;
}

.rvlab-plan-row{
  padding:14px 0;
  border-top:1px solid rgba(110,207,240,.08);
}

.rvlab-plan-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  margin-bottom:12px;
}

.rvlab-plan-head small{
  color:var(--rv-text-soft);
  font-size:.78rem;
}

.rvlab-plan-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
}

.rvlab-mini-field{
  display:grid;
  gap:8px;
}

.rvlab-mini-field input{
  width:100%;
}

.rvlab-plan-actions{
  display:flex;
  gap:10px;
  margin-top:12px;
}

.rvlab-list{
  margin:0;
  padding-left:18px;
  display:grid;
  gap:10px;
  color:var(--rv-text-soft);
}

.rvlab-list strong{
  color:#fff;
}

.rvlab-status{
  margin-top:12px;
  padding:12px 14px;
  border-radius:14px;
  border:1px solid rgba(255,107,107,.3);
  background:rgba(8,21,37,.88);
  color:#ffd7d7;
  font-size:.92rem;
  font-weight:700;
}

.rvlab-chart-tip{
  position:fixed;
  z-index:9999;
  max-width:260px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(110,207,240,.18);
  background:rgba(6,17,29,.96);
  color:#fff;
  pointer-events:none;
  box-shadow:0 12px 26px rgba(0,0,0,.28);
  line-height:1.45;
}

.rvlab-modal-backdrop{
  position:fixed;
  inset:0;
  z-index:9998;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px;
  background:rgba(0,7,14,.52);
  backdrop-filter:blur(6px);
}

.rvlab-modal{
  width:min(100%,490px);
  padding:20px;
  border-radius:24px;
  border:1px solid rgba(110,207,240,.14);
  background:linear-gradient(180deg, rgba(10,26,45,.98), rgba(5,15,28,.98));
  box-shadow:0 20px 60px rgba(0,0,0,.4);
}

.rvlab-modal h3{
  margin:0 0 12px;
  font-family:Orbitron,Inter,sans-serif;
}

.rvlab-modal p{
  margin:0 0 16px;
  color:var(--rv-text-soft);
  line-height:1.55;
}

.rvlab-modal-actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  flex-wrap:wrap;
  margin-top:16px;
}

.rvlab-progress-track{
  width:100%;
  height:10px;
  overflow:hidden;
  border-radius:999px;
  border:1px solid rgba(110,207,240,.14);
  background:rgba(110,207,240,.12);
}

.rvlab-progress-bar{
  width:0%;
  height:100%;
  background:linear-gradient(90deg, var(--rv-cyan), #9fe9ff);
  box-shadow:0 0 18px rgba(110,207,240,.36);
  transition:width .18s ease;
}

.rvlab-progress-meta{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  margin-top:12px;
  color:var(--rv-text-soft);
}

@media (max-width:1450px){
  .rvlab-panel{
    padding:18px;
  }

  .rvlab-card{
    padding:16px 16px 18px;
  }

  .rvlab-header{
    padding:22px 22px 18px;
  }

  .rvlab-grid{
    grid-template-columns:1fr;
  }

  .rvlab-card--setup{
    position:static;
  }

  .rvlab-split-card{
    grid-template-columns:1fr;
  }

  .rvlab-hero-stats,
  .rvlab-whatif-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}

@media (max-width:920px){
  .rvlab-header{
    flex-direction:column;
  }

  .rvlab-form-grid--2,
  .rvlab-split-card,
  .rvlab-hero-stats,
  .rvlab-whatif-grid,
  .rvlab-plan-grid{
    grid-template-columns:1fr;
  }

  .rvlab-canvas{
    height:300px;
    min-height:300px;
  }

  .rvlab-kv-row{
    flex-direction:column;
    align-items:flex-start;
  }

  .rvlab-kv-row strong,
  .rvlab-dual{
    justify-items:start;
    text-align:left;
  }
}