/* === Темы через CSS-переменные === */
/* Тёмная (по умолчанию) */
body{
  --bg:#0b1020;
  --bg2:#0e1533;
  --card:#111735;
  --muted:#93a4bf;
  --text:#e9eefc;
  --brand:#4ea7ff;
  --ring:0 0 0 3px rgba(78,167,255,.3);

  --surface-05: rgba(255,255,255,.05);
  --surface-04: rgba(255,255,255,.04);
  --surface-03: rgba(255,255,255,.03);
  --surface-02: rgba(255,255,255,.02);
  --border-15: rgba(255,255,255,.15);
  --border-10: rgba(255,255,255,.10);
  --border-08: rgba(255,255,255,.08);
  --border-06: rgba(255,255,255,.06);

  --input-bg: rgba(12,16,38,.6);
  --input-border: rgba(255,255,255,.12);
  --placeholder: #90a4c3;

  --error-bg: rgba(255,50,50,.08);
  --error-border: rgba(255,80,80,.35);
  --notice-bg: var(--surface-04);
  --notice-border: var(--border-10);
}

/* Светлая */
body.light{
  --bg:#f5f7fa;
  --bg2:#e9eef5;
  --card:#ffffff;
  --muted:#44546a;
  --text:#0f172a;
  --brand:#0b66d0;
  --ring:0 0 0 3px rgba(11,102,208,.22);

  --surface-05:#f6f8fb;
  --surface-04:#f9fbff;
  --surface-03:#f1f4f9;
  --surface-02:#f9fbff;
  --border-15: rgba(0,0,0,.16);
  --border-10: rgba(0,0,0,.10);
  --border-08: rgba(0,0,0,.08);
  --border-06: rgba(0,0,0,.06);

  --input-bg:#ffffff;
  --input-border: rgba(0,0,0,.12);
  --placeholder:#8a97a8;

  --error-bg: #ffecec;
  --error-border: #ffb3b3;
  --notice-bg:#f6f9ff;
  --notice-border: rgba(11,102,208,.18);
}

/* === Базовая стилизация (как было) с привязкой к переменным === */
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial,Helvetica,sans-serif;
  background:linear-gradient(180deg,var(--bg) 0%, var(--bg2) 100%);
  color:var(--text);
  min-height:100vh;
  transition: background .3s ease, color .3s ease;
}

/* Шапка */
header{
  position:sticky;top:0;z-index:20;
  backdrop-filter:saturate(1.2) blur(10px);
  background:rgba(11,16,32,.6);
  border-bottom:1px solid var(--border-06);
  transition:background .3s ease, border-color .3s ease;
}
body.light header{
  background:rgba(255,255,255,.8);
  border-bottom:1px solid var(--border-10);
}
.header-wrap{max-width:1060px;margin:0 auto;padding:14px 20px;display:flex;align-items:center;justify-content:space-between;gap:16px}
header img{width:56px;height:56px;object-fit:contain;transition:transform .4s ease}
header img:hover{transform:rotate(-6deg) scale(1.04)}
.title{font-size:18px;font-weight:800;letter-spacing:.4px}

