/* ---------- Theme ---------- */
:root{
  --bg: #0b0e12;
  --card: #11151b;
  --ink: #e9eef7;
  --muted: #98a2b3;
  --accent: #e8a7ff;
  --accent-2: #88f7d3;
  --ring: #2a3242;
  --ok: #79ffa9;
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  color:var(--ink);
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(232,167,255,.08), transparent 60%),
    radial-gradient(1000px 600px at 110% 10%, rgba(136,247,211,.06), transparent 50%),
    var(--bg);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
}

/* ---------- Layout ---------- */
.shell{
  max-width: 1100px;
  margin: 40px auto;
  padding: 0 20px;
}
.masthead h1{
  margin:0 0 .2rem 0;
  font-family:"Playfair Display", serif;
  font-weight:700;
  letter-spacing:.5px;
}
.subtitle{color:var(--muted); margin:0 0 1.4rem 0}

.card{
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.015));
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 10px 40px rgba(0,0,0,.35);
}

/* ---------- Groups ---------- */
.group{padding: 16px 0; border-top:1px solid rgba(255,255,255,.06)}
.group:first-of-type{border-top:0; padding-top:0}
.group h2{display:flex; align-items:center; gap:.5rem; margin:.2rem 0 1rem 0; font-weight:600}
.lead-ico{font-size:1.2rem}
.group-head{display:flex; align-items:center; justify-content:space-between; gap:1rem}
.stack{display:grid; gap:14px}

/* ---------- Grid ---------- */
.grid{display:grid; gap:12px}
.grid.two{grid-template-columns: 1fr 1fr}
.grid.three{grid-template-columns: repeat(3, 1fr)}
.align-start{align-items:start}

@media (max-width:900px){
  .grid.two, .grid.three{grid-template-columns:1fr}
}

/* ---------- Inputs ---------- */
.input{
  display:grid; gap:.45rem; padding:.8rem;
  border:1px solid var(--ring); border-radius:14px;
  background:rgba(255,255,255,.02);
}
.input span{font-size:.9rem;color:var(--muted)}
.input input, .input textarea{
  width:100%; padding:.75rem .85rem;
  border:1px solid rgba(255,255,255,.08);
  background:#0e131a; color:var(--ink);
  border-radius:12px; outline:none;
}
textarea{resize:vertical}

/* ---------- Fieldset pills ---------- */
.fieldset{
  border:1px dashed var(--ring); border-radius:16px; padding:10px; min-height:100%;
}
.fieldset legend{
  padding:0 .5rem; color:var(--muted); font-size:.9rem;
}

/* ---------- Chips / Radios / Checks ---------- */
.switch, .radio, .check{
  display:inline-grid; grid-auto-flow:column; align-items:center;
  gap:.6rem; padding:.65rem .8rem; cursor:pointer; user-select:none;
  border:1px solid var(--ring); border-radius:999px;
  background:linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.01));
  transition: transform .12s ease, border-color .2s ease, box-shadow .2s;
}
.radio:hover, .check:hover, .switch:hover{border-color:#44506a; box-shadow:0 4px 18px rgba(0,0,0,.24)}
.radio input, .check input, .switch input{display:none}
.radio span, .check span{letter-spacing:.2px}

/* Icons for every option via data-ico */
.radio[data-ico] span::before,
.check[data-ico] span::before{
  content: attr(data-ico);
  display:inline-block;
  margin-right:.35rem;
}

.switch .switch-track{
  position:relative; display:inline-block;
  min-width: 170px; height: 40px; border-radius:999px;
  background: #0e131a;
  border:1px solid var(--ring);
  overflow:hidden;
}
.switch .switch-track::before{
  /* knob */
  content:"";
  position:absolute; top:3px; left:3px;
  width:34px; height:34px; border-radius:50%;
  background:#151b24;
  transition:left .2s ease;
  box-shadow:0 2px 10px rgba(0,0,0,.35) inset, 0 2px 12px rgba(0,0,0,.35);
}
.switch input:checked + .switch-track::before{ left: calc(100% - 3px - 34px); }

/* Yin-Yang background in the switch track */
.yin-yang .switch-track{
  background:
    radial-gradient(circle at 25% 50%, #fff 10px, #000 10px 20px, transparent 20px) left center / 50% 100% no-repeat,
    radial-gradient(circle at 75% 50%, #000 10px, #fff 10px 20px, transparent 20px) right center / 50% 100% no-repeat,
    linear-gradient(90deg, #0e131a 0 50%, #0e131a 50% 100%);
}
.yin-yang .switch-track{ background-blend-mode:normal; }

/* Labels inside switch track */
.switch .switch-track::after{
  content: attr(data-off);
  position:absolute; inset:0; display:grid; place-items:center;
  color:var(--muted); font-size:.9rem; padding-left:42px; padding-right:42px;
}
.switch input:checked + .switch-track::after{
  content: attr(data-on);
}

/* ---------- Buttons ---------- */
.btn{
  background: linear-gradient(180deg, rgba(232,167,255,.22), rgba(232,167,255,.12));
  color:#1a0f25; border:1px solid rgba(232,167,255,.45); border-radius:12px;
  padding:.7rem 1rem; font-weight:600; cursor:pointer;
}
.btn:hover{filter:brightness(1.05)}
.btn.ghost{background:transparent; color:var(--ink); border-color:var(--ring)}
.btn.alt{background: linear-gradient(180deg, rgba(136,247,211,.22), rgba(136,247,211,.12)); border-color: rgba(136,247,211,.45)}
.add-more{font-size:.9rem; padding:.55rem .8rem}

/* Actions row */
.footnote{
  display:flex; align-items:center; justify-content:space-between; gap:.8rem;
  padding:1rem 0 0; border-top:1px solid rgba(255,255,255,.08); margin-top:1rem;
}
.actions{display:flex; gap:.6rem; flex-wrap:wrap}
.check.small span{font-size:.92rem}
#copyBtn.ok{outline:2px solid var(--ok)}

/* Clause output */
.clause{
  display:block; padding:1rem; border-radius:12px;
  background:rgba(255,255,255,.02);
  border:1px dashed var(--ring);
  min-height:70px;
}

/* Print */
@media print{
  body{background:#fff; color:#111}
  .shell{max-width:none; margin:0; padding:0}
  .masthead, .add-more, .actions .btn.ghost, .actions .btn, .lead-ico{display:none !important}
  .card{box-shadow:none; border:0; background:#fff; color:#111}
  .group{page-break-inside:avoid}
  .clause{border-color:#333; background:#fff}
}

