/* LPM theme */
:root{
  --bg:#ffffff;
  --card:#ffffff;
  --ink:#111827;
  --ink-soft:#374151;
  --muted:#6b7280;
  --accent:#6557A2;
  --border:#e5e7eb;
  --grid:rgba(17,24,39,0.06);
  --result-tint:#f9fff8;
  --shadow:0 6px 18px rgba(0,0,0,0.06);
}

*{box-sizing:border-box}
html,body{
  margin:0;
  padding:0;
  background:var(--bg);
  color:var(--ink);
  font:15px/1.5 system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
}

.header{
  padding:16px 20px 4px;
}
.header h1{
  margin:0 0 4px;
  font-size:24px;
  color:var(--accent);
}
.header .sub{
  margin:0;
  font-size:13px;
  color:var(--ink-soft);
}

/* Layout */
main{ width:100%; }
.grid{
  display:grid;
  grid-template-columns:1fr;
  gap:16px;
  padding:16px;
  max-width:1100px;
  margin:0 auto;
}
.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:16px;
  padding:14px;
  box-shadow:var(--shadow);
}
.card h2{ margin:0 0 8px; font-size:18px; }

@media (max-width:800px){
  .grid{ grid-template-columns:1fr; max-width:600px; }
}

/* Forms */
.form{ display:grid; gap:8px; }
.grid-2{ grid-template-columns:repeat(2,minmax(0,1fr)); }
label{ font-size:13px; color:var(--ink-soft); display:grid; gap:3px; }
input,select,button{ font:inherit; }
input[type="number"],select{
  padding:6px 7px; border-radius:8px; border:1px solid var(--border);
  background:#fff; color:var(--ink);
}

/* Small bits */
.i0-row{ align-items:center; }
.i0-input{ width:64px; }
.i0-range{ flex:1; }

.btn-outline{
  padding:6px 10px; border-radius:9px; border:1px solid var(--accent);
  background:#fff; color:var(--accent); cursor:pointer;
}
.btn-outline:hover{ box-shadow:0 0 0 2px rgba(101,87,162,0.16); }