/* Тумблер темы */
.theme-toggle{
  appearance:none;width:48px;height:28px;border-radius:999px;
  background:rgba(255,255,255,.12);
  position:relative;cursor:pointer;border:none;
  transition:background .3s ease, box-shadow .3s ease
}
.theme-toggle:focus{outline:none; box-shadow:var(--ring)}
.theme-toggle::after{
  content:"";position:absolute;top:3px;left:3px;width:22px;height:22px;border-radius:50%;
  background:linear-gradient(180deg,#fff,#cfe2ff);
  transition:left .25s ease, transform .25s ease
}
.theme-toggle.active{background:rgba(0,0,0,.25)}
.theme-toggle.active::after{left:23px;transform:rotate(180deg)}

/* Контент */
main{max-width:1060px;margin:0 auto;padding:28px 20px 60px}
.hero{display:grid;grid-template-columns:1.2fr .8fr;gap:20px;align-items:center;margin-top:18px}
.hero-card{
  background:radial-gradient(120% 120% at 10% 10%, rgba(78,167,255,.16) 0%, var(--surface-02) 55%, transparent 100%),
             linear-gradient(180deg, var(--surface-06, rgba(255,255,255,.06)), var(--surface-02));
  border:1px solid var(--border-08);border-radius:18px;padding:22px;overflow:hidden;animation:fadeUp .5s ease both;
  transition:background .3s ease, border-color .3s ease
}
body.light .hero-card{
  background:linear-gradient(180deg, #ffffff, #f2f6fa);
  border:1px solid var(--border-08);
}
.subtle{color:var(--muted);font-size:14px}
h1{margin:6px 0 6px;font-size:28px}
.authors{margin:0;color:var(--muted);font-size:14px}
.badge{
  display:inline-block;padding:6px 10px;border:1px solid var(--border-15);
  border-radius:999px;font-size:12px;letter-spacing:.3px;color:#cfe2ff
}
body.light .badge{color:var(--brand);border-color:var(--border-15)}
.grid{margin-top:20px;display:grid;grid-template-columns:repeat(2, minmax(0,1fr));gap:16px}
@media (max-width:860px){ .hero{grid-template-columns:1fr} .grid{grid-template-columns:1fr} }

/* Секции */
.section{
  margin-top:22px;border:1px solid var(--border-08);
  border-radius:16px;overflow:hidden;
  background:linear-gradient(180deg, var(--surface-04), var(--surface-02));
  transition:background .3s ease, border-color .3s ease
}
.section h3{
  margin:0;padding:14px 16px;font-size:16px;
  background:var(--surface-04);
  border-bottom:1px solid var(--border-06)
}
.section .content{padding:14px 16px}

/* Формы */
label{font-size:13px;color:#d9e6ff;display:block;margin:8px 0 6px}
body.light label{color:#24324a}
.help{font-size:12px;color:#a8b7d3;margin:6px 0 0}
body.light .help{color:#667792}

input, select{
  width:100%;padding:12px 12px;border-radius:12px;
  border:1px solid var(--input-border);
  background:var(--input-bg);color:var(--text);
  outline:none;transition:border .2s ease, box-shadow .2s ease, transform .06s ease
}
input::placeholder{color:var(--placeholder)}
input:focus, select:focus{border-color:rgba(78,167,255,.6);box-shadow:var(--ring)}
input:hover, select:hover{transform:translateY(-1px)}
.dual{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}

/* Кнопки */
.actions{display:flex;gap:12px;align-items:center;margin-top:18px}
button{
  cursor:pointer;border:none;padding:14px 18px;border-radius:14px;font-weight:600;font-size:16px;
  background:linear-gradient(180deg,#5db6ff,#378cf0);color:#071028;
  box-shadow:0 10px 24px rgba(56,140,240,.25);
  transition:transform .08s ease, box-shadow .2s ease, filter .2s ease
}
body.light button{color:#06203e}
button:hover{transform:translateY(-1px);filter:saturate(1.1);box-shadow:0 14px 28px rgba(56,140,240,.32)}
button:active{transform:translateY(1px)}
.ghost{
  background:transparent;color:#bcd3ff;border:1px solid var(--border-15)
}
body.light .ghost{color:#244a73}

/* Статусы/результаты */
.pill{display:inline-flex;gap:8px;align-items:center;font-size:12px;color:#b6caff}
body.light .pill{color:#356aa3}

.result{
  margin-top:24px;padding:16px;border:1px solid var(--border-10);
  border-radius:16px;background:linear-gradient(180deg, var(--surface-05), var(--surface-02));
  animation:fadeUp .45s ease both
}
.result h3{margin:0 0 10px}

.error{
  margin-top:16px;padding:12px 14px;border:1px solid var(--error-border);
  border-radius:12px;background:var(--error-bg);color:#c02626
}
.notice{
  margin-top:12px;padding:10px 12px;border:1px dashed var(--notice-border);
  border-radius:10px;background:var(--notice-bg);color:var(--text);font-size:13px
}

/* Иконка-подсказка */
.i{
  display:inline-block;width:18px;height:18px;border-radius:50%;
  background:rgba(255,255,255,.15);text-align:center;line-height:18px;font-size:12px;margin-left:6px;color:#cfe2ff;cursor:help
}
body.light .i{background:rgba(0,0,0,.08);color:#315e8e}

/* Подсветка потенциально рискованных значений */
.field-bad{ border-color: rgba(255,90,90,.85) !important; box-shadow: 0 0 0 3px rgba(255,90,90,.25) !important }
.field-warn{ border-color: rgba(255,190,70,.85) !important; box-shadow: 0 0 0 3px rgba(255,190,70,.25) !important }
.inline-hint{
  margin-top:6px; font-size:12px; border-radius:8px; padding:8px 10px;
  background:var(--surface-04); border:1px dashed var(--border-10); color:var(--text)
}
.inline-hint b{color:#ffd08a}
body.light .inline-hint b{color:#b45b00}

/* Анимации */
@keyframes fadeUp{from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)}}