/* IlovaBozor — базовые стили. Цвета задаются токенами; тёмная тема — системная или выбранная вручную. */
:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #eef1f7;
  --text: #17202e;
  --muted: #5d6b80;
  --border: #dde2ec;
  --brand: #1d4f9c;
  --brand-2: #1aa6b7;
  --accent: #f2b632;
  --on-brand: #ffffff;
  --ok: #1f8a4c;
  --warn: #b26a00;
  --err: #c0362c;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f141c; --surface: #171e29; --surface-2: #1f2836; --text: #e8edf5; --muted: #9aa7ba;
    --border: #2a3444; --brand: #6ea2ff; --brand-2: #3fc6d4; --on-brand: #0b1220;
    --ok: #4cc283; --warn: #f0a63a; --err: #ff7a6e; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f141c; --surface: #171e29; --surface-2: #1f2836; --text: #e8edf5; --muted: #9aa7ba;
  --border: #2a3444; --brand: #6ea2ff; --brand-2: #3fc6d4; --on-brand: #0b1220;
  --ok: #4cc283; --warn: #f0a63a; --err: #ff7a6e; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: clamp(1.5rem, 4vw, 2.1rem); }
h2 { font-size: 1.3rem; }
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
main { flex: 1; padding: 24px 0 48px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

/* шапка */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar .container { display: flex; align-items: center; gap: 12px; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img { width: 34px; height: 34px; }
.brand span b { color: var(--brand-2); }
.nav { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.nav form { margin: 0; }
.avatar { width: 30px; height: 30px; border-radius: 50%; vertical-align: middle; }

/* кнопки и формы */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand); filter: brightness(1.08); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: 6px 10px; font-size: .875rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.lang-switch { display: flex; gap: 2px; background: var(--surface-2); border-radius: 10px; padding: 2px; }
.lang-switch button { border: 0; background: transparent; color: var(--muted); padding: 5px 8px; border-radius: 8px; font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; }
.lang-switch button[aria-current="true"] { background: var(--surface); color: var(--text); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.stack > * + * { margin-top: 16px; }
.narrow { max-width: 640px; margin: 0 auto; }
label { display: block; font-weight: 600; margin-bottom: 6px; }
.hint { color: var(--muted); font-size: .85rem; font-weight: 400; margin-top: 4px; }
input[type=text], input[type=email], input[type=url], select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit;
}
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 1px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { margin-top: 4px; }
.field + .field { margin-top: 16px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }

/* сообщения */
.flashes { list-style: none; padding: 0; margin: 0 0 16px; }
.flash { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); margin-bottom: 8px; }
.flash.success { border-color: var(--ok); }
.flash.error { border-color: var(--err); }
.flash.info { border-color: var(--brand-2); }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.badge.ok { color: var(--ok); }
.badge.warn { color: var(--warn); }
.errors { color: var(--err); padding-left: 18px; }

/* главная */
.hero { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; padding: 28px; border-radius: 20px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%); color: #fff; }
.hero p { opacity: .92; max-width: 560px; }
.hero img { width: 120px; height: 120px; }
.hero .btn { background: #fff; color: #1d4f9c; border-color: #fff; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }

/* подвал */
.footer { border-top: 1px solid var(--border); background: var(--surface); padding: 20px 0; font-size: .9rem; color: var(--muted); }
.footer .container { display: flex; gap: 16px; flex-wrap: wrap; justify-content: space-between; }
.footer nav { display: flex; gap: 14px; flex-wrap: wrap; }

@media (max-width: 640px) {
  .hero { grid-template-columns: 1fr; padding: 20px; }
  .hero img { display: none; }
  .nav { margin-left: 0; width: 100%; padding-bottom: 10px; }
  .dl { grid-template-columns: 1fr; }
  .dl dd { margin-bottom: 8px; }
}

/* inline-стили запрещены CSP — только классы */
.section { margin-top: 28px; }
.narrow-sm { max-width: 440px; margin: 0 auto; text-align: center; }
.center-img { display: block; margin: 0 auto; }