/* Table */
#conductorTableWrap{ overflow-x:auto; }
#conductorTable{ width:100%; border-collapse:collapse; font-size:11px; }
#conductorTable thead{ background:rgba(101,87,162,0.03); }
#conductorTable th,#conductorTable td{
  padding:3px 4px;
  border:none;
  border-bottom:1px solid var(--border);
  text-align:left;
}
#conductorTable th{ font-weight:600; color:var(--muted); }
#conductorTable input{ font-size:11px; padding:3px 4px; border-radius:6px; max-width:70px; }
.btn-icon{ background:transparent; border:none; padding:0; cursor:pointer; color:#9ca3af; }
.btn-icon:hover{ color:#ef4444; }
.btn-icon svg{ width:13px; height:13px; }

/* Viewport */
.viewport{
  position:relative; height:360px; border:1px solid var(--border);
  border-radius:12px; overflow:hidden;
  background:
    linear-gradient(transparent 23px, var(--grid) 24px),
    linear-gradient(90deg, transparent 23px, var(--grid) 24px);
  background-size:24px 24px; margin-top:8px;
}
#canvas2d{ width:100%; height:100%; display:block; }

/* Knob */
.knob-row{ margin-top:2px; }
.knob-wrap{ display:flex; align-items:center; gap:8px; }
.knob{
  width:40px; height:40px; border-radius:50%; border:2px solid var(--accent);
  position:relative; cursor:grab;
}
.knob:active{ cursor:grabbing; }
.knob::after{
  content:""; position:absolute; left:50%; top:4px; width:2px; height:14px;
  background:var(--accent); transform:translateX(-50%);
}
.knob-label{ font-size:13px; color:var(--ink-soft); }

/* Intermediates */
.accord{ margin-top:10px; }
.accord summary{ cursor:pointer; font-weight:600; font-size:13px; color:var(--ink-soft); }

.table-wrap{ margin-top:6px; max-height:220px; overflow:auto; border-radius:10px; border:1px solid var(--border); padding:4px; }
.table-wrap table{ width:100%; border-collapse:collapse; font-size:11px; }
.table-wrap th,.table-wrap td{ border-bottom:1px solid var(--border); padding:3px 4px; text-align:center; }

/* Key outputs */
.key-row{ margin-top:14px; }
.key-flex{ display:flex; flex-wrap:wrap; gap:18px; }
.metric{
  border-radius:12px; padding:10px 12px; background:#fff; border:1px solid var(--border);
  min-width:220px; box-shadow:var(--shadow);
}
.metric.accent{ background:var(--accent); color:#fff; border-color:transparent; }
.metric .label{ color:inherit; opacity:0.9; }
.metric .mono{ color:inherit; }

/* Two-column top card */
.top-grid{ display:grid; grid-template-columns:1.5fr 2fr; gap:16px; align-items:flex-start; }
.top-col h3{ margin:0 0 6px; font-size:14px; font-weight:600; color:var(--ink-soft); }

/* Inputs */
.input-row{ display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:4px; }
.input-label{ font-size:13px; color:var(--ink-soft); display:flex; align-items:baseline; gap:4px; }
.unit{ font-size:11px; color:var(--muted); }
.form .input-row input,.form .input-row select{ font-size:13px; max-width:130px; padding:4px 6px; }

/* I0 multi */
.input-multi{ display:flex; align-items:center; gap:6px; }
.i0-input{ width:60px; }
.i0-range{ width:110px; }

/* Small right button */
.btn-small-right{ display:block; margin-left:auto; margin-top:6px; padding:3px 8px; font-size:11px; border-radius:6px; }

/* Polar radar block */
.polar-wrap{ margin-top:8px; border:1px solid var(--border); border-radius:12px; padding:8px; }
#dcPolarCanvas{ width:100%; height:320px; display:block; }
.polar-legend{ display:flex; flex-wrap:wrap; gap:10px; margin-top:6px; font-size:12px; }
.polar-legend .item{ display:flex; align-items:center; gap:6px; cursor:pointer; user-select:none; color:var(--ink-soft); }
.polar-legend .swatch{ width:12px; height:12px; border-radius:3px; border:1px solid var(--border); }
.polar-legend .item.off{ opacity:0.5; text-decoration:line-through; }

/* Distributions panel */
.dist-controls{ display:flex; gap:10px; align-items:center; margin:6px 0 10px; font-size:13px; color:var(--ink-soft); }
.dist-controls input{ max-width:100px; }
#distTableWrap{ max-height:280px; overflow:auto; border:1px solid var(--border); border-radius:10px; padding:4px; }
#distTable{ width:100%; border-collapse:collapse; font-size:11px; }
#distTable th,#distTable td{ border-bottom:1px solid var(--border); padding:3px 4px; text-align:right; }
#distTable th:first-child,#distTable td:first-child{ text-align:center; }

/* Inline metric row in Geometry card */
.inline-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  margin-bottom:6px;
}
.inline-right{
  margin-left:auto;
}
.metric-inline{
  border-radius:10px;
  padding:6px 10px;
  background:#fff;
  border:1px solid var(--border);
  box-shadow:var(--shadow);
  min-width:220px;
  text-align:left;
}
.metric-inline .label{ color:var(--ink-soft); }

.dist-controls{ display:flex; flex-direction:column; gap:6px; }
.dist-row{ display:flex; justify-content:space-between; align-items:center; }
#distTable thead th{ position:sticky; top:0; background:var(--card); z-index:2; }

/* Light purple background for mini cards */
.card-result .metric, .metric-inline{
  background: rgba(101,87,162,0.12);
  padding:8px 10px;
  border-radius:8px;
}



/* Button row for conductors & demos */
.btn-row{
  display:flex;
  justify-content:flex-end;
  align-items:center;
  gap:6px;
  margin-top:6px;
}
.btn-small{
  padding:3px 8px;
  font-size:11px;
  border-radius:6px;
}


.lds-warning {
  color: #c2410c; /* dark orange */
  font-weight: 500;
  margin-left: 0.5em;
}


/* Custom slider styling for lightning current range */
#i0Range{
  -webkit-appearance:none;
  appearance:none;
  width:100%;
  height:4px;
  border-radius:999px;
  background:var(--border);
  outline:none;
}
#i0Range::-webkit-slider-thumb{
  -webkit-appearance:none;
  appearance:none;
  width:14px;
  height:14px;
  border-radius:50%;
  background:var(--accent);
  cursor:pointer;
  border:2px solid #ffffff;
  box-shadow:0 0 0 1px rgba(0,0,0,0.1);
}
#i0Range::-moz-range-thumb{
  width:14px;
  height:14px;
  border-radius:50%;
  background:var(--accent);
  cursor:pointer;
  border:2px solid #ffffff;
  box-shadow:0 0 0 1px rgba(0,0,0,0.1);
}
#i0Range::-moz-range-track{
  height:4px;
  border-radius:999px;
  background:var(--border);
}


/* --- LPM embed hardening (WordPress overrides) --- */

/* Scope table border reset to the LPM tool only */
#lpmTool .table-wrap table,
#lpmTool #conductorTable,
#lpmTool #distTable{
  border: none !important;
}

#lpmTool .table-wrap th,
#lpmTool .table-wrap td,
#lpmTool #conductorTable th,
#lpmTool #conductorTable td,
#lpmTool #distTable th,
#lpmTool #distTable td{
  border-top: none !important;
  border-left: none !important;
  border-right: none !important;
  border-bottom: 1px solid var(--border) !important;
}

/* Inline lightning current group between knob and LUD */
.i0-inline{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  flex:1;
}
.i0-inline-label{
  font-size:13px;
  color:var(--ink-soft);
  white-space:nowrap;
}

/* Stronger, scoped slider styling so WordPress cannot override it */
#lpmTool #i0Range{
  -webkit-appearance:none !important;
  appearance:none !important;
  width:100%;
  max-width:180px;
  height:4px !important;
  border-radius:999px;
  background:var(--border) !important;
  outline:none;
}

#lpmTool #i0Range::-webkit-slider-thumb{
  -webkit-appearance:none !important;
  appearance:none !important;
  width:14px;
  height:14px;
  border-radius:50%;
  background:var(--accent);
  cursor:pointer;
  border:2px solid #ffffff;
  box-shadow:0 0 0 1px rgba(0,0,0,0.1);
}

#lpmTool #i0Range::-moz-range-thumb{
  width:14px;
  height:14px;
  border-radius:50%;
  background:var(--accent);
  cursor:pointer;
  border:2px solid #ffffff;
  box-shadow:0 0 0 1px rgba(0,0,0,0.1);
}

#lpmTool #i0Range::-moz-range-track{
  height:4px;
  border-radius:999px;
  background:var(--border);
}
