/* Лотерея — общие стили (светлая тема) */
:root {
  --bg: #F2F3F5;
  --surface: #FFFFFF;
  --surface-2: #F8F9FA;
  --ink: #11151C;
  --ink-2: #3A414D;
  --muted: #5B6472;
  --line: #E3E6EA;
  --line-2: #C9CED6;
  --accent: #E8B04A;
  --accent-ink: #8A5A00;
  --accent-soft: #FFF4DC;
  --on-accent: #14110A;
  --ok: #11603A;
  --ok-soft: #E8F5EE;
  --danger: #B42318;
  --danger-ink: #8A1C12;
  --danger-soft: #FDECEA;
  --nav: #0B0E14;
  --radius: 12px;
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Unbounded", "Manrope", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); }
a { color: var(--ink); }
a:hover { color: var(--accent-ink); }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.2; margin: 0; }
h1 { font-size: 28px; font-weight: 800; }
h2 { font-size: 18px; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row-between { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.grow { flex: 1 1 auto; }

/* Кнопки */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: var(--radius);
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  font: 700 14px/1 var(--font); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-2); color: var(--ink); }
.btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible {
  outline: 3px solid rgba(232, 176, 74, .6); outline-offset: 2px;
}
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-dark:hover { background: #262C37; color: #fff; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-accent:hover { background: #F0BE60; color: var(--on-accent); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #9A1D14; color: #fff; }
.btn-danger-outline { border-color: #D9534A; color: var(--danger-ink); }
.btn-danger-soft { background: var(--danger-soft); border-color: var(--danger-soft); color: var(--danger-ink); }
.btn-link { border: 0; background: none; padding: 0 6px; text-decoration: underline; }
.btn-icon { width: 40px; min-height: 40px; padding: 0; border-color: transparent; background: transparent; }
.btn-icon:hover { background: var(--surface-2); border-color: var(--line); }
.btn-icon.danger { color: var(--danger); }
.btn[disabled], .btn.is-disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-icon svg { width: 18px; height: 18px; }
form.inline { display: inline; margin: 0; }

/* Формы */
label { font-weight: 700; font-size: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field .hint { font-weight: 400; font-size: 13px; color: var(--muted); }
.field .err { font-weight: 500; font-size: 13px; color: var(--danger); }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=date], textarea, select {
  width: 100%; min-height: 44px; padding: 0 14px; border-radius: var(--radius);
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: 15px var(--font);
}
textarea { padding: 12px 14px; line-height: 1.5; resize: vertical; }
input[readonly] { background: var(--surface-2); color: var(--ink-2); }
input.is-invalid, textarea.is-invalid { border-color: var(--danger); }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 640px) { .form-grid .span-2 { grid-column: auto; } }

/* Карточки */
.card { background: var(--surface); border-radius: 20px; padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.card.danger { border: 1px solid #F3C7C1; }
.card.danger h2 { color: var(--danger-ink); }
@media (max-width: 640px) { .card { padding: 20px; border-radius: 16px; } }
.count { font-family: var(--font); font-weight: 500; font-size: 15px; color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.stat { background: var(--surface); border-radius: 16px; padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; }
.stat span:first-child { font-size: 13px; color: var(--muted); }
.stat strong { font-family: var(--display); font-weight: 600; font-size: 24px; }

.badge { display: inline-block; padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; background: #ECEEF1; color: var(--ink-2); }
.badge.active { background: #DDF5E7; color: var(--ok); }
.badge.finished { background: #E6ECFB; color: #23408E; }
.badge.paused { background: var(--accent-soft); color: #5C3D00; }
.tag { display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--accent-soft); color: #5C3D00; vertical-align: 1px; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }

/* Сообщения */
.flash, .notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 18px; border-radius: 14px; font-size: 14px; line-height: 1.5; }
.flash.success { background: var(--ok-soft); color: var(--ok); }
.flash.error { background: var(--danger-soft); color: var(--danger-ink); }
.notice { background: var(--accent-soft); color: #5C3D00; }
.notice svg { flex: none; width: 18px; height: 18px; margin-top: 1px; }

/* Таблицы */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
table.data { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 15px; }
table.data th { background: var(--surface-2); text-align: left; color: var(--muted); font-size: 13px; font-weight: 700; padding: 12px 16px; }
table.data td { border-top: 1px solid var(--line); padding: 8px 16px; vertical-align: middle; }
table.data td.num { color: var(--muted); width: 56px; }
table.data td.actions, table.data th.actions { text-align: right; white-space: nowrap; width: 1%; padding-right: 8px; }
table.data td.empty { text-align: center; color: var(--muted); padding: 28px 16px; }
table.data .sub { font-size: 13px; color: var(--muted); }

/* Загрузка файла */
.dropzone { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; padding: 18px 20px; border: 1.5px dashed #B7BDC7; border-radius: 16px; background: var(--surface-2); }
.dropzone.is-over { border-color: var(--accent-ink); background: var(--accent-soft); }
.dropzone > svg { width: 28px; height: 28px; flex: none; color: var(--muted); }
.dropzone .text { flex: 1 1 300px; display: flex; flex-direction: column; gap: 4px; }
.dropzone fieldset { border: 0; margin: 0; padding: 0; display: flex; gap: 16px; }
.dropzone input[type=file] { max-width: 260px; font: 14px var(--font); }

.pager { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.pager a, .pager span { min-width: 40px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; text-decoration: none; font-weight: 700; font-size: 14px; }
.pager a:hover { background: var(--surface-2); }
.pager .current { background: var(--ink); color: #fff; }

.report { max-height: 260px; overflow: auto; font-size: 13px; }
.report li { padding: 2px 0; }

.log { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.log li { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.log li:first-child { border-top: 0; }
@media (max-width: 640px) { .log li { grid-template-columns: 1fr; gap: 2px; } }

/* Админка: каркас */
.admin { display: flex; flex-wrap: wrap; min-height: 100vh; }
.admin-nav { flex: 1 1 260px; max-width: 100%; background: var(--nav); color: #F3F1EC; padding: 28px 20px; display: flex; flex-direction: column; gap: 22px; }
@media (min-width: 900px) { .admin-nav { flex: 0 0 280px; } }
.admin-nav a { color: #F3F1EC; text-decoration: none; }
.admin-nav .brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; font-family: var(--display); font-weight: 600; font-size: 15px; }
.admin-nav .brand i { width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; font-style: normal; font-weight: 800; }
.admin-nav .new { border: 1px solid var(--accent); color: var(--accent); background: transparent; }
.admin-nav .new:hover { background: rgba(232, 176, 74, .12); color: var(--accent); }
.admin-nav .label { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: #9AA4B2; padding: 0 8px; }
.admin-nav .draws { display: flex; flex-direction: column; gap: 4px; }
.admin-nav .draws a { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 12px; }
.admin-nav .draws a:hover, .admin-nav .draws a.current { background: #1A1F2A; }
.admin-nav .draws b { font-size: 15px; }
.admin-nav .draws span { font-size: 13px; color: #9AA4B2; }
.admin-nav .draws span.st-active { color: #7FD1A8; }
.admin-nav .draws span.st-draft { color: var(--accent); }
.admin-nav .note { font-size: 13px; line-height: 1.5; color: #9AA4B2; padding: 0 8px; }
.admin-nav .me { margin-top: auto; display: flex; flex-direction: column; gap: 6px; padding: 12px 8px 0; border-top: 1px solid #1E2430; font-size: 13px; color: #9AA4B2; }
.admin-nav .me button { background: none; border: 0; color: #F3F1EC; font: 700 14px var(--font); padding: 0; cursor: pointer; text-align: left; min-height: 32px; }
.admin-main { flex: 999 1 560px; min-width: 0; padding: 32px 40px 64px; }
@media (max-width: 640px) { .admin-main { padding: 20px 16px 48px; } }
.admin-main > .inner { max-width: 1120px; display: flex; flex-direction: column; gap: 24px; }
.crumbs { font-size: 14px; color: var(--muted); }
.crumbs a { color: var(--muted); }

.protocol-preview { border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--ink-2); }
.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 28px; }

/* Публичные страницы */
.public { min-height: 100vh; display: flex; flex-direction: column; background: #F6F7F9; position: relative; overflow-x: hidden; }
.public header.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 24px 40px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.75); position: relative; z-index: 1; }
.public header.top .brand { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.public header.top .logo { background-image:url('/assets/images/SDO.komus.3.png'); background-position:center; background-repeat:no-repeat; background-size:contain;  width: 44px; height: 44px; border-radius: 12px; border: 1px dashed transparent; display: flex; align-items: center; justify-content: center; font-size: 10px; letter-spacing: .08em; color: var(--muted); }
.public header.top b { font-family: var(--display); font-weight: 600; font-size: 18px; }
.public main { flex: 1; width: 100%; max-width: 1040px; margin: 0 auto; padding: 56px 40px 72px; display: flex; flex-direction: column; gap: 28px; position: relative; z-index: 1; }
@media (max-width: 640px) { .public header.top { padding: 16px; } .public main { padding: 32px 16px 48px; } }
.public .eyebrow { font-size: 14px; letter-spacing: .16em; text-transform: uppercase; color: var(--accent-ink); font-weight: 700; }
.public h1.big { font-size: clamp(36px, 6vw, 64px); line-height: 1.05; }
.public .lead { font-size: 19px; color: #4A525F; max-width: 680px; white-space: pre-line; }
.public .decor { position: absolute; left: -280px; top: 140px; width: 900px; height: 900px; pointer-events: none; z-index: 0; }
.public footer { padding: 24px 40px; font-size: 13px; color: var(--muted); position: relative; z-index: 1; }
.winners { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.winners li { display: flex; align-items: center; gap: 16px; padding: 16px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.winners .n { flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; font-weight: 700; }
.winners .who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.winners .prize { font-size: 13px; color: var(--muted); }
.winners .name { font-weight: 700; font-size: 17px; }
.winners .mail { font-size: 13px; color: var(--muted); letter-spacing: .03em; word-break: break-all; }
.center-page { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 22px; padding: 48px 16px; }

/* Вход */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login form { width: 100%; max-width: 400px; background: var(--surface); border-radius: 20px; padding: 32px; display: flex; flex-direction: column; gap: 18px; box-shadow: 0 10px 30px rgba(17,21,28,.06); }
