:root {
  --bg: #0f1115;
  --panel: #ffffff;
  --ink: #14171f;
  --muted: #6b7280;
  --line: #e3e6ec;
  --accent: #e23b2e;
  --accent-dark: #b92c21;
  --ok: #12855b;
  --warn: #b7791f;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 20, 30, .06), 0 8px 24px rgba(16, 20, 30, .06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.5 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: #f4f5f8;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Шапка ───────────────────────────────────────────────────────────────── */
header.top {
  background: var(--bg);
  color: #fff;
  padding: 14px 0;
  border-bottom: 3px solid var(--accent);
}
header.top .wrap { display: flex; align-items: center; gap: 16px; }
header.top .brand {
  font-weight: 800; font-size: 19px; letter-spacing: -.3px; color: #fff;
  display: flex; align-items: center; gap: 9px;
}
header.top .brand span.mark {
  width: 26px; height: 26px; border-radius: 7px; background: var(--accent);
  display: grid; place-items: center; font-size: 15px;
}
header.top .brand:hover { text-decoration: none; }
header.top .spacer { flex: 1; }
header.top .who { font-size: 13px; color: #9aa3b2; }

.wrap { max-width: 1320px; margin: 0 auto; padding: 0 20px; }

/* ─── Типографика ─────────────────────────────────────────────────────────── */
h1 { font-size: 26px; margin: 24px 0 4px; letter-spacing: -.4px; }
h2 { font-size: 18px; margin: 26px 0 10px; }
h3 { font-size: 15px; margin: 18px 0 8px; }
.sub { color: var(--muted); margin: 0 0 18px; }

/* ─── Вкладки ─────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 18px 0 0; flex-wrap: wrap; }
.tabs button {
  background: none; border: 0; padding: 11px 18px; font: inherit; font-weight: 600;
  color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ─── Карточки, кнопки, формы ─────────────────────────────────────────────── */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); margin: 16px 0;
}
.card.tight { padding: 0; overflow: hidden; }

.btn {
  display: inline-flex; align-items: center; gap: 7px; background: var(--accent); color: #fff;
  border: 0; border-radius: 8px; padding: 10px 16px; font: inherit; font-weight: 600;
  cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--accent-dark); text-decoration: none; color: #fff; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { background: #f6f7f9; }
.btn.sm { padding: 6px 11px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }

label { display: block; font-size: 13px; font-weight: 600; color: #414958; margin: 0 0 5px; }
input, select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(226, 59, 46, .25); border-color: var(--accent); }
.field { margin-bottom: 14px; }
.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: 1fr 1fr; }
.grid.c3 { grid-template-columns: 1fr 1fr 1fr; }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 760px) { .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; } }

.hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.err { background: #fdecea; border: 1px solid #f6c8c3; color: #96271c; padding: 10px 13px; border-radius: 8px; margin: 12px 0; }
.ok { background: #e7f6ef; border: 1px solid #b8e2ce; color: #0d5e41; padding: 10px 13px; border-radius: 8px; margin: 12px 0; }

/* ─── Таблицы ─────────────────────────────────────────────────────────────── */
.tbl-scroll { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th, table.tbl td { border: 1px solid var(--line); padding: 7px 9px; text-align: center; vertical-align: middle; }
table.tbl th { background: #f7f8fa; font-weight: 700; font-size: 12px; color: #414958; }
table.tbl td.l, table.tbl th.l { text-align: left; }
table.tbl tbody tr:hover { background: #fcfcfd; }
table.tbl td.num { font-variant-numeric: tabular-nums; }
table.tbl .grp td { background: #eef0f4; font-weight: 700; text-align: left; font-size: 13px; }
table.tbl input { padding: 4px 6px; font-size: 13px; text-align: center; }
table.tbl input.w60 { width: 62px; }
table.tbl input.w48 { width: 50px; }

table.tbl td.est { color: var(--warn); cursor: help; }
.note { padding: 10px 14px; border-top: 1px solid var(--line); background: #fffbf2; color: #8a6412; font-size: 12.5px; }

.place-1 { color: #b8860b; font-weight: 800; }
.place-2 { color: #6b7280; font-weight: 700; }
.place-3 { color: #a0522d; font-weight: 700; }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
  background: #eef0f4; color: #414958;
}
.badge.new { background: #fff4e0; color: var(--warn); }
.badge.accepted { background: #e7f6ef; color: var(--ok); }
.badge.rejected { background: #fdecea; color: #96271c; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line);
  border-radius: 999px; padding: 7px 13px; cursor: pointer; background: #fff; font-size: 13.5px;
  user-select: none;
}
.chip input { width: auto; margin: 0; }
.chip.on { border-color: var(--accent); background: #fef3f2; color: var(--accent-dark); font-weight: 600; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.muted { color: var(--muted); }
.right { text-align: right; }
.mono { font-variant-numeric: tabular-nums; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }

.attempt-ok { background: #e7f6ef !important; }
.attempt-fail { background: #fdecea !important; text-decoration: line-through; color: #96271c; }
.att { display: flex; gap: 3px; align-items: center; justify-content: center; }
.att button {
  border: 1px solid var(--line); background: #fff; border-radius: 6px; width: 24px; height: 26px;
  cursor: pointer; font-size: 13px; line-height: 1; padding: 0;
}
.att button.on-ok { background: #12855b; color: #fff; border-color: #12855b; }
.att button.on-x { background: #e23b2e; color: #fff; border-color: #e23b2e; }

dialog {
  border: 0; border-radius: 12px; padding: 0; box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
  max-width: 720px; width: calc(100% - 32px);
}
dialog::backdrop { background: rgba(15, 17, 21, .55); }
dialog .dlg-head { padding: 16px 20px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 17px; }
dialog .dlg-body { padding: 20px; max-height: 70vh; overflow: auto; }
dialog .dlg-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; background: #fafbfc; }

.event-card {
  display: block; background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); color: var(--ink);
}
.event-card:hover { text-decoration: none; border-color: var(--accent); }
.event-card .t { font-weight: 700; font-size: 17px; margin-bottom: 4px; }
.event-card .m { color: var(--muted); font-size: 13.5px; }

footer.bot { padding: 40px 0; color: var(--muted); font-size: 13px; text-align: center; }
